/* =====================================================================
   BCS Employee Portal — portal.css
   Industrial / dispatch-document language carried over from the main
   site: Bebas display, mono micro-labels, amber hairlines, sand canvas.
   Built mobile-first; light and dark are both first-class.
   ===================================================================== */

/* ---------- tokens: light ---------- */
:root {
  --paper:         #f4efe5;
  --surface:       #fffefb;
  --surface-2:     #faf6ed;
  --surface-sunk:  #efe8da;
  --border:        #ded4bf;
  --border-strong: #c7ba9d;
  --text:          #15130f;
  --text-muted:    #6e6557;
  --text-faint:    #918876;
  --accent:        #8e5a26;
  --accent-bright: #b87a3a;
  --accent-soft:   rgba(184, 122, 58, .13);
  --danger:        #a02e2e;
  --danger-soft:   rgba(160, 46, 46, .10);
  --success:       #2f6f3e;
  --success-soft:  rgba(47, 111, 62, .12);
  --topbar:        #15130f;
  --topbar-text:   #ede4d0;
  --topbar-muted:  rgba(236, 227, 210, .62);
  --grain:         rgba(58, 53, 46, .028);

  --shadow-sm: 0 1px 2px rgba(21,19,15,.06), 0 2px 8px -4px rgba(21,19,15,.08);
  --shadow-md: 0 10px 28px -12px rgba(21,19,15,.22);
  --shadow-lg: 0 26px 56px -20px rgba(21,19,15,.34);

  --ff-display: "Bebas Neue", Impact, "Haettenschweiler", sans-serif;
  --ff-body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ff-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  --topbar-h: 58px;
  --tabbar-h: 62px;
  --container: 1180px;
  --gutter: clamp(1rem, 4vw, 2rem);
}

/* ---------- tokens: dark ---------- */
:root[data-theme="dark"] {
  --paper:         #14120e;
  --surface:       #1e1a15;
  --surface-2:     #262119;
  --surface-sunk:  #100e0b;
  --border:        #38322a;
  --border-strong: #4d4539;
  --text:          #ece3d2;
  --text-muted:    #9c9281;
  --text-faint:    #7b7264;
  --accent:        #c9924f;
  --accent-bright: #ddab66;
  --accent-soft:   rgba(201, 146, 79, .16);
  --danger:        #d46b64;
  --danger-soft:   rgba(212, 107, 100, .14);
  --success:       #74b382;
  --success-soft:  rgba(116, 179, 130, .14);
  --topbar:        #0d0b08;
  --topbar-text:   #ece3d2;
  --grain:         rgba(236, 227, 210, .022);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 10px 28px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 26px 56px -20px rgba(0,0,0,.7);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ff-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background-color: var(--paper);
  background-image:
    radial-gradient(var(--grain) 1px, transparent 1px),
    radial-gradient(var(--grain) 1px, transparent 1px);
  background-size: 3px 3px, 5px 5px;
  background-position: 0 0, 1px 2px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
img, video { max-width: 100%; height: auto; display: block; }

/* The icon set ships a viewBox but no width/height, so an icon with no
   component rule of its own would fall back to the replaced-element
   default of 300x150. Tie it to the current text size instead; the
   component rules further down override where a specific size is wanted. */
svg { width: 1.05em; height: 1.05em; flex: none; vertical-align: -.15em; }

/* A class that sets `display` otherwise beats the UA [hidden] rule and
   leaves elements on screen that JavaScript meant to hide. */
[hidden] { display: none !important; }
ul, ol { list-style: none; padding: 0; margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-bright); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.15; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
  border-radius: 3px;
}

.container { width: min(100% - var(--gutter) * 2, var(--container)); margin-inline: auto; }

/* ---------- typographic utilities ---------- */
.display {
  font-family: var(--ff-display);
  font-weight: 400;
  letter-spacing: .02em;
  line-height: 1;
  text-transform: uppercase;
}
.mono { font-family: var(--ff-mono); font-feature-settings: "tnum"; }
.eyebrow {
  font-family: var(--ff-mono);
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 500;
}
.muted { color: var(--text-muted); }
.tiny  { font-size: .8rem; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent-bright); color: #15130f;
  padding: .6rem 1rem; font-weight: 700;
}
.skip-link:focus { left: 0; }

