/* ============================================================================
   AG Shares & Securities — Client File Portal
   Shared design system  ·  assets/portal.css  ·  v2
   ========================================================================== */

:root {
    /* surfaces (dark — default) */
    --bg-0:        #070b14;
    --bg-1:        #0a1120;
    --bg-2:        #0e182b;
    --surface:     rgba(17, 27, 48, 0.72);
    --surface-2:   rgba(24, 37, 64, 0.78);
    --surface-3:   #16233d;
    --elevated:    #1b2b49;

    --line:        rgba(148, 176, 224, 0.12);
    --line-strong: rgba(148, 176, 224, 0.22);

    --text:        #eaf1fb;
    --text-dim:    #a7b8d4;
    --text-mute:   #6f83a6;

    --brand:       #2f74d0;
    --brand-bright:#57a0f2;
    --brand-deep:  #1b4d83;
    --accent:      #24d1c8;
    --gold:        #e7b84e;

    --ok:          #37d39b;
    --warn:        #f2b34b;
    --err:         #ff6b74;

    --grad-brand:  linear-gradient(135deg, #3a80e0 0%, #57a0f2 55%, #24d1c8 130%);
    --grad-sheen:  linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0));
    --shadow-sm:   0 2px 10px rgba(0, 0, 0, 0.30);
    --shadow-md:   0 18px 44px rgba(3, 8, 20, 0.55);
    --shadow-lg:   0 40px 90px rgba(2, 6, 16, 0.65);
    --ring:        0 0 0 3px rgba(87, 160, 242, 0.28);

    --card-bg:     var(--surface);
    --inp-bg:      rgba(7, 13, 26, 0.7);
    --grid-line:   rgba(120, 160, 220, 0.05);

    /* header + footer — neutral gray */
    --header-bg:      rgba(26, 31, 42, 0.86);
    --header-border:  rgba(150, 165, 190, 0.16);
    --header-text:    #c9d3e3;
    --footer-bg:      #171b24;
    --footer-border:  rgba(150, 165, 190, 0.12);

    --radius:      16px;
    --radius-sm:   11px;
    --radius-lg:   24px;

    --font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono:        'JetBrains Mono', ui-monospace, 'SFMono-Regular', 'Cascadia Mono', Menlo, Consolas, monospace;

    --maxw:        1360px;

    /* density (comfortable — default) */
    --pad-card:    16px;
    --gap-grid:    14px;
    --fs-name:     0.96rem;
    --card-min:    268px;
}

/* light theme — explicit toggle wins in both directions */
:root[data-theme="light"] {
    --bg-0:        #eef2f8;
    --bg-1:        #f4f7fc;
    --bg-2:        #ffffff;
    --surface:     rgba(255, 255, 255, 0.82);
    --surface-2:   rgba(255, 255, 255, 0.94);
    --surface-3:   #eef2f9;
    --elevated:    #ffffff;

    --line:        rgba(20, 40, 80, 0.10);
    --line-strong: rgba(20, 40, 80, 0.18);

    --text:        #14213d;
    --text-dim:    #43567a;
    --text-mute:   #7285a5;

    --brand-bright:#2f74d0;
    --grad-sheen:  linear-gradient(180deg, rgba(20,40,90,0.03), rgba(255,255,255,0));
    --shadow-sm:   0 2px 10px rgba(20, 40, 90, 0.10);
    --shadow-md:   0 18px 40px rgba(20, 40, 90, 0.14);
    --shadow-lg:   0 34px 80px rgba(20, 40, 90, 0.20);
    --ring:        0 0 0 3px rgba(47, 116, 208, 0.22);

    --inp-bg:      #ffffff;
    --grid-line:   rgba(30, 70, 140, 0.06);

    --header-bg:      rgba(228, 231, 238, 0.9);
    --header-border:  rgba(20, 40, 80, 0.12);
    --header-text:    #3c4a63;
    --footer-bg:      #e8ebf1;
    --footer-border:  rgba(20, 40, 80, 0.10);
}
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]):not([data-theme="light"]) {
        --bg-0: #eef2f8; --bg-1: #f4f7fc; --bg-2: #ffffff;
        --surface: rgba(255,255,255,0.82); --surface-2: rgba(255,255,255,0.94);
        --surface-3: #eef2f9; --elevated: #ffffff;
        --line: rgba(20,40,80,0.10); --line-strong: rgba(20,40,80,0.18);
        --text: #14213d; --text-dim: #43567a; --text-mute: #7285a5;
        --brand-bright: #2f74d0;
        --shadow-sm: 0 2px 10px rgba(20,40,90,0.10);
        --shadow-md: 0 18px 40px rgba(20,40,90,0.14);
        --shadow-lg: 0 34px 80px rgba(20,40,90,0.20);
        --ring: 0 0 0 3px rgba(47,116,208,0.22);
        --inp-bg: #ffffff; --grid-line: rgba(30,70,140,0.06);
    }
}

