/* =========================================================================
   Fileyard — design system
   -------------------------------------------------------------------------
   One quiet, classic look shared by every page: a neutral paper background,
   white panels separated by hairlines, one confident blue for anything
   interactive, and type that stays legible at small sizes. Both a light and a
   dark theme are defined; the theme is chosen by the toggle in the header and
   falls back to the operating-system preference.

   Layout of this file:
     1  experiment block (the colours worth tweaking by hand)
     2  tokens — light + dark
     3  base + typography
     4  buttons, forms, badges
     5  app shell — header, footer, page frame
     6  panels
     7  side rail — folder tree + storage meter
     8  toolbar + sub bar
     9  file explorer — list, grid, selection, drag, empty state
     10 context menu
     11 upload tray
     12 toasts + overlays
     13 modals, dialogs, preview lightbox
     14 sign-in / register pages
     15 home + document pages
     16 responsive
   ========================================================================= */

/* -------------------------------------------------------------- 1. EXPERIMENT
   ⮕ EXPERIMENT HERE. These six hex values set the whole look. Every one is a
   plain hex literal, so the Visual Studio colour dropper can edit it in place
   and the change flows through the rest of the stylesheet. */
:root {
  --brand: #15528f;         /* primary buttons, links, active nav, selection   */
  --brand-strong: #0f4173;  /* the same blue, pressed / hovered                */
  --brand-soft: #e9f0f9;    /* selected rows, soft button faces               */
  --page: #f4f6f9;          /* the paper the panels sit on                    */
  --folder: #dfa32b;        /* folder icons                                   */
  --brand-ring: rgba(21, 82, 143, .26); /* focus ring                         */
}

/* ------------------------------------------------------------------ 2. TOKENS */

:root {
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --line: #e3e8ef;
  --line-strong: #cfd8e3;

  --ink: #101828;
  --ink-2: #56637a;
  --ink-3: #8794a7;
  --on-brand: #ffffff;

  --danger: #b42318;
  --danger-soft: #fdecea;
  --success: #0d7a52;
  --success-soft: #e7f6f0;
  --warning: #b25e09;
  --warning-soft: #fdf3e6;

  --radius-sm: 5px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-2: 0 4px 14px rgba(16, 24, 40, .08);
  --shadow-3: 0 18px 44px rgba(16, 24, 40, .18);

  --header-height: 58px;
  --rail-width: 252px;

  --tone-pdf: #c1372c;
  --tone-doc: #2b5fb8;
  --tone-sheet: #1c7a4b;
  --tone-slides: #c26216;
  --tone-archive: #a5762a;
  --tone-image: #7a52c4;
  --tone-video: #b3357a;
  --tone-audio: #1f7f92;
  --tone-code: #2c7d8c;
  --tone-generic: #7d8899;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand: #3c86d8;
  --brand-strong: #5a9be6;
  --brand-soft: #17293c;
  --brand-ring: rgba(60, 134, 216, .34);
  --page: #0d1117;
  --folder: #e0ad4d;

  --surface: #151b24;
  --surface-2: #1a212b;
  --surface-3: #212a36;
  --line: #262f3c;
  --line-strong: #36424f;

  --ink: #e7ecf3;
  --ink-2: #a2aebe;
  --ink-3: #78849a;
  --on-brand: #ffffff;

  --danger: #e5675c;
  --danger-soft: #2c1c1c;
  --success: #4bbd91;
  --success-soft: #12241f;
  --warning: #d99546;
  --warning-soft: #2a2117;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-2: 0 4px 14px rgba(0, 0, 0, .45);
  --shadow-3: 0 18px 44px rgba(0, 0, 0, .6);

  --tone-pdf: #ef7c70;
  --tone-doc: #6fa5ef;
  --tone-sheet: #56bd8b;
  --tone-slides: #e79a55;
  --tone-archive: #d8ac5d;
  --tone-image: #a98cec;
  --tone-video: #e57bb0;
  --tone-audio: #56b6c8;
  --tone-code: #62b3c1;
  --tone-generic: #94a1b3;

  color-scheme: dark;
}

/* -------------------------------------------------------------- 3. BASE TYPE */

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

html,
body {
  min-height: 100%;
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
  font-size: 0.95rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.012em;
}

