/* =====================================================================
   ShawnEffect Portal — Modern corporate admin theme
   Hand-written, dependency-free. Works without Node/Tailwind/CDN.
   ===================================================================== */

:root {
    /* Brand / accent */
    --brand:        #4f46e5;
    --brand-600:    #4338ca;
    --brand-700:    #3730a3;
    --brand-soft:   #eef2ff;

    /* Sidebar */
    --sidebar-bg:   #0f172a;
    --sidebar-bg-2: #111a30;
    --sidebar-fg:   #94a3b8;
    --sidebar-fg-2: #e2e8f0;
    --sidebar-active-bg: rgba(99,102,241,0.16);
    --sidebar-active-fg: #ffffff;

    /* Surfaces */
    --bg:           #f5f6fa;
    --surface:      #ffffff;
    --surface-2:    #f8fafc;
    --border:       #e6e8f0;
    --border-2:     #eef0f6;

    /* Text */
    --text:         #0f172a;
    --text-2:       #475569;
    --text-3:       #94a3b8;

    /* Status */
    --green:        #16a34a;
    --green-soft:   #dcfce7;
    --amber:        #d97706;
    --amber-soft:   #fef3c7;
    --red:          #dc2626;
    --red-soft:     #fee2e2;
    --blue:         #2563eb;
    --blue-soft:    #dbeafe;
    --purple:       #7c3aed;
    --purple-soft:  #ede9fe;

    --radius:       14px;
    --radius-sm:    10px;
    --shadow-sm:    0 1px 2px rgba(15,23,42,0.06), 0 1px 3px rgba(15,23,42,0.05);
    --shadow-md:    0 4px 12px rgba(15,23,42,0.08);
    --shadow-lg:    0 20px 40px -12px rgba(15,23,42,0.25);

    --sidebar-w:    262px;
    --topbar-h:     68px;

    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

/* =====================================================================
   App shell
   ===================================================================== */
.app {
    display: flex;
    min-height: 100vh;
}

/* ---------------------------- Sidebar ------------------------------- */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    color: var(--sidebar-fg);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transition: transform .25s ease;
}

.sidebar__brand {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 22px;
    border-bottom: 1px solid rgba(148,163,184,0.12);
}

.brand-mark {
    width: 38px; height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--brand) 0%, #7c3aed 100%);
    display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 17px;
    box-shadow: 0 6px 16px -4px rgba(79,70,229,0.6);
    flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { color: #fff; font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.brand-text span { font-size: 11px; color: var(--sidebar-fg); text-transform: uppercase; letter-spacing: 1.4px; }

.nav {
    padding: 16px 14px;
    overflow-y: auto;
    flex: 1;
}
.nav__label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: #64748b;
    padding: 14px 12px 8px;
    font-weight: 700;
}
.nav__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-fg);
    font-weight: 500;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
    position: relative;
}
.nav__item svg { width: 19px; height: 19px; flex-shrink: 0; opacity: .9; }
.nav__item:hover { background: rgba(148,163,184,0.08); color: var(--sidebar-fg-2); }
.nav__item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-fg);
}
.nav__item.active::before {
    content: "";
    position: absolute; left: -14px; top: 8px; bottom: 8px;
    width: 3px; border-radius: 0 3px 3px 0;
    background: var(--brand);
}
.nav__item .badge-pill {
    margin-left: auto;
    background: var(--brand);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 999px;
}

.sidebar__foot {
    padding: 14px;
    border-top: 1px solid rgba(148,163,184,0.12);
}
.upgrade-card {
    background: rgba(99,102,241,0.12);
    border: 1px solid rgba(129,140,248,0.25);
    border-radius: var(--radius-sm);
    padding: 14px;
    color: var(--sidebar-fg-2);
}
.upgrade-card b { color: #fff; font-size: 13px; }
.upgrade-card p { margin: 4px 0 10px; font-size: 12px; color: var(--sidebar-fg); }

/* ---------------------------- Main -------------------------------- */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--topbar-h);
    background: rgba(255,255,255,0.85);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 26px;
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar__title { display: flex; flex-direction: column; }
.topbar__title h1 { margin: 0; font-size: 17px; font-weight: 700; }
.topbar__title .crumbs { font-size: 12px; color: var(--text-3); }

