/* ============================================
   ADMIN PANEL — Premium Glassmorphism
   ============================================ */

:root {
    --primary: #0a84ff;
    --accent: #bf5af2;
    --bg-1: #050510;
    --bg-2: #0a0a1c;
    --bg-3: #12122a;
    --text: #f5f5f7;
    --text-dim: #b0b0c0;
    --muted: #80808f;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.14);
    --glass: rgba(255, 255, 255, 0.04);
    --glass-strong: rgba(255, 255, 255, 0.07);
    --shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.5);
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --danger: #ff453a;
    --success: #30d158;
    --warning: #ff9f0a;
}

[data-theme="light"] {
    --bg-1: #f5f5f7;
    --bg-2: #ffffff;
    --bg-3: #fafafa;
    --text: #1d1d1f;
    --text-dim: #4a4a52;
    --muted: #86868b;
    --line: rgba(0, 0, 0, 0.08);
    --line-strong: rgba(0, 0, 0, 0.14);
    --glass: rgba(255, 255, 255, 0.7);
    --glass-strong: rgba(255, 255, 255, 0.85);
    --shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.15);
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-1);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}

body {
    background:
        radial-gradient(ellipse 80% 50% at 80% 0%, rgba(10, 132, 255, 0.18), transparent 60%),
        radial-gradient(ellipse 60% 60% at 0% 100%, rgba(191, 90, 242, 0.15), transparent 60%),
        var(--bg-1);
    background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ============================================
   LAYOUT
   ============================================ */

body.admin {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    align-items: stretch;
}

/* Aurora background (decorative) */
.aurora {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.aurora-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35;
    animation: blob 20s ease-in-out infinite;
}

.aurora-blob.blob-1 {
    width: 520px; height: 520px;
    background: var(--primary);
    top: -180px; left: -160px;
}

.aurora-blob.blob-2 {
    width: 520px; height: 520px;
    background: var(--accent);
    bottom: -200px; right: -180px;
    animation-delay: -10s;
}

@keyframes blob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, -30px) scale(1.1); }
}

[data-theme="light"] .aurora-blob { opacity: 0.2; }

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    background: var(--glass);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-right: 1px solid var(--line);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.4s var(--ease);
    z-index: 50;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px 22px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: grid;
    place-items: center;
    color: #fff;
    box-shadow: 0 8px 22px -6px rgba(10, 132, 255, 0.55);
}

.brand-mark i { width: 20px; height: 20px; }

.brand-text strong {
    display: block;
    font-size: 15px;
    letter-spacing: -0.01em;
}

.brand-text span {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.side-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.side-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 11px;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.25s var(--ease);
    position: relative;
}

.side-nav a i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.85;
}

.side-nav a:hover {
    background: var(--glass-strong);
    color: var(--text);
}

.side-nav a.active {
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.18), rgba(191, 90, 242, 0.14));
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--line-strong);
}

.side-nav a.active::before {
    content: '';
    position: absolute;
    left: -18px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 22px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
}

.side-foot {
    padding-top: 18px;
    border-top: 1px solid var(--line);
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.side-foot a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 13px;
    transition: all 0.2s var(--ease);
}

.side-foot a i { width: 16px; height: 16px; }
.side-foot a:hover { color: var(--text); background: var(--glass-strong); }

/* ============================================
   CONTENT AREA
   ============================================ */