h1, .h1 { font-size: 1.75rem; }
h2, .h2 { font-size: 1.35rem; }
h3, .h3 { font-size: 1.15rem; }
h4, .h4 { font-size: 1.02rem; }
h5, .h5 { font-size: 0.95rem; }

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--brand-strong);
}

hr {
  border-color: var(--line);
  opacity: 1;
}

::selection {
  background: var(--brand-soft);
  color: var(--ink);
}

.text-muted {
  color: var(--ink-2) !important;
}

.text-faint {
  color: var(--ink-3);
}

.text-danger {
  color: var(--danger) !important;
}

/* Numbers that line up in columns — sizes, dates, counts. */
.numeric {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 4000;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.skip-link:focus {
  left: 0.75rem;
  top: 0.75rem;
}

/* Text should not carry a blinking caret in the file manager chrome. */
.explorer-surface,
.explorer-surface *,
.folder-tree,
.folder-tree * {
  caret-color: transparent;
}

/* ------------------------------------------------------- 4. CONTROLS */

.btn {
  --btn-face: transparent;
  --btn-ink: var(--ink);
  --btn-line: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--btn-line);
  background-color: var(--btn-face);
  color: var(--btn-ink);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.35;
  padding: 0.42rem 0.8rem;
  transition: background-color .13s ease, border-color .13s ease, color .13s ease;
}

.btn:hover,
.btn:focus-visible {
  color: var(--btn-ink);
}

.btn .bi {
  font-size: 0.95em;
  line-height: 1;
}

.btn-sm {
  font-size: 0.83rem;
  padding: 0.32rem 0.62rem;
}

.btn-lg {
  font-size: 0.95rem;
  padding: 0.6rem 1.15rem;
}

.btn-primary {
  --btn-face: var(--brand);
  --btn-ink: var(--on-brand);
  --btn-line: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  --btn-face: var(--brand-strong);
  --btn-line: var(--brand-strong);
  background-color: var(--brand-strong);
  border-color: var(--brand-strong);
  color: var(--on-brand);
}

/* Quiet secondary button — a face, not an outline. */
.btn-soft,
.btn-outline-secondary {
  --btn-face: var(--surface);
  --btn-ink: var(--ink);
  --btn-line: var(--line-strong);
}

.btn-soft:hover,
.btn-outline-secondary:hover,
.btn-soft:focus,
.btn-outline-secondary:focus {
  background-color: var(--surface-3);
  border-color: var(--line-strong);
  color: var(--ink);
}

/* Toolbar button — no chrome until you touch it. */
.btn-ghost {
  --btn-face: transparent;
  --btn-ink: var(--ink-2);
  --btn-line: transparent;
}

.btn-ghost:hover,
.btn-ghost:focus {
  background-color: var(--surface-3);
  color: var(--ink);
}

.btn-ghost.is-danger:hover,
.btn-ghost.is-danger:focus {
  background-color: var(--danger-soft);
  color: var(--danger);
}

.btn-danger {
  --btn-face: var(--danger);
  --btn-ink: #fff;
  --btn-line: var(--danger);
}

.btn-danger:hover,
.btn-danger:focus {
  background-color: var(--danger);
  border-color: var(--danger);
  color: #fff;
  filter: brightness(0.92);
}

.btn-outline-danger {
  --btn-face: transparent;
  --btn-ink: var(--danger);
  --btn-line: var(--danger);
}

.btn-outline-danger:hover,
.btn-outline-danger:focus {
  background-color: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

/* Bootstrap's disabled rule reaches for --bs-btn-disabled-* variables that a
   custom variant never sets, which would drop the button back to browser
   defaults (a grey border on a borderless button). Restate our own faces. */
.btn:disabled,
.btn.disabled,
fieldset:disabled .btn {
  background-color: var(--btn-face);
  border-color: var(--btn-line);
  color: var(--btn-ink);
  opacity: 0.4;
  pointer-events: none;
}

.btn-block {
  width: 100%;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  font-size: 1rem;
  transition: background-color .13s ease, color .13s ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: var(--surface-3);
  color: var(--ink);
}

/* One focus treatment everywhere. */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.btn:focus,
.btn:active:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.form-control,
.form-select {
  background-color: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.88rem;
  padding: 0.4rem 0.65rem;
}

.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2356637a' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.form-control::placeholder {
  color: var(--ink-3);
}