/* =====================================================================
   Top bar
   ===================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: var(--topbar);
  border-bottom: 1px solid rgba(184,122,58,.32);
  height: var(--topbar-h);
  display: flex; align-items: center;
}
.topbar__inner {
  width: min(100% - var(--gutter) * 2, var(--container));
  margin-inline: auto;
  display: flex; align-items: center; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
/* The compass mark is black line-art, so it sits on a light disc to stay
   legible against the dark top bar in both themes. */
.brand__mark {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  object-fit: contain; background: #fff; padding: 2px;
}
.brand__text { display: flex; flex-direction: column; min-width: 0; line-height: 1; }
.brand__name {
  font-family: var(--ff-display); font-size: 1.22rem; letter-spacing: .05em;
  color: var(--topbar-text); text-transform: uppercase; white-space: nowrap;
}
.brand__sub {
  font-family: var(--ff-mono); font-size: .58rem; letter-spacing: .18em;
  color: var(--accent-bright); text-transform: uppercase; margin-top: 3px;
}

/* desktop nav */
.topnav { display: none; margin-left: auto; align-items: center; gap: .15rem; }
.topnav a {
  display: flex; align-items: baseline; gap: .4rem;
  padding: .5rem .8rem; border-radius: var(--r-sm);
  color: rgba(236,227,210,.72); font-size: .9rem; font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.topnav a:hover { background: rgba(236,227,210,.09); color: var(--topbar-text); }
.topnav a.is-current { color: var(--topbar-text); background: rgba(184,122,58,.18); }
.topnav .navnum {
  font-family: var(--ff-mono); font-size: .6rem; letter-spacing: .1em;
  color: var(--accent-bright); opacity: .85;
}

.topbar__right { display: flex; align-items: center; gap: .4rem; margin-left: auto; }
.topnav ~ .topbar__right { margin-left: .5rem; }

.icon-btn {
  width: 38px; height: 38px; border-radius: var(--r-sm);
  display: grid; place-items: center; flex: none;
  color: rgba(236,227,210,.8);
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: rgba(236,227,210,.1); color: var(--topbar-text); }
.icon-btn svg { width: 19px; height: 19px; }

/* user chip / menu */
.usermenu { position: relative; }
.usermenu__btn {
  display: flex; align-items: center; gap: .5rem;
  padding: .3rem .45rem .3rem .3rem; border-radius: 999px;
  transition: background .15s ease;
}
.usermenu__btn:hover { background: rgba(236,227,210,.1); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--accent-bright); color: #15130f;
  font-family: var(--ff-mono); font-size: .78rem; font-weight: 700;
  letter-spacing: .02em;
}
.usermenu__name {
  display: none; color: var(--topbar-text); font-size: .88rem;
  font-weight: 500; max-width: 150px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.usermenu__panel {
  position: absolute; right: 0; top: calc(100% + 10px);
  min-width: 232px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); padding: .4rem;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.usermenu.is-open .usermenu__panel { opacity: 1; visibility: visible; transform: translateY(0); }
.usermenu__head { padding: .6rem .7rem .55rem; border-bottom: 1px solid var(--border); margin-bottom: .35rem; }
.usermenu__head strong { display: block; font-size: .92rem; }
.usermenu__panel a, .usermenu__panel button {
  display: flex; align-items: center; gap: .6rem; width: 100%;
  padding: .55rem .7rem; border-radius: var(--r-sm);
  color: var(--text); font-size: .9rem; text-align: left;
}
.usermenu__panel a:hover, .usermenu__panel button:hover { background: var(--surface-2); }
.usermenu__panel svg { width: 16px; height: 16px; color: var(--text-muted); flex: none; }
.usermenu__panel .is-danger { color: var(--danger); }
.usermenu__panel .is-danger svg { color: var(--danger); }

/* =====================================================================
   Bottom tab bar (mobile)
   ===================================================================== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; align-items: stretch;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -2px 16px -8px rgba(21,19,15,.28);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; padding: .5rem .25rem;
  min-height: var(--tabbar-h);
  color: var(--text-muted); font-size: .66rem; font-weight: 600;
  letter-spacing: .03em; position: relative;
}
.tabbar a svg { width: 21px; height: 21px; }
.tabbar a.is-current { color: var(--accent); }
.tabbar a.is-current::before {
  content: ""; position: absolute; top: 0; left: 22%; right: 22%;
  height: 2px; background: var(--accent-bright);
}

/* =====================================================================
   Page shell
   ===================================================================== */
.page { padding: 1.5rem 0 calc(var(--tabbar-h) + 2.5rem); }
.page__head { margin-bottom: 1.4rem; }
.page__title {
  font-family: var(--ff-display); font-size: clamp(1.9rem, 6vw, 2.5rem);
  letter-spacing: .015em; text-transform: uppercase; line-height: 1;
}
.page__sub { color: var(--text-muted); margin-top: .45rem; font-size: .94rem; }
.page__head-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.rule {
  height: 1px; background: var(--border); margin: 1.1rem 0 1.4rem;
  position: relative;
}
.rule::before {
  content: ""; position: absolute; left: 0; top: 0; width: 54px; height: 1px;
  background: var(--accent-bright);
}

/* =====================================================================
   Cards & surfaces
   ===================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.card__body { padding: 1.1rem; }
.card__head {
  padding: .9rem 1.1rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
}
.card__title { font-size: 1rem; font-weight: 600; }

/* stat / shortcut tiles */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.tile {
  position: relative; display: block; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 1rem;
  box-shadow: var(--shadow-sm); color: var(--text);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); color: var(--text); }
