/* =====================================================================
   ISOS — Styles.  All color/spacing tokens come from themes.js.
   ===================================================================== */
:root {
  --radius: 14px;
  --radius-sm: 9px;
  --gap: 16px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --mono: "Cascadia Code", "SF Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}
[data-density="compact"] { --gap: 11px; --radius: 10px; }
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--brand); color: var(--brand-ink); }

/* Scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---- Boot ---- */
.boot { display: grid; place-content: center; height: 100vh; gap: 12px; text-align: center; color: var(--text-dim); }
.boot-mark { font-size: 48px; color: var(--brand); animation: spin 2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Layout (mobile-first) ---- */
.app { display: grid; grid-template-columns: 1fr; min-height: 100dvh; }
.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 6px;
  position: fixed; inset: 0 auto 0 0; z-index: 50;
  width: min(85vw, 280px);
  transform: translateX(-100%);
  transition: transform .25s ease;
}
.sidebar.open { transform: none; }
.brand-row { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  display: grid; place-content: center; font-size: 20px;
  background: var(--brand); color: var(--brand-ink);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 40%, transparent);
}
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -.02em; line-height: 1; }
.brand-tag { font-size: 10.5px; color: var(--text-faint); margin-top: 3px; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-dim); cursor: pointer; border: none; background: none;
  width: 100%; text-align: left; font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: var(--brand); color: var(--brand-ink); font-weight: 700; }
.nav-item .ico { font-size: 17px; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto; background: var(--bad); color: #fff; font-size: 10px;
  font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; display: grid; place-content: center;
}
.nav-item.active .nav-badge { background: var(--brand-ink); color: var(--brand); }
.nav-sep { height: 1px; background: var(--border); margin: 10px 4px; }
.nav-foot { margin-top: auto; }

.who { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); background: var(--surface); }
.who .avatar { width: 34px; height: 34px; }
.who-name { font-size: 13px; font-weight: 700; }
.who-role { font-size: 11px; color: var(--text-faint); }

/* ---- Main / topbar ---- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); z-index: 20;
}
.page-title { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.page-sub { font-size: 12px; color: var(--text-faint); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content { padding: 16px 14px 80px; width: 100%; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); border-color: var(--brand); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-hover); }
.btn.sm { padding: 6px 11px; font-size: 12px; }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { width: 38px; height: 38px; padding: 0; justify-content: center; position: relative; }

/* ---- Cards & grid ---- */
.grid { display: grid; gap: var(--gap); }
.cards { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow);
}
.card.pad-sm { padding: 14px; }
.card-title { font-size: 13px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }

/* ---- Stat tiles ---- */
.stat { position: relative; overflow: hidden; }
.stat .k { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.stat .v { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 2px; }
.stat .d { font-size: 11.5px; color: var(--text-faint); }
.stat .spark { position: absolute; right: 14px; bottom: 12px; width: 96px; opacity: .9; }
.stat .chip { position: absolute; top: 16px; right: 16px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  font-size: 11px; font-weight: 700; border-radius: 999px;
  background: var(--bg-elev-2); color: var(--text-dim);
}
.chip.good { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.chip.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.chip.bad  { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.chip.info { background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); }
.chip.brand{ background: var(--brand); color: var(--brand-ink); }

/* ---- Avatars ---- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-content: center; font-size: 19px;
  background: var(--bg-elev-2); border: 2px solid var(--border);
}
.avatar.lg { width: 76px; height: 76px; font-size: 36px; }
.avatar.sm { width: 28px; height: 28px; font-size: 14px; }
.avatar-wrap { position: relative; }
.status-dot {
  position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px;
  border-radius: 50%; border: 2px solid var(--surface);
}
.st-active { background: var(--good); }
.st-away   { background: var(--warn); }
.st-off    { background: var(--text-faint); }

/* ---- Task cards ---- */
.task {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 15px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); transition: border-color .15s, transform .1s;
}
.task:hover { border-color: var(--border-strong); }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; }
.task-meta { font-size: 12px; color: var(--text-faint); display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.task-actions { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.timer { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--brand); min-width: 74px; text-align: right; }
.state-pill {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 6px;
}
.pulse::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--good); margin-right: 6px; animation: pulse 1.4s ease-in-out infinite; vertical-align: middle;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.param-tag { font-size: 11px; background: var(--bg-elev-2); padding: 2px 8px; border-radius: 6px; color: var(--text-dim); }