.form-control:focus,
.form-select:focus {
  background-color: var(--surface);
  border-color: var(--brand);
  color: var(--ink);
}

.form-control:disabled,
.form-select:disabled {
  background-color: var(--surface-3);
}

.form-label {
  color: var(--ink-2);
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 0.28rem;
}

.form-check-input {
  border-color: var(--line-strong);
  background-color: var(--surface);
  width: 1rem;
  height: 1rem;
  margin-top: 0.16rem;
}

.form-check-input:checked {
  background-color: var(--brand);
  border-color: var(--brand);
}

.form-check-input:indeterminate {
  background-color: var(--brand);
  border-color: var(--brand);
}

.input-group-text {
  background: var(--surface-3);
  border-color: var(--line-strong);
  color: var(--ink-2);
}

.badge {
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.3em 0.66em;
}

.badge-quiet {
  background: var(--surface-3);
  color: var(--ink-2);
}

.badge-ok      { background: var(--success-soft); color: var(--success); }
.badge-warn    { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-neutral { background: var(--surface-3);    color: var(--ink-2); }

.alert {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  font-size: 0.9rem;
}

/* --------------------------------------------------------- 5. APP SHELL */

.app-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.app-header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--header-height);
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 1.15rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font-size: 0.95rem;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.brand-tagline {
  font-size: 0.68rem;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex: 1 1 auto;
  min-width: 0;
}

.app-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.app-nav-link:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.app-nav-link.is-active {
  background: var(--brand-soft);
  color: var(--brand);
}

:root[data-theme="dark"] .app-nav-link.is-active {
  color: var(--brand-strong);
}

.header-search {
  flex: 0 1 300px;
  min-width: 0;
}

.header-search .form-control {
  background: var(--surface-2);
  padding-left: 2rem;
}

.header-search-wrap {
  position: relative;
}

.header-search-wrap .bi {
  position: absolute;
  left: 0.62rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  font-size: 0.85rem;
  pointer-events: none;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: 0 0 auto;
}

.account-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.5rem 0.25rem 0.3rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-2);
  font-size: 0.84rem;
}

.account-button:hover,
.account-button[aria-expanded="true"] {
  background: var(--surface-3);
  color: var(--ink);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.dropdown-menu {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  background: var(--surface);
  padding: 0.3rem;
  font-size: 0.88rem;
  color: var(--ink);
}

.dropdown-item {
  border-radius: var(--radius-sm);
  color: var(--ink);
  padding: 0.42rem 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background: var(--surface-3);
  color: var(--ink);
}

.dropdown-item.text-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.dropdown-divider {
  border-color: var(--line);
  margin: 0.3rem 0;
}

.dropdown-header {
  color: var(--ink-3);
  font-size: 0.76rem;
  padding: 0.35rem 0.6rem;
}

.app-main {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.15rem;
}

/* The file manager fills whatever the window has left after the header, the
   demo bar (when present) and the footer — measured by the layout rather than
   guessed at with magic numbers. */
.app-main.is-flush {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding-top: 0.9rem;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.page-title {
  margin: 0;
  font-size: 1.28rem;
}

.page-subtitle {
  margin: 0.15rem 0 0;
  color: var(--ink-2);
  font-size: 0.88rem;
}

.app-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-3);
  font-size: 0.82rem;
  padding: 0.85rem 0;
  margin-top: 1.5rem;
}

.app-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 1.15rem;
}

.app-footer a {
  color: var(--ink-2);
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* ------------------------------------------------------------ DEMO BAR */
/* Only rendered by the public demo deployment. */

.demo-bar {
  position: sticky;
  top: var(--header-height);
  z-index: 1029;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  padding: 0.5rem 1.15rem;
  background: var(--brand-soft);
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
  color: var(--ink);
}

.demo-badge {
  flex: 0 0 auto;
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.demo-bar-text {
  flex: 1 1 auto;
  min-width: 0;
}

.demo-bar-text strong {
  font-variant-numeric: tabular-nums;
}

.demo-bar.is-urgent {
  background: var(--warning-soft);
}

.demo-bar.is-urgent .demo-badge {
  background: var(--warning);
}

.demo-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.demo-ended {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 auto 1.1rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--success-soft);
  color: var(--success);
  font-size: 0.87rem;
}

/* ------------------------------------------------------------- 6. PANELS */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
}

.panel-body {
  padding: 1rem;
}

