/* ==========================================================================
   N& Co — group portal
   Direction "Paper" — Luxury Financial Report. Warm ivory paper as the
   home base, deep emerald as the trust colour, aged-gold as the accent
   that only ever appears as a thin rule or a small mark — never a fill.
   Cards read as elevated pages resting on a table (a soft shadow, a
   whisper of border) rather than the flat seamless grid of the previous
   direction. Corners soften slightly — a report, not a terminal.
   Dark mode still exists as an override for anyone who wants it, but
   paper-light is the system's home now.
   ========================================================================== */

:root {
    --ink:        #F6F1E7;
    --surface:    #FFFFFF;
    --surface-2:  #F1EADA;
    --surface-3:  #E8DFC8;
    --line:       #DCD0AF;
    --line-soft:  #E9E1CB;
    --text:       #2A2517;
    --text-muted: #6B6146;
    --text-dim:   #9C9070;
    --red:        #1F4D3D;
    --red-bright: #16382C;
    --gold:       #A9812F;
    --gold-soft:  #C9A75C;
    --ok:         #1F7A50;
    --warn:       #9C6A1E;
    --info:       #2A628F;

    --company:    var(--red);

    --radius:     6px;
    --radius-md:  4px;
    --radius-sm:  3px;
    --shell:      1240px;
    --shadow-card: 0 1px 2px rgba(42,37,23,.05), 0 6px 20px rgba(42,37,23,.06);

    --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
    --s5: 24px; --s6: 32px; --s7: 48px;

    --font: "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, monospace;
}

[data-theme="dark"] {
    --ink:        #0C0C0D;
    --surface:    #15130E;
    --surface-2:  #1B1912;
    --surface-3:  #232016;
    --line:       #2E2A1D;
    --line-soft:  #221F16;
    --text:       #EDEAE0;
    --text-muted: #A79E86;
    --text-dim:   #6B6350;
    --red:        #3F8067;
    --red-bright: #5FAE8C;
    --gold:       #C9A75C;
    --gold-soft:  #DABF83;
    --ok:         #3F8067;
    --warn:       #C9922E;
    --info:       #3B82C4;
    --shadow-card: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.35);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--ink);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; }
p { margin: 0 0 1rem; }
img { max-width: 100%; }

:focus-visible {
    outline: 1.5px solid var(--company);
    outline-offset: 2px;
}

.shell { max-width: var(--shell); margin: 0 auto; padding: 0 var(--s5); }
.stack > * + * { margin-top: var(--s4); }
.row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.push { margin-inline-start: auto; }

/* --- Top bar: a compact mono path, not a chrome bar -------------------- */

.topbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(12, 12, 13, 0.94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}
.topbar__inner { display: flex; align-items: center; gap: var(--s4); height: 52px; }

.brand { display: flex; align-items: center; gap: var(--s2); font-weight: 700; letter-spacing: 0.01em; }
.brand__mark {
    width: 22px; height: 22px;
    display: grid; place-items: center;
    background: var(--company); color: #fff;
    font-family: var(--mono); font-size: 10px; font-weight: 600;
}

.crumb { display: flex; align-items: center; gap: var(--s2); font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--text-dim); min-width: 0; text-transform: uppercase; }
.crumb__sep { color: var(--text-dim); }
.crumb__here { color: var(--text-muted); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.crumb__dot { width: 6px; height: 6px; background: var(--company); flex: none; }

.topbar__nav { display: flex; gap: 2px; margin-inline-start: auto; align-items: center; }

.navlink {
    padding: 7px 11px;
    font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em;
    color: var(--text-muted);
    transition: background .15s ease, color .15s ease;
}
.navlink:hover { background: var(--surface-3); color: var(--text); }

.usermenu { display: flex; align-items: center; gap: var(--s2); padding-inline-start: var(--s3); margin-inline-start: var(--s2); border-inline-start: 1px solid var(--line); }
.usermenu__name { font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); }
.usermenu__name:hover { color: var(--text); }