/* ---- Feed / wall ---- */
.post { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: var(--gap); }
.post-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.post-body { font-size: 14px; line-height: 1.5; }
.post-body strong { color: var(--text); }
.post-body em { color: var(--brand); font-style: normal; font-weight: 600; }
.post-meta-row { display: flex; gap: 16px; margin: 12px 0; flex-wrap: wrap; }
.post-metric { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-dim); }
.post-metric b { color: var(--text); }
.reactions { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.react-btn {
  border: 1px solid var(--border); background: var(--bg-elev-2); border-radius: 999px;
  padding: 5px 11px; font-size: 13px; cursor: pointer; color: var(--text-dim);
  transition: all .12s; display: inline-flex; gap: 5px; align-items: center;
}
.react-btn:hover { border-color: var(--brand); transform: translateY(-1px); }
.react-btn.on { background: var(--brand-soft); border-color: var(--brand); color: var(--text); }
.comment { display: flex; gap: 9px; font-size: 13px; padding: 8px 0; border-top: 1px solid var(--border); }
.comment b { color: var(--text); }
.formatted-text { flex: 1; line-height: 1.45; }
.formatted-text .fmt-line { margin-bottom: 4px; }
.formatted-text .fmt-list { margin: 4px 0 6px 18px; padding-left: 12px; }
.formatted-text .fmt-list li { margin-bottom: 2px; }
.formatted-text a.link { color: var(--brand); text-decoration: underline; word-break: break-word; }

/* ---- Inbox ---- */
.msg { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); margin-bottom: 10px; }
.msg.unread { border-color: var(--brand); }
.msg-body { flex: 1; }
.msg-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-faint); margin-bottom: 3px; }
.msg-head b { color: var(--text); font-size: 13px; }

/* ---- Forms ---- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 11px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg-elev-2);
  color: var(--text); font-size: 16px; font-family: inherit;
  min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
textarea { resize: vertical; min-height: 70px; }
.color-in { display: flex; align-items: center; gap: 10px; }
.color-in input[type=color] { width: 46px; height: 40px; padding: 3px; cursor: pointer; }
.range-row { display: flex; align-items: center; gap: 12px; }
input[type=range] { accent-color: var(--brand); }

/* ---- Modal ---- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(3px); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: 0; width: 100%; max-width: none; max-height: 100dvh; overflow: auto; box-shadow: var(--shadow); }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--bg-elev); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; position: sticky; bottom: 0; background: var(--bg-elev); }

/* ---- Theme picker ---- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.theme-card { border: 2px solid var(--border); border-radius: var(--radius); padding: 12px; cursor: pointer; transition: border-color .15s; }
.theme-card:hover { border-color: var(--border-strong); }
.theme-card.on { border-color: var(--brand); }
.theme-swatch { height: 42px; border-radius: 8px; display: flex; overflow: hidden; margin-bottom: 9px; }
.theme-swatch span { flex: 1; }
.theme-card .nm { font-size: 12.5px; font-weight: 700; }

/* ---- Misc ---- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 14px; }
.section-head h2 { font-size: 16px; margin: 0; }
.muted { color: var(--text-faint); }
.empty { text-align: center; padding: 48px 20px; color: var(--text-faint); }
.empty .big { font-size: 40px; margin-bottom: 10px; opacity: .5; }
.tabs { display: flex; gap: 4px; background: var(--bg-elev-2); padding: 4px; border-radius: var(--radius-sm); width: fit-content; margin-bottom: 18px; }
.tab { padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text-dim); border: none; background: none; }
.tab.on { background: var(--brand); color: var(--brand-ink); }
.divider { height: 1px; background: var(--border); margin: 22px 0; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-dim); }
.legend-dot { width: 11px; height: 11px; border-radius: 3px; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--brand); color: var(--brand-ink); padding: 11px 20px;
  border-radius: 999px; font-weight: 700; font-size: 13px; z-index: 200;
  box-shadow: var(--shadow); animation: pop .2s;
}
@keyframes pop { from { transform: translate(-50%, 12px); opacity: 0; } }
.day-break { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.day-chip { font-size: 11px; background: var(--bg-elev-2); border-radius: 6px; padding: 3px 8px; color: var(--text-dim); }
.day-chip b { color: var(--brand); }

/* two-column dashboard */
.dash-2, .dash-3 { display: grid; grid-template-columns: 1fr; gap: var(--gap); align-items: start; }
.menu-toggle { display: inline-flex; }
.field-row { display: grid; grid-template-columns: 1fr; gap: 12px; }
.company-toggle { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 16px; }
.profile-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }

/* ---- Inline SVG icons ---- */
svg.i { flex: none; vertical-align: -3px; display: inline-block; }
.nav-item .ico { display: grid; place-content: center; width: 20px; }
.card-title svg.i { color: var(--brand); }
.empty .big svg.i { opacity: .45; }