.panel-body-flush {
  padding: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  color: var(--ink);
}

/* --------------------------------------------------------- 7. SIDE RAIL */

/* The rail and the file panel are the same height and both end at the bottom
   of the window, so the page reads as one application surface. */
.workspace {
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}

.workspace > .panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.side-rail {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 0;
}

.rail-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.rail-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem 0.5rem;
}

.rail-scroll {
  overflow-y: auto;
  padding: 0 0.45rem 0.6rem;
  min-height: 0;
}

/* folder tree ------------------------------------------------------------ */

.folder-tree {
  font-size: 0.86rem;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  border-radius: var(--radius-sm);
  padding-right: 0.2rem;
}

.tree-row:hover {
  background: var(--surface-3);
}

.tree-row.is-current {
  background: var(--brand-soft);
}

.tree-row.is-current .tree-link,
.tree-row.is-current .tree-link .bi {
  color: var(--brand);
  font-weight: 600;
}

:root[data-theme="dark"] .tree-row.is-current .tree-link,
:root[data-theme="dark"] .tree-row.is-current .tree-link .bi {
  color: var(--brand-strong);
}

.tree-row.drop-target {
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.tree-twisty {
  flex: 0 0 auto;
  width: 18px;
  height: 24px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 0.62rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
}

.tree-twisty .bi {
  transition: transform .14s ease;
}

.tree-twisty[aria-expanded="true"] .bi {
  transform: rotate(90deg);
}

.tree-twisty:hover {
  color: var(--ink);
}

.tree-spacer {
  flex: 0 0 18px;
}

.tree-link {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  min-width: 0;
  flex: 1 1 auto;
  padding: 0.28rem 0.15rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
}

.tree-link span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-link .bi {
  color: var(--folder);
  font-size: 0.92rem;
  flex: 0 0 auto;
}

.tree-link .bi-hdd-fill,
.tree-link .bi-house-fill {
  color: var(--ink-3);
}

.tree-children {
  padding-left: 0.62rem;
  border-left: 1px solid var(--line);
  margin-left: 0.62rem;
}

.tree-children.is-collapsed {
  display: none;
}

.tree-empty {
  padding: 0.5rem 0.6rem 0.7rem;
  color: var(--ink-3);
  font-size: 0.8rem;
}

/* storage meter ---------------------------------------------------------- */

.storage-card {
  padding: 0.8rem 0.85rem;
}

.storage-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--ink-2);
}

.storage-used {
  color: var(--ink);
  font-weight: 600;
}

.meter {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
  margin: 0.5rem 0 0.55rem;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width .25s ease;
}

.meter.is-high span { background: var(--warning); }
.meter.is-full span { background: var(--danger); }

/* ------------------------------------------------------------- 8. TOOLBAR */

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
}

.toolbar-divider {
  width: 1px;
  align-self: stretch;
  margin: 0.15rem 0.4rem;
  background: var(--line);
}

.toolbar-spacer {
  flex: 1 1 auto;
}

.selection-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.3rem 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

:root[data-theme="dark"] .selection-pill {
  color: var(--brand-strong);
}

.selection-pill button {
  border: 0;
  background: transparent;
  color: inherit;
  display: inline-flex;
  padding: 0.1rem 0.25rem;
  border-radius: 50%;
  font-size: 0.72rem;
}

.selection-pill button:hover {
  background: rgba(0, 0, 0, .08);
}

.subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.subbar-path {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  min-width: 0;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  flex-wrap: wrap;
  min-width: 0;
  font-size: 0.86rem;
}

.crumb-count {
  font-size: 0.79rem;
  color: var(--ink-3);
  white-space: nowrap;
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  text-decoration: none;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.crumb:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.crumb.is-current {
  color: var(--ink);
  font-weight: 600;
}

.crumb-sep {
  color: var(--ink-3);
  font-size: 0.7rem;
  padding: 0 0.05rem;
}

.subbar-tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-box {
  position: relative;
}

.filter-box .bi {
  position: absolute;
  left: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  font-size: 0.8rem;
  pointer-events: none;
}

.filter-box .form-control {
  width: 190px;
  max-width: 42vw;
  padding-left: 1.85rem;
  font-size: 0.83rem;
}

.view-switch {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-switch button {
  border: 0;
  background: var(--surface);
  color: var(--ink-2);
  padding: 0.3rem 0.5rem;
  font-size: 0.88rem;
  line-height: 1;
}

.view-switch button + button {
  border-left: 1px solid var(--line-strong);
}

.view-switch button:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.view-switch button.is-active {
  background: var(--brand);
  color: var(--on-brand);
}

/* ------------------------------------------------------- 9. FILE EXPLORER */

.explorer-surface {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: var(--surface);
}

/* Fixed layout keeps the columns at their declared widths, so a very long file
   name truncates instead of stretching the table past the viewport. */
.file-table {
  width: 100%;
  table-layout: fixed;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--ink);
  font-size: 0.88rem;
}

.file-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.5rem 0.65rem;
  text-align: left;
  white-space: nowrap;
  user-select: none;
}

