/* Seravelle Admin — Luxury beauty brand dashboard
   Inspired by high-end cosmetics retail (cream · champagne · editorial serif) */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400&family=El+Messiri:wght@400;500;600;700&display=swap');

:root {
    --bg:           #f7f4ef;
    --bg-2:         #ffffff;
    --bg-3:         #f0ebe3;
    --bg-sidebar:   #1a1714;
    --line:         #e8e0d4;
    --line-2:       #d4c9b8;

    --text:         #1c1814;
    --text-soft:    #5c5348;
    --muted:        #9a8f7e;

    --gold:         #b8956b;
    --gold-2:       #d4b896;
    --gold-3:       #8a6d4a;
    --champagne:    #e8d5bc;
    --rose:         #c4a090;
    --blush:        #f3e8e0;

    --danger:       #b85c55;
    --ok:           #5d8f6e;
    --warn:         #c4923f;

    --shadow-sm:    0 2px 8px rgba(28, 22, 14, .04);
    --shadow-md:    0 12px 40px rgba(28, 22, 14, .08);
    --shadow-lg:    0 24px 64px rgba(28, 22, 14, .12);
    --radius:       14px;
    --radius-lg:    22px;
    --sidebar-w:    280px;
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body:    'El Messiri', 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--text);
    line-height: 1.2;
}

a { color: var(--gold-3); text-decoration: none; transition: color .2s; }
a:hover { color: var(--gold); }
button, input, select, textarea { font-family: inherit; }
::selection { background: rgba(184, 149, 107, .28); }

/* ─── Login (split editorial layout) ─── */
.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.login-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 48px;
    background:
        linear-gradient(165deg, rgba(26, 23, 20, .72) 0%, rgba(26, 23, 20, .45) 50%, rgba(138, 109, 74, .35) 100%),
        url('https://images.unsplash.com/photo-1596462502278-27bfdc403348?w=1200&q=80') center/cover no-repeat;
    color: #fff;
    text-align: center;
}

.login-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(212, 184, 150, .25), transparent 55%);
    pointer-events: none;
}

.login-hero-inner { position: relative; z-index: 1; max-width: 380px; }

.login-hero .brand-logo {
    width: 88px; height: 88px;
    font-size: 42px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, .12);
    border: 1.5px solid rgba(255, 255, 255, .35);
    color: #fff;
    backdrop-filter: blur(8px);
}

.login-hero h1 {
    margin: 0;
    font-size: clamp(42px, 5vw, 56px);
    font-weight: 500;
    color: #fff;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.login-hero .tagline {
    margin: 16px 0 0;
    font-size: 17px;
    font-weight: 400;
    opacity: .88;
    letter-spacing: .04em;
    font-family: var(--font-body);
}

.login-hero .divider {
    width: 48px; height: 1px;
    background: linear-gradient(90deg, transparent, var(--champagne), transparent);
    margin: 28px auto;
}

.login-hero .quote {
    font-family: var(--font-display);
    font-size: 22px;
    font-style: italic;
    opacity: .9;
    line-height: 1.5;
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background: var(--bg);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-2);
    padding: 44px 40px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
}

