/* ──────────────────────────────────────────────────────────────────────
   Academia Tech · UA-PILOT cloud portal — modernised theme
   Direct port of theacademia.tech tokens (neutral palette, pure-black
   accents, Inter / Unbounded) with no shadows. Cards = border only.
   ────────────────────────────────────────────────────────────────────── */

:root {
  /* surfaces (theacademia.tech-style: pure white) */
  --bg:        #FFFFFF;
  --surface:   #FFFFFF;
  --surface-2: #FAFAFA;       /* hover/highlight bg, very subtle */
  --surface-3: #F5F5F5;

  /* ink (theacademia.tech-style: pure black, neutral grays) */
  --ink:   #000000;
  --ink-2: #171717;            /* neutral-900 */
  --ink-3: #525252;            /* neutral-600 */
  --ink-4: #A3A3A3;            /* neutral-400 — secondary text */
  --ink-5: #D4D4D4;            /* neutral-300 — disabled */

  /* lines (theacademia.tech neutral-200 / 300) */
  --line:   #E5E5E5;           /* neutral-200 */
  --line-2: #D4D4D4;           /* neutral-300 */
  --line-3: #A3A3A3;           /* neutral-400 — hover border */

  /* accent — keep one olive thread for compatibility w/ StabX surface */
  --stabx:        #BCCC68;
  --stabx-deep:   #7E8B41;
  --stabx-soft:   #F4F6E5;     /* still used for the product chip */

  /* status (subdued, neutral-looking) */
  --ok:     #16A34A;
  --warn:   #CA8A04;
  --danger: #DC2626;
  --info:   #2563EB;

  /* shape (theacademia.tech mostly uses 6-8px) */
  --r:    8px;
  --r-sm: 6px;
  --r-lg: 12px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--ink-2); }
button, input, select, textarea { font-family: inherit; color: inherit; }

/* ── sticky header ─────────────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.app-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}
@media (min-width: 1024px) {
  .app-header-inner { padding: 14px 48px; }
}
@media (min-width: 1280px) {
  .app-header-inner { padding: 14px 96px; }
}

/* brand: image logo (Academia ▲) + ACADEMIA wordmark + UA-PILOT chip */
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
  line-height: 1;
}
.brand:hover { opacity: 0.88; color: var(--ink); }
.brand-logo {
  width: 28px; height: 28px;
  object-fit: contain;
  filter: invert(1);             /* white-on-white source → black */
  flex-shrink: 0;
}
.brand-name {
  font-family: 'Unbounded', 'Inter', sans-serif;
  font-size: 17px; font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}
.brand-product {
  font-family: 'Unbounded', 'Inter', sans-serif;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--stabx-deep);
  padding: 4px 8px;
  border-radius: 5px;
  margin-left: 6px;
  background: var(--stabx-soft);
  white-space: nowrap;
}

/* nav links */
.nav-links {
  display: inline-flex; gap: 28px;
  justify-self: center;
  list-style: none; margin: 0; padding: 0;
  font-size: 13.5px;
}
.nav-links a {
  color: var(--ink-3); font-weight: 500;
  letter-spacing: 0;
  transition: color 120ms;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--ink); font-weight: 600; }

.header-actions {
  display: inline-flex; align-items: center; gap: 8px;
}

/* EN / UA — two separate flat pills (matches theacademia.tech exactly) */
.lang-switch {
  display: inline-flex; gap: 4px;
}
.lang-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px 12px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-4);
  cursor: pointer;
  transition: all 100ms ease-in-out;
  text-decoration: none;
}
.lang-btn:hover { border-color: var(--ink-4); color: var(--ink-3); }
.lang-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #FFFFFF;
}