/* ---- Task activity icon ---- */
.task-ico {
  width: 42px; height: 42px; border-radius: 11px; flex: none;
  display: grid; place-content: center;
  background: var(--brand-soft); color: var(--brand);
  border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
}

/* ---- Company toggle (task modal) ---- */
.company-card {
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: 13px 14px; cursor: pointer; display: flex; gap: 10px; align-items: center;
  font-weight: 700; font-size: 13.5px; color: var(--text-dim); transition: all .15s;
}
.company-card:hover { border-color: var(--border-strong); }
.company-card.on { border-color: var(--brand); background: var(--brand-soft); color: var(--text); }
.company-card.on svg.i { color: var(--brand); }

/* ---- Admin: live workforce board ---- */
.lb-row {
  display: grid; grid-template-columns: 190px 1fr 84px 90px 80px 110px;
  gap: 10px; align-items: center; padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.lb-head {
  border-top: none; padding-top: 14px; padding-bottom: 6px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); font-weight: 800;
}
@media (max-width: 900px) {
  .lb-row { grid-template-columns: 150px 1fr 80px 100px; }
  .lb-row > :nth-child(3), .lb-row > :nth-child(5) { display: none; }
}

/* ---- Admin: benchmark rows ---- */
.bench-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.bench-row:first-child { border-top: none; }
.bench-bar { flex: 1; height: 9px; border-radius: 5px; background: var(--bg-elev-2); position: relative; overflow: hidden; min-width: 40px; }
.bench-bar > span { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 5px; }
.chip svg.i { vertical-align: -1.5px; }

/* ---- Avatar stacks & collaborators ---- */
.avatar.xs { width: 22px; height: 22px; font-size: 9.5px; border-width: 1.5px; }
.stack { display: inline-flex; align-items: center; }
.stack .avatar { margin-left: -7px; box-shadow: 0 0 0 2px var(--surface); }
.stack .avatar:first-child { margin-left: 0; }

.collab-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.collab-opt {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 6px 12px 6px 8px; font-size: 12.5px; cursor: pointer;
  background: var(--bg-elev-2); transition: border-color .15s;
}
.collab-opt:hover { border-color: var(--brand); }
.collab-opt input { width: auto; accent-color: var(--brand); margin: 0; }
.collab-opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.collab-opt.disabled { opacity: .4; pointer-events: none; }

/* ---- Color / icon swatch pickers ---- */
.swatch-row { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; padding: 0;
}
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg-elev); }
.icon-swatch {
  width: 38px; height: 38px; border-radius: var(--radius-sm); cursor: pointer;
  border: 2px solid var(--border); background: var(--bg-elev-2); color: var(--text-dim);
  display: grid; place-content: center;
}
.icon-swatch:hover { border-color: var(--border-strong); }
.icon-swatch.on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* ---- Admin: people table ---- */
.pt-row {
  display: grid;
  grid-template-columns: 210px 130px 1fr 130px 100px 200px 44px;
  gap: 10px; align-items: center; padding: 11px 18px;
  border-top: 1px solid var(--border); min-width: 900px;
}
.pt-head {
  border-top: none; padding-top: 14px; padding-bottom: 6px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); font-weight: 800;
}

/* ---- Profile detail grid ---- */
.profile-grid > div {
  background: var(--bg-elev-2); border-radius: var(--radius-sm);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 4px;
}
.profile-grid .muted { font-size: 11px; display: flex; align-items: center; gap: 6px; }
.profile-grid b { font-size: 13px; word-break: break-word; }

/* ---- Auth screen ---- */
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow);
}
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-card .tabs { width: 100%; }
.auth-card .tab { flex: 1; text-align: center; }
.auth-msg { font-size: 12.5px; padding: 9px 12px; border-radius: var(--radius-sm); margin-bottom: 12px; }
.auth-msg.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.auth-msg.good { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.remember-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-dim); margin-bottom: 12px; cursor: pointer; }
.remember-row input { width: auto; accent-color: var(--brand); margin: 0; }

/* ---- Consent agreement ---- */
.consent-scroll {
  max-height: 46vh; overflow-y: auto; padding: 14px 16px; margin-top: 6px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elev-2); font-size: 12.5px; line-height: 1.55; color: var(--text-dim);
}
.consent-scroll h4 { color: var(--text); font-size: 13px; margin: 14px 0 4px; }
.consent-scroll p { margin: 0 0 8px; }
.consent-scroll ul { margin: 6px 0 8px; padding-left: 18px; }
.consent-scroll li { margin-bottom: 5px; }
.consent-scroll b { color: var(--text); }