main { padding: var(--s6) 0 var(--s7); }

/* --- Avatars — the one place circles survive ---------------------------- */

.avatar {
    width: 30px; height: 30px; flex: none;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--surface-3);
    border: 1px solid var(--line);
    font-size: 12.5px; font-weight: 600;
    color: var(--text);
}
.avatar--lg { width: 48px; height: 48px; font-size: 17px; border-radius: 50%; }
.avatar--brand { background: color-mix(in srgb, var(--company) 24%, var(--surface-3)); border-color: color-mix(in srgb, var(--company) 45%, var(--line)); color: var(--red-bright); }

/* --- Page heading --------------------------------------------------------
   The eyebrow carries the section's identity — mono, uppercase, dim — the
   same voice the mockup uses for "01 — اختيار الشركة" style labels. We
   don't force a literal step number onto it: a step number only means
   something when screens are a fixed sequence, and most of these aren't. */

.eyebrow {
    font-family: var(--mono); font-size: 11px;
    letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--text-dim); margin-bottom: var(--s2);
}

.page-head { margin-bottom: var(--s5); }
.page-head h1 { font-size: 25px; }
.page-head p { color: var(--text-muted); margin: 6px 0 0; max-width: 68ch; }
.page-head__row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }

/* --- Company hero --------------------------------------------------------- */

.hero {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-card);
    padding: var(--s5);
    margin-bottom: var(--s5);
    overflow: hidden;
}
.hero::before {
    content: ""; position: absolute; inset-block-start: 0; inset-inline: 0; height: 3px;
    background: linear-gradient(90deg, var(--company), var(--gold));
}
.hero::after {
    content: ""; position: absolute; inset-block-start: 0; inset-inline-end: 0;
    width: 300px; height: 100%;
    background: radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--company) 10%, transparent), transparent 70%);
    pointer-events: none;
}
.hero__top { display: flex; align-items: flex-start; gap: var(--s4); flex-wrap: wrap; position: relative; z-index: 1; }
.hero__logo { height: 54px; display: flex; align-items: center; }
.hero__logo img { max-height: 54px; max-width: 190px; object-fit: contain; }
.hero__title { font-size: 25px; font-weight: 700; }
.hero__tagline { color: var(--text-muted); font-size: 14px; margin-top: 3px; }
.hero__wordmark { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); }

.hero__stats {
    display: flex; gap: var(--s6); flex-wrap: wrap;
    margin-top: var(--s5); padding-top: var(--s4);
    border-top: 1px solid var(--line);
    position: relative; z-index: 1;
}
.stat__value { font-family: var(--mono); font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat__label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* --- Company plates (home grid) — elevated pages, not a flat grid ------- */

.plates {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: var(--s4);
}

.plate {
    position: relative; display: block;
    padding: var(--s5) var(--s5) var(--s4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    transition: transform .15s ease, box-shadow .15s ease;
}
.plate::before {
    content: ""; position: absolute; inset-block-start: 0; inset-inline: 0; height: 3px;
    background: var(--company); opacity: 0; border-radius: var(--radius) var(--radius) 0 0;
    transition: opacity .15s ease;
}
.plate:hover, .plate:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(42,37,23,.08), 0 14px 28px rgba(42,37,23,.1);
}
.plate:hover::before { opacity: 1; }

.plate__logo { height: 46px; display: flex; align-items: center; margin-bottom: var(--s5); }
.plate__logo img { max-height: 46px; max-width: 175px; object-fit: contain; }
.plate__wordmark { font-family: var(--mono); font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.plate__wordmark span { color: var(--gold); }
.plate__name { font-size: 16px; font-weight: 700; }
.plate__tagline { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; min-height: 22px; }
.plate__foot {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
    margin-top: var(--s4); padding-top: var(--s3);
    border-top: 1px solid var(--line);
    font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
    color: var(--text-dim);
}

/* --- Module tiles — same elevated-card treatment ------------------------- */

.tiles {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
    gap: var(--s3);
}

.tile {
    position: relative;
    display: flex; flex-direction: column; gap: var(--s3);
    padding: var(--s4) var(--s4) var(--s3);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    min-height: 126px;
    transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(42,37,23,.08), 0 14px 28px rgba(42,37,23,.1); }
.tile__icon {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--company) 14%, transparent);
    color: var(--red);
}
.tile__name { font-size: 14.5px; font-weight: 700; }
.tile__summary { font-size: 12.5px; color: var(--text-muted); margin-top: -6px; }
.tile__foot {
    margin-top: auto; padding-top: var(--s2);
    display: flex; align-items: center; justify-content: space-between;
    font-family: var(--mono); font-size: 10.5px; color: var(--text-dim);
}
.tile__go { color: var(--text-dim); transition: transform .15s ease, color .15s ease; }
.tile:hover .tile__go { color: var(--red-bright); transform: translateX(-3px); }