/* icon button (3-dot overflow) */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--r-sm); color: var(--ink-3);
  cursor: pointer; transition: 100ms;
}
.icon-btn:hover { color: var(--ink); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* 3-dot overflow menu */
.more-wrap { position: relative; }
.more-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  min-width: 220px;
  padding: 6px;
  z-index: 60;
}
.more-wrap.open .more-menu { display: block; }
.more-menu a, .more-menu button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 8px 10px;
  background: transparent; border: none;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 13px; font-weight: 500;
  cursor: pointer; transition: 60ms;
  text-decoration: none;
}
.more-menu a:hover, .more-menu button:hover { background: var(--surface-2); color: var(--ink); }
.more-menu .sep { height: 1px; background: var(--line); margin: 4px 4px; }
.more-menu .danger { color: var(--danger); }
.more-menu .danger:hover { background: #FEF2F2; color: var(--danger); }

/* ── page wrap (Academia-style generous max width) ─────────────── */
.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}
@media (min-width: 768px) {
  .page { padding: 64px 24px 96px; }
}

/* page heading (matches Academia hero treatment — huge, simple) */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; margin-bottom: 40px;
  flex-wrap: wrap;
}
.page-head-text { flex: 1; min-width: 240px; }
.page-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 36px; font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink); margin: 0;
}
@media (min-width: 768px) {
  .page-title { font-size: 44px; }
}
.page-subtitle {
  margin-top: 12px;
  color: var(--ink-3);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
}
.page-meta {
  display: inline-flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
  color: var(--ink-4);
  font-size: 12px; font-weight: 500;
  letter-spacing: 0;
}
.page-meta .label { color: var(--ink-3); font-weight: 600; }
.page-meta .sep { color: var(--line-2); }

/* settings-page eyebrow shows license count with green number */
.page-meta.lic-meta {
  font-size: 12.5px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.page-meta.lic-meta .label { color: var(--ink-3); font-weight: 500; text-transform: none; letter-spacing: 0; }
.page-meta.lic-meta .num { color: var(--ok); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px; }
.page-meta.lic-meta.zero .num { color: var(--danger); }

/* license pill: minimal, badge-like, green number */
.lic-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px; font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
  background: var(--bg);
}
.lic-chip .num {
  font-weight: 700;
  color: var(--ok);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.lic-chip.zero .num { color: var(--danger); }

/* ── cards (border only — no shadows anywhere) ────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: 20px;
}
/* keep the header strip's bottom border crisp without clipping
   absolutely-positioned children (e.g. dropdown menus) */
.card-head { border-top-left-radius: var(--r-lg); border-top-right-radius: var(--r-lg); }
.card-body { border-bottom-left-radius: var(--r-lg); border-bottom-right-radius: var(--r-lg); }
/* when card-body is the only child (no card-head), round all four corners.
   overflow:hidden clips flush content (e.g. uploads table) to the card edge.
   NOTE: only safe on cards with no dropdown — the build/camera selects open
   absolutely-positioned menus that need to escape, and those cards all have
   a .card-head, which excludes them from this rule. */
.card > .card-body:first-child:last-child {
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}
.card-head .ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink-2);
  flex-shrink: 0;
}
.card-head .ic svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.card-head h3 {
  font-family: 'Inter', sans-serif;
  font-size: 14px; font-weight: 600;
  letter-spacing: 0;
  color: var(--ink); margin: 0;
  white-space: nowrap;
}
.card-head .card-sub {
  margin-left: auto;
  color: var(--ink-4); font-size: 12px;
}
.card-head .card-toggle {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 6px;
  background: transparent; border: none;
  color: var(--ink-4); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: 100ms;
}
.card-head .card-toggle:hover { color: var(--ink); background: var(--surface-2); }
.card-head .card-toggle svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 200ms; }
.card.collapsed .card-toggle svg { transform: rotate(-90deg); }
.card.collapsed .card-body { display: none; }
.card.collapsed .card-head { border-bottom: none; }
.card-body { padding: 24px; }

/* ── fields ────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field label,
.field > .label {
  font-size: 13px; font-weight: 500;
  color: var(--ink-2);
  letter-spacing: 0;
}
.field .hint {
  font-size: 12px; color: var(--ink-4); font-weight: 400;
  margin-top: 4px;
}

/* text inputs */
.input-wrap, .input {
  display: flex; align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  transition: border-color 120ms, background-color 120ms;
}
.input-wrap:hover, .input:hover { border-color: var(--line-3); }
.input-wrap:focus-within, .input:focus { border-color: var(--ink); outline: none; }

