:root {
    --bg: #eef3f8;
    --bg-2: #f8fbff;
    --panel: rgba(255, 255, 255, 0.92);
    --panel-solid: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --soft: #f1f5f9;
    --primary: #0f766e;
    --primary-2: #14b8a6;
    --primary-dark: #0f4f49;
    --accent: #f59e0b;
    --danger: #b42318;
    --success: #047857;
    --border: rgba(148, 163, 184, 0.28);
    --shadow: 0 22px 60px rgba(15, 23, 42, 0.10);
    --shadow-soft: 0 12px 30px rgba(15, 23, 42, 0.07);
    --radius: 22px;
    --sidebar: #07111f;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top right, rgba(20, 184, 166, 0.16), transparent 32rem),
        radial-gradient(circle at bottom left, rgba(245, 158, 11, 0.12), transparent 30rem),
        linear-gradient(135deg, var(--bg), var(--bg-2));
    color: var(--text);
    font-family: Tahoma, Arial, sans-serif;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; }
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 288px;
    background:
        linear-gradient(180deg, rgba(20, 184, 166, 0.18), transparent 26rem),
        var(--sidebar);
    color: #fff;
    padding: 22px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
    box-shadow: 18px 0 45px rgba(15, 23, 42, 0.12);
    z-index: 20;
}