.topbar__spacer { flex: 1; }

.icon-btn {
    width: 40px; height: 40px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: var(--surface);
    display: grid; place-items: center;
    cursor: pointer;
    color: var(--text-2);
    position: relative;
    transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: #d7dbe7; }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot {
    position: absolute; top: 9px; right: 10px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--red); border: 2px solid #fff;
}

.searchbox {
    display: flex; align-items: center; gap: 9px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 0 12px;
    height: 40px;
    width: 300px;
    max-width: 34vw;
    color: var(--text-3);
}
.searchbox input {
    border: 0; background: transparent; outline: none;
    font: inherit; color: var(--text); width: 100%;
}
.searchbox svg { width: 17px; height: 17px; }

.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 8px 5px 5px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
}
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--brand) 0%, #7c3aed 100%);
    color: #fff; display: grid; place-items: center;
    font-weight: 700; font-size: 13px;
}
.user-chip .u-meta { line-height: 1.15; }
.user-chip .u-meta b { font-size: 13px; }
.user-chip .u-meta span { font-size: 11px; color: var(--text-3); display: block; }

.hamburger { display: none; }

/* ---------------------------- Content ----------------------------- */
.content { padding: 26px; }
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-head h2 { margin: 0 0 4px; font-size: 22px; font-weight: 750; letter-spacing: -.3px; }
.page-head p { margin: 0; color: var(--text-2); font-size: 13.5px; }