/* density: compact */
:root[data-density="compact"] {
    --pad-card:  11px;
    --gap-grid:  9px;
    --fs-name:   0.88rem;
    --card-min:  228px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font); color: var(--text); background: var(--bg-0);
    line-height: 1.6; min-height: 100vh;
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
    overflow-x: hidden; transition: background .3s ease, color .3s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(87, 160, 242, 0.35); }

.bg-field {
    position: fixed; inset: 0; z-index: -2;
    background:
        radial-gradient(900px 620px at 12% -6%, rgba(47, 116, 208, 0.28), transparent 60%),
        radial-gradient(820px 560px at 100% 8%, rgba(36, 209, 200, 0.16), transparent 58%),
        radial-gradient(1200px 800px at 50% 120%, rgba(27, 77, 131, 0.30), transparent 62%),
        linear-gradient(180deg, var(--bg-1), var(--bg-0) 70%);
}
:root[data-theme="light"] .bg-field { opacity: 0.5; }
.bg-grid {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 78%);
            mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 78%);
    animation: gridDrift 60s linear infinite;
}
@keyframes gridDrift { to { background-position: 64px 64px, 64px 64px; } }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(18px, 4vw, 44px); }

.brand-mark { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; letter-spacing: -0.01em; }
.brand-mark img { width: 40px; height: 40px; border-radius: 11px; object-fit: cover; background: #fff; padding: 4px; box-shadow: var(--shadow-sm); }
.brand-mark .bm-lines { display: flex; flex-direction: column; line-height: 1.15; }
.brand-mark .bm-title { font-size: 0.98rem; }
.brand-mark .bm-sub { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-mute); }

.pill {
    display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--line); font-size: 0.76rem; font-weight: 600;
    color: var(--text-dim); backdrop-filter: blur(8px);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(55, 211, 155, 0.18); }
.pill .dot.pulse { animation: dotPulse 2.4s ease-in-out infinite; }
@keyframes dotPulse { 0%,100% { box-shadow: 0 0 0 3px rgba(55,211,155,0.20); } 50% { box-shadow: 0 0 0 7px rgba(55,211,155,0); } }

.btn {
    position: relative; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 13px 22px; border-radius: var(--radius-sm); font-weight: 650; font-size: 0.92rem;
    letter-spacing: 0.01em; border: 1px solid transparent;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn .arr, .btn svg { transition: transform .2s ease; }
.btn-primary { background: var(--grad-brand); color: #04101f; box-shadow: 0 12px 30px rgba(47, 116, 208, 0.35); }
.btn-primary:hover { box-shadow: 0 16px 40px rgba(47, 116, 208, 0.5); transform: translateY(-2px); }
.btn-primary:hover .arr { transform: translateX(4px); }
/* light sweep on hover */
.btn-primary::after {
    content: ""; position: absolute; top: 0; left: -65%; width: 45%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,0.55), transparent);
    transform: skewX(-18deg); pointer-events: none;
}
.btn-primary:hover::after { animation: btnShine .75s ease; }
@keyframes btnShine { from { left: -65%; } to { left: 135%; } }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--text); backdrop-filter: blur(8px); }
.btn-ghost:hover { border-color: var(--brand-bright); color: var(--text); }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; transform: none; }

.spinner { width: 17px; height: 17px; border-radius: 50%; border: 2px solid rgba(4,16,31,0.35); border-top-color: #04101f; animation: spin 0.7s linear infinite; }
.spinner.light { border-color: rgba(120,150,200,0.25); border-top-color: var(--brand-bright); }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
    width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
    background: var(--surface); border: 1px solid var(--line); color: var(--text-dim);
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }

/* ============================================================================
   SIGN-IN  (index.html)
   ========================================================================== */
.landing { min-height: 100vh; display: flex; flex-direction: column; }

.top {
    position: sticky; top: 0; z-index: 40; backdrop-filter: blur(14px);
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
}
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.top .brand-mark, .top .brand-mark .bm-title { color: var(--header-text); }
.top-links { display: flex; align-items: center; gap: 10px; }
.top-links a.textlink { font-size: 0.85rem; font-weight: 600; color: var(--header-text); padding: 8px 12px; border-radius: 9px; }
.top-links a.textlink:hover { color: var(--text); background: rgba(125,140,165,0.16); }