.file-table thead th.sortable {
  cursor: pointer;
}

.file-table thead th.sortable:hover {
  color: var(--ink);
  background: var(--surface-3);
}

.file-table thead th.is-sorted {
  color: var(--brand);
}

:root[data-theme="dark"] .file-table thead th.is-sorted {
  color: var(--brand-strong);
}

.sort-indicator {
  display: inline-block;
  min-width: 0.75em;
  font-size: 0.62rem;
  vertical-align: 0.1em;
}

.file-table tbody td {
  border-bottom: 1px solid var(--line);
  padding: 0.4rem 0.65rem;
  vertical-align: middle;
  user-select: none;
}

.file-table tbody tr {
  cursor: default;
}

.file-table tbody tr:hover > td {
  background: var(--surface-2);
}

.file-table tbody tr.is-selected > td {
  background: var(--brand-soft);
}

.file-table tbody tr.is-focused > td:first-child {
  box-shadow: inset 2px 0 0 var(--brand);
}

.col-select {
  width: 38px;
  text-align: center;
  padding-right: 0 !important;
}

.col-date  { width: 152px; }
.col-type  { width: 176px; }
.col-size  { width: 104px; text-align: right; }

.file-table td.col-size,
.file-table th.col-size {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.file-table td.col-date {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.file-table td.col-type {
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.item-visual {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  font-size: 1.02rem;
  line-height: 1;
}

.item-thumb {
  width: 22px;
  height: 22px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--surface-3);
}

.item-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-icon { color: var(--folder); }
.tone-pdf     { color: var(--tone-pdf); }
.tone-doc     { color: var(--tone-doc); }
.tone-sheet   { color: var(--tone-sheet); }
.tone-slides  { color: var(--tone-slides); }
.tone-archive { color: var(--tone-archive); }
.tone-image   { color: var(--tone-image); }
.tone-video   { color: var(--tone-video); }
.tone-audio   { color: var(--tone-audio); }
.tone-code    { color: var(--tone-code); }
.tone-generic { color: var(--tone-generic); }

.parent-row .item-visual .bi {
  color: var(--ink-3);
}

/* empty state ------------------------------------------------------------ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 3.4rem 1.5rem;
  text-align: center;
  color: var(--ink-2);
}

/* Direct child only — buttons inside an empty state keep their own icon size. */
.empty-state > .bi {
  font-size: 2.1rem;
  color: var(--ink-3);
  margin-bottom: 0.35rem;
}

.empty-state-title {
  color: var(--ink);
  font-weight: 600;
  font-size: 0.98rem;
}

.empty-state-text {
  font-size: 0.87rem;
  max-width: 40ch;
}

/* grid view -------------------------------------------------------------- */

.file-table.is-grid {
  table-layout: auto;
}

.file-table.is-grid thead {
  display: none;
}

.file-table.is-grid tbody {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.6rem;
  padding: 0.75rem;
}

.file-table.is-grid tbody tr {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.1rem 0.55rem 0.6rem;
  min-height: 158px;
  transition: border-color .13s ease, box-shadow .13s ease;
}

.file-table.is-grid tbody tr:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-1);
}

.file-table.is-grid tbody tr:hover > td {
  background: transparent;
}

.file-table.is-grid tbody tr.is-selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
}

.file-table.is-grid tbody tr.is-selected > td {
  background: transparent;
}

.file-table.is-grid tbody td {
  display: none;
  border: 0;
  padding: 0;
  background: transparent !important;
}