.input-wrap input,
.input-wrap select {
  flex: 1; width: 100%;
  height: 44px;
  padding: 0 14px;
  background: transparent;
  border: none; outline: none;
  color: var(--ink);
  font-size: 14px; font-weight: 500;
  font-family: inherit;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
}
input.input, select.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  color: var(--ink);
  font-size: 14px; font-weight: 500;
  font-family: inherit;
  outline: none;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
}
.input-wrap input::placeholder { color: var(--ink-4); font-weight: 400; }

/* Kill Chrome / Edge / Safari autofill background — it paints a square
   bg on the inner <input>, which bleeds past the rounded .input-wrap
   corners. The inset box-shadow re-paints the input with our surface
   color (effectively transparent over the wrap), keeping rounded
   corners intact. Long transition prevents a yellow flash on load. */
.input-wrap input:-webkit-autofill,
.input-wrap input:-webkit-autofill:hover,
.input-wrap input:-webkit-autofill:focus,
.input-wrap input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset !important;
  -webkit-text-fill-color: var(--ink) !important;
  caret-color: var(--ink);
  transition: background-color 5000s ease-in-out 0s;
  border-radius: var(--r);
}

/* ── custom listbox dropdown (replaces native <select> UI) ─────────
   The native <select> is hidden in-place so form submission still works,
   and a .select-shell renders the visible trigger + a fully-styled menu. */