/* =====================================================================
   Components
   ===================================================================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card__head {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-2);
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card__head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.card__head p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-3); }
.card__body { padding: 20px; }

/* Stat cards */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat__icon {
    width: 46px; height: 46px; border-radius: 13px;
    display: grid; place-items: center; margin-bottom: 14px;
}
.stat__icon svg { width: 22px; height: 22px; }
.stat__label { color: var(--text-2); font-size: 13px; font-weight: 500; }
.stat__value { font-size: 28px; font-weight: 780; letter-spacing: -.5px; margin: 3px 0 6px; }
.stat__trend { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.trend-up   { color: var(--green); }
.trend-down { color: var(--red); }
.trend-flat { color: var(--text-3); }

.i-indigo { background: var(--brand-soft); color: var(--brand); }
.i-green  { background: var(--green-soft); color: var(--green); }
.i-amber  { background: var(--amber-soft); color: var(--amber); }
.i-blue   { background: var(--blue-soft); color: var(--blue); }
.i-purple { background: var(--purple-soft); color: var(--purple); }

/* Grid helpers */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1100px){ .grid-2 { grid-template-columns: 1fr; } }

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600;
    padding: 3px 10px; border-radius: 999px;
    border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green  { background: var(--green-soft); color: #15803d; }
.badge-amber  { background: var(--amber-soft); color: #b45309; }
.badge-red    { background: var(--red-soft); color: #b91c1c; }
.badge-blue   { background: var(--blue-soft); color: #1d4ed8; }
.badge-purple { background: var(--purple-soft); color: #6d28d9; }
.badge-gray   { background: #f1f5f9; color: #64748b; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
    text-align: left; padding: 12px 16px; color: var(--text-3);
    font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
table.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr { transition: background .12s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
.cell-strong { font-weight: 600; color: var(--text); }
.cell-muted { color: var(--text-3); }

.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user .avatar { width: 30px; height: 30px; font-size: 12px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 40px; padding: 0 16px;
    border-radius: 11px; border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: 13.5px;
    cursor: pointer; transition: background .15s, box-shadow .15s, border-color .15s, transform .05s;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 14px -6px rgba(79,70,229,.7); }
.btn-primary:hover { background: var(--brand-600); }
.btn-ghost { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }

/* Tabs (page-level, no submenus) */
.tabs {
    display: flex; gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 22px;
    overflow-x: auto;
}
.tabs__item {
    padding: 11px 16px;
    font-weight: 600; font-size: 13.5px;
    color: var(--text-2);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color .15s, border-color .15s;
}
.tabs__item:hover { color: var(--text); }
.tabs__item.active { color: var(--brand); border-bottom-color: var(--brand); }

/* Settings vertical tabs layout */
.settings-layout { display: grid; grid-template-columns: 230px 1fr; gap: 22px; align-items: start; }
@media (max-width: 900px){ .settings-layout { grid-template-columns: 1fr; } }
.settings-nav {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow-sm);
    position: sticky; top: calc(var(--topbar-h) + 20px);
}
.settings-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--text-2); font-weight: 600; font-size: 13.5px; margin-bottom: 2px;
}
.settings-nav a svg { width: 18px; height: 18px; opacity: .8; }
.settings-nav a:hover { background: var(--surface-2); color: var(--text); }
.settings-nav a.active { background: var(--brand-soft); color: var(--brand); }

/* Forms */
.form-row { margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 640px){ .form-grid { grid-template-columns: 1fr; } }
label.lbl { display: block; font-weight: 600; font-size: 13px; margin-bottom: 7px; color: var(--text); }
.hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.input, .select, textarea.input {
    width: 100%; height: 42px; padding: 0 13px;
    border: 1px solid var(--border); border-radius: 11px;
    background: var(--surface); font: inherit; color: var(--text);
    outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 11px 13px; resize: vertical; }
.input:focus, .select:focus, textarea.input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79,70,229,.14);
}
.input-group { position: relative; }
.input-group .ig-icon {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    color: var(--text-3); pointer-events: none;
}
.input-group .ig-icon svg { width: 18px; height: 18px; }
.input-group .input { padding-left: 40px; }

.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input { display: none; }
.toggle .track {
    width: 42px; height: 24px; border-radius: 999px; background: #cbd5e1;
    position: relative; transition: background .15s;
}
.toggle .track::after {
    content: ""; position: absolute; top: 3px; left: 3px;
    width: 18px; height: 18px; border-radius: 50%; background: #fff;
    box-shadow: var(--shadow-sm); transition: transform .15s;
}
.toggle input:checked + .track { background: var(--brand); }
.toggle input:checked + .track::after { transform: translateX(18px); }

/* Empty / placeholder states */
.placeholder {
    text-align: center;
    padding: 56px 24px;
}
.placeholder .ph-icon {
    width: 72px; height: 72px; border-radius: 20px;
    background: var(--brand-soft); color: var(--brand);
    display: grid; place-items: center; margin: 0 auto 18px;
}
.placeholder .ph-icon svg { width: 34px; height: 34px; }
.placeholder h3 { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.placeholder p { margin: 0 auto 20px; color: var(--text-2); max-width: 440px; }

.feature-list { display: grid; gap: 10px; max-width: 440px; margin: 0 auto 22px; text-align: left; }
.feature-list li {
    list-style: none; display: flex; align-items: center; gap: 10px;
    padding: 11px 14px; background: var(--surface-2); border: 1px solid var(--border-2);
    border-radius: var(--radius-sm); font-size: 13.5px; color: var(--text-2);
}
.feature-list li .tick { color: var(--green); display: grid; place-items: center; }
.feature-list li .tick svg { width: 18px; height: 18px; }
ul.feature-list { padding: 0; margin-left: auto; margin-right: auto; }

/* Alerts / flash */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 15px; border-radius: 11px; font-size: 13.5px; font-weight: 500;
    margin-bottom: 16px; border: 1px solid transparent;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--green-soft); color: #166534; border-color: #bbf7d0; }
.alert-error   { background: var(--red-soft); color: #991b1b; border-color: #fecaca; }
.alert-info    { background: var(--blue-soft); color: #1e40af; border-color: #bfdbfe; }
.alert-warning { background: var(--amber-soft); color: #92400e; border-color: #fde68a; }

.demo-ribbon {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--amber-soft); color: #92400e;
    border: 1px solid #fde68a; border-radius: 999px;
    padding: 5px 13px; font-size: 12.5px; font-weight: 600;
}

/* Progress */
.progress { height: 8px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--brand); }

/* Activity feed */
.feed { display: flex; flex-direction: column; }
.feed__item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-2); }
.feed__item:last-child { border-bottom: 0; }
.feed__dot { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.feed__dot svg { width: 16px; height: 16px; }
.feed__item b { font-size: 13.5px; }
.feed__item p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-3); }
.feed__time { margin-left: auto; font-size: 12px; color: var(--text-3); white-space: nowrap; }