.content {
    padding: 28px 36px 60px;
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

.content > * { max-width: 1180px; }

.top-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.top-bar-title { flex: 1; min-width: 0; }

.top-bar h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.top-bar .welcome {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}

/* Stacked pills (theme on top, clock below) on the right side of the header */
.top-bar-pills {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== Glass pill (used by theme-toggle and clock) ===== */
.glass-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    background: var(--glass);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s var(--ease);
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.glass-pill:hover {
    background: var(--glass-strong);
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

.glass-pill svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

/* Clock pill */
.clock { font-variant-numeric: tabular-nums; }
.clock .dot {
    width: 4px; height: 4px;
    background: var(--text-dim);
    border-radius: 50%;
    flex-shrink: 0;
}

/* Apple-style theme toggle */
.theme-toggle {
    position: relative;
    width: 64px;
    height: 34px;
    padding: 0;
    cursor: pointer;
    background: var(--glass);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 14px; height: 14px;
    pointer-events: none;
    transition: opacity 0.3s var(--ease);
}

.theme-toggle .icon-sun  { left: 9px;  color: #ffd60a; opacity: 1; }
.theme-toggle .icon-moon { right: 9px; color: var(--text-dim); opacity: 0.35; }
[data-theme="light"] .theme-toggle .icon-sun  { opacity: 1; }
[data-theme="dark"]  .theme-toggle .icon-moon { opacity: 0.9; }

.toggle-knob {
    position: absolute;
    top: 3px; left: 3px;
    width: 28px; height: 28px;
    background: linear-gradient(180deg, #fff, #e5e7ee);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25), inset 0 -1px 1px rgba(0,0,0,0.05);
    transition: transform 0.35s var(--ease-spring), background 0.3s var(--ease);
}

[data-theme="light"] .toggle-knob {
    transform: translateX(30px);
    background: linear-gradient(180deg, #1d1d1f, #2c2c2e);
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--glass);
    color: var(--text);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.25s var(--ease);
}

.icon-btn i { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--glass-strong); border-color: var(--line-strong); }

/* Hamburger hidden on desktop, shown on mobile (rule below) */
.mobile-toggle { display: none; }

/* ============================================
   PANELS / CARDS
   ============================================ */

.panel {
    background: var(--glass);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 28px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-soft);
    min-width: 0;
    overflow: hidden;
}

/* Bare <table class="table"> not wrapped in .table-wrap — make it scroll
   horizontally when content overflows instead of breaking the panel. */
.panel > .table,
.dash-grid .panel > .table {
    display: block;
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}
.panel > .table thead,
.panel > .table tbody { display: table; width: 100%; min-width: 480px; }

.panel.narrow { max-width: 600px; }

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.panel-head h2 {
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.panel-head p {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.panel-head .panel-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.lock-badge {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(48, 209, 88, 0.2), rgba(10, 132, 255, 0.15));
    display: grid;
    place-items: center;
    color: var(--success);
    border: 1px solid rgba(48, 209, 88, 0.3);
}

.lock-badge i { width: 22px; height: 22px; }

/* ============================================
   FLASH / ALERTS
   ============================================ */

.flash {
    padding: 14px 18px;
    border-radius: 14px;
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid;
}

.alert {
    padding: 13px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    border: 1px solid;
}

.alert i, .flash i { width: 18px; height: 18px; flex-shrink: 0; }

.flash, .alert-success {
    background: rgba(48, 209, 88, 0.1);
    color: var(--success);
    border-color: rgba(48, 209, 88, 0.25);
}

.flash.error, .alert-error {
    background: rgba(255, 69, 58, 0.1);
    color: var(--danger);
    border-color: rgba(255, 69, 58, 0.25);
}

/* ============================================
   FORMS
   ============================================ */

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: -0.005em;
}

.field small.muted {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

/* ============================================
   PANEL FORM NORMALIZATION
   Handles the bare <label>Text <input></label> pattern used across
   categories.php, services.php, menu.php, etc. — without forcing
   each page to be rewritten with .form-grid / .field wrappers.
   ============================================ */

.panel form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    min-width: 0;
}

.panel form > label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: -0.005em;
    width: 100%;
    min-width: 0;
}

.panel form > label > input,
.panel form > label > textarea,
.panel form > label > select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Inline grid for groups of labels wrapped in .grid-2/.grid-3 inside forms */
.panel form .grid-2,
.panel form .grid-3,
.panel form .grid-4 {
    width: 100%;
    min-width: 0;
}

/* Buttons in panel forms align left and respect wrapping */
.panel form .btn,
.panel form button {
    align-self: flex-start;
}

/* Ensure inline checkbox labels (e.g. "Active") stay on one line, not stretched */
.panel form > label.check {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    width: auto;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="search"],
select,
textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s var(--ease);
    outline: none;
}

[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="url"],
[data-theme="light"] input[type="tel"],
[data-theme="light"] input[type="search"],
[data-theme="light"] select,
[data-theme="light"] textarea {
    background: rgba(255, 255, 255, 0.85);
}

textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    background: var(--glass-strong);
    box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.12);
}

input[type="file"] {
    padding: 8px;
    background: var(--glass);
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    width: 100%;
}

input[type="color"] {
    width: 56px;
    height: 44px;
    padding: 4px;
    background: var(--glass);
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
}

.color-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-text {
    flex: 1;
    font-family: 'SF Mono', monospace;
    text-transform: uppercase;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap i {
    position: absolute;
    left: 14px;
    width: 16px;
    height: 16px;
    color: var(--muted);
    pointer-events: none;
}

.input-wrap input { padding-left: 42px; }

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: var(--text-dim);
}

.check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