.tile--planned .tile__icon { background: var(--surface-3); color: var(--text-dim); }
.tile--planned .tile__name { color: var(--text-muted); }
.tile--planned:hover .tile__go { color: var(--text-muted); }

/* --- Panels ------------------------------------------------------------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: var(--s5);
}
.panel + .panel { margin-top: var(--s4); }
.panel--flush { padding: 0; overflow: hidden; }
.panel--flush .panel__head { padding: var(--s4) var(--s5); margin: 0; border-bottom: 1px solid var(--line); }
.panel--flush .table { margin: 0; }
.panel--flush .table th { padding-inline: var(--s5); }
.panel--flush .table td { padding-inline: var(--s5); }

.panel__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s4); }
.panel__head h2 { font-size: 15px; font-weight: 700; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: var(--s4); align-items: start; }

/* --- Tables --------------------------------------------------------------- */

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: start;
    font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
    color: var(--text-dim); font-weight: 500;
    padding: 0 var(--s3) var(--s2);
    border-bottom: 1px solid var(--line);
}
.table td { padding: var(--s3); border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s ease; }
.table--hover tbody tr:hover { background: var(--surface-2); }

.cell-main { display: flex; align-items: center; gap: var(--s3); }
.cell-title { font-weight: 600; }
.cell-sub { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); }

/* --- Status: a coloured bullet and text, no badge box -------------------- */

.tag {
    display: inline-block; padding: 3px 8px;
    background: var(--surface-3); border: 1px solid var(--line);
    font-family: var(--mono); font-size: 10.5px; color: var(--text-muted);
    white-space: nowrap;
}

.pill {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12.5px; font-weight: 500;
    background: none; border: 0; padding: 0;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill--ok      { color: #6FD3A5; }
.pill--lead    { color: #E5B65C; }
.pill--muted   { color: var(--text-dim); }
.pill--danger  { color: var(--red-bright); }

.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: var(--text-dim); }
.dot--on { background: var(--ok); }

.chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 12px;
    background: var(--surface-2); border: 1px solid var(--line);
    font-size: 13px; color: var(--text-muted);
    transition: border-color .15s ease, color .15s ease;
}
a.chip:hover { border-color: color-mix(in srgb, var(--company) 55%, var(--line)); color: var(--text); }
.chip svg { color: var(--text-dim); flex: none; }
.chip__value { font-family: var(--mono); font-size: 12.5px; color: var(--text); direction: ltr; }

/* --- Segmented filter ----------------------------------------------------- */

.segmented { display: inline-flex; padding: 2px; background: var(--surface-2); border: 1px solid var(--line); gap: 1px; }
.segmented a {
    padding: 6px 13px;
    font-family: var(--mono); font-size: 11.5px; letter-spacing: .02em;
    color: var(--text-muted);
    transition: background .15s ease, color .15s ease;
}
.segmented a:hover { color: var(--text); }
.segmented a.on { background: var(--surface-3); color: var(--text); }
.segmented .count { font-family: var(--mono); font-size: 11px; color: var(--text-dim); margin-inline-start: 5px; }

/* --- Timeline --------------------------------------------------------------- */

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
    content: ""; position: absolute; inset-block: 14px 14px;
    inset-inline-start: 15px; width: 1px; background: var(--line);
}
.timeline li { position: relative; display: flex; gap: var(--s3); padding: var(--s3) 0; }
.timeline__mark {
    width: 30px; height: 30px; flex: none;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text-dim);
    position: relative; z-index: 1;
}
.timeline__mark--brand { color: var(--red-bright); border-color: color-mix(in srgb, var(--company) 40%, var(--line)); }
.timeline__body { min-width: 0; flex: 1; }
.timeline__meta { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; font-size: 12px; color: var(--text-dim); }
.timeline__who { color: var(--text-muted); }
.timeline__text { font-size: 13.5px; margin-top: 2px; overflow-wrap: anywhere; }