.split {
    flex: 1; display: grid;
    grid-template-columns: minmax(280px, 0.82fr) minmax(0, 1.7fr);
    gap: clamp(34px, 4.5vw, 80px);
    max-width: var(--maxw); margin: 0 auto; width: 100%;
    padding: clamp(40px, 6vw, 80px) clamp(20px, 4vw, 48px); align-items: start;
}

/* one consistent measure for every block in the left column */
.hero { min-width: 0; }
.hero > * { max-width: 560px; }
.hero .eyebrow {
    display: inline-flex; align-items: center; gap: 9px; margin-bottom: 22px;
    font-size: 0.74rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent);
}
.hero .eyebrow::before { content: ""; width: 26px; height: 2px; background: var(--accent); border-radius: 2px; }
.hero h1 { font-size: clamp(2.1rem, 4.4vw, 3.3rem); line-height: 1.08; letter-spacing: -0.025em; font-weight: 750; margin-bottom: 22px; }
.hero h1 .grad { background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: clamp(1rem, 1.6vw, 1.12rem); color: var(--text-dim); max-width: 52ch; margin-bottom: 36px; }

.feature-list { display: grid; gap: 18px; margin-bottom: 38px; }
.feature-list li { display: flex; gap: 13px; align-items: flex-start; list-style: none; }
.feature-list .fi { flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line-strong); color: var(--brand-bright); }
.feature-list .ft { font-weight: 650; font-size: 0.95rem; }
.feature-list .fd { font-size: 0.86rem; color: var(--text-mute); }

.trust-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 36px; }
.trust-row .chip { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text-dim); }
.trust-row .chip b { color: var(--text); font-family: var(--mono); font-weight: 600; }

/* FAQ accordion */
.faq { display: grid; gap: 11px; }
.faq details {
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
    overflow: hidden; backdrop-filter: blur(6px);
}
.faq summary {
    list-style: none; cursor: pointer; padding: 15px 18px; font-weight: 620; font-size: 0.9rem;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .fx { transition: transform .2s ease; color: var(--text-mute); flex-shrink: 0; }
.faq details[open] summary .fx { transform: rotate(45deg); }
.faq .fa-body { padding: 2px 18px 16px; font-size: 0.87rem; line-height: 1.65; color: var(--text-dim); }

/* right column */
/* right area = sign-in window and the how-to guide side by side, help below */
.signin-col {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(300px, 1fr);
    gap: 24px;
    align-items: start;
}
.signin-col #signin { grid-column: 1; }
.signin-col #signinGuide { grid-column: 2; }
.signin-col #help { grid-column: 1 / -1; }
@media (max-width: 1140px) {
    .signin-col { grid-template-columns: 1fr; }
    .signin-col #signin, .signin-col #signinGuide { grid-column: 1; }
}
.card-signin, .card-guide {
    width: 100%; background: var(--surface-2); border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); backdrop-filter: blur(20px);
    position: relative;
}
.card-guide { overflow: hidden; }
.card-signin {
    padding: clamp(30px, 3.4vw, 42px) clamp(28px, 3.4vw, 38px);
    transition: transform .28s cubic-bezier(.22,.61,.36,1), box-shadow .28s ease, border-color .28s ease;
}
.card-signin::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--grad-sheen); pointer-events: none; }
/* floating "card" tab */
.card-signin::after {
    content: "SECURE SIGN-IN";
    position: absolute; top: -12px; left: 26px;
    font-size: 0.62rem; font-weight: 800; letter-spacing: 0.14em;
    padding: 6px 13px; border-radius: 999px;
    background: var(--grad-brand); color: #04101f;
    box-shadow: 0 10px 22px rgba(47,116,208,0.45);
}
.card-signin:hover {
    transform: translateY(-5px);
    border-color: rgba(87,160,242,0.5);
    box-shadow: 0 46px 100px rgba(2,6,16,0.7), 0 0 0 1px rgba(87,160,242,0.28), 0 0 40px rgba(47,116,208,0.18);
}
:root[data-theme="light"] .card-signin:hover { box-shadow: 0 40px 80px rgba(20,40,90,0.22), 0 0 0 1px rgba(47,116,208,0.35); }
.card-signin .sc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.card-signin .sc-badge {
    width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
    background: var(--grad-brand); color: #04101f; box-shadow: 0 10px 24px rgba(47,116,208,0.4);
    transition: transform .28s cubic-bezier(.22,.61,.36,1);
}
.card-signin:hover .sc-badge { transform: rotate(-7deg) scale(1.08); }
.card-signin h2 { font-size: 1.24rem; letter-spacing: -0.02em; }
.card-signin .sc-sub { font-size: 0.85rem; color: var(--text-mute); margin-bottom: 26px; }