.preview {
    margin-top: 8px;
    max-width: 220px;
    border-radius: 12px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s var(--ease);
    border: 1px solid transparent;
    background: none;
    color: inherit;
    font-family: inherit;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.btn i { width: 16px; height: 16px; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 8px 22px -6px rgba(10, 132, 255, 0.5);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px -6px rgba(10, 132, 255, 0.65);
}

.btn-glass {
    background: var(--glass-strong);
    border-color: var(--line-strong);
    color: var(--text);
}

.btn-glass:hover {
    background: var(--glass);
    border-color: var(--primary);
}

.btn-glass.danger {
    color: var(--danger);
    border-color: rgba(255, 69, 58, 0.3);
}

.btn-glass.danger:hover {
    background: rgba(255, 69, 58, 0.1);
    border-color: var(--danger);
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 13px 20px;
}

.btn-mini {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 11px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    background: var(--glass-strong);
    border: 1px solid var(--line);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    text-decoration: none;
    font-family: inherit;
}

.btn-mini i { width: 13px; height: 13px; }
.btn-mini:hover { background: var(--glass); color: var(--text); border-color: var(--line-strong); }

.btn-mini.danger { color: var(--danger); border-color: rgba(255, 69, 58, 0.25); }
.btn-mini.danger:hover { background: rgba(255, 69, 58, 0.1); border-color: var(--danger); }

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* ============================================
   DASHBOARD
   ============================================ */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.kpi-card {
    background: var(--glass);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s var(--ease);
}

.kpi-card:hover {
    transform: translateY(-3px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-soft);
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 8px 18px -6px rgba(10, 132, 255, 0.45);
}

.kpi-icon i { width: 22px; height: 22px; }

.kpi-card:nth-child(2) .kpi-icon { background: linear-gradient(135deg, #ff9f0a, #ff453a); box-shadow: 0 8px 18px -6px rgba(255, 159, 10, 0.45); }
.kpi-card:nth-child(3) .kpi-icon { background: linear-gradient(135deg, #30d158, #0a84ff); box-shadow: 0 8px 18px -6px rgba(48, 209, 88, 0.45); }
.kpi-card:nth-child(4) .kpi-icon { background: linear-gradient(135deg, #bf5af2, #ff2d55); box-shadow: 0 8px 18px -6px rgba(191, 90, 242, 0.45); }
.kpi-card:nth-child(5) .kpi-icon { background: linear-gradient(135deg, #64d2ff, #5e5ce6); box-shadow: 0 8px 18px -6px rgba(100, 210, 255, 0.45); }

.kpi-num {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}

.kpi-label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 5px;
}

.dash-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 22px;
    min-width: 0;
}

.dash-grid > * { min-width: 0; }

/* ============================================
   LISTS
   ============================================ */

.list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--glass-strong);
    border: 1px solid var(--line);
    border-radius: 12px;
    transition: all 0.2s var(--ease);
}

.list-item:hover {
    border-color: var(--line-strong);
    background: var(--glass);
}

.list-item .thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--line);
    flex-shrink: 0;
}

.list-item .thumb-empty {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--glass);
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    color: var(--muted);
    flex-shrink: 0;
}

.list-item .thumb-empty i { width: 18px; height: 18px; }

.list-item .info {
    flex: 1;
    min-width: 0;
}

.list-item .info strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item .info span {
    font-size: 12px;
    color: var(--muted);
}

/* ============================================
   TABLES
   ============================================ */

.table-wrap {
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--glass-strong);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    background: var(--glass);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }

.table tr { transition: background 0.2s var(--ease); }
.table tbody tr:hover { background: var(--glass); }

.table .thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--line);
}

.table .thumb-empty {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--glass);
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    color: var(--muted);
}

.table .thumb-empty i { width: 18px; height: 18px; }

.table .actions {
    display: flex;
    gap: 6px;
    margin-top: 0;
    flex-wrap: nowrap;
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(48, 209, 88, 0.15);
    color: var(--success);
    border: 1px solid rgba(48, 209, 88, 0.25);
}

.badge.off {
    background: rgba(128, 128, 143, 0.15);
    color: var(--muted);
    border-color: rgba(128, 128, 143, 0.25);
}

/* ============================================
   MESSAGES INBOX
   ============================================ */

.msg-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.msg {
    background: var(--glass-strong);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px 18px;
    transition: all 0.25s var(--ease);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: flex-start;
}

.msg:hover { border-color: var(--line-strong); background: var(--glass); }

.msg.unread {
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.08), rgba(191, 90, 242, 0.05));
    border-color: rgba(10, 132, 255, 0.25);
}