.file-table.is-grid tbody td.col-select {
  display: block;
  position: absolute;
  top: 0.35rem;
  left: 0.45rem;
  width: auto;
  z-index: 1;
  opacity: 0;
}

.file-table.is-grid tbody tr:hover td.col-select,
.file-table.is-grid tbody tr.is-selected td.col-select {
  opacity: 1;
}

.file-table.is-grid tbody td.col-name {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

.file-table.is-grid .name-cell {
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.file-table.is-grid .item-visual {
  width: 88px;
  height: 88px;
  font-size: 2.55rem;
}

.file-table.is-grid .item-thumb {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-1);
}

.file-table.is-grid .item-name {
  white-space: normal;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.28;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.file-table.is-grid tbody td.col-size {
  display: block;
  margin-top: 0.32rem;
  font-size: 0.72rem;
  color: var(--ink-3);
  text-align: center;
}

.file-table.is-grid tbody tr.empty-row {
  grid-column: 1 / -1;
  border: 0;
  min-height: 0;
  padding: 0;
}

.file-table.is-grid tbody tr.empty-row td.col-empty {
  display: block;
  width: 100%;
}

/* drag + drop cues ------------------------------------------------------- */

.file-table tbody tr.drop-target > td {
  background: var(--brand-soft) !important;
  box-shadow: inset 0 1px 0 var(--brand), inset 0 -1px 0 var(--brand);
}

.explorer-surface.is-drop-active::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 2px dashed var(--brand);
  border-radius: var(--radius);
  background: var(--brand-soft);
  opacity: .55;
  pointer-events: none;
}

/* ------------------------------------------------------- 10. CONTEXT MENU */

.context-menu {
  position: absolute;
  z-index: 1400;
  min-width: 208px;
  padding: 0.28rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  font-size: 0.86rem;
}

.context-menu button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 0.36rem 0.55rem;
  border-radius: var(--radius-sm);
}

.context-menu button:hover {
  background: var(--surface-3);
}

.context-menu button.is-danger {
  color: var(--danger);
}

.context-menu button.is-danger:hover {
  background: var(--danger-soft);
}

.context-menu button .bi {
  width: 1.05rem;
  color: var(--ink-3);
  font-size: 0.92rem;
}

.context-menu button.is-danger .bi {
  color: var(--danger);
}

.context-menu-sep {
  height: 1px;
  background: var(--line);
  margin: 0.28rem 0.2rem;
}

.context-menu .shortcut {
  margin-left: auto;
  color: var(--ink-3);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
}

/* --------------------------------------------------------- 11. UPLOAD TRAY */

.upload-tray {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 1500;
  width: min(392px, calc(100vw - 2rem));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}

.tray-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.55rem 0.6rem 0.85rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.tray-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tray-head .icon-button {
  width: 28px;
  height: 28px;
  font-size: 0.85rem;
}

.tray-progress {
  height: 3px;
  background: var(--surface-3);
}

.tray-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width .18s ease;
}

.tray-status {
  padding: 0.5rem 0.85rem;
  font-size: 0.79rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--line);
}

.tray-body {
  max-height: 274px;
  overflow: auto;
}

.upload-tray.is-collapsed .tray-body,
.upload-tray.is-collapsed .tray-foot,
.upload-tray.is-collapsed .tray-status {
  display: none;
}

.upload-tray.is-collapsed .tray-head {
  border-bottom: 0;
}

.queue-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.queue-item:last-child {
  border-bottom: 0;
}

.queue-icon {
  flex: 0 0 auto;
  margin-top: 0.12rem;
  color: var(--ink-3);
  font-size: 0.95rem;
}

.queue-main {
  flex: 1 1 auto;
  min-width: 0;
}