.login-card .brand-mini {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .brand-mini h2 {
    margin: 10px 0 4px;
    font-size: 32px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--gold-3), var(--gold));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.login-card .subtitle {
    color: var(--muted);
    font-size: 13px;
    margin: 0;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.brand-logo {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: linear-gradient(145deg, #fff 0%, var(--blush) 100%);
    border: 1.5px solid var(--gold-2);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto;
    font-size: 28px; font-weight: 600;
    color: var(--gold-3);
    font-family: var(--font-display);
    box-shadow: var(--shadow-sm);
}

/* ─── App shell ─── */
body.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    color: #e8e2d8;
    display: flex;
    flex-direction: column;
    padding: 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar .brand {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 28px 24px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar .brand .brand-logo {
    width: 48px; height: 48px;
    font-size: 24px;
    background: linear-gradient(145deg, rgba(184, 149, 107, .25), rgba(196, 160, 144, .12));
    border-color: rgba(212, 184, 150, .45);
    color: var(--champagne);
    margin: 0;
}

.sidebar .brand strong {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #fff;
    display: block;
}

.sidebar .brand .muted {
    color: rgba(232, 226, 216, .55);
    font-size: 11px;
    letter-spacing: .2em;
    text-transform: uppercase;
    margin-top: 2px;
}

.sidebar nav {
    flex: 1;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    border-radius: 12px;
    color: rgba(232, 226, 216, .75);
    transition: all .2s ease;
    font-weight: 500;
    font-size: 14.5px;
}

.nav-item .nav-icon {
    width: 20px; height: 20px;
    flex-shrink: 0;
    opacity: .7;
    stroke: currentColor;
}

.nav-item:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.nav-item:hover .nav-icon { opacity: 1; }

.nav-item.active {
    background: linear-gradient(90deg, rgba(184, 149, 107, .22), rgba(184, 149, 107, .06));
    color: var(--champagne);
    box-shadow: inset 3px 0 0 var(--gold);
}

.nav-item.active .nav-icon { opacity: 1; stroke: var(--gold-2); }

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, .08);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.sidebar-footer .user {
    font-size: 13px;
    color: rgba(232, 226, 216, .85);
    min-width: 0;
}

.sidebar-footer .user small {
    color: rgba(232, 226, 216, .45);
    font-size: 11px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

.logout {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .18);
    color: rgba(232, 226, 216, .7);
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    transition: .2s;
    flex-shrink: 0;
}

.logout:hover {
    border-color: var(--rose);
    color: #f5d4cc;
    background: rgba(184, 92, 85, .15);
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.main-topbar {
    padding: 20px 40px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.main-topbar .studio-badge {
    font-size: 11px;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: 99px;
    background: var(--bg-2);
}

.main-content {
    flex: 1;
    padding: 24px 40px 40px;
    overflow: auto;
}

/* ─── Page header ─── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
    gap: 20px;
    flex-wrap: wrap;
}

.page-header h2 {
    margin: 0;
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 600;
}

.page-header .page-desc {
    color: var(--muted);
    font-size: 14px;
    margin-top: 6px;
}

.page-header .actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ─── Dashboard hero ─── */
.dash-hero {
    background: linear-gradient(135deg, var(--bg-2) 0%, var(--blush) 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 36px 40px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}

.dash-hero::after {
    content: 'S';
    position: absolute;
    left: -20px;
    bottom: -30px;
    font-family: var(--font-display);
    font-size: 180px;
    font-weight: 700;
    color: rgba(184, 149, 107, .06);
    line-height: 1;
    pointer-events: none;
}

.dash-hero h2 {
    margin: 0 0 8px;
    font-size: clamp(32px, 4vw, 42px);
}

.dash-hero .greeting {
    color: var(--text-soft);
    font-size: 15px;
    max-width: 480px;
}

/* ─── Buttons ─── */
.btn-gold {
    background: linear-gradient(135deg, var(--gold-3) 0%, var(--gold) 100%);
    color: #fffef9;
    border: none;
    padding: 12px 26px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all .22s ease;
    box-shadow: 0 4px 16px rgba(138, 109, 74, .28);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: .02em;
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(138, 109, 74, .35);
}

.btn-gold:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-outline {
    background: var(--bg-2);
    color: var(--text-soft);
    border: 1px solid var(--line-2);
    padding: 11px 20px;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all .2s;
}

.btn-outline:hover {
    border-color: var(--gold);
    color: var(--gold-3);
    background: #fff;
}

/* ─── Forms ─── */
.field { margin-bottom: 18px; }

.field label {
    display: block;
    font-size: 12px;
    color: var(--text-soft);
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=number], .field input[type=search], .field select, .field textarea {
    width: 100%;
    padding: 13px 16px;
    background: var(--bg);
    border: 1px solid var(--line-2);
    border-radius: 12px;
    color: var(--text);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--gold);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(184, 149, 107, .12);
}

.field input[type=checkbox] { accent-color: var(--gold); margin-left: 8px; }

.card {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}

.card h3 {
    margin-top: 0;
    font-size: 22px;
}

.error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.muted { color: var(--muted); }
.mono { font-family: 'Consolas', monospace; font-size: 13px; color: var(--text-soft); }
.small { font-size: 12px; }

/* ─── Stats ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all .25s ease;
}

.stat-card:hover {
    border-color: var(--gold-2);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 100%; height: 3px;
    background: linear-gradient(90deg, var(--gold-3), var(--gold), var(--rose));
}

.stat-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.stat-value {
    font-size: 36px;
    font-weight: 600;
    margin-top: 10px;
    font-family: var(--font-display);
    background: linear-gradient(135deg, var(--gold-3), var(--gold));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.stat-icon {
    position: absolute;
    bottom: 16px;
    left: 20px;
    font-size: 32px;
    opacity: .12;
}

/* ─── Quick links (luxury tiles) ─── */
.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.quick {
    background: var(--bg);
    padding: 20px 22px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    color: var(--text-soft);
    font-weight: 500;
    transition: all .22s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.quick:hover {
    border-color: var(--gold);
    color: var(--gold-3);
    background: #fff;
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.quick .ql-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--blush), #fff);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

/* ─── Filters ─── */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.filters .search-wrap {
    flex: 2;
    min-width: 260px;
    position: relative;
}

.filters .search-wrap svg {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px; height: 18px;
    stroke: var(--muted);
    pointer-events: none;
}

.filters input, .filters select {
    flex: 1;
    min-width: 160px;
    padding: 11px 16px;
    background: var(--bg);
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--text);
    outline: none;
    transition: all .2s;
}

.filters .search-wrap input {
    padding-right: 42px;
    width: 100%;
}

.filters input:focus, .filters select:focus {
    border-color: var(--gold);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(184, 149, 107, .1);
}

.filters .clear-btn {
    background: transparent;
    border: 1px solid var(--line-2);
    color: var(--muted);
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: .2s;
}

.filters .clear-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ─── Table ─── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--bg-2);
    box-shadow: var(--shadow-sm);
}

.data-table { width: 100%; border-collapse: collapse; }

.data-table th, .data-table td {
    padding: 15px 18px;
    text-align: right;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.data-table thead th {
    color: var(--muted);
    font-weight: 600;
    font-size: 11px;
    background: var(--bg-3);
    text-transform: uppercase;
    letter-spacing: .08em;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: #faf6f0; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table.small td, .data-table.small th { padding: 8px 12px; font-size: 12px; }

.thumb {
    width: 52px; height: 52px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--blush), var(--bg-3));
    border: 1px solid var(--line);
    object-fit: cover;
    box-shadow: var(--shadow-sm);
}

.thumb-zoom { cursor: zoom-in; transition: transform .2s, box-shadow .2s; }
.thumb-zoom:hover { transform: scale(1.06); box-shadow: var(--shadow-md); }

.thumb-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--gold-2);
    font-size: 20px;
}

