:root {
    --sidebar-w: 272px;
    --topbar-h: 72px;
    --primary: #059669;
    --primary-dark: #047857;
    --primary-soft: #ecfdf5;
    --accent: #0ea5e9;
    --sidebar-bg: #0b1220;
    --sidebar-bg-2: #111827;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #f8fafc;
    --body-bg: #f4f6fb;
    --surface: #ffffff;
    --border: #e5e7eb;
    --text: #0f172a;
    --muted: #64748b;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
    --radius: 14px;
    --radius-lg: 18px;
    --font: 'Inter', 'Noto Sans Bengali', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--body-bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ─── Login ─── */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background:
        radial-gradient(circle at 10% 20%, rgba(5, 150, 105, 0.25), transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(14, 165, 233, 0.18), transparent 35%),
        linear-gradient(145deg, #0b1220 0%, #111827 50%, #0f172a 100%);
}

.login-shell {
    width: 100%;
    max-width: 980px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--surface);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.login-hero {
    padding: 2.5rem;
    background: linear-gradient(160deg, var(--primary-dark), #065f46 55%, #0b1220);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-hero .logo {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.15);
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
}

.login-hero h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0 0 .5rem;
}

.login-hero p {
    color: #d1fae5;
    margin: 0;
    line-height: 1.6;
}

.login-features {
    margin-top: 2rem;
    display: grid;
    gap: .75rem;
}

.login-features li {
    list-style: none;
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .9rem;
    color: #ecfdf5;
}

.login-card {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-card h2 {
    font-size: 1.35rem;
    font-weight: 800;
    margin: 0 0 .25rem;
}

.login-card .sub {
    color: var(--muted);
    margin-bottom: 1.5rem;
}

/* ─── App shell ─── */
.admin-app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
    color: #fff;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1.15rem 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #34d399, #059669);
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    color: #fff;
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.35);
}

.brand-title { font-weight: 800; font-size: 1rem; line-height: 1.2; }
.brand-sub { font-size: .72rem; color: var(--sidebar-text); letter-spacing: .04em; text-transform: uppercase; }

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: .65rem .55rem 1rem;
}

.sidebar-scroll::-webkit-scrollbar { width: 5px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 99px; }

.nav-group { margin-bottom: .35rem; }

.nav-group-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--sidebar-text);
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .55rem .75rem;
    border-radius: 10px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.nav-group-toggle:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
.nav-group.is-open .nav-group-toggle { color: #e2e8f0; }

.nav-group-icon { font-size: .95rem; opacity: .85; }
.nav-group-chevron {
    margin-left: auto;
    font-size: .75rem;
    transition: transform .2s;
}
.nav-group.is-open .nav-group-chevron { transform: rotate(180deg); }

.nav-group-items { padding: .15rem 0 .35rem .25rem; }

.nav-link-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .58rem .85rem;
    margin: 2px .35rem;
    border-radius: 10px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    transition: all .15s ease;
}

.nav-link-item i { font-size: 1rem; width: 1.1rem; text-align: center; opacity: .9; }

.nav-link-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #f1f5f9;
}

.nav-link-item.active {
    background: linear-gradient(90deg, rgba(5, 150, 105, 0.25), rgba(5, 150, 105, 0.08));
    color: var(--sidebar-text-active);
    box-shadow: inset 3px 0 0 #34d399;
}

.sidebar-footer {
    padding: .85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.15);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: .65rem;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #34d399, #059669);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: .9rem;
}

.user-meta strong { display: block; font-size: .88rem; line-height: 1.2; }
.user-meta small { color: var(--sidebar-text); font-size: .72rem; }

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .55rem;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
    transition: background .15s;
}