.queue-name {
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.queue-meta {
  font-size: 0.74rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.queue-meta.is-error {
  color: var(--danger);
}

.queue-bar {
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
  margin-top: 0.3rem;
}

.queue-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
}

.queue-item.is-done .queue-icon { color: var(--success); }
.queue-item.is-failed .queue-icon { color: var(--danger); }

/* Once an item is finished or failed the bar says nothing useful. */
.queue-item.is-done .queue-bar,
.queue-item.is-failed .queue-bar {
  display: none;
}

.queue-remove {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 0.8rem;
  padding: 0.1rem 0.25rem;
  border-radius: var(--radius-sm);
}

.queue-remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.queue-failures {
  margin-top: 0.25rem;
  font-size: 0.74rem;
  color: var(--danger);
}

.tray-foot {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.tray-empty {
  padding: 1.1rem 0.85rem;
  color: var(--ink-3);
  font-size: 0.82rem;
  text-align: center;
}

/* ------------------------------------------------------ 12. TOASTS/OVERLAY */

/* Bottom left, so notifications never cover the toolbar, the selection pill
   or the upload tray in the opposite corner. */
.toast-stack {
  position: fixed;
  left: 1.1rem;
  bottom: 1.1rem;
  z-index: 1900;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}

.toast-note {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  font-size: 0.87rem;
  pointer-events: auto;
  animation: toast-in .18s ease-out;
}

.toast-note.is-out {
  animation: toast-out .18s ease-in forwards;
}

.toast-note .bi {
  font-size: 0.98rem;
  margin-top: 0.06rem;
}

.toast-note.is-success { border-left-color: var(--success); }
.toast-note.is-success .bi { color: var(--success); }
.toast-note.is-error   { border-left-color: var(--danger); }
.toast-note.is-error .bi { color: var(--danger); }
.toast-note.is-info    { border-left-color: var(--brand); }
.toast-note.is-info .bi { color: var(--brand); }

.toast-body {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast-close {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  padding: 0 0.15rem;
  font-size: 0.78rem;
  line-height: 1;
}

.toast-close:hover {
  color: var(--ink);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

@keyframes toast-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(8px); }
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(16, 24, 40, .45);
  backdrop-filter: blur(1.5px);
}

.busy-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  padding: 1.15rem 1.15rem 1rem;
  text-align: center;
}

.busy-title {
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.busy-text {
  color: var(--ink-2);
  font-size: 0.86rem;
  margin-bottom: 0.9rem;
}

.spinner-ring {
  display: inline-block;
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--surface-3);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------- 13. MODALS + PREVIEW */

.modal-content {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  color: var(--ink);
}

.modal-header {
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 1rem;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
}

.modal-body {
  padding: 1rem;
}

.modal-footer {
  border-top: 1px solid var(--line);
  padding: 0.7rem 1rem;
  gap: 0.4rem;
}

.modal-backdrop.show {
  opacity: .45;
}

.btn-close {
  filter: none;
  opacity: .55;
}

.btn-close:hover {
  opacity: 1;
}

:root[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(1.6);
}

.preview-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 340px;
  background: var(--surface-3);
  border-radius: var(--radius);
  overflow: hidden;
}

.preview-frame img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.preview-frame video {
  width: 100%;
  max-height: 70vh;
  background: #000;
}

.preview-frame iframe {
  width: 100%;
  height: 70vh;
  border: 0;
  background: #fff;
}

.preview-frame .audio-wrap {
  width: 100%;
  padding: 2.5rem 1.5rem;
}

.preview-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-2);
}

.preview-nav:hover:not(:disabled) {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

.preview-nav:disabled {
  opacity: .3;
}

.preview-prev { left: -19px; }
.preview-next { right: -19px; }

/* ------------------------------------------------------- 14. AUTH PAGES */

.auth-shell {
  max-width: 430px;
  margin: 2.2rem auto 3rem;
}

.auth-shell h1 {
  font-size: 1.45rem;
  text-align: center;
  margin-bottom: 0.35rem;
}

.auth-shell > .row {
  display: block;
  margin: 0;
}

/* The default Identity pages ship a second column advertising external login
   providers; none are configured, so it is hidden rather than shown empty. */
.auth-shell > .row > div:nth-child(2) {
  display: none;
}

.auth-shell > .row > div:first-child {
  width: 100%;
  max-width: none;
  flex: none;
  padding: 0;
}

.auth-shell section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: 1.5rem;
}

.auth-shell section h2 {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-2);
  text-align: center;
}

.auth-shell section > form > hr,
.auth-shell section > hr {
  display: none;
}

.auth-shell .form-floating > .form-control {
  padding: 1rem 0.75rem;
  height: calc(3.25rem + 2px);
}

.auth-shell .form-floating > label {
  color: var(--ink-3);
  padding: 1rem 0.75rem;
}

.auth-shell .btn-lg {
  padding: 0.62rem 1rem;
  font-size: 0.95rem;
}

.auth-shell .checkbox label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink-2);
  font-size: 0.86rem;
}