/* ─── Lightbox ─── */
.img-lightbox {
    position: fixed; inset: 0;
    background: rgba(20, 16, 12, .88);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    animation: lb-fade .25s ease;
}

.img-lightbox[hidden] { display: none; }

.img-lightbox figure {
    margin: 0;
    max-width: 90vw; max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.img-lightbox img {
    max-width: 90vw; max-height: 80vh;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-lg);
    object-fit: contain;
}

.img-lightbox figcaption {
    color: var(--champagne);
    font-size: 15px;
    text-align: center;
}

.lb-close {
    position: absolute;
    top: 20px; left: 20px;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .25);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

.lb-close:hover { background: rgba(255, 255, 255, .25); }

@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }

/* ─── Badges & icons ─── */
.badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .03em;
}

.badge.ok   { background: rgba(93, 143, 110, .14); color: var(--ok); }
.badge.off  { background: rgba(184, 92, 85, .12); color: var(--danger); }
.badge.warn { background: rgba(196, 146, 63, .14); color: var(--warn); }

.ic {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-soft);
    cursor: pointer;
    font-size: 15px;
    padding: 7px 10px;
    border-radius: 10px;
    transition: all .15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ic:hover { background: var(--bg-3); color: var(--gold-3); border-color: var(--line); }
.ic.danger:hover { color: var(--danger); border-color: #f0d8d5; background: #fdf5f4; }

/* ─── Pagination ─── */
.pagination {
    display: flex;
    gap: 6px;
    margin-top: 24px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.pagination .pg-info {
    color: var(--muted);
    font-size: 13px;
    margin-left: 14px;
}

.pg {
    min-width: 40px;
    padding: 9px 14px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text-soft);
    cursor: pointer;
    font-weight: 500;
    transition: all .15s;
}

.pg:hover:not(:disabled):not(.active) {
    border-color: var(--gold-2);
    color: var(--gold-3);
}

.pg.active {
    background: linear-gradient(135deg, var(--gold-3), var(--gold));
    color: #fffef9;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(138, 109, 74, .3);
}

.pg:disabled { opacity: .4; cursor: not-allowed; }
.pg-ellipsis { color: var(--muted); padding: 9px 6px; user-select: none; }

/* ─── Skeleton & empty ─── */
.skel-row td { padding: 16px; }

.skel {
    display: block;
    height: 14px;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--bg-3) 0%, #faf6ef 50%, var(--bg-3) 100%);
    background-size: 200% 100%;
    animation: skel 1.4s ease-in-out infinite;
}