.select-shell {
  position: relative;
  width: 100%;
}
.select-shell select {
  /* visually hidden but keeps the form value & accessibility tree */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  -webkit-appearance: none; appearance: none;
}
.select-trigger {
  display: flex; align-items: center;
  width: 100%;
  height: 44px;
  padding: 0 0 0 14px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms, background-color 120ms;
}
.select-trigger:hover { border-color: var(--ink); background-color: var(--surface-2); }
.select-trigger:focus-visible { outline: none; border-color: var(--ink); }
.select-trigger .select-value {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.select-trigger .select-chev-wrap {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 100%;
  border-left: 1px solid var(--line-2);
  margin-left: 12px;
  color: var(--ink);
  flex-shrink: 0;
}
.select-trigger .select-chev-wrap svg {
  width: 16px; height: 16px;
  stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform 160ms;
}
.select-shell.open .select-trigger .select-chev-wrap svg { transform: rotate(180deg); }
.select-shell.open .select-trigger { border-color: var(--ink); background-color: var(--surface); }

.select-menu {
  display: none;
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: 4px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 50;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.select-menu::-webkit-scrollbar { width: 8px; }
.select-menu::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
.select-menu::-webkit-scrollbar-track { background: transparent; }
.select-shell.open .select-menu { display: block; }
.select-menu .opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 60ms, color 60ms;
}
.select-menu .opt:hover { background: var(--surface-2); color: var(--ink); }
.select-menu .opt.selected {
  background: var(--surface-3);
  color: var(--ink);
  font-weight: 600;
}
.select-menu .opt.selected::after {
  content: '';
  display: inline-block;
  margin-left: 8px;
  width: 6px; height: 12px;
  border: solid var(--ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-1px);
}

/* numeric / text inputs used by render_json */
.card-body .form-control,
.personal .form-control {
  display: block; width: 100%;
  height: 40px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color 120ms;
  outline: none;
  appearance: textfield;
}
.card-body .form-control:hover,
.personal .form-control:hover { border-color: var(--line-3); }
.card-body .form-control:focus,
.personal .form-control:focus { border-color: var(--ink); }

/* checkbox-as-switch */
.switch {
  position: relative; display: inline-flex; align-items: center;
  width: 40px; height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 40px; height: 22px;
  background: var(--line-2); border-radius: 999px;
  transition: 160ms;
  position: relative;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #FFF; border-radius: 50%;
  transition: 160ms;
}
.switch input:checked + .track { background: var(--ink); }
.switch input:checked + .track::after { transform: translateX(18px); }

.wifi-row {
  display: flex; align-items: center; gap: 14px;
  padding: 4px 0;
}
.wifi-row .wifi-label {
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  cursor: pointer;
}
.wifi-row .wifi-sub {
  font-size: 12px; color: var(--ink-4); margin-left: auto;
  font-weight: 500;
}

.wifi-fields {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 12px;
}
@media (max-width: 600px) {
  .wifi-fields { grid-template-columns: 1fr; }
}

/* ── personal-settings (render_json output) ────────────────────── */
.personal h4 {
  font-family: 'Inter', sans-serif;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-4); margin: 24px 0 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.personal h4:first-child { margin-top: 0; }
.personal h5 {
  font-size: 13px; font-weight: 500;
  color: var(--ink-2); margin: 0;
}
.personal ul { list-style: none; padding: 0; margin: 0; }
.personal > ul > li { margin-bottom: 12px; }
.personal > ul > li:last-child { margin-bottom: 0; }

.personal .horizontal-list {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 2fr;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.personal .horizontal-list:last-child { border-bottom: none; }
.personal .horizontal-list li { margin: 0 !important; }
.personal .horizontal-list li.item_name {
  width: auto !important;
  font-size: 13px; color: var(--ink-3); font-weight: 500;
}
.personal .horizontal-list li.item_name h5 { font-size: 13px; color: var(--ink-3); font-weight: 500; }

/* tables (speed/distance profiles) */
.personal .table {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  margin: 12px 0 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.personal .table th {
  background: var(--surface-2);
  padding: 10px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3); text-align: center;
  border-bottom: 1px solid var(--line);
}
.personal .table td {
  padding: 8px 12px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px; color: var(--ink-2);
}
.personal .table tr:first-child td { border-top: none; }
.personal .table input.form-control {
  height: 32px;
  text-align: center;
  background: transparent;
  border: 1px solid transparent;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.personal .table input.form-control:hover { border-color: var(--line); }
.personal .table input.form-control:focus { background: var(--surface); border-color: var(--ink); }

/* ── buttons (Academia: pure black primary, neutral border secondary) ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 24px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-family: inherit; font-size: 14px; font-weight: 500;
  letter-spacing: 0;
  cursor: pointer;
  transition: 120ms;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn:disabled, .btn[disabled] {
  background: var(--surface-2); color: var(--ink-4);
  border-color: var(--line); cursor: not-allowed;
}
.btn-primary {
  background: var(--ink); color: #FFFFFF; border-color: var(--ink);
  font-weight: 500;
}
.btn-primary:hover { background: #262626; border-color: #262626; color: #FFFFFF; }
.btn-primary:disabled {
  background: var(--ink-5); border-color: var(--ink-5); color: #FFFFFF;
}
.btn-ghost {
  background: transparent; border-color: transparent; color: var(--ink-3);
}
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); border-color: transparent; }
.btn-sm {
  height: 32px; padding: 0 14px;
  font-size: 12.5px;
}
.btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* outline danger / outline primary (used by upload list) */
.btn-outline-danger { color: var(--danger); border-color: var(--line); background: transparent; }
.btn-outline-danger:hover { color: var(--danger); border-color: var(--danger); }
.btn-outline-primary { color: var(--ink); border-color: var(--line); background: transparent; }
.btn-outline-primary:hover { color: var(--ink); border-color: var(--ink); }

/* action bar at end of form — no border, just spacing */
.actions-bar {
  margin-top: 24px;
  display: flex; gap: 10px; justify-content: flex-end;
  align-items: center;
}

/* ── alerts ────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13.5px;
  margin-bottom: 16px;
}
.alert-success { background: #F0FDF4; border-color: #BBF7D0; color: #166534; }
.alert-danger  { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.alert-warning { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.alert-info    { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }

/* ── upload page (drop-zone + uploads table) ─────────────────── */
/* upload section: full-width drop zone, then a row with hint + button */
.upload-footer-row {
  margin-top: 14px;
  display: flex; align-items: center;
  gap: 16px;
}
.upload-footer-row .form-text { flex: 1; margin: 0; }
.upload-footer-row .btn { height: 40px; padding: 0 18px; font-size: 13.5px; flex-shrink: 0; }
@media (max-width: 640px) {
  .upload-footer-row { flex-direction: column; align-items: stretch; }
  .upload-footer-row .btn { width: 100%; }
}

.client-upload-download-form {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
  margin-bottom: 4px;
  white-space: nowrap;
}
.client-upload-download-form select.client-upload-download-select {
  flex: 0 0 148px;
  width: 148px;
  min-width: 148px;
  height: 32px;
  padding: 0 10px;
  font-size: 12.5px;
}
.client-upload-download-btn {
  padding-left: 16px;
  padding-right: 16px;
}
@media (max-width: 640px) {
  .client-upload-download-form {
    flex-direction: column;
    align-items: stretch;
  }
  .client-upload-download-select,
  .client-upload-download-form .btn {
    width: 100%;
  }
}

.archive-progress-cell {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
  min-width: 150px;
  max-width: 220px;
  vertical-align: middle;
}
.archive-progress-bar {
  position: relative;
  display: block;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}
.archive-progress-bar span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  min-width: 2px;
  border-radius: inherit;
  background: var(--ink);
  transition: width 160ms ease;
}
.archive-progress-cell small {
  color: var(--ink-4);
  font-size: 11.5px;
  line-height: 1.25;
  white-space: normal;
}

.upload-zone {
  position: relative;
  display: flex; align-items: center; gap: 16px;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-lg);
  padding: 18px 22px;
  background: var(--surface-2);
  transition: 120ms;
  cursor: pointer;
  text-align: left;
  min-height: 72px;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--ink); background: var(--surface); }