.msg.unread::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
    margin-right: 8px;
    vertical-align: middle;
}

.msg .subj {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.msg .body {
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.55;
    margin-top: 6px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.msg .meta {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
}

.msg .meta a { color: var(--primary); }
.msg .meta a:hover { text-decoration: underline; }

.msg .actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
    margin-top: 0;
}

/* ============================================
   COUNTER
   ============================================ */

.counter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.counter-display {
    display: flex;
    align-items: center;
    gap: 16px;
}

.counter-display > i {
    width: 26px;
    height: 26px;
    color: var(--primary);
}

.counter-num {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ============================================
   UTILITIES
   ============================================ */

.muted { color: var(--muted); font-size: 13px; }
.text-center { text-align: center; }
.link { color: var(--primary); }
.link:hover { text-decoration: underline; }

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 100px 24px 140px;  /* top space for clock/theme; bottom space for dock */
    position: relative;
    overflow: hidden;
    /* Use the same aurora bg as home page (defined in style.css) */
    background:
        radial-gradient(ellipse 80% 50% at 80% 0%, rgba(10, 132, 255, 0.18), transparent 60%),
        radial-gradient(ellipse 60% 60% at 0% 100%, rgba(191, 90, 242, 0.15), transparent 60%),
        var(--bg-1);
}

.login-shell {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--glass);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--line-strong);
    border-radius: 24px;
    padding: 36px 32px;
    box-shadow: var(--shadow);
}

.login-logo {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: grid;
    place-items: center;
    margin: 0 auto 20px;
    color: #fff;
    box-shadow: 0 14px 30px -8px rgba(10, 132, 255, 0.55);
}

.login-logo i { width: 30px; height: 30px; }

.login-card h1 {
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.login-card .login-sub {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 26px;
}

/* Form layout — labels stack ABOVE their input wrap */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 4px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: -0.005em;
    display: block;
}

.login-form .btn-block { margin-top: 6px; }

.login-hint {
    margin-top: 22px;
    padding: 12px 14px;
    background: var(--glass-strong);
    border: 1px solid var(--line);
    border-radius: 10px;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

.login-hint code {
    color: var(--primary);
    font-family: 'SF Mono', monospace;
    background: rgba(10, 132, 255, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
}

@media (max-width: 640px) {
    .login-page { padding: 90px 18px 130px; }
    .login-card { padding: 28px 22px; }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 960px) {
    body.admin { grid-template-columns: 1fr; }

    .sidebar {
        position: fixed;
        left: 0; top: 0;
        width: 280px;
        transform: translateX(-100%);
        height: 100vh;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
    }

    .mobile-toggle {
        display: grid;
        place-items: center;
    }

    .content { padding: 22px 20px 60px; }

    .top-bar h1 { font-size: 20px; }

    /* Smaller pills on tablet */
    .top-bar-pills { gap: 6px; }
    .glass-pill { padding: 7px 12px; font-size: 12px; }
    .theme-toggle { width: 56px; height: 30px; }
    .toggle-knob { width: 24px; height: 24px; }
    [data-theme="light"] .toggle-knob { transform: translateX(26px); }

    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .dash-grid { grid-template-columns: 1fr; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .panel { padding: 22px 18px; border-radius: 18px; }
    .kpi-grid { grid-template-columns: 1fr; }

    /* Header on mobile:
       Row 1: title (left)  +  hamburger (right)
       Row 2: theme toggle + clock pills (left-aligned, full row)  */
    .top-bar {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "title hamburger"
            "pills pills";
        align-items: center;
        column-gap: 12px;
        row-gap: 14px;
        padding-bottom: 18px;
    }
    .top-bar-title    { grid-area: title; min-width: 0; }
    .top-bar .mobile-toggle { grid-area: hamburger; align-self: start; }
    .top-bar-pills {
        grid-area: pills;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }
    .top-bar h1 { font-size: 20px; line-height: 1.25; }
    .top-bar .muted { font-size: 12px; }

    /* Pills size for mobile */
    .glass-pill { padding: 7px 12px; font-size: 12px; }
    .theme-toggle { width: 56px; height: 30px; }
    .toggle-knob { width: 24px; height: 24px; }
    [data-theme="light"] .toggle-knob { transform: translateX(26px); }

    /* Hide date on very small screens to save space — only time shows */
    .clock #clock-date,
    .clock .dot { display: none; }

    .msg { grid-template-columns: 1fr; }
    .msg .actions { flex-direction: row; align-items: center; }
    .counter-num { font-size: 28px; }
}