.field { margin-bottom: 18px; position: relative; }
.field label { display: block; font-size: 0.76rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-mute); margin-bottom: 8px; }
.field .inp-wrap { position: relative; }
.field input[type=email], .field input[type=password], .field input[type=text] {
    width: 100%; padding: 13px 44px 13px 42px; background: var(--inp-bg);
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-size: 0.95rem;
    transition: border-color .16s ease, box-shadow .16s ease;
}
.field input::placeholder { color: #6d7fa0; }
.field input:focus { outline: none; border-color: var(--brand-bright); box-shadow: var(--ring); }
.field .ic-left { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-mute); pointer-events: none; display: grid; place-items: center; }
.field .ic-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--text-mute); }
.field .ic-toggle:hover { color: var(--text); background: var(--surface); }
.caps-hint { display: none; margin-top: 7px; font-size: 0.76rem; font-weight: 600; color: var(--warn); }
.caps-hint.show { display: block; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 22px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-dim); cursor: pointer; user-select: none; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line-strong); background: var(--inp-bg); display: grid; place-items: center; transition: all .15s ease; }
.check .box svg { opacity: 0; transform: scale(.6); transition: all .15s ease; color: #04101f; }
.check input:checked + .box { background: var(--grad-brand); border-color: transparent; }
.check input:checked + .box svg { opacity: 1; transform: scale(1); }
.check input:focus-visible + .box { box-shadow: var(--ring); }

/* sign-in submit — richer hover */
#signinBtn {
    margin-top: 4px; padding-top: 15px; padding-bottom: 15px; font-size: 0.96rem;
    background: linear-gradient(120deg, #3a80e0 0%, #57a0f2 45%, #24d1c8 100%);
    background-size: 200% 100%; background-position: 0% 50%;
    transition: background-position .55s ease, transform .18s ease, box-shadow .18s ease, letter-spacing .25s ease;
}
#signinBtn:hover { background-position: 100% 50%; transform: translateY(-2px); letter-spacing: 0.04em; box-shadow: 0 20px 46px rgba(47,116,208,0.55); }
#signinBtn:active { transform: translateY(0); }

.form-alert {
    display: none; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm);
    margin-bottom: 16px; font-size: 0.86rem; font-weight: 600;
    background: rgba(255,107,116,0.12); border: 1px solid rgba(255,107,116,0.4); color: #ffb3b7;
}
.form-alert.show { display: flex; }
.form-alert.info { background: rgba(87,160,242,0.12); border-color: rgba(87,160,242,0.4); color: #bcd8ff; }

.sc-foot { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.76rem; color: var(--text-mute); }
.sc-foot .lockline { display: inline-flex; align-items: center; gap: 6px; }

/* client sign-in guide card */
.card-guide { padding: clamp(26px, 3vw, 34px) clamp(24px, 3vw, 32px) clamp(28px, 3vw, 34px); }
.card-guide h3 { font-size: 1.04rem; display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.card-guide h3 svg { color: var(--brand-bright); }
.card-guide .cg-sub { font-size: 0.83rem; color: var(--text-mute); margin-bottom: 20px; }
.steps { display: grid; gap: 14px; margin-bottom: 22px; }
.steps li { display: flex; gap: 13px; align-items: flex-start; list-style: none; font-size: 0.88rem; line-height: 1.6; color: var(--text-dim); }
.steps .sn { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); border: 1px solid var(--line-strong); font-size: 0.75rem; font-weight: 700; color: var(--text); }
.cred-box { background: var(--inp-bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 14px 16px; display: grid; gap: 12px; }
.cred-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 0; }
.cred-row .ck { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-mute); }
.cred-row .cv { font-family: var(--mono); font-size: 0.86rem; color: var(--text); }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 0.74rem; font-weight: 650; color: var(--text-dim); }
.copy-btn:hover { color: var(--text); border-color: var(--brand-bright); }
.copy-btn.done { color: var(--ok); border-color: rgba(55,211,155,0.5); }
.cg-actions { display: flex; gap: 10px; margin-top: 20px; }
.cg-note { margin-top: 18px; font-size: 0.77rem; line-height: 1.6; color: var(--text-mute); display: flex; gap: 8px; align-items: flex-start; }