.upload-zone input[type=file] {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}
.upload-zone .uz-text { flex: 1; min-width: 0; }
.upload-zone .uz-icon {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-3);
  flex-shrink: 0;
}
.upload-zone .uz-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.upload-zone .uz-title {
  font-size: 14px; font-weight: 600; color: var(--ink);
  margin: 0 0 2px;
}
.upload-zone .uz-sub {
  font-size: 12.5px; color: var(--ink-4);
  margin: 0;
}
.upload-zone .uz-file {
  display: block;
  margin-top: 4px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px; color: var(--ink);
  font-weight: 500;
}

.allowed-chips {
  display: inline-flex; gap: 6px; flex-wrap: wrap;
  margin-left: 6px;
}
.allowed-chip {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.5px; font-weight: 500;
  color: var(--ink-2);
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
}

.upload-progress-card {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
}
.upload-progress-card label {
  font-size: 12px; font-weight: 600; color: var(--ink-3);
  display: block; margin-bottom: 8px;
  letter-spacing: 0.04em; text-transform: uppercase;
}
progress {
  width: 100%; height: 6px;
  appearance: none;
  border: none;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--ink); border-radius: 999px; transition: width 120ms; }
progress::-moz-progress-bar { background: var(--ink); }
.upload-progress-card small {
  display: block; margin-top: 8px;
  color: var(--ink-4); font-size: 12px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* uploads table — no outer border, relies on the parent card's border */
.table {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
  background: var(--surface);
}
.table th, .table td {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  text-align: left;
  vertical-align: middle;
}
.table thead th {
  background: var(--surface-2);
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-4);
  border-top: none;
}
/* round corners so the table sits flush inside its rounded card */
.table thead tr:first-child th:first-child { border-top-left-radius: var(--r-lg); }
.table thead tr:first-child th:last-child  { border-top-right-radius: var(--r-lg); }
.table tbody tr:last-child  td:first-child { border-bottom-left-radius: var(--r-lg); }
.table tbody tr:last-child  td:last-child  { border-bottom-right-radius: var(--r-lg); }
.table tbody tr:first-child td { border-top: 1px solid var(--line); }
.table-responsive { width: 100%; overflow-x: auto; }
.table-striped tbody tr:nth-child(even) td { background: var(--surface-2); }
.table-bordered { border: 1px solid var(--line); }
.table-sm th, .table-sm td { padding: 8px 12px; font-size: 12.5px; }

.empty-state {
  text-align: center;
  padding: 36px 24px;
  color: var(--ink-4);
  font-size: 13px;
}

