:root {
    --sidebar-width: 268px;
    --brand: #0d9488;
    --brand-dark: #0f766e;
    --brand-soft: #ccfbf1;
    --ink: #0f172a;
    --muted: #64748b;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --line: #e2e8f0;
    --shadow: 0 10px 30px rgba(15, 23, 42, .07);
    --radius: 1rem;
}

body {
    background:
        radial-gradient(1200px 400px at 100% -10%, rgba(13, 148, 136, .12), transparent 50%),
        var(--bg);
    color: var(--ink);
    font-family: "Cairo", "Inter", system-ui, sans-serif;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #082f3b 0%, #0b1f2a 55%, #0a1720 100%);
    color: #dbe7ee;
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    overflow-y: auto;
    z-index: 1030;
    box-shadow: 8px 0 30px rgba(2, 8, 12, .18);
}

.app-sidebar a {
    color: #c9d6de;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .58rem .9rem;
    border-radius: .75rem;
    margin: 0 .35rem;
    transition: background .15s ease, color .15s ease;
}

.app-sidebar a:hover,
.app-sidebar a.active {
    background: rgba(13, 148, 136, .28);
    color: #fff;
}

.app-sidebar a.active {
    box-shadow: inset 3px 0 0 #2dd4bf;
}

[dir="rtl"] .app-sidebar a.active {
    box-shadow: inset -3px 0 0 #2dd4bf;
}

.app-sidebar .brand {
    padding: 1.15rem 1rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.app-main {
    margin-inline-start: var(--sidebar-width);
    min-height: 100vh;
}

.app-topbar {
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}

.card {
    border: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--surface);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
}

.stat-card {
    border: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.stat-card::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    background: linear-gradient(180deg, #14b8a6, #0f766e);
}

.stat-card .icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.table thead th {
    white-space: nowrap;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    background: #f8fafc;
}

.table tbody tr:hover {
    background: #f0fdfa;
}

.app-sidebar .nav-group-title {
    font-size: .7rem;
    letter-spacing: .06em;
    color: #7e93a0;
    padding: .7rem 1rem .2rem;
    text-transform: uppercase;
}

.company-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.company-chip {
    border: 1px solid #d7e0e6;
    background: #fff;
    color: #0b1f2a;
    border-radius: .85rem;
    padding: .7rem 1rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}
.company-chip:hover, .company-chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.company-chip .count { font-size: .75rem; background: rgba(15,23,42,.08); border-radius: 999px; padding: .1rem .45rem; }
.company-chip.active .count { background: rgba(255,255,255,.2); }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem; max-height: 280px; overflow: auto; }
.product-card { border: 1px solid var(--line); background: #fff; border-radius: .8rem; padding: .75rem; text-align: start; width: 100%; }
.product-card:hover, .product-card.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(13,148,136,.15); }
.product-card .price { color: var(--brand-dark); font-weight: 700; }

.app-sidebar .nav-sub a { padding-inline-start: 1.7rem; font-size: .92rem; }
.page-tabs { border-bottom: 0; }
.compact-table td, .compact-table th { padding: .5rem .75rem; vertical-align: middle; }
.pos-shell { min-height: calc(100vh - 120px); }
.pos-checkout { position: sticky; top: 12px; }
.pos-total { font-size: 1.7rem; font-weight: 700; color: var(--brand-dark); }
.pos-results { position: absolute; inset-inline: 0; top: 100%; z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: .5rem; max-height: 240px; overflow: auto; box-shadow: var(--shadow); }
.pos-results button { width: 100%; text-align: start; border: 0; background: transparent; padding: .55rem .75rem; }
.pos-results button:hover { background: #f0fdfa; }
.search-wrap { position: relative; }

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.page-head h1 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
}

.filter-bar {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: .85rem 1rem;
}

.btn {
    border-radius: .7rem;
    font-weight: 600;
}

.btn-success, .btn-primary {
    background: var(--brand);
    border-color: var(--brand);
}

.btn-success:hover, .btn-primary:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}

.form-control, .form-select {
    border-radius: .7rem;
    border-color: #dbe3ea;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem rgba(13, 148, 136, .18);
}

.badge {
    font-weight: 600;
}

.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.widget-card .table {
    margin-bottom: 0;
}

.permission-group {
    background: #f8fafc;
    border-radius: .9rem;
    padding: 1rem;
    height: 100%;
}

.permission-group h2 {
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: .75rem;
    color: var(--brand-dark);
}

.auth-shell, .install-shell {
    min-height: 100vh;
    background:
        radial-gradient(900px 420px at 10% -10%, rgba(45, 212, 191, .28), transparent 45%),
        linear-gradient(160deg, #082f3b, #0f766e);
    font-family: "Cairo", "Inter", system-ui, sans-serif;
}

.auth-shell .card, .install-shell .card {
    border: 0;
    border-radius: 1.25rem;
    box-shadow: 0 24px 60px rgba(2, 8, 12, .28);
}

.toast-copy {
    position: fixed;
    inset-inline-end: 1rem;
    bottom: 1rem;
    z-index: 1080;
}

@media (max-width: 991px) {
    .app-sidebar { transform: translateX(-100%); transition: transform .2s; }
    html[dir="rtl"] .app-sidebar { transform: translateX(100%); }
    .app-sidebar.show { transform: none; }
    .app-main { margin-inline-start: 0; }
    body.pos-page main { padding-bottom: 210px; }
    .pos-checkout { position: fixed; inset-inline: 0; bottom: 0; top: auto; z-index: 1040; border-radius: 1rem 1rem 0 0; box-shadow: 0 -8px 30px rgba(15,23,42,.12); }
}