/* ---- Hint bar ---- */
.hint-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; margin-bottom: 16px; border-radius: var(--radius-sm);
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
  font-size: 12.5px; color: var(--text-dim);
}
.hint-bar svg.i { color: var(--brand); flex: none; }
.hint-bar b { color: var(--text); }

/* ---- To-do items (admin workload cards) ---- */
.todo-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 0;
  font-size: 12.5px; border-top: 1px solid var(--border);
}
.todo-item:first-child { border-top: none; }
.todo-item svg.i { color: var(--text-faint); flex: none; }
.todo-item .state-pill { font-size: 9.5px; padding: 2px 7px; }
.msg .btn.sm { align-self: center; }

/* ---- Clip rows (video-clipping completion) ---- */
.clip-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.clip-row svg.i { color: var(--brand); flex: none; }
.clip-row input { flex: 1; }

/* ---- Attachments ---- */
.att-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.att-thumb {
  position: relative; width: 84px; height: 84px; border-radius: 9px; overflow: hidden;
  border: 1px solid var(--border); cursor: pointer; background: var(--bg-elev-2);
}
.att-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-thumb:hover { border-color: var(--brand); }
.att-file {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--bg-elev-2);
  font-size: 12.5px; max-width: 240px;
}
.att-file a { display: inline-flex; align-items: center; gap: 7px; color: var(--text); min-width: 0; }
.att-file a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file svg.i, .att-thumb svg.i { color: var(--brand); flex: none; }
.att-del {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; padding: 0;
  border: none; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff;
  cursor: pointer; display: grid; place-content: center;
}
.att-file .att-del { position: static; background: var(--surface-hover); color: var(--text-dim); }
.att-del:hover { background: var(--bad); color: #fff; }

/* =====================================================================
   Mobile-first responsive layer
   ===================================================================== */

/* Minimum touch-target sizing */
.btn, .nav-item, .tab, .icon-btn, input, select, textarea {
  min-height: 44px;
}

/* Tabs scroll on narrow screens */
.tabs { flex-wrap: wrap; max-width: 100%; width: 100%; }
@media (max-width: 640px) {
  .tabs { overflow-x: auto; flex-wrap: nowrap; gap: 6px; padding: 6px; }
  .tab { flex: 0 0 auto; white-space: nowrap; }
}

/* Leaderboard hides non-essential columns on small screens */
@media (max-width: 640px) {
  .lb-row { grid-template-columns: 1fr 90px !important; gap: 8px; padding: 10px 14px; }
  .lb-row > :nth-child(2), .lb-row > :nth-child(3), .lb-row > :nth-child(4), .lb-row > :nth-child(5) { display: none; }
  .lb-head { display: none; }
  .stat .v { font-size: 24px; }
  .stat .spark { display: none; }
  .page-sub { display: none; }
  .hint-bar { font-size: 12px; padding: 10px 12px; }
  .topbar-actions .btn.primary { font-size: 0; gap: 0; padding: 8px 11px; }
  .topbar-actions .btn.primary svg { width: 18px; height: 18px; }
  .card { padding: 14px; }
  .modal-body { padding: 16px; }
  .modal-head { padding: 14px 16px; }
  .modal-foot { padding: 12px 16px; }
  .overlay { padding: 0; align-items: flex-end; }
}

/* Desktop expansion */
@media (min-width: 821px) {
  .app { grid-template-columns: 248px 1fr; }
  .sidebar { position: sticky; top: 0; height: 100dvh; width: 248px; transform: none; }
  .menu-toggle { display: none !important; }

  .topbar { padding: 16px 26px; flex-wrap: nowrap; }
  .page-title { font-size: 20px; }
  .page-sub { font-size: 12.5px; }
  .content { padding: 24px 26px 60px; max-width: 1240px; }

  .cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .dash-2 { grid-template-columns: 1.6fr 1fr; }
  .dash-3 { grid-template-columns: repeat(3, 1fr); }
  .field-row { grid-template-columns: 1fr 1fr; }
  .company-toggle { grid-template-columns: 1fr 1fr; }
  .profile-grid { grid-template-columns: 1fr 1fr; }

  .modal { border-radius: var(--radius); max-width: 520px; max-height: 88vh; }
  .overlay { padding: 20px; align-items: center; }

  input, select, textarea { font-size: 13.5px; }
  .btn, .nav-item, .tab, .icon-btn, input, select, textarea { min-height: 0; }
}

/* Large cards on very small screens */
@media (max-width: 380px) {
  .topbar { padding: 10px 12px; }
  .page-title { font-size: 16px; }
  .content { padding: 12px 12px 80px; }
  .btn { padding: 10px 12px; }
}