/* ── login card ─────────────────────────────────────────────────── */
.login-wrap {
  min-height: calc(100vh - 240px);
  display: grid; place-items: center;
  padding: 48px 24px;
}
.login-card {
  width: 100%; max-width: 420px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 36px 32px;
  background: var(--surface);
}
.login-card .login-title {
  font-family: 'Inter', sans-serif;
  font-size: 24px; font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  color: var(--ink);
}
.login-card .login-sub {
  font-size: 13.5px; color: var(--ink-4);
  margin: 0 0 28px;
}

.login-card.error-404 { text-align: center; }
.login-card.error-404 .login-sub { margin-left: auto; margin-right: auto; }
.login-card.error-404 .error-code {
  font-family: 'Unbounded', 'Inter', sans-serif;
  font-size: 72px; font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1; color: var(--ink-4);
  margin-bottom: 18px;
}

/* ── footer (matches theacademia.tech structure) ───────────────── */
.app-footer {
  border-top: 1px solid var(--line);
  background: var(--bg);
  margin-top: 64px;
}
.app-footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 48px 24px;
}
@media (min-width: 1024px) {
  .app-footer-inner { padding: 64px 48px; }
}
@media (min-width: 1280px) {
  .app-footer-inner { padding: 64px 96px; }
}
.app-footer-row {
  display: flex; flex-direction: column; gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 48px;
}
@media (min-width: 768px) {
  .app-footer-row { flex-direction: row; align-items: center; }
}
.app-footer-brand { display: inline-flex; align-items: center; gap: 10px; }
.app-footer-brand .brand-logo { width: 24px; height: 24px; }
.app-footer-brand .brand-name { font-size: 15px; }
.app-footer-links {
  display: inline-flex; flex-wrap: wrap;
  gap: 24px;
  font-size: 13.5px;
}
.app-footer-links a { color: var(--ink-4); transition: color 200ms; }
.app-footer-links a:hover { color: var(--ink); }
.app-footer-bottom {
  border-top: 1px solid var(--line);
  padding-top: 24px;
  font-size: 13px;
  color: var(--ink-4);
}

/* ── Bootstrap utility shims (so the upload JS keeps working) ──── */
.d-none { display: none !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-3 { margin-bottom: 16px; }
.mt-3 { margin-top: 16px; }
.my-4 { margin-top: 24px; margin-bottom: 24px; }
.h5 { font-size: 16px; font-weight: 600; color: var(--ink); margin: 0; }
.text-end { text-align: right; }
.text-nowrap { white-space: nowrap; }
.text-muted { color: var(--ink-4); }
.align-middle { vertical-align: middle; }
.w-100 { width: 100%; }
.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px; font-weight: 500; color: var(--ink-2);
}
.form-text { font-size: 12.5px; color: var(--ink-4); }

/* default — desktop hides duplicate nav items in the 3-dot menu */
@media (min-width: 761px) {
  .more-menu .nav-dup { display: none; }
}

/* responsive — overrides above */
@media (max-width: 760px) {
  .app-header-inner { gap: 10px; padding: 14px 16px; }
  .nav-links { display: none; }
  .brand { gap: 9px; }
  .brand-name { font-size: 15px; letter-spacing: 0.06em; }
  .brand-logo { width: 26px; height: 26px; }
  .brand-product { font-size: 11px; padding: 4px 7px; margin-left: 4px; }
  .lang-btn { padding: 5px 11px; font-size: 12px; }
  .icon-btn { width: 36px; height: 36px; }
  .icon-btn svg { width: 20px; height: 20px; }
  .header-actions { gap: 8px; }
  .page { padding: 32px 16px 64px; }
  .page-title { font-size: 26px; line-height: 1.15; }
  .page-head { flex-direction: column; }
  .page-subtitle { font-size: 13px; }
  .lic-chip { font-size: 11.5px; padding: 6px 12px; }
  .card-head { padding: 14px 16px; gap: 10px; }
  .card-body { padding: 18px 16px; }
  .actions-bar { flex-direction: column-reverse; align-items: stretch; }
  .actions-bar .btn { width: 100%; }
  .app-footer-inner { padding: 32px 16px; }
  .app-footer-row { margin-bottom: 32px; }
  .app-footer-links { font-size: 12.5px; gap: 14px; row-gap: 8px; }
  .personal .horizontal-list { grid-template-columns: 1fr; gap: 4px; }
}