/* The default pages finish with a block of helper links; give it a divider and
   centre it so the card ends deliberately rather than trailing off. */
.auth-shell form > div:last-of-type {
  margin-top: 1.2rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  text-align: center;
}

.auth-shell p {
  margin-bottom: 0.3rem;
  font-size: 0.86rem;
}

.auth-shell p:last-child {
  margin-bottom: 0;
}

.auth-shell a {
  text-decoration: none;
}

.auth-shell a:hover {
  text-decoration: underline;
}

.auth-shell .checkbox {
  margin-bottom: 1.1rem !important;
}

.auth-note {
  text-align: center;
  color: var(--ink-2);
  font-size: 0.85rem;
  margin-top: 1rem;
}

/* Identity's Manage pages use a nav-pills sidebar. */
.auth-manage .nav-pills .nav-link {
  color: var(--ink-2);
  border-radius: var(--radius-sm);
}

.auth-manage .nav-pills .nav-link.active {
  background: var(--brand-soft);
  color: var(--brand);
}

/* ------------------------------------------------- 15. HOME + DOCUMENTS */

.hero {
  max-width: 1120px;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: 3rem 2rem;
  text-align: center;
}

.hero-kicker {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.6rem;
}

:root[data-theme="dark"] .hero-kicker {
  color: var(--brand-strong);
}

.hero-title {
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  line-height: 1.1;
  margin: 0 0 0.6rem;
}

.hero-text {
  color: var(--ink-2);
  max-width: 56ch;
  margin: 0 auto 1.4rem;
}

.feature-grid {
  max-width: 1120px;
  margin: 1rem auto 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 1rem;
  margin-bottom: 0.65rem;
}

:root[data-theme="dark"] .feature-icon {
  color: var(--brand-strong);
}

.feature h3 {
  font-size: 0.98rem;
  margin-bottom: 0.25rem;
}

.feature p {
  color: var(--ink-2);
  font-size: 0.87rem;
  margin: 0;
}

.doc {
  max-width: 76ch;
}

.doc h2 {
  margin-top: 1.9rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  font-size: 1.1rem;
}

.doc h2:first-of-type {
  margin-top: 0.4rem;
  padding-top: 0;
  border-top: 0;
}

.doc h3 {
  margin-top: 1.2rem;
  font-size: 0.98rem;
}

.doc p,
.doc li {
  color: var(--ink-2);
  font-size: 0.92rem;
}

.doc code,
.kbd {
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05rem 0.34rem;
  font-size: 0.82em;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.data-table {
  width: 100%;
  font-size: 0.88rem;
  color: var(--ink);
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.55rem 0.8rem;
  text-align: left;
  white-space: nowrap;
}

.data-table tbody td {
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 0.8rem;
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: var(--surface-2);
}

.data-table .numeric {
  text-align: right;
}

/* ---------------------------------------------------------- 16. RESPONSIVE */

@media (max-width: 1199.98px) {
  :root { --rail-width: 216px; }
}

@media (max-width: 991.98px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }

  .side-rail {
    display: none;
  }

  .explorer-surface {
    min-height: 60vh;
  }

  .app-header-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 0.6rem 0.9rem;
    gap: 0.6rem;
  }

  .header-search {
    order: 5;
    flex: 1 1 100%;
  }

  .app-nav {
    order: 4;
    flex: 1 1 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .app-nav::-webkit-scrollbar {
    display: none;
  }

  .col-type,
  .file-table td.col-type,
  .file-table th.col-type {
    display: none;
  }

  .toast-stack {
    bottom: 5.5rem;
  }
}

@media (max-width: 767.98px) {
  html { font-size: 14.5px; }

  .app-main {
    padding: 0.85rem;
  }

  .col-date,
  .file-table td.col-date,
  .file-table th.col-date {
    display: none;
  }

  .toolbar,
  .toolbar-group {
    flex-wrap: nowrap;
  }

  .toolbar {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .toolbar .btn {
    white-space: nowrap;
  }

  .toolbar::-webkit-scrollbar {
    display: none;
  }

  .brand-tagline {
    display: none;
  }

  .preview-prev { left: 6px; }
  .preview-next { right: 6px; }

  .upload-tray {
    right: 0.6rem;
    left: 0.6rem;
    bottom: 0.6rem;
    width: auto;
  }
}

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