.skel.thumb-skel { width: 52px; height: 52px; border-radius: 12px; }

@keyframes skel {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.empty-state {
    padding: 72px 24px;
    text-align: center;
    color: var(--muted);
}

.empty-state .ico { font-size: 64px; opacity: .25; margin-bottom: 16px; }
.empty-state h4 { margin: 8px 0; font-size: 20px; color: var(--text-soft); font-family: var(--font-display); }

/* ─── Forms grid & images ─── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 28px; }
.form-grid .full { grid-column: 1 / -1; }

.img-list { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }

.img-thumb img {
    width: 88px; height: 88px;
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid var(--line);
}

.img-thumb { position: relative; }

.img-thumb button {
    position: absolute;
    top: -6px; left: -6px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(184, 92, 85, .4);
}

/* ─── Modal ─── */
.modal {
    position: fixed; inset: 0;
    background: rgba(28, 22, 16, .5);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 520px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
}

.modal-card h3 { margin-top: 0; font-size: 26px; }
.modal-card .actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 22px; }

/* ─── Toast ─── */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-sidebar);
    color: var(--champagne);
    padding: 14px 28px;
    border-radius: 14px;
    font-size: 14px;
    z-index: 2000;
    box-shadow: var(--shadow-lg);
    animation: toast-in .3s ease;
    border: 1px solid rgba(255, 255, 255, .1);
}