.logout-btn:hover { background: rgba(239, 68, 68, 0.22); color: #fecaca; }

/* ─── Main panel ─── */
.main-panel {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-h);
    padding: 0 1.35rem;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar-left { display: flex; align-items: center; gap: .85rem; min-width: 0; }

.page-heading { min-width: 0; }

.breadcrumb-trail {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    color: var(--muted);
    margin-bottom: .15rem;
}

.breadcrumb-trail .current { color: var(--primary); font-weight: 600; }
.breadcrumb-trail i { font-size: .65rem; opacity: .6; }

.page-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-right { display: flex; align-items: center; gap: .5rem; }

.php-badge {
    font-size: .7rem;
    font-weight: 700;
    padding: .28rem .55rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    border: 1px solid #a7f3d0;
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
}
.btn-ghost:hover { background: #f8fafc; color: var(--text); }

.sidebar-toggle { display: none; border: 1px solid var(--border); background: #fff; }

.content-area {
    flex: 1;
    padding: 1.35rem;
}

.page-lead {
    color: var(--muted);
    margin: -.35rem 0 1.25rem;
    font-size: .95rem;
}

/* ─── Cards & legacy aliases ─── */
.ui-card,
.panel-card,
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
    overflow: hidden;
}

.ui-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    background: linear-gradient(180deg, #fafbfc, #fff);
}

.ui-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.ui-card-subtitle {
    margin: .2rem 0 0;
    font-size: .85rem;
    color: var(--muted);
}

.ui-card-body,
.panel-card,
.table-card {
    padding: 1.15rem 1.25rem;
}

.panel-card h5,
.table-card h5 {
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: .85rem;
}

/* ─── Dashboard stats ─── */
.stat-tile-link { text-decoration: none; color: inherit; display: block; height: 100%; }

.stat-tile {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    height: 100%;
    transition: transform .15s, box-shadow .15s;
}

.stat-tile-link:hover .stat-tile,
.stat-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-tile-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-tile--primary .stat-tile-icon { background: #ecfdf5; color: #059669; }
.stat-tile--blue .stat-tile-icon { background: #eff6ff; color: #2563eb; }
.stat-tile--rose .stat-tile-icon { background: #fff1f2; color: #e11d48; }
.stat-tile--amber .stat-tile-icon { background: #fffbeb; color: #d97706; }
.stat-tile--violet .stat-tile-icon { background: #f5f3ff; color: #7c3aed; }
.stat-tile--cyan .stat-tile-icon { background: #ecfeff; color: #0891b2; }
.stat-tile--slate .stat-tile-icon { background: #f1f5f9; color: #475569; }

.stat-tile-value {
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
}

.stat-tile-label {
    margin-top: .25rem;
    font-size: .82rem;
    color: var(--muted);
    font-weight: 500;
}

.alert-tile {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: inherit;
    border: 1px solid;
    transition: transform .15s;
}

.alert-tile:hover { transform: translateY(-2px); color: inherit; }

.alert-tile--warning { background: #fffbeb; border-color: #fde68a; }
.alert-tile--danger { background: #fef2f2; border-color: #fecaca; }
.alert-tile--info { background: #eff6ff; border-color: #bfdbfe; }

.alert-tile-count {
    font-size: 1.5rem;
    font-weight: 800;
    min-width: 2.5rem;
}

.alert-tile-label { flex: 1; font-weight: 600; font-size: .9rem; }
.alert-tile-arrow { opacity: .5; }

.welcome-banner {
    background: linear-gradient(120deg, #059669 0%, #047857 45%, #0b1220 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 1.35rem 1.5rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: var(--shadow-md);
}

.welcome-banner h2 {
    margin: 0 0 .35rem;
    font-size: 1.35rem;
    font-weight: 800;
}

.welcome-banner p { margin: 0; color: #d1fae5; font-size: .92rem; }

.quick-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .65rem;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .45rem;
    padding: .85rem .5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fafbfc;
    text-decoration: none;
    color: var(--text);
    font-size: .82rem;
    font-weight: 600;
    text-align: center;
    transition: all .15s;
}

.quick-action i {
    font-size: 1.25rem;
    color: var(--primary);
}

.quick-action:hover {
    background: var(--primary-soft);
    border-color: #a7f3d0;
    color: var(--primary-dark);
    transform: translateY(-1px);
}

.api-box {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: #0f172a;
    color: #e2e8f0;
    padding: .65rem .85rem;
    border-radius: 10px;
    font-family: ui-monospace, monospace;
    font-size: .8rem;
    word-break: break-all;
}

.api-box button {
    flex-shrink: 0;
    border: 0;
    background: rgba(255,255,255,.1);
    color: #fff;
    border-radius: 8px;
    padding: .35rem .55rem;
    cursor: pointer;
}

.api-box button:hover { background: rgba(255,255,255,.18); }

/* ─── Forms & tables ─── */
.form-control, .form-select {
    border-radius: 10px;
    border-color: var(--border);
    padding: .55rem .8rem;
    font-size: .92rem;
}

.form-control:focus, .form-select:focus {
    border-color: #6ee7b7;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.ui-label {
    font-size: .82rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: .35rem;
}

.btn {
    border-radius: 10px;
    font-weight: 600;
    padding: .5rem 1rem;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-sm { padding: .35rem .7rem; font-size: .82rem; border-radius: 8px; }

.ui-table-wrap {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.ui-table thead th {
    background: #f8fafc;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    padding: .75rem 1rem;
}

.ui-table tbody td {
    padding: .8rem 1rem;
    font-size: .9rem;
    border-color: #f1f5f9;
}

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--muted);
}

.empty-state i {
    font-size: 2rem;
    opacity: .35;
    display: block;
    margin-bottom: .65rem;
}

.toast-alert {
    border: 0;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

/* ─── Menu builder ─── */
.menu-category-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.menu-category-head {
    background: linear-gradient(180deg, #f8fafc, #fff);
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
}

.menu-item-row {
    padding: .85rem 1.15rem;
    border-bottom: 1px solid #f1f5f9;
}

.menu-item-row:last-child { border-bottom: 0; }

/* ─── Notification templates ─── */
.template-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem;
    height: 100%;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s, transform .15s;
}

.template-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.template-card-head {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    margin-bottom: .75rem;
}

.template-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--tpl-bg, #d1fae5);
    color: var(--tpl-color, #0b6e4f);
    display: grid;
    place-items: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.template-preview {
    background: #f8fafc;
    border-radius: 10px;
    padding: .75rem;
    margin-bottom: .75rem;
    border: 1px solid #f1f5f9;
}

.template-preview-title { font-weight: 700; color: var(--tpl-color, #0b6e4f); }
.template-preview-body { font-size: .85rem; color: var(--muted); margin-top: .25rem; }
.template-meta { margin-bottom: .75rem; }
.template-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Legacy stat-card */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    height: 100%;
}
.stat-card .stat-value { font-size: 1.65rem; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { color: var(--muted); font-size: .82rem; margin-top: .25rem; }
.pending-card { border-left: 4px solid #f59e0b; }

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1035;
}

/* ─── Responsive ─── */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main-panel { margin-left: 0; }
    .sidebar-toggle { display: inline-grid; }
    .overlay.show { display: block; }
    .login-shell { grid-template-columns: 1fr; }
    .login-hero { display: none; }
}

@media (max-width: 575px) {
    .content-area { padding: 1rem; }
    .topbar { padding: 0 .85rem; }
    .page-title { font-size: 1.05rem; }
    .welcome-banner { flex-direction: column; align-items: flex-start; }
}

/* ─── Admin activity inbox bell ─── */
.admin-inbox-wrap { position: relative; }

.admin-inbox-btn {
    position: relative;
}

.admin-inbox-btn::after {
    display: none;
}

.admin-inbox-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: inline-grid;
    place-items: center;
    border: 2px solid #fff;
}

.admin-inbox-menu {
    width: min(380px, calc(100vw - 24px));
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.admin-inbox-menu-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .85rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.admin-inbox-menu-body {
    max-height: 360px;
    overflow-y: auto;
}

.admin-inbox-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--muted);
    font-size: .9rem;
}

.admin-inbox-menu-item {
    display: flex;
    gap: .75rem;
    padding: .8rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #f1f5f9;
    transition: background .12s;
}

.admin-inbox-menu-item:hover { background: #f8fafc; color: inherit; }
.admin-inbox-menu-item.is-unread { background: #fff7ed; }
.admin-inbox-menu-item.is-unread:hover { background: #ffedd5; }

.admin-inbox-menu-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.tone-warning { background: #fffbeb; color: #d97706; }
.tone-danger { background: #fef2f2; color: #dc2626; }
.tone-info { background: #eff6ff; color: #2563eb; }
.tone-success { background: #ecfdf5; color: #059669; }
.tone-rose { background: #fff1f2; color: #e11d48; }
.tone-slate { background: #f1f5f9; color: #475569; }

.admin-inbox-menu-text { min-width: 0; flex: 1; }
.admin-inbox-menu-title {
    display: block;
    font-weight: 700;
    font-size: .88rem;
    color: var(--text);
}
.admin-inbox-menu-summary {
    display: block;
    font-size: .78rem;
    color: var(--muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-inbox-menu-time {
    display: block;
    font-size: .7rem;
    color: #94a3b8;
    margin-top: 4px;
}

.admin-inbox-menu-foot {
    padding: .75rem;
    background: #fff;
    border-top: 1px solid var(--border);
}

.inbox-feed { display: grid; gap: .75rem; }

.inbox-item {
    display: flex;
    gap: .85rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
}

.inbox-item--unread {
    border-color: #fdba74;
    background: #fff7ed;
    box-shadow: inset 3px 0 0 #f97316;
}

.inbox-item-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: #f1f5f9;
    color: #475569;
}

.inbox-item--warning .inbox-item-icon { background: #fffbeb; color: #d97706; }
.inbox-item--danger .inbox-item-icon { background: #fef2f2; color: #dc2626; }
.inbox-item--info .inbox-item-icon { background: #eff6ff; color: #2563eb; }
.inbox-item--success .inbox-item-icon { background: #ecfdf5; color: #059669; }
.inbox-item--rose .inbox-item-icon { background: #fff1f2; color: #e11d48; }

.inbox-item-body { flex: 1; min-width: 0; }
.inbox-item-title {
    margin: .35rem 0 .25rem;
    font-size: 1rem;
    font-weight: 800;
}
.inbox-item-summary {
    margin: 0;
    color: var(--muted);
    font-size: .9rem;
}
.inbox-type-badge {
    background: #e2e8f0;
    color: #334155;
    font-size: .68rem;
    margin-right: .25rem;
}