.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; padding: 10px 8px 18px; border-bottom: 1px solid rgba(255,255,255,0.09); }
.brand-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 16px; background: #fff; color: #061623; font-weight: 900; letter-spacing: 0.04em; box-shadow: 0 14px 30px rgba(2, 8, 23, 0.28); }
.logo-mark { overflow: hidden; padding: 0; flex: 0 0 auto; }
.logo-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand strong { display: block; font-size: 19px; letter-spacing: 0.08em; color: #fff; line-height: 1; }
.brand small { display: block; color: #9fb0c7; margin-top: 7px; font-size: 12px; }

.side-nav { display: grid; gap: 6px; }
.side-nav a {
    color: #cbd5e1;
    padding: 11px 12px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.side-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; transform: translateX(-2px); }
.ltr .side-nav a:hover { transform: translateX(2px); }
.side-nav a.active { background: linear-gradient(135deg, rgba(20, 184, 166, 0.28), rgba(255,255,255,0.09)); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08); }
.nav-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 11px; background: rgba(255,255,255,0.08); color: #ccfbf1; }

.main { flex: 1; min-width: 0; padding: 24px; }
.auth-main { max-width: 560px; margin: 0 auto; width: 100%; display: grid; align-content: center; }
.topbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 22px;
    background: rgba(255,255,255,0.68);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 12px 14px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
}
.top-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar h1 { margin: 0; font-size: clamp(22px, 2.4vw, 30px); letter-spacing: -0.02em; }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.top-actions form { margin: 0; }
.user-pill { background: #e6fffb; color: var(--primary-dark); padding: 9px 13px; border-radius: 999px; font-weight: 700; }
.sidebar-toggle { display: none; width: 42px; height: 42px; border: 0; border-radius: 14px; background: var(--text); color: #fff; cursor: pointer; }

.card {
    background: var(--panel);
    border: 1px solid rgba(255,255,255,0.74);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 20px;
    backdrop-filter: blur(14px);
}
.hero { border-inline-start: 7px solid var(--primary); background: linear-gradient(135deg, #fff, #ecfeff); }
.hero p { margin: 0; color: var(--muted); font-weight: 700; }

.dashboard-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 0.34fr); gap: 18px; align-items: stretch; background: linear-gradient(135deg, #061623, #0f766e 60%, #14b8a6); color: #fff; overflow: hidden; position: relative; }
.dashboard-hero::after { content: ''; position: absolute; width: 260px; height: 260px; border-radius: 999px; background: rgba(255,255,255,0.10); inset-inline-end: -80px; top: -90px; }
.dashboard-hero-copy, .dashboard-hero-total { position: relative; z-index: 1; }
.dashboard-hero .eyebrow { background: rgba(255,255,255,0.15); color: #ccfbf1; }
.dashboard-hero h2 { margin: 0 0 8px; font-size: clamp(28px, 4vw, 48px); line-height: 1.1; letter-spacing: -0.04em; }
.dashboard-hero p { margin: 0; color: #ccfbf1; max-width: 64ch; font-weight: 700; }
.dashboard-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.dashboard-hero .btn.secondary { background: rgba(255,255,255,0.14); color: #fff; }
.dashboard-hero-total { display: grid; align-content: center; justify-items: center; text-align: center; border: 1px solid rgba(255,255,255,0.18); border-radius: 24px; background: rgba(255,255,255,0.12); padding: 18px; }
.dashboard-hero-total span, .dashboard-hero-total small { color: #ccfbf1; font-weight: 900; }
.dashboard-hero-total strong { display: block; font-size: clamp(34px, 5vw, 58px); letter-spacing: -0.06em; }
.dashboard-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi-card { position: relative; overflow: hidden; margin-bottom: 16px; }
.kpi-card::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 6px; background: var(--primary); }
.kpi-card::after { content: ''; position: absolute; width: 120px; height: 120px; border-radius: 999px; inset-inline-end: -42px; bottom: -56px; background: rgba(20, 184, 166, 0.12); }
.kpi-card span { color: var(--muted); font-weight: 900; }
.kpi-card strong { display: block; margin-top: 10px; font-size: clamp(28px, 3vw, 40px); letter-spacing: -0.05em; }
.kpi-card small { color: var(--muted); font-weight: 800; }
.kpi-card.accent-amber::before { background: #f59e0b; }
.kpi-card.accent-amber::after { background: rgba(245, 158, 11, 0.14); }
.kpi-card.accent-blue::before { background: #2563eb; }
.kpi-card.accent-blue::after { background: rgba(37, 99, 235, 0.12); }
.kpi-card.accent-rose::before { background: #e11d48; }
.kpi-card.accent-rose::after { background: rgba(225, 29, 72, 0.12); }
.dashboard-grid-main { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr); gap: 16px; align-items: stretch; }
.dashboard-chart-card, .dashboard-health-card { min-height: 380px; }
.trend-chart { height: 280px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; align-items: end; padding-top: 12px; }
.trend-day { display: grid; grid-template-rows: 1fr auto auto; gap: 6px; height: 100%; text-align: center; min-width: 0; }
.trend-bar-wrap { height: 100%; min-height: 180px; display: flex; align-items: end; justify-content: center; border-radius: 18px; background: linear-gradient(180deg, #f8fafc, #eef2f7); overflow: hidden; border: 1px solid #e2e8f0; }
.trend-bar { width: 64%; min-height: 8px; display: block; border-radius: 18px 18px 0 0; background: linear-gradient(180deg, #14b8a6, #0f766e); box-shadow: 0 -10px 22px rgba(20, 184, 166, 0.22); }
.trend-day strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trend-day small { color: var(--muted); font-weight: 900; }
.health-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.health-list a { display: grid; gap: 8px; padding: 14px; border-radius: 18px; background: linear-gradient(135deg, #fff, #f8fafc); border: 1px solid var(--border); color: var(--text); min-height: 98px; }
.health-list a:hover { border-color: rgba(20, 184, 166, 0.7); box-shadow: var(--shadow-soft); }
.health-list span { color: var(--muted); font-weight: 900; }
.health-list strong { font-size: 24px; letter-spacing: -0.04em; }
.dashboard-grid-secondary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.top-products-list, .activity-list, .alert-stack { display: grid; gap: 10px; }
.top-product-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 16px; background: #fff; overflow: hidden; }
.top-product-row div, .top-product-row span { position: relative; z-index: 1; }
.top-product-row strong, .activity-item strong { display: block; }
.top-product-row small, .activity-item small { display: block; color: var(--muted); margin-top: 3px; font-size: 12px; }
.top-product-row i { position: absolute; inset-block: 0; inset-inline-start: 0; background: linear-gradient(90deg, rgba(20, 184, 166, 0.13), transparent); }
.activity-item { display: flex; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 16px; background: #fff; }
.activity-item > span { font-weight: 900; }
.activity-item > strong { text-align: end; }
.dashboard-alert { display: grid; gap: 4px; padding: 12px; border-radius: 16px; border: 1px solid var(--border); background: #fff; color: var(--text); }
.dashboard-alert strong { display: block; }
.dashboard-alert span { color: var(--muted); font-size: 12px; font-weight: 800; }
.dashboard-alert.danger { background: #fff7f7; border-color: #fecaca; }
.dashboard-alert.warning { background: #fffbeb; border-color: #fde68a; }

.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px; }
.finance-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat { position: relative; overflow: hidden; }
.stat::after { content: ''; position: absolute; inset-inline-end: -28px; bottom: -34px; width: 96px; height: 96px; border-radius: 999px; background: rgba(20, 184, 166, 0.10); }
.stat span { color: var(--muted); font-weight: 700; }
.stat strong { display: block; font-size: clamp(28px, 3.4vw, 42px); margin-top: 10px; letter-spacing: -0.04em; }

.two-column { display: grid; grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr); gap: 20px; align-items: start; }
.three-column { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 20px; align-items: start; }
.wide-card { min-width: 0; }
.inline-form { display: flex; gap: 10px; }
.inline-form input { flex: 1; }
.section-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.compact-head { margin-top: 16px; margin-bottom: 10px; }
.section-head h2, .compact-head h2 { margin: 0; font-size: 19px; }
.eyebrow { display: inline-flex; color: var(--primary-dark); background: #dffcf7; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 800; margin-bottom: 8px; }

label, fieldset { display: grid; gap: 7px; color: var(--muted); font-size: 14px; font-weight: 700; }
fieldset { border: 1px solid var(--border); border-radius: 16px; padding: 12px; }
input, select, textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 13px;
    color: var(--text);
    background: rgba(255,255,255,0.96);
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
input:focus, select:focus, textarea:focus { border-color: rgba(20, 184, 166, 0.75); box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.13); background: #fff; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.check input { width: auto; min-height: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid.compact { margin-bottom: 18px; }

.btn {
    border: 0;
    border-radius: 14px;
    padding: 10px 16px;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 44px;
    font-weight: 800;
    transition: transform 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: 0.62; transform: none; }
.btn.primary { background: linear-gradient(135deg, var(--primary-2), var(--primary)); color: #fff; box-shadow: 0 14px 26px rgba(15, 118, 110, 0.24); }
.btn.secondary { background: #e6fffb; color: var(--primary-dark); }
.btn.danger { background: #fee4e2; color: var(--danger); }
.btn.small { min-height: 34px; padding: 7px 10px; border-radius: 11px; font-size: 13px; }

.table-wrap { overflow-x: auto; border-radius: 18px; border: 1px solid var(--border); background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th, td { padding: 12px; border-bottom: 1px solid rgba(226, 232, 240, 0.82); text-align: start; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 900; background: #f8fafc; position: sticky; top: 0; z-index: 1; }
td small { display: block; color: var(--muted); margin-top: 4px; }

.alert { padding: 13px 16px; border-radius: 16px; margin-bottom: 14px; border: 1px solid transparent; font-weight: 700; }
.alert.success { background: #ecfdf3; color: #027a48; border-color: #bbf7d0; }
.alert.error { background: #fef3f2; color: var(--danger); border-color: #fecaca; }
.alert.info { background: #eff8ff; color: #175cd3; border-color: #bfdbfe; }
.auth-card { margin-top: 0; padding: 30px; background: linear-gradient(135deg, #fff, #f0fdfa); }
.auth-card h2 { margin-top: 0; font-size: 28px; }
.login-brand { display: grid; place-items: center; width: 100%; margin-bottom: 24px; padding: 18px 20px; border-radius: 26px; background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-soft); }
.login-brand img { width: min(280px, 86%); height: auto; display: block; }

.pos-mode .main { padding: 16px; }
.pos-mode .topbar { margin-bottom: 14px; }
.pos-screen { display: grid; grid-template-columns: minmax(430px, 1.05fr) minmax(520px, 0.95fr); gap: 16px; align-items: start; }
.pos-catalog-panel, .pos-checkout-panel { margin-bottom: 16px; }
.pos-checkout-panel { position: sticky; top: 16px; }
.pos-hero-block {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: stretch;
    margin-bottom: 16px;
    padding: 18px;
    border-radius: 22px;
    background: linear-gradient(135deg, #042f2e, #0f766e 62%, #14b8a6);
    color: #fff;
    overflow: hidden;
}
.pos-hero-block .eyebrow { background: rgba(255,255,255,0.16); color: #ccfbf1; }
.pos-hero-block h2 { margin: 0 0 5px; font-size: clamp(24px, 3vw, 36px); letter-spacing: -0.03em; }
.pos-hero-block p { margin: 0; color: #ccfbf1; max-width: 52ch; }
.pos-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pos-shortcuts span { display: inline-flex; align-items: center; min-height: 28px; border-radius: 999px; padding: 4px 10px; background: rgba(255,255,255,0.14); color: #f0fdfa; font-size: 12px; font-weight: 900; }
.pos-live-total { min-width: 150px; display: grid; align-content: center; justify-items: center; border: 1px solid rgba(255,255,255,0.18); border-radius: 20px; background: rgba(255,255,255,0.12); padding: 12px 14px; }
.pos-live-total span { color: #ccfbf1; font-size: 13px; font-weight: 800; }
.pos-live-total strong { font-size: 30px; letter-spacing: -0.04em; }
.pos-toolbar { display: grid; grid-template-columns: minmax(160px, 1fr) 150px minmax(180px, 1fr); gap: 10px; margin-bottom: 12px; }
.scan-card { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; background: #f8fafc; border: 1px dashed rgba(20, 184, 166, 0.55); border-radius: 20px; padding: 12px; margin-bottom: 12px; }
.scan-icon { display: grid; place-items: center; height: 58px; border-radius: 17px; color: #fff; background: linear-gradient(135deg, var(--primary-2), var(--primary)); font-size: 26px; }
.scanner-label { margin: 0; }
.scanner-input { min-height: 58px; font-size: 22px; border-color: rgba(20, 184, 166, 0.56); font-weight: 800; }
.search-box { margin-bottom: 4px; }
.search-box input { min-height: 50px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M8.5 14.5a6 6 0 1 1 0-12 6 6 0 0 1 0 12Zm4.3-1.7 4.7 4.7' stroke='%2364748b' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 14px center; padding-inline-start: 42px; }
.rtl .search-box input { background-position: calc(100% - 14px) center; }
.category-filters { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px 10px; margin-bottom: 2px; }
.category-filter { border: 1px solid var(--border); background: #fff; color: var(--muted); border-radius: 999px; padding: 9px 13px; cursor: pointer; white-space: nowrap; font-weight: 900; }
.category-filter.active, .category-filter:hover { background: #0f766e; color: #fff; border-color: #0f766e; }
.quick-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 10px; max-height: calc(100vh - 420px); min-height: 230px; overflow: auto; padding: 2px 2px 8px; }
.quick-products.loading { opacity: 0.62; pointer-events: none; }
.quick-product { border: 1px solid var(--border); background: linear-gradient(180deg, #fff, #f8fafc); border-radius: 18px; padding: 13px; text-align: start; cursor: pointer; min-height: 116px; display: grid; align-content: space-between; gap: 8px; color: var(--text); box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04); transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease; }
.quick-product:hover { border-color: rgba(20, 184, 166, 0.7); box-shadow: 0 16px 28px rgba(20, 184, 166, 0.13); transform: translateY(-2px); }
.quick-product strong { display: block; font-size: 15px; line-height: 1.35; }
.product-chip { justify-self: start; display: inline-flex; border-radius: 999px; background: #eef2ff; color: #3730a3; padding: 3px 8px; font-size: 11px; font-weight: 900; }
.product-meta { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.pos-status { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #ecfdf3; color: #027a48; border: 1px solid #bbf7d0; border-radius: 16px; padding: 10px 12px; margin-bottom: 14px; font-weight: 800; }
.pos-cart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.pos-cart-head h2 { margin: 0; font-size: 22px; }
.cart-count { background: #fef3c7; color: #92400e; border-radius: 999px; padding: 8px 12px; font-weight: 900; white-space: nowrap; }
.cashier-help { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.cashier-help span { border-radius: 14px; background: #eff6ff; color: #1d4ed8; padding: 9px 11px; font-size: 12px; font-weight: 800; }
.pos-cart-wrap { max-height: 34vh; overflow: auto; }
.pos-cart-table { min-width: 650px; }
.pos-cart-table input { min-width: 84px; min-height: 38px; padding: 7px 9px; }
.qty-control { display: grid; grid-template-columns: 34px minmax(72px, 1fr) 34px; gap: 6px; align-items: center; }
.qty-control button { min-height: 34px; border: 0; border-radius: 11px; background: #e6fffb; color: var(--primary-dark); cursor: pointer; font-weight: 900; }
.qty-control button:hover { background: #ccfbf1; }
.empty-cart-cell { text-align: center; color: var(--muted); padding: 30px 12px; font-weight: 800; }
.totals-box { display: grid; gap: 8px; background: linear-gradient(135deg, #f8fafc, #ffffff); border: 1px solid var(--border); border-radius: 20px; padding: 14px; margin: 14px 0; }
.totals-box div { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-weight: 800; }
.totals-box strong { color: var(--text); }
.totals-box .grand { font-size: 25px; color: var(--primary-dark); border-top: 1px solid var(--border); padding-top: 10px; margin-top: 3px; }
.totals-box .grand strong { color: var(--primary-dark); }
.payment-rows { display: grid; gap: 10px; margin-bottom: 10px; }
.payment-row { display: grid; grid-template-columns: 130px 1fr 1fr auto; gap: 8px; align-items: center; }
.pos-actions { display: grid; grid-template-columns: 1.35fr 0.8fr; gap: 10px; margin-top: 14px; }
.pos-actions .btn { min-height: 58px; font-size: 17px; }
.held-orders { display: grid; gap: 10px; }
.held-order { border: 1px solid var(--border); border-radius: 16px; background: #fff; padding: 12px; text-align: start; cursor: pointer; box-shadow: var(--shadow-soft); }
.held-order span { display: block; color: var(--muted); margin-top: 4px; }
.receipt-card { display: grid; gap: 12px; }
.thermal-receipt { background: #fff; border: 1px dashed #94a3b8; color: #111; width: 320px; max-width: 100%; padding: 16px; font-family: Tahoma, Arial, sans-serif; border-radius: 12px; font-size: 12px; }
.receipt-empty { color: var(--muted); text-align: center; font-weight: 800; padding: 34px 16px; }
.receipt-header { text-align: center; border-bottom: 1px dashed #111; padding-bottom: 8px; margin-bottom: 8px; }
.receipt-header h3, .receipt-header p { margin: 0 0 5px; }
.receipt-meta, .receipt-totals { display: grid; gap: 5px; margin: 8px 0; }
.receipt-meta div, .receipt-totals div { display: flex; justify-content: space-between; gap: 10px; }
.receipt-items { min-width: 0; font-size: 12px; }
.receipt-items th, .receipt-items td { padding: 6px 0; border-bottom: 1px dashed #cbd5e1; }
.receipt-items small { display: block; color: #475569; margin-top: 2px; }
.receipt-grand { border-top: 1px solid #111; border-bottom: 1px solid #111; padding: 6px 0; font-size: 15px; }
.qr-box { border: 1px solid #111; padding: 8px; word-break: break-all; font-size: 10px; text-align: center; }
.qr-box strong, .qr-box small { display: block; }

.bar-chart { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 95px 1fr 90px; gap: 8px; align-items: center; font-size: 13px; }
.bar-row div { height: 12px; border-radius: 999px; background: #eef2f6; overflow: hidden; }
.bar-row i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); border-radius: inherit; }
.bar-row strong { text-align: end; }
.invoice-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.invoice-meta div { background: #f9fafb; border: 1px solid var(--border); border-radius: 14px; padding: 12px; }
.invoice-meta span { display: block; color: var(--muted); margin-bottom: 4px; }
.approval-actions { display: grid; grid-template-columns: minmax(160px, 1fr) auto auto; gap: 8px; align-items: center; }
.purchase-rows { display: grid; gap: 10px; margin: 12px 0; }
.purchase-row { display: grid; grid-template-columns: minmax(180px, 1fr) 110px 120px 95px auto; gap: 8px; align-items: center; }
.purchase-row.invoice-row { grid-template-columns: minmax(180px, 1fr) 95px 110px 85px 130px 150px auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.muted-text { color: var(--muted); margin-top: 0; font-weight: 700; }
.users-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.user-stat-card { margin-bottom: 16px; }
.user-stat-card span { color: var(--muted); font-weight: 900; }
.user-stat-card strong { display: block; font-size: 38px; letter-spacing: -0.04em; margin-top: 8px; }
.user-stat-card small { color: var(--muted); font-weight: 700; }
.users-layout { grid-template-columns: minmax(320px, 0.75fr) minmax(520px, 1.25fr); }
.role-checks { background: #f8fafc; }
.role-permission-grid { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 12px; align-items: start; }
.role-permission-card { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 18px; background: #fff; box-shadow: var(--shadow-soft); }
.role-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.role-card-head strong { display: block; font-size: 17px; }
.role-card-head small { display: block; color: var(--muted); direction: ltr; text-align: start; }
.locked-pill, .role-pill, .status-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 900; }
.locked-pill { background: #fef3c7; color: #92400e; }
.role-pill { background: #e0f2fe; color: #075985; margin: 2px; }
.status-pill.active { background: #dcfce7; color: #166534; }
.status-pill.inactive { background: #fee2e2; color: #991b1b; }
.permission-group { border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; background: #f8fafc; }
.permission-group summary { cursor: pointer; padding: 9px 11px; font-weight: 900; color: var(--text); }
.permission-checks { display: grid; gap: 7px; padding: 0 10px 10px; }
.permission-check { align-items: flex-start; background: #fff; border: 1px solid #edf2f7; border-radius: 12px; padding: 8px; }
.permission-check small { display: block; color: var(--muted); direction: ltr; text-align: start; margin-top: 2px; font-weight: 700; }

@media (max-width: 1280px) {
    .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .finance-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .pos-screen { grid-template-columns: 1fr; }
    .pos-checkout-panel { position: static; }
    .quick-products { max-height: 54vh; }
    .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid-main, .dashboard-grid-secondary { grid-template-columns: 1fr; }
    .role-permission-grid { grid-template-columns: repeat(2, minmax(260px, 1fr)); }
}

@media (max-width: 1100px) {
    .two-column, .three-column, .dashboard-hero { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .shell { display: block; }
    .sidebar { width: 100%; height: auto; max-height: 78vh; position: fixed; inset-inline: 0; top: 0; transform: translateY(-105%); transition: transform 0.2s ease; border-radius: 0 0 24px 24px; }
    body.sidebar-open .sidebar { transform: translateY(0); }
    .sidebar-toggle { display: inline-grid; place-items: center; }
    .main { padding: 14px; }
    .topbar { align-items: flex-start; flex-direction: column; position: sticky; top: 10px; z-index: 10; }
    .top-actions { width: 100%; }
    .stats-grid, .finance-stats, .form-grid, .inline-form { grid-template-columns: 1fr; flex-direction: column; }
    .dashboard-kpis, .health-list { grid-template-columns: 1fr; }
    .trend-chart { gap: 7px; height: 220px; overflow-x: auto; }
    .trend-day { min-width: 54px; }
    .users-overview, .users-layout, .role-permission-grid { grid-template-columns: 1fr; }
    .pos-toolbar, .payment-row, .pos-actions, .invoice-meta, .approval-actions { grid-template-columns: 1fr; }
    .purchase-row, .purchase-row.invoice-row { grid-template-columns: 1fr; }
    .pos-hero-block { grid-template-columns: 1fr; }
    .pos-live-total { justify-items: start; }
    .scan-card { grid-template-columns: 1fr; }
    .scan-icon { display: none; }
    .quick-products { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none; }
    .cashier-help { grid-template-columns: 1fr; }
    .card { padding: 16px; border-radius: 18px; }
    .auth-card { margin-top: 24px; }
}

@media (max-width: 460px) {
    .quick-products { grid-template-columns: 1fr; }
    .pos-cart-head { align-items: flex-start; flex-direction: column; }
}

@media print {
    body * { visibility: hidden; }
    .thermal-receipt, .thermal-receipt * { visibility: visible; }
    .thermal-receipt { position: absolute; inset-inline-start: 0; top: 0; width: 80mm; border: 0; box-shadow: none; border-radius: 0; }
}

@media (min-width: 761px) {
    .ltr .sidebar { order: 0; }
    .rtl .sidebar { order: 0; }
}