.toast.ok { background: var(--ok); color: #fff; border: none; }
.toast.err { background: var(--danger); color: #fff; border: none; }

@keyframes toast-in {
    from { transform: translate(-50%, 16px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

/* ─── Responsive ─── */
@media (max-width: 960px) {
    .login-page { grid-template-columns: 1fr; }
    .login-hero { min-height: 220px; padding: 32px 24px; }
    .login-hero .quote { font-size: 18px; }

    body.app-layout { flex-direction: column; }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0;
    }

    .sidebar .brand { padding: 16px 20px; flex: 1; min-width: 200px; }
    .sidebar nav {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 8px 12px 12px;
        width: 100%;
    }
    .sidebar-footer { width: 100%; }

    .main-topbar, .main-content { padding-left: 20px; padding-right: 20px; }
    .form-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 600px) {
    .login-card { padding: 32px 24px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ═══ Home — full-page portal (no sidebar) ═══ */
body.home-page {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(212, 184, 150, .22), transparent),
        linear-gradient(180deg, #faf7f2 0%, #f0ebe3 100%);
    display: flex;
    flex-direction: column;
}

.home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .72);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.home-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.home-brand .brand-logo {
    width: 52px; height: 52px;
    font-size: 26px;
    margin: 0;
}

.home-brand strong {
    font-family: var(--font-display);
    font-size: 28px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text);
    display: block;
}

.home-tag {
    font-size: 11px;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--muted);
}

.home-header-end {
    display: flex;
    align-items: center;
    gap: 16px;
}

.home-user {
    font-size: 13px;
    color: var(--text-soft);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-top {
    background: transparent;
    border: 1px solid var(--line-2);
    color: var(--text-soft);
    padding: 8px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    transition: .2s;
}

.logout-top:hover {
    border-color: var(--gold);
    color: var(--gold-3);
}

.home-main {
    flex: 1;
    padding: 48px 40px 64px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.home-hero {
    text-align: center;
    margin-bottom: 48px;
}

.home-welcome {
    margin: 0;
    font-size: 12px;
    letter-spacing: .28em;
    text-transform: uppercase;
    color: var(--muted);
}

.home-hero h1 {
    margin: 12px 0 10px;
    font-size: clamp(36px, 6vw, 52px);
    font-weight: 600;
}

.home-lead {
    margin: 0;
    color: var(--text-soft);
    font-size: 16px;
}

.home-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.home-stat {
    text-align: center;
    padding: 16px 28px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-width: 100px;
    box-shadow: var(--shadow-sm);
}

.home-stat .n {
    display: block;
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 600;
    color: var(--gold-3);
    line-height: 1.1;
}

.home-stat .l {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-top: 4px;
    display: block;
}

.portal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.portal-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 28px 30px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: inherit;
    transition: all .25s ease;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.portal-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0; left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold-3), var(--gold), var(--rose));
    opacity: 0;
    transition: opacity .25s;
}

.portal-card:hover {
    transform: translateY(-4px);
    border-color: var(--gold-2);
    box-shadow: var(--shadow-md);
}

.portal-card:hover::before { opacity: 1; }

.portal-card.portal-lg {
    grid-column: 1 / -1;
    padding: 36px 40px;
    background: linear-gradient(135deg, #fff 0%, var(--blush) 100%);
}

.portal-icon {
    font-size: 28px;
    opacity: .85;
}

.portal-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    color: var(--text);
}

.portal-lg .portal-title { font-size: 32px; }

.portal-desc {
    font-size: 14px;
    color: var(--muted);
}

.portal-arrow {
    position: absolute;
    left: 28px;
    bottom: 28px;
    font-size: 22px;
    color: var(--gold);
    opacity: .6;
    transition: transform .2s, opacity .2s;
}

.portal-card:hover .portal-arrow {
    opacity: 1;
    transform: translateX(-4px);
}

/* ═══ Inner pages — top bar only ═══ */
body.page-shell {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
}

.top-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 32px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.back-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--gold-3);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--bg);
    transition: all .2s;
    flex-shrink: 0;
}

.back-home svg {
    width: 18px; height: 18px;
}

.back-home:hover {
    border-color: var(--gold);
    background: #fff;
}

.top-title {
    flex: 1;
    margin: 0;
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    text-align: center;
}

.top-bar-end {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.top-user {
    font-size: 13px;
    color: var(--muted);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-content {
    padding: 28px 32px 48px;
    max-width: 1400px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .home-header, .home-main, .top-bar, .page-content {
        padding-left: 20px;
        padding-right: 20px;
    }
    .portal-grid { grid-template-columns: 1fr; }
    .portal-card.portal-lg { grid-column: 1; }
    .top-user { display: none; }
    .top-title { font-size: 20px; }
}