/* guide + help live in the left column now — same 600px measure as the rest */
.signin-col .card-guide { margin-top: 0; }
.signin-col .card-guide .steps { grid-template-columns: 1fr; }
.signin-col .card-guide .cred-box { grid-template-columns: 1fr; }

.help-cell {
    display: flex; gap: 16px; align-items: flex-start; width: 100%;
    padding: 22px 24px; border: 1px solid var(--line-strong); border-radius: var(--radius);
    background: var(--surface); backdrop-filter: blur(8px);
}
.help-cell .hc-icon {
    width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center;
    background: var(--grad-brand); color: #04101f; box-shadow: 0 10px 22px rgba(47,116,208,0.4);
}
.help-cell .hc-title { font-weight: 700; font-size: 0.98rem; }
.help-cell .hc-sub { font-size: 0.79rem; color: var(--text-mute); margin-bottom: 15px; }
.help-cell .hc-links { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.help-cell .hc-links a {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line-strong);
    background: var(--inp-bg); font-size: 0.84rem; font-weight: 650; color: var(--text);
    transition: border-color .15s ease, color .15s ease, transform .15s ease;
}
.help-cell .hc-links a:hover { border-color: var(--brand-bright); color: var(--brand-bright); transform: translateY(-1px); }
.help-cell .hc-links a svg { color: var(--brand-bright); flex-shrink: 0; }

.sc-foot a { color: var(--brand-bright); font-weight: 650; }
.sc-foot a:hover { text-decoration: underline; }

.faq .fa-body a { color: var(--brand-bright); font-weight: 600; }
.faq .fa-body a:hover { text-decoration: underline; }

.landing-foot { border-top: 1px solid var(--footer-border); background: var(--footer-bg); }
.landing-foot .wrap { padding: 26px 0; display: flex; flex-wrap: wrap; gap: 14px 30px; align-items: center; justify-content: space-between; }
.landing-foot .lf-legal { font-size: 0.78rem; color: var(--text-mute); max-width: 62ch; }
.landing-foot .lf-legal b { color: var(--text-dim); }

@media (max-width: 980px) {
    .split { grid-template-columns: 1fr; gap: 34px; justify-items: center; }
    .hero { order: 2; width: 100%; }
    .hero > *, .hero p.lead { max-width: 640px; margin-left: auto; margin-right: auto; }
    .signin-col { order: 1; width: 100%; grid-template-columns: 1fr; justify-items: center; }
    .signin-col > * { max-width: 480px; width: 100%; }
}

/* ============================================================================
   FILE LIBRARY  (welcome.php)
   ========================================================================== */
.portal { min-height: 100vh; display: flex; flex-direction: column; }

.pnav {
    position: sticky; top: 0; z-index: 50; backdrop-filter: blur(16px);
    background: var(--header-bg); border-bottom: 1px solid var(--header-border);
}
.pnav .wrap { display: flex; align-items: center; gap: 12px; height: 66px; }
.pnav .brand-mark, .pnav .brand-mark .bm-title { color: var(--header-text); }
.pnav .spacer { flex: 1; }
.pnav .user-chip { display: inline-flex; align-items: center; gap: 10px; padding: 7px 8px 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 0.82rem; font-weight: 600; color: var(--text-dim); }
.pnav .user-chip .av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--grad-brand); color: #04101f; font-weight: 800; font-size: 0.78rem; }
.pnav .btn { padding: 9px 16px; font-size: 0.84rem; }

.session-chip {
    display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--line); font-size: 0.78rem; font-weight: 650; color: var(--text-dim);
}
.session-chip .st-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.session-chip.warn { color: #ffdca1; border-color: rgba(242,179,75,0.45); background: rgba(242,179,75,0.12); }
.session-chip.warn .st-dot { background: var(--warn); }
.session-chip .st-time { font-family: var(--mono); }
.session-chip button { font-size: 0.72rem; font-weight: 700; color: var(--brand-bright); }

/* settings popover */
.pop-wrap { position: relative; }
.popover {
    position: absolute; right: 0; top: calc(100% + 10px); width: 260px; z-index: 60;
    background: var(--elevated); border: 1px solid var(--line-strong); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 14px; display: none;
}
.popover.open { display: block; }
.popover h4 { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-mute); margin: 4px 0 8px; }
.seg { display: flex; background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; padding: 7px 6px; border-radius: 7px; font-size: 0.78rem; font-weight: 650; color: var(--text-mute); }
.seg button.on { background: var(--elevated); color: var(--text); box-shadow: var(--shadow-sm); }