.tile::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent-bright); opacity: .9;
}
.tile__icon {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: grid; place-items: center; margin-bottom: .7rem;
  background: var(--accent-soft); color: var(--accent);
}
.tile__icon svg { width: 18px; height: 18px; }
.tile__value { font-family: var(--ff-display); font-size: 1.9rem; line-height: 1; letter-spacing: .01em; }
.tile__label {
  font-family: var(--ff-mono); font-size: .64rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-faint); margin-top: .4rem;
}

/* =====================================================================
   Resource list
   ===================================================================== */
.reslist { display: flex; flex-direction: column; }
.resitem {
  display: flex; align-items: center; gap: .85rem;
  padding: .85rem .3rem; border-bottom: 1px solid var(--border);
  color: var(--text); transition: background .14s ease;
}
.resitem:last-child { border-bottom: 0; }
.resitem:hover { background: var(--surface-2); color: var(--text); }
.resitem__icon {
  width: 42px; height: 42px; flex: none; border-radius: var(--r-sm);
  display: grid; place-items: center;
  font-family: var(--ff-mono); font-size: .58rem; font-weight: 700;
  letter-spacing: .04em;
  background: var(--surface-sunk); color: var(--text-muted);
  border: 1px solid var(--border);
}
.resitem__icon[data-fam="pdf"]   { background: rgba(160,46,46,.10);  color: #a02e2e; border-color: rgba(160,46,46,.25); }
.resitem__icon[data-fam="doc"]   { background: rgba(77,100,120,.12); color: #4d6478; border-color: rgba(77,100,120,.28); }
.resitem__icon[data-fam="sheet"] { background: rgba(47,111,62,.12);  color: #2f6f3e; border-color: rgba(47,111,62,.28); }
.resitem__icon[data-fam="slide"] { background: rgba(184,122,58,.14); color: #8e5a26; border-color: rgba(184,122,58,.3); }
.resitem__icon[data-fam="image"] { background: rgba(122,90,150,.12); color: #6f5a8e; border-color: rgba(122,90,150,.26); }
.resitem__icon[data-fam="video"] { background: rgba(160,46,46,.09);  color: #8e5a26; border-color: rgba(184,122,58,.3); }
.resitem__icon[data-fam="audio"] { background: rgba(77,100,120,.10); color: #4d6478; border-color: rgba(77,100,120,.24); }
.resitem__icon[data-fam="zip"]   { background: var(--surface-sunk);  color: var(--text-muted); }
:root[data-theme="dark"] .resitem__icon[data-fam="pdf"]   { color: #d4736c; }
:root[data-theme="dark"] .resitem__icon[data-fam="doc"]   { color: #86a2bc; }
:root[data-theme="dark"] .resitem__icon[data-fam="sheet"] { color: #74b382; }
:root[data-theme="dark"] .resitem__icon[data-fam="slide"] { color: #c9924f; }
:root[data-theme="dark"] .resitem__icon[data-fam="image"] { color: #a48ec4; }
:root[data-theme="dark"] .resitem__icon[data-fam="video"] { color: #c9924f; }
:root[data-theme="dark"] .resitem__icon[data-fam="audio"] { color: #86a2bc; }

.resitem__body { min-width: 0; flex: 1; }
.resitem__title {
  font-weight: 600; font-size: .95rem; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.resitem__meta {
  font-family: var(--ff-mono); font-size: .68rem; letter-spacing: .06em;
  color: var(--text-faint); margin-top: .3rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .45rem;
}
.resitem__meta .dot { opacity: .5; }
.resitem__actions { display: flex; align-items: center; gap: .3rem; flex: none; }
.resitem__go { color: var(--text-faint); display: grid; place-items: center; padding: .3rem; }
.resitem__go svg { width: 17px; height: 17px; }

/* =====================================================================
   Video grid
   ===================================================================== */
.vidgrid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.vidcard {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden; color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.vidcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); color: var(--text); }
.vidcard__thumb {
  position: relative; aspect-ratio: 16 / 9; background: var(--surface-sunk);
  display: grid; place-items: center; overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.vidcard__thumb img { width: 100%; height: 100%; object-fit: cover; }
.vidcard__play {
  position: absolute; width: 52px; height: 52px; border-radius: 50%;
  background: rgba(21,19,15,.62); backdrop-filter: blur(3px);
  display: grid; place-items: center; color: #fff;
  border: 1.5px solid rgba(255,255,255,.34);
  transition: transform .16s ease, background .16s ease;
}
.vidcard:hover .vidcard__play { transform: scale(1.08); background: var(--accent); }
.vidcard__play svg { width: 20px; height: 20px; margin-left: 3px; }
.vidcard__body { padding: .85rem .95rem 1rem; }
.vidcard__title { font-weight: 600; font-size: .97rem; line-height: 1.3; }
.vidcard__meta {
  font-family: var(--ff-mono); font-size: .66rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-faint); margin-top: .45rem;
  display: flex; align-items: center; gap: .45rem; flex-wrap: wrap;
}

/* =====================================================================
   Badges & chips
   ===================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-family: var(--ff-mono); font-size: .63rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  padding: .25rem .5rem; border-radius: 4px;
  background: var(--surface-sunk); color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge--accent  { background: var(--accent-soft);  color: var(--accent);  border-color: transparent; }
.badge--danger  { background: var(--danger-soft);  color: var(--danger);  border-color: transparent; }
.badge--success { background: var(--success-soft); color: var(--success); border-color: transparent; }

/* filter chips */
.chips { display: flex; gap: .45rem; overflow-x: auto; padding-bottom: .3rem; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: .4rem;
  padding: .42rem .8rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: .82rem; font-weight: 500;
  white-space: nowrap; transition: all .14s ease;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active { background: var(--text); color: var(--paper); border-color: var(--text); }
:root[data-theme="dark"] .chip.is-active { background: var(--accent); color: #14120e; border-color: var(--accent); }

/* =====================================================================
   Forms
   ===================================================================== */
.field { margin-bottom: 1rem; }
.field > label, .label {
  display: block; margin-bottom: .38rem;
  font-family: var(--ff-mono); font-size: .68rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-muted); font-weight: 500;
}
.input, .select, .textarea {
  width: 100%; padding: .7rem .8rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 1rem; /* 16px keeps iOS from zooming on focus */
  transition: border-color .14s ease, box-shadow .14s ease;
  -webkit-appearance: none; appearance: none;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent-bright);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e6557' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center;
  background-size: 15px; padding-right: 2.2rem;
}
.field__hint { font-size: .8rem; color: var(--text-faint); margin-top: .35rem; }
.field__error { font-size: .82rem; color: var(--danger); margin-top: .35rem; font-weight: 500; }
.input.has-error { border-color: var(--danger); }

.form-row { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
.checkline { display: flex; align-items: flex-start; gap: .6rem; margin-bottom: .75rem; }
.checkline input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.checkline label { font-size: .92rem; margin: 0; text-transform: none; letter-spacing: 0; font-family: var(--ff-body); color: var(--text); }

/* search */
.searchbar { position: relative; }
.searchbar svg {
  position: absolute; left: .75rem; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-faint); pointer-events: none;
}
.searchbar .input { padding-left: 2.4rem; }

/* password reveal */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 3rem; }
.pw-toggle {
  position: absolute; right: .3rem; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--text-faint);
}
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
.pw-toggle svg { width: 18px; height: 18px; }

/* =====================================================================
   Buttons
   ===================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .68rem 1.15rem; border-radius: var(--r-sm);
  font-size: .93rem; font-weight: 600; letter-spacing: .01em;
  border: 1px solid transparent; text-align: center;
  transition: background .15s ease, border-color .15s ease, transform .1s ease, opacity .15s ease;
  min-height: 44px; /* comfortable touch target */
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn--primary { background: var(--text); color: var(--paper); }
.btn--primary:hover { background: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn--primary { background: var(--accent); color: #14120e; }
:root[data-theme="dark"] .btn--primary:hover { background: var(--accent-bright); color: #14120e; }
.btn--ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { opacity: .88; color: #fff; }
.btn--sm { padding: .45rem .75rem; font-size: .84rem; min-height: 36px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; }

/* =====================================================================
   Flash messages
   ===================================================================== */
.flash {
  display: flex; align-items: flex-start; gap: .65rem;
  padding: .8rem .95rem; border-radius: var(--r-sm);
  margin-bottom: .7rem; font-size: .92rem;
  border: 1px solid var(--border); background: var(--surface);
  animation: flash-in .3s ease both;
}
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.flash svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.flash--success { background: var(--success-soft); border-color: transparent; color: var(--success); }
.flash--error   { background: var(--danger-soft);  border-color: transparent; color: var(--danger); }
.flash--info    { background: var(--accent-soft);  border-color: transparent; color: var(--accent); }
.flash strong { font-weight: 700; }

/* =====================================================================
   Tables (admin)
   ===================================================================== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .91rem; }
.table th {
  text-align: left; padding: .6rem .7rem;
  font-family: var(--ff-mono); font-size: .64rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-faint); font-weight: 600;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: .75rem .7rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { font-family: var(--ff-mono); font-size: .85rem; }

/* =====================================================================
   Empty states
   ===================================================================== */
.empty { text-align: center; padding: 3rem 1.25rem; }
.empty__icon {
  width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-sunk); color: var(--text-faint);
  border: 1px solid var(--border);
}
.empty__icon svg { width: 24px; height: 24px; }
.empty h3 { font-family: var(--ff-display); font-size: 1.35rem; letter-spacing: .02em; text-transform: uppercase; margin-bottom: .4rem; }
.empty p { color: var(--text-muted); font-size: .93rem; max-width: 40ch; margin-inline: auto; }

/* =====================================================================
   Login
   ===================================================================== */
.login-wrap {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 1.5rem;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: login-in .45s cubic-bezier(.16,.84,.44,1) both;
}
@keyframes login-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.login-card__top {
  background: var(--topbar); padding: 1.6rem 1.5rem 1.4rem;
  text-align: center; border-bottom: 2px solid var(--accent-bright);
}
.login-card__logo {
  width: 96px; height: 96px; margin: 0 auto .9rem;
  border-radius: 50%; background: #fff; padding: 9px;
  object-fit: contain;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,.55);
}
.login-card__title {
  font-family: var(--ff-display); font-size: 1.55rem; letter-spacing: .05em;
  text-transform: uppercase; color: var(--topbar-text); line-height: 1;
}
.login-card__sub {
  font-family: var(--ff-mono); font-size: .62rem; letter-spacing: .2em;
  text-transform: uppercase; color: var(--accent-bright); margin-top: .5rem;
}
.login-card__body { padding: 1.5rem; }
.login-foot {
  text-align: center; margin-top: 1.5rem;
  font-family: var(--ff-mono); font-size: .68rem; letter-spacing: .08em;
  color: var(--text-faint);
}
.login-foot a { color: var(--text-muted); }

/* =====================================================================
   Upload dropzone
   ===================================================================== */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--r-md);
  background: var(--surface-2); padding: 2rem 1.25rem; text-align: center;
  transition: border-color .16s ease, background .16s ease;
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent-bright); background: var(--accent-soft); }
.dropzone__icon { width: 40px; height: 40px; margin: 0 auto .7rem; color: var(--accent); }
.dropzone__title { font-weight: 600; margin-bottom: .3rem; }
.dropzone input[type="file"] { display: none; }
.filepick {
  display: flex; align-items: center; gap: .7rem; margin-top: .9rem;
  padding: .7rem .8rem; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border);
  font-size: .9rem; text-align: left;
}
.filepick__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

/* progress bar for uploads */
.progress { height: 6px; border-radius: 999px; background: var(--surface-sunk); overflow: hidden; margin-top: .8rem; }
.progress__bar { height: 100%; width: 0; background: var(--accent-bright); transition: width .2s ease; }

/* =====================================================================
   Player page
   ===================================================================== */
.player {
  background: #000; border-radius: var(--r-md); overflow: hidden;
  aspect-ratio: 16 / 9; border: 1px solid var(--border);
}
.player iframe, .player video { width: 100%; height: 100%; display: block; border: 0; }

.docframe {
  width: 100%; height: min(78vh, 900px); border: 1px solid var(--border);
  border-radius: var(--r-md); background: var(--surface-sunk);
}

/* =====================================================================
   Misc layout helpers
   ===================================================================== */
.stack   { display: flex; flex-direction: column; gap: 1.25rem; }
.stack-s { display: flex; flex-direction: column; gap: .6rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
.toolbar { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 1.1rem; }

.back-link {
  display: inline-flex; align-items: center; gap: .35rem;
  font-family: var(--ff-mono); font-size: .7rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: .8rem;
}
.back-link:hover { color: var(--accent); }
.back-link svg { width: 14px; height: 14px; }

.deflist { display: grid; grid-template-columns: auto 1fr; gap: .55rem 1.1rem; font-size: .92rem; align-items: baseline; }
.deflist dt {
  font-family: var(--ff-mono); font-size: .64rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-faint); white-space: nowrap;
}
.deflist dd { margin: 0; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (min-width: 560px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .vidgrid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr 1fr; }
  .toolbar { flex-direction: row; align-items: center; }
  .toolbar .searchbar { flex: 1; }
}

@media (min-width: 880px) {
  body { font-size: 16px; }
  .topnav { display: flex; }
  .usermenu__name { display: block; }
  .tabbar { display: none; }
  .page { padding: 2rem 0 4rem; }
  .vidgrid { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1.6fr 1fr; }
  .resitem { padding: .9rem .5rem; }
}

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

@media print {
  .topbar, .tabbar, .btn-row, .toolbar { display: none !important; }
  body { background: #fff; }
}

/* =====================================================================
   Password-mode chooser (new user form)
   ===================================================================== */
.pwmode { display: grid; gap: .55rem; }
.pwmode__opt {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .8rem .9rem; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface);
  transition: border-color .14s ease, background .14s ease;
}
.pwmode__opt:hover { border-color: var(--border-strong); }
.pwmode__opt input[type="radio"] {
  width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--accent);
}
.pwmode__opt strong {
  display: block; font-size: .93rem; font-weight: 600;
  text-transform: none; letter-spacing: 0;
}
.pwmode__opt .field__hint { margin-top: .2rem; }
/* .is-selected is set by JS so this works where :has() is unsupported. */
.pwmode__opt:has(input:checked),
.pwmode__opt.is-selected {
  border-color: var(--accent-bright);
  background: var(--accent-soft);
}


/* =====================================================================
   Icon sizes for containers that set their own scale
   ===================================================================== */
.chip svg          { width: 15px; height: 15px; }
.filepick svg      { width: 18px; height: 18px; color: var(--text-muted); }
.card__title svg   { width: 16px; height: 16px; vertical-align: -.18em; }
.dropzone__icon svg{ width: 100%; height: 100%; }
.deflist svg       { width: 15px; height: 15px; }
.table svg         { width: 15px; height: 15px; }

/* =====================================================================
   Viewer: images, and non-video items filed under Training
   ===================================================================== */
.imgview {
  margin: 0; padding: 1rem;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-sunk);
  display: grid; place-items: center;
}
.imgview img {
  max-height: min(70vh, 720px); max-width: 100%; width: auto;
  object-fit: contain; border-radius: 4px;
  box-shadow: var(--shadow-sm);
}

/* File-type badge shown when a card has no picture to preview. */
.vidcard__badge {
  font-family: var(--ff-mono); font-size: .82rem; font-weight: 700;
  letter-spacing: .08em; padding: .5rem .8rem; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted);
}
.vidcard__badge[data-fam="pdf"]   { color: #a02e2e; border-color: rgba(160,46,46,.3); }
.vidcard__badge[data-fam="doc"]   { color: #4d6478; border-color: rgba(77,100,120,.3); }
.vidcard__badge[data-fam="sheet"] { color: #2f6f3e; border-color: rgba(47,111,62,.3); }
.vidcard__badge[data-fam="slide"] { color: #8e5a26; border-color: rgba(184,122,58,.32); }
:root[data-theme="dark"] .vidcard__badge[data-fam="pdf"]   { color: #d4736c; }
:root[data-theme="dark"] .vidcard__badge[data-fam="doc"]   { color: #86a2bc; }
:root[data-theme="dark"] .vidcard__badge[data-fam="sheet"] { color: #74b382; }
:root[data-theme="dark"] .vidcard__badge[data-fam="slide"] { color: #c9924f; }

/* An image preview fills its card rather than being letterboxed. */
.vidcard__thumb img { object-fit: cover; }

audio { width: 100%; }