/* =====================================================================
   Auth screens
   ===================================================================== */
.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
}
@media (max-width: 900px){ .auth { grid-template-columns: 1fr; } }

.auth__aside {
    background: linear-gradient(160deg, #1e1b4b 0%, #312e81 45%, #4f46e5 100%);
    color: #fff;
    padding: 54px 56px;
    display: flex; flex-direction: column; justify-content: space-between;
    position: relative; overflow: hidden;
}
@media (max-width: 900px){ .auth__aside { display: none; } }
.auth__aside::after {
    content: ""; position: absolute; right: -120px; bottom: -120px;
    width: 360px; height: 360px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.14), transparent 70%);
}
.auth__brand { display: flex; align-items: center; gap: 12px; }
.auth__brand b { font-size: 18px; font-weight: 700; }
.auth__aside h2 { font-size: 30px; font-weight: 760; letter-spacing: -.5px; line-height: 1.25; margin: 0 0 14px; }
.auth__aside p { color: rgba(226,232,240,0.85); font-size: 15px; max-width: 420px; }
.auth-points { display: grid; gap: 14px; margin-top: 28px; position: relative; z-index: 1; }
.auth-points div { display: flex; align-items: center; gap: 12px; font-size: 14px; color: rgba(226,232,240,0.92); }
.auth-points .tk {
    width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
    background: rgba(255,255,255,0.14); display: grid; place-items: center;
}
.auth-points .tk svg { width: 16px; height: 16px; }
.auth__foot { font-size: 12.5px; color: rgba(226,232,240,0.6); position: relative; z-index: 1; }

.auth__main { display: grid; place-items: center; padding: 40px 24px; }
.auth__card { width: 100%; max-width: 400px; }
.auth__card .logo-inline { display: none; }
@media (max-width: 900px){ .auth__card .logo-inline { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 26px; } }
.auth__card h1 { font-size: 24px; font-weight: 760; margin: 0 0 6px; letter-spacing: -.4px; }
.auth__card .sub { color: var(--text-2); margin: 0 0 26px; font-size: 14px; }
.auth__card .btn { height: 46px; font-size: 15px; }

.field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.field-row a { color: var(--brand); font-size: 12.5px; font-weight: 600; }

.cred-note {
    margin-top: 22px; padding: 13px 15px;
    background: var(--surface-2); border: 1px dashed var(--border);
    border-radius: 11px; font-size: 12.5px; color: var(--text-2);
}
.cred-note b { color: var(--text); }
.cred-note code { background: #eef2ff; color: var(--brand-700); padding: 1px 6px; border-radius: 6px; font-size: 12px; }

/* 404 */
.err-box { text-align: center; max-width: 420px; }
.err-box .code { font-size: 88px; font-weight: 800; letter-spacing: -2px; color: var(--brand); line-height: 1; }

/* =====================================================================
   Responsive sidebar
   ===================================================================== */
.backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,0.5); z-index: 39;
}
@media (max-width: 1024px){
    .sidebar { transform: translateX(-100%); }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open .backdrop { display: block; }
    .main { margin-left: 0; }
    .hamburger { display: grid; }
    .searchbox { display: none; }
}
@media (max-width: 560px){
    .content { padding: 18px; }
    .user-chip .u-meta { display: none; }
    .topbar { padding: 0 16px; }
}