/* --- Activity strip (under the tiles) ------------------------------------- */

.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.strip__item {
    display: flex; gap: var(--s3);
    padding: var(--s3) var(--s4);
    background: var(--ink);
}
.strip__icon { color: var(--text-dim); flex: none; margin-top: 2px; }
.strip__what { font-size: 13px; }
.strip__when { font-size: 11.5px; color: var(--text-dim); font-family: var(--mono); }

.activity-panel { padding-bottom: var(--s3); }
.activity-panel__scroll { max-height: 480px; overflow-y: auto; padding-inline-end: 4px; }
.activity-panel__scroll::-webkit-scrollbar { width: 6px; }
.activity-panel__scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.activity-panel__scroll .strip__item:last-child { border-bottom: 0 !important; }

/* --- Empty states ----------------------------------------------------------- */

.empty { padding: var(--s7) var(--s5); text-align: center; border: 1px dashed var(--line); color: var(--text-muted); }
.empty__icon { color: var(--text-dim); margin-bottom: var(--s3); }
.empty h3 { font-size: 15px; margin-bottom: 6px; color: var(--text); }
.empty p { max-width: 46ch; margin-inline: auto; }

/* --- Forms and buttons -------------------------------------------------- */

.field { margin-bottom: var(--s4); }
.field label { display: block; font-family: var(--mono); font-size: 11.5px; letter-spacing: .03em; color: var(--text-muted); margin-bottom: 7px; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.fields-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--s3); }

.input {
    width: 100%; padding: 10px 13px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text); font-family: inherit; font-size: 15px;
    transition: border-color .15s ease, background .15s ease;
}
.input:hover { border-color: color-mix(in srgb, var(--text-dim) 60%, var(--line)); }
.input:focus { border-color: var(--company); outline: none; }
.input--error { border-color: var(--red-bright); }
textarea.input { resize: vertical; line-height: 1.6; }

.field__error { display: block; margin-top: 6px; font-size: 12.5px; color: var(--red-bright); }
.field__hint  { display: block; margin-top: 6px; font-size: 12.5px; color: var(--text-dim); }