.phead { padding: clamp(24px, 4vw, 40px) 0 18px; }
.phead h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); letter-spacing: -0.025em; margin-bottom: 8px; }
.phead p { color: var(--text-dim); font-size: 0.95rem; }

/* slim inline metrics bar */
.statbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 13px 20px; margin-bottom: 14px; backdrop-filter: blur(8px);
    position: relative; overflow: hidden;
}
.statbar::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad-brand); opacity: 0.7; }
.statbar .si-item { display: inline-flex; align-items: baseline; gap: 8px; }
.statbar .si-v { font-family: var(--mono); font-size: 1.02rem; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.statbar .si-l { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-mute); }
.statbar .si-sep { width: 1px; height: 20px; background: var(--line-strong); }
@media (max-width: 640px) { .statbar .hide-sm { display: none; } }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; backdrop-filter: blur(8px); }
.search { position: relative; flex: 1; min-width: 220px; }
.search input { width: 100%; padding: 12px 74px 12px 42px; background: var(--inp-bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-size: 0.92rem; }
.search input:focus { outline: none; border-color: var(--brand-bright); box-shadow: var(--ring); }
.search .si { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-mute); }
.search .clear-s { position: absolute; right: 40px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 6px; display: none; place-items: center; color: var(--text-mute); }
.search .clear-s.show { display: grid; }
.search kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 0.72rem; color: var(--text-mute); background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: 6px; padding: 2px 7px; }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding: 12px 38px 12px 14px; background: var(--inp-bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-size: 0.86rem; font-weight: 600; cursor: pointer; }
.select-wrap select:focus { outline: none; border-color: var(--brand-bright); box-shadow: var(--ring); }
.select-wrap .sc { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-mute); }
.view-toggle { display: flex; background: var(--inp-bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 4px; }
.view-toggle button { width: 40px; height: 38px; border-radius: 8px; display: grid; place-items: center; color: var(--text-mute); transition: background .15s ease, color .15s ease; }
.view-toggle button.on { background: var(--elevated); color: var(--text); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; background: var(--surface); border: 1px solid var(--line); color: var(--text-dim); transition: all .15s ease; }
.chip-btn:hover { border-color: var(--line-strong); color: var(--text); }
.chip-btn.on { background: var(--grad-brand); color: #04101f; border-color: transparent; }
.chip-btn .cnt { font-family: var(--mono); font-size: 0.74rem; opacity: 0.75; }

.crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; font-size: 0.86rem; }
.crumbs a, .crumbs span { color: var(--text-mute); }
.crumbs a:hover { color: var(--brand-bright); }
.crumbs .sep { opacity: 0.5; }
.crumbs .here { color: var(--text); font-weight: 600; }
.crumbs .backlink { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); color: var(--text-dim); font-weight: 600; margin-right: 4px; }
.crumbs .backlink:hover { color: var(--text); border-color: var(--line-strong); }
.crumbs .copy-path { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 0.76rem; font-weight: 600; color: var(--text-mute); }
.crumbs .copy-path:hover { color: var(--text); }
.crumbs .copy-path.done { color: var(--ok); }

/* selection action bar */
.selbar {
    display: none; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--elevated); border: 1px solid var(--brand-bright); border-radius: var(--radius);
    padding: 12px 16px; margin-bottom: 14px; box-shadow: var(--shadow-md);
}
.selbar.show { display: flex; }
.selbar .sel-n { font-weight: 700; font-family: var(--mono); }
.selbar .sel-sz { color: var(--text-mute); font-size: 0.84rem; }
.selbar .spacer { flex: 1; }

.files.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr)); gap: var(--gap-grid); }
.files.list { display: flex; flex-direction: column; gap: 8px; }
.files[hidden] { display: none; }

.fcard {
    background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius);
    padding: var(--pad-card); display: flex; flex-direction: column; gap: 13px;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
    position: relative; overflow: hidden; backdrop-filter: blur(6px);
}
.fcard:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.fcard.sel { border-color: var(--brand-bright); box-shadow: var(--ring); }
.fcard .fc-top { display: flex; gap: 12px; align-items: flex-start; }
.ficon { flex-shrink: 0; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; color: #eaf1fb; box-shadow: var(--shadow-sm); }
:root[data-density="compact"] .ficon { width: 38px; height: 38px; border-radius: 10px; }
.ficon.folder      { background: linear-gradient(135deg, #3a80e0, #1b4d83); }
.ficon.archive     { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.ficon.installer   { background: linear-gradient(135deg, #2f74d0, #24d1c8); }
.ficon.document    { background: linear-gradient(135deg, #ef5a6f, #b91c3c); }
.ficon.spreadsheet { background: linear-gradient(135deg, #21c17a, #10804f); }
.ficon.image       { background: linear-gradient(135deg, #f0912b, #c2410c); }
.ficon.data        { background: linear-gradient(135deg, #eab308, #a16207); }
.ficon.other       { background: linear-gradient(135deg, #5b6b8c, #384861); }

.fc-name { font-weight: 650; font-size: var(--fs-name); word-break: break-word; line-height: 1.35; }
.fc-type { display: inline-block; margin-top: 5px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; color: var(--text-mute); text-transform: uppercase; }
.badge-new { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.06em; background: rgba(36,209,200,0.16); color: var(--accent); vertical-align: middle; }
.fc-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.78rem; color: var(--text-mute); }
.fc-meta span { display: inline-flex; align-items: center; gap: 5px; }
.fc-meta .mono { font-family: var(--mono); }
.fc-actions { display: flex; gap: 8px; margin-top: auto; align-items: center; }
.fc-actions .btn { flex: 1; padding: 10px 12px; font-size: 0.85rem; }
:root[data-density="compact"] .fc-actions .btn { padding: 8px 10px; font-size: 0.8rem; }

.sel-check {
    position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 7px;
    border: 1.5px solid var(--line-strong); background: var(--surface-2); display: grid; place-items: center;
    color: transparent; transition: all .14s ease; z-index: 2;
}
.fcard:hover .sel-check, .frow:hover .sel-check { border-color: var(--brand-bright); }
.sel-check.on { background: var(--grad-brand); border-color: transparent; color: #04101f; }

.kebab { width: 34px; height: 34px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--text-mute); }
.kebab:hover { color: var(--text); }
.menu {
    position: absolute; z-index: 70; min-width: 190px; background: var(--elevated);
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
    padding: 6px; display: none;
}
.menu.open { display: block; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; font-size: 0.84rem; font-weight: 550; color: var(--text-dim); text-align: left; }
.menu button:hover { background: var(--surface); color: var(--text); }
.menu button svg { color: var(--text-mute); flex-shrink: 0; }
.menu .sepline { height: 1px; background: var(--line); margin: 5px 4px; }

.frow { display: flex; align-items: center; gap: 14px; background: var(--card-bg); border: 1px solid var(--line); border-left: 3px solid transparent; border-radius: var(--radius-sm); padding: 11px 16px; transition: border-color .15s ease, transform .15s ease; position: relative; }
.frow:hover { border-left-color: var(--brand-bright); transform: translateX(3px); }
.frow.sel { border-left-color: var(--brand-bright); background: var(--surface-2); }
.frow .ficon { width: 40px; height: 40px; border-radius: 10px; }
.frow .fr-main { flex: 1; min-width: 0; }
.frow .fc-name { font-size: 0.9rem; }
.frow .fc-meta { margin-top: 3px; }
.frow .fr-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
.frow .fr-actions .btn { padding: 9px 16px; font-size: 0.82rem; }
.frow .sel-check { position: static; }

.star { width: 34px; height: 34px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--text-mute); transition: color .15s ease, background .15s ease; }
.star:hover { color: var(--gold); }
.star.on { color: var(--gold); background: rgba(231,184,78,0.12); border-color: rgba(231,184,78,0.4); }

.empty { grid-column: 1 / -1; text-align: center; padding: 66px 20px; color: var(--text-mute); }
.empty .ei { width: 60px; height: 60px; margin: 0 auto 16px; opacity: 0.5; }
.empty h3 { color: var(--text-dim); font-size: 1.05rem; margin-bottom: 6px; }

.portal-foot { border-top: 1px solid var(--footer-border); margin-top: 40px; background: var(--footer-bg); }
.portal-foot .wrap { padding: 24px 0; display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: center; font-size: 0.8rem; color: var(--text-mute); }
.portal-foot .foot-help { color: var(--text-dim); }
.portal-foot a, .landing-foot a { color: var(--brand-bright); font-weight: 600; }
.portal-foot a:hover, .landing-foot a:hover { text-decoration: underline; }

/* recent drawer */
.recent-fab { position: fixed; right: 22px; bottom: 22px; z-index: 60; display: inline-flex; align-items: center; gap: 9px; padding: 12px 18px; border-radius: 999px; background: var(--elevated); border: 1px solid var(--line-strong); color: var(--text); font-weight: 650; font-size: 0.85rem; box-shadow: var(--shadow-md); }
.recent-fab:hover { border-color: var(--brand-bright); }
.recent-fab .badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--grad-brand); color: #04101f; font-family: var(--mono); font-size: 0.72rem; font-weight: 700; display: grid; place-items: center; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); z-index: 90; background: var(--bg-2); border-left: 1px solid var(--line-strong); box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .28s cubic-bezier(.22,.61,.36,1); display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { font-size: 1rem; }
.drawer-head button { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--text-mute); }
.drawer-head button:hover { background: var(--surface); color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px; }
.dl-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--radius-sm); }
.dl-item:hover { background: var(--surface); }
.dl-item .di { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center; background: var(--surface-3); color: var(--brand-bright); }
.dl-item .dn { font-size: 0.84rem; font-weight: 600; word-break: break-word; }
.dl-item .dt { font-size: 0.74rem; color: var(--text-mute); font-family: var(--mono); }
.drawer-body .empty { padding: 40px 10px; }

.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(3,7,16,0.62); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.scrim.on { opacity: 1; pointer-events: auto; }

/* details / preview modal */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-card { width: min(680px, 100%); max-height: 88vh; overflow: hidden; display: flex; flex-direction: column; background: var(--elevated); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head .ficon { width: 40px; height: 40px; border-radius: 10px; }
.modal-head .mh-name { font-weight: 700; word-break: break-word; }
.modal-head .mh-type { font-size: 0.76rem; color: var(--text-mute); }
.modal-head .mclose { margin-left: auto; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--text-mute); flex-shrink: 0; }
.modal-head .mclose:hover { background: var(--surface); color: var(--text); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.preview-box { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; background: var(--surface-3); min-height: 120px; display: grid; place-items: center; }
.preview-box img { max-height: 340px; width: auto; }
.preview-box pre { margin: 0; padding: 14px; width: 100%; max-height: 340px; overflow: auto; font-family: var(--mono); font-size: 0.78rem; color: var(--text-dim); white-space: pre-wrap; word-break: break-word; }
.preview-box .pv-none { padding: 30px; color: var(--text-mute); font-size: 0.85rem; text-align: center; }
.meta-grid { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; font-size: 0.85rem; }
.meta-grid dt { color: var(--text-mute); font-weight: 600; }
.meta-grid dd { color: var(--text); word-break: break-word; font-family: var(--mono); font-size: 0.82rem; }
.modal-foot { display: flex; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .btn { flex: 1; min-width: 140px; }

/* toast */
.toast-zone { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 110; display: flex; flex-direction: column; gap: 10px; width: min(420px, 92vw); }
.toast { background: var(--elevated); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; transform: translateY(30px); opacity: 0; transition: transform .3s cubic-bezier(.22,.61,.36,1), opacity .3s ease; }
.toast.in { transform: translateY(0); opacity: 1; }
.toast .tt { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
.toast .ti { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center; background: rgba(55,211,155,0.14); color: var(--ok); }
.toast .tc strong { font-size: 0.88rem; display: block; }
.toast .tc span { font-size: 0.78rem; color: var(--text-mute); word-break: break-word; }
.toast .tp { height: 3px; background: var(--surface-3); }
.toast .tp i { display: block; height: 100%; width: 40%; background: var(--grad-brand); animation: tprog 1.8s ease-in-out infinite; }
@keyframes tprog { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

.idle-note { position: fixed; left: 50%; top: 18px; transform: translateX(-50%) translateY(-140%); z-index: 115; padding: 12px 20px; border-radius: 999px; background: rgba(242,179,75,0.14); border: 1px solid rgba(242,179,75,0.45); color: #ffdca1; font-size: 0.84rem; font-weight: 600; transition: transform .3s ease; }
.idle-note.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) {
    .stat-row { grid-template-columns: repeat(2, 1fr); }
    .pnav .user-chip .lbl, .session-chip .st-label { display: none; }
}
@media (max-width: 560px) {
    .toolbar { padding: 12px; }
    .search { min-width: 100%; order: -1; }
    .frow { flex-wrap: wrap; }
    .frow .fr-actions { width: 100%; }
    .frow .fr-actions .btn { flex: 1; }
    .modal-foot .btn { min-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
    .bg-grid { animation: none; }
}