.searchbar { position: relative; flex: 1; min-width: 200px; }
.searchbar svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }
.searchbar .input { padding-inline-start: 40px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 10px 17px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--company); color: #fff;
    font-family: inherit; font-size: 13.5px; font-weight: 700;
    cursor: pointer; white-space: nowrap;
    transition: filter .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { filter: brightness(1.18); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn--ghost:hover { background: var(--surface-3); border-color: var(--line); filter: none; }
.btn--sm { padding: 7px 13px; font-size: 12.5px; }
.btn--block { width: 100%; }
.btn svg { flex: none; }

.linkbtn { background: none; border: 0; padding: 0; color: var(--text-muted); font: inherit; cursor: pointer; }
.linkbtn:hover { color: var(--text); }

.actions { display: flex; gap: 6px; justify-content: flex-end; }

/* --- Flash ---------------------------------------------------------------- */

.flash {
    display: flex; align-items: center; gap: var(--s3);
    padding: 12px 16px;
    border: 1px solid var(--line); background: var(--surface);
    margin-bottom: var(--s4); font-size: 13.5px;
    border-inline-start: 2px solid var(--line);
}
.flash svg { flex: none; }
.flash--success { border-inline-start-color: var(--ok); color: #A8E5C8; }
.flash--error   { border-inline-start-color: var(--red-bright); color: #F0AEB6; }

/* --- Code block ------------------------------------------------------------- */

.code {
    background: var(--ink); border: 1px solid var(--line);
    padding: var(--s3); overflow: auto;
    font-family: var(--mono); font-size: 12px; line-height: 1.65; margin: 0;
    direction: ltr; text-align: left;
}

/* --- Auth ------------------------------------------------------------------- */

.auth { min-height: 100dvh; display: grid; place-items: center; padding: var(--s6) var(--s4); }
.auth__card {
    width: 100%; max-width: 400px;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: var(--s6) var(--s5);
}
.auth__head { text-align: center; margin-bottom: var(--s5); }
.auth__head .brand { justify-content: center; margin-bottom: var(--s4); }
.auth__head h1 { font-size: 19px; }
.auth__head p { color: var(--text-muted); font-size: 13.5px; margin: 6px 0 0; }
.auth__foot { margin-top: var(--s4); text-align: center; font-family: var(--mono); font-size: 10.5px; color: var(--text-dim); letter-spacing: .1em; }

/* --- Error pages -------------------------------------------------------- */

.errorpage { min-height: 100dvh; display: grid; place-items: center; text-align: center; padding: var(--s5); }
.errorpage__code { font-family: var(--mono); font-size: 60px; font-weight: 700; color: var(--red-bright); line-height: 1; }
.errorpage p { color: var(--text-muted); margin: var(--s3) 0 var(--s5); }

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 900px) {
    .grid-2, .grid-side { grid-template-columns: 1fr; }
    .fields-3 { grid-template-columns: 1fr; }
    .topbar__inner { height: 52px; gap: var(--s2); }
    .usermenu__name, .crumb__root { display: none; }
    main { padding: var(--s5) 0 var(--s6); }
    .page-head h1 { font-size: 20px; }
    .hero { padding: var(--s4); }
    .hero__title { font-size: 20px; }
    .hero__stats { gap: var(--s5); }
}

@media (max-width: 560px) {
    .plates { grid-template-columns: 1fr; }
    .tiles  { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .fields-2 { grid-template-columns: 1fr; }
    .shell  { padding: 0 var(--s4); }
    .navlink { padding: 7px 9px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}


/* --- Office document preview (rendered by mammoth.js / SheetJS) --------- */
#office-preview table { border-collapse: collapse; font-size: 13px; width: max-content; }
#office-preview td, #office-preview th { border: 1px solid #ddd; padding: 4px 8px; }
#office-preview img { max-width: 100%; }
#office-preview p { margin: 0 0 0.8em; line-height: 1.6; }


/* --- File type badges (Drive) -------------------------------------------- */
.filebadge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px; padding: 0 8px;
    font-family: var(--mono); font-size: 10px; font-weight: 600;
    letter-spacing: .02em; flex: none;
}
.fb-pdf   { background: rgba(220, 68, 68, .16);  color: #FF8B8B; }
.fb-doc   { background: rgba(59, 130, 196, .16);  color: #7FBCEE; }
.fb-xls   { background: rgba(46, 158, 107, .16);  color: #7BD8AC; }
.fb-ppt   { background: rgba(201, 146, 46, .16);  color: #F0BE73; }
.fb-img   { background: rgba(139, 92, 246, .16);  color: #C4A8FA; }
.fb-video { background: rgba(236, 72, 153, .16);  color: #F5A0C6; }
.fb-audio { background: rgba(20, 184, 166, .16);  color: #7FE0D3; }
.fb-zip   { background: rgba(148, 163, 184, .16); color: #C4CCDA; }
.fb-default { background: var(--surface-3); color: var(--text-dim); }

/* --- Drive: dropzone, grid view, upload toasts --------------------------- */
.dropzone {
    border: 1px dashed var(--line);
    padding: var(--s6) var(--s4); text-align: center; color: var(--text-muted);
    margin-bottom: var(--s4); transition: border-color .15s ease, background .15s ease;
}
.dropzone--active { border-color: var(--company); background: color-mix(in srgb, var(--company) 6%, transparent); color: var(--text); }
.dropzone__icon { color: var(--text-dim); margin-bottom: var(--s2); }
.dropzone--active .dropzone__icon { color: var(--red-bright); }
.dropzone small { display: block; margin-top: 4px; font-size: 12px; color: var(--text-dim); }

.view-toggle { display: inline-flex; padding: 2px; background: var(--surface-2); border: 1px solid var(--line); gap: 1px; }
.view-toggle button {
    display: grid; place-items: center; width: 28px; height: 24px;
    border: 0; background: transparent; color: var(--text-dim); cursor: pointer;
}
.view-toggle button.on { background: var(--surface-3); color: var(--text); }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.file-card {
    display: flex; flex-direction: column; align-items: center; gap: var(--s2);
    padding: var(--s4) var(--s3); text-align: center;
    background: var(--ink);
    cursor: pointer; transition: background .15s ease;
}
.file-card:hover { background: var(--surface-2); }
.file-card .filebadge { width: 44px; height: 44px; font-size: 11px; }
.file-card__name { font-size: 12.5px; overflow-wrap: anywhere; line-height: 1.4; max-height: 2.8em; overflow: hidden; }
.file-card__meta { font-size: 11px; color: var(--text-dim); }
.file-list-row { display: none; }
[data-view="list"] .file-grid { display: none; }
[data-view="grid"] .panel--filetable { display: none; }

.toasts { position: fixed; inset-inline-end: 20px; inset-block-end: 20px; z-index: 90; display: flex; flex-direction: column; gap: 8px; width: 300px; }
.toast {
    background: var(--surface-2); border: 1px solid var(--line);
    padding: 10px 14px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.toast__row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; overflow-wrap: anywhere; }
.toast__bar { height: 3px; background: var(--surface-3); overflow: hidden; }
.toast__fill { height: 100%; background: var(--company); width: 0%; transition: width .15s ease; }
.toast--done .toast__fill { background: var(--ok); width: 100%; }
.toast--error .toast__fill { background: var(--red-bright); width: 100%; }

/* --- Admin nav dropdown -------------------------------------------------- */
.navdrop { position: relative; }
.navdrop__trigger { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-family: inherit; border: 0; background: none; color: var(--text-muted); }
.navdrop__trigger svg { transform: rotate(-90deg); transition: transform .15s ease; }
.navdrop.open .navdrop__trigger svg { transform: rotate(90deg); }
.navdrop__menu {
    display: none;
    position: absolute; inset-inline-end: 0; top: calc(100% + 6px);
    min-width: 170px;
    background: var(--surface-2); border: 1px solid var(--line);
    padding: 4px; box-shadow: 0 12px 32px rgba(0,0,0,.55);
    z-index: 60;
}
.navdrop.open .navdrop__menu { display: block; }
.navdrop__menu a {
    display: block; padding: 8px 12px;
    font-family: var(--mono); font-size: 11.5px; letter-spacing: .02em; color: var(--text-muted);
}
.navdrop__menu a:hover { background: var(--surface-3); color: var(--text); }

/* --- Kanban board (Projects) --------------------------------------------- */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); align-items: start; }
.board__col { background: var(--ink); padding: var(--s3); display: flex; flex-direction: column; gap: var(--s2); }
.board__head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px var(--s2); font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: var(--text-muted); }
.board__count { font-family: var(--mono); }
.board__cards { display: flex; flex-direction: column; gap: 1px; min-height: 40px; background: var(--line); transition: background .12s ease; }
.board__cards:not(:empty) { border: 1px solid var(--line); }
.board__cards--over { outline: 1px dashed color-mix(in srgb, var(--company) 55%, var(--line)); }

.taskcard {
    position: relative;
    background: var(--surface-2);
    padding: 10px 12px; cursor: grab;
}
.taskcard.dragging { opacity: .4; }
.taskcard__title { display: block; font-size: 13px; font-weight: 500; overflow-wrap: anywhere; padding-inline-end: 16px; color: var(--text); }
.taskcard__title:hover { color: var(--red-bright); text-decoration: underline; }
.taskcard__desc { font-size: 11.5px; color: var(--text-dim); margin-top: 4px; overflow-wrap: anywhere; }
.taskcard__meta { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.taskcard__del {
    position: absolute; top: 6px; inset-inline-end: 6px;
    opacity: 0; transition: opacity .12s ease;
}
.taskcard:hover .taskcard__del { opacity: 1; }
.taskcard__del button { background: none; border: 0; color: var(--text-dim); cursor: pointer; padding: 2px; }
.taskcard__del button:hover { color: var(--red-bright); }

.board__add {
    background: none; border: 1px dashed var(--line);
    color: var(--text-muted); font-size: 12px; padding: 8px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.board__add:hover { border-color: color-mix(in srgb, var(--company) 50%, var(--line)); color: var(--text); }
.board__addform { padding: 8px; background: var(--ink); border: 1px solid var(--line); }

@media (max-width: 760px) {
    .board { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Light theme — same tokens, inverted values. Every component already
   reads color through these custom properties, so switching themes is
   just swapping the token block — nothing else in the file needs to
   know which one is active. Company colours (--company, set inline per
   company) are untouched — they work the same in both themes.
   ========================================================================== */

[data-theme="dark"] .errorpage__code { color: var(--red-bright); }

/* --- Theme toggle button -------------------------------------------------- */
.theme-toggle {
    display: grid; place-items: center; width: 30px; height: 30px;
    border: 1px solid var(--line); background: none; color: var(--text-muted);
    cursor: pointer; flex: none;
}
.theme-toggle:hover { background: var(--surface-3); color: var(--text); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* --- Social Media Plan: Instagram-style feed grid ------------------------ */
.ig-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 2px; background: var(--line); border: 1px solid var(--line);
    max-width: 640px;
}
.ig-cell {
    position: relative; aspect-ratio: 1 / 1; overflow: hidden;
    background: var(--surface-2); cursor: grab; display: block;
}
.ig-cell.dragging { opacity: .35; }
.ig-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ig-cell__empty { width: 100%; height: 100%; display: grid; place-items: center; color: var(--text-dim); }
.ig-cell__badge {
    position: absolute; bottom: 6px; inset-inline-start: 6px;
    background: rgba(255,255,255,.88); padding: 3px 7px;
    font-size: 10px; color: var(--text);
}
[data-theme="dark"] .ig-cell__badge { background: rgba(12,12,13,.82); color: var(--text); }

/* --- Pagination --------------------------------------------------------- */

.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: var(--s5); flex-wrap: wrap; }
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 34px; padding: 0 8px;
    border: 1px solid var(--line); border-radius: 8px;
    font-size: 13px; color: var(--text-muted); text-decoration: none;
}
.pagination a:hover { border-color: var(--company); color: var(--text); }
.pagination .on { background: var(--company); border-color: var(--company); color: #fff; font-weight: 700; }
.pagination .disabled { opacity: .35; pointer-events: none; }
.pagination .dots { border: 0; color: var(--text-dim); }
