/* ==========================================================================
   Drive — visual system
   Tokens → base → layout → components → pages → responsive
   ========================================================================== */

:root {
  color-scheme: light;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --bg-base: #eceff8;
  --bg-tint-1: rgba(99, 102, 241, 0.52);
  --bg-tint-2: rgba(14, 165, 233, 0.42);
  --bg-tint-3: rgba(168, 85, 247, 0.38);

  --surface: rgba(255, 255, 255, 0.68);
  --surface-strong: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-sunken: rgba(15, 23, 42, 0.045);
  --surface-hover: rgba(15, 23, 42, 0.05);
  --surface-active: rgba(99, 102, 241, 0.11);

  --ink: #121a2c;
  --ink-soft: #3b465c;
  --muted: #6a768c;
  --faint: #99a2b4;

  --line: rgba(15, 23, 42, 0.10);
  --line-strong: rgba(15, 23, 42, 0.17);

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-ink: #4338ca;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(79, 70, 229, 0.10);
  --accent-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #2563eb 100%);

  --enc: #0284c7;
  --enc-soft: rgba(14, 165, 233, 0.12);

  --ok: #047857;
  --ok-soft: rgba(16, 185, 129, 0.14);
  --danger: #d92d20;
  --danger-soft: rgba(217, 45, 32, 0.09);
  --warn: #b54708;
  --warn-soft: rgba(245, 158, 11, 0.16);

  --radius-xs: 7px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --blur: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow: 0 14px 34px -16px rgba(15, 23, 42, 0.30), 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 40px 80px -30px rgba(15, 23, 42, 0.45), 0 10px 28px rgba(15, 23, 42, 0.12);
  --ring: 0 0 0 3px rgba(99, 102, 241, 0.38);

  --dur-fast: 120ms;
  --dur: 220ms;
  --ease: cubic-bezier(0.32, 0.72, 0.28, 1);

  --topbar-h: 62px;
  --content-max: 1280px;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg-base: #070a14;
  --bg-tint-1: rgba(99, 102, 241, 0.48);
  --bg-tint-2: rgba(14, 165, 233, 0.34);
  --bg-tint-3: rgba(168, 85, 247, 0.40);

  --surface: rgba(23, 29, 50, 0.62);
  --surface-strong: rgba(19, 24, 43, 0.88);
  --surface-solid: #131829;
  --surface-sunken: rgba(255, 255, 255, 0.045);
  --surface-hover: rgba(255, 255, 255, 0.065);
  --surface-active: rgba(129, 140, 248, 0.18);

  --ink: #e9edf8;
  --ink-soft: #c5cbdd;
  --muted: #94a1bd;
  --faint: #6c7a99;

  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.18);

  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-ink: #a5b4fc;
  --accent-contrast: #0a0f1f;
  --accent-soft: rgba(129, 140, 248, 0.16);
  --accent-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #3b82f6 100%);

  --enc: #38bdf8;
  --enc-soft: rgba(56, 189, 248, 0.16);

  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.15);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.40);
  --shadow: 0 18px 44px -20px rgba(0, 0, 0, 0.80), 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 44px 90px -34px rgba(0, 0, 0, 0.90), 0 12px 32px rgba(0, 0, 0, 0.45);
  --ring: 0 0 0 3px rgba(129, 140, 248, 0.45);
}

/* ---------------------------------------------------------------- base --- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 640;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 22px;
  line-height: 1.25;
}

h2 {
  font-size: 15px;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-xs);
}

::selection {
  background: var(--accent-soft);
}

/* ------------------------------------------------------------- ambient --- */

.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.aurora::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(40% 44% at 6% -4%, var(--bg-tint-1) 0%, transparent 70%),
    radial-gradient(36% 40% at 102% -2%, var(--bg-tint-2) 0%, transparent 70%),
    radial-gradient(48% 46% at 82% 104%, var(--bg-tint-3) 0%, transparent 72%),
    radial-gradient(42% 42% at -4% 96%, var(--bg-tint-2) 0%, transparent 70%);
  filter: blur(8px);
}

.aurora::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.025) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(80% 60% at 50% 0%, #000 20%, transparent 80%);
}

:root[data-theme="dark"] .aurora::after {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
}

/* --------------------------------------------------------------- topbar --- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 clamp(14px, 3vw, 28px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 680;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: #fff;
  background-color: var(--accent);
  background-image: var(--accent-grad);
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, 0.85);
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.spacer {
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.who {
  max-width: 220px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 520;
  white-space: nowrap;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
}

.chip svg {
  width: 16px;
  height: 16px;
  opacity: 0.75;
}

.chip:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.chip.is-on {
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

/* ------------------------------------------------------------ workspace --- */

.workspace {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: clamp(16px, 2.4vw, 32px);
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(16px, 2.4vw, 28px) clamp(14px, 3vw, 28px) 120px;
}

.sidenav {
  position: sticky;
  top: calc(var(--topbar-h) + 24px);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidenav-label {
  padding: 0 10px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 640;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.spaces {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.space {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 520;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.space svg {
  width: 17px;
  height: 17px;
  opacity: 0.7;
}

.space:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.space.active {
  color: var(--ink);
  background: var(--surface-strong);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.space.active svg {
  color: var(--accent-ink);
  opacity: 1;
}

.space[data-tab="encrypted"].active {
  color: var(--enc);
  background: var(--enc-soft);
  border-color: transparent;
}

.space-note {
  padding: 10px 11px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
}

.content {
  min-width: 0;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.page-head-text {
  min-width: 0;
}

.page-head .lede {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.lede {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
  min-height: 26px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.breadcrumb button {
  padding: 2px 6px;
  color: var(--accent-ink);
  background: none;
  border: 0;
  border-radius: 6px;
  transition: background var(--dur-fast) var(--ease);
}

.breadcrumb button:hover {
  background: var(--accent-soft);
}

.breadcrumb button.current {
  color: var(--ink);
  font-weight: 560;
}

.crumb-sep {
  display: inline-grid;
  place-items: center;
  color: var(--faint);
}

.crumb-sep svg {
  width: 13px;
  height: 13px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* --------------------------------------------------------------- button --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 540;
  white-space: nowrap;
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:hover {
  background: var(--surface-solid);
  border-color: var(--faint);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  color: #fff;
  background-color: var(--accent);
  background-image: var(--accent-grad);
  border-color: transparent;
  box-shadow: 0 8px 20px -10px rgba(79, 70, 229, 0.9);
}

.btn.primary:hover {
  background-color: var(--accent);
  background-image: var(--accent-grad);
  filter: brightness(1.08);
}

.btn.ghost {
  background: transparent;
  border-color: var(--line-strong);
  box-shadow: none;
}

.btn.ghost:hover {
  background: var(--surface-hover);
}

.btn.danger {
  color: var(--danger);
  background: transparent;
  border-color: var(--line-strong);
  box-shadow: none;
}

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

.btn.full {
  width: 100%;
}

.btn.lg {
  height: 44px;
  padding: 0 22px;
  font-size: 14.5px;
}

.btn[disabled],
.btn.is-busy {
  pointer-events: none;
  opacity: 0.65;
}

.btn.is-busy {
  position: relative;
  color: transparent;
}

.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: #fff;
  animation: spin 720ms linear infinite;
}

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

/* ---------------------------------------------------------------- sheet --- */

.sheet {
  overflow: hidden;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(150%);
}

.entries {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 0;
}

.entries thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 620;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--line);
}

.entries tbody td {
  padding: 9px 14px;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

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

.entries tbody tr {
  transition: background var(--dur-fast) var(--ease);
}

.entries tbody tr:hover {
  background: var(--surface-hover);
}

.entries tbody tr.is-selected {
  background: var(--accent-soft);
}

.col-check {
  width: 44px;
}

.col-name {
  width: auto;
  overflow: hidden;
}

.col-size,
.col-time {
  width: 128px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.col-time {
  width: 152px;
}

.col-actions {
  width: 104px;
  text-align: right;
}

.name {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  overflow: hidden;
}

.name-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--muted);
  background: var(--surface-sunken);
  border-radius: 9px;
}

.name-icon svg {
  width: 17px;
  height: 17px;
}

.name-icon.is-dir {
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.name-icon.is-image {
  color: var(--enc);
  background: var(--enc-soft);
}

.name-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.name-text button,
.name-text .label {
  overflow: hidden;
  padding: 0;
  font-size: 13.5px;
  font-weight: 520;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: none;
  border: 0;
}

.name-text .label {
  color: var(--ink);
}

.name-text .folder {
  color: var(--accent-ink);
}

.name-text button:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.name-meta {
  display: none;
  color: var(--muted);
  font-size: 12px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.row-actions .icon-btn {
  width: 32px;
  height: 32px;
  color: var(--muted);
}

.row-actions .icon-btn:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.row-actions .icon-btn.is-primary {
  color: var(--accent-ink);
}

.row-actions .icon-btn.is-primary:hover {
  background: var(--accent-soft);
}

.empty {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 54px 16px;
  color: var(--muted);
  text-align: center;
}

.empty strong {
  color: var(--ink-soft);
  font-weight: 560;
}

/* --------------------------------------------------------------- upload --- */

.uploads {
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
}

.upload-head {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12.5px;
}

.upload-list {
  display: grid;
  gap: 10px;
  max-height: 110px;
  overflow: auto;
  overscroll-behavior: contain;
}

.upload-item {
  display: grid;
  grid-template-columns: minmax(130px, 1.5fr) minmax(110px, 1fr) 150px;
  gap: 14px;
  align-items: center;
  font-size: 13px;
}

.upload-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-meta {
  color: var(--muted);
  font-size: 12.5px;
  text-align: right;
}

.upload-item.done .upload-meta {
  color: var(--ok);
}

.upload-item.failed .upload-meta {
  color: var(--danger);
}

.bar {
  height: 6px;
  overflow: hidden;
  background: var(--surface-sunken);
  border-radius: 999px;
}

.bar > span {
  display: block;
  width: 0;
  height: 100%;
  background-color: var(--accent);
  background-image: var(--accent-grad);
  border-radius: inherit;
  transition: width var(--dur) var(--ease);
}

.upload-item.done .bar > span {
  background: var(--ok);
}

.upload-item.failed .bar > span {
  background: var(--danger);
}

/* ------------------------------------------------------------ selection --- */

.selection {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 8px 10px 8px 16px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
}

.selection-summary {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.selection .btn {
  height: 32px;
  background: var(--surface-solid);
}

.selection .btn.danger {
  color: var(--danger);
}

.selection .btn.danger:hover {
  background: var(--danger-soft);
}

/* --------------------------------------------------------------- toasts --- */

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  color: var(--ink);
  font-size: 13px;
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast::before {
  content: "";
  flex: none;
  width: 6px;
  align-self: stretch;
  background: var(--accent);
  border-radius: 999px;
}

.toast.error::before {
  background: var(--danger);
}

.toast.error {
  border-color: var(--danger);
}

.toast.success::before {
  background: var(--ok);
}

.toast.success {
  border-color: var(--ok);
}

/* -------------------------------------------------------------- overlay --- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 14, 26, 0.52);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade var(--dur) var(--ease);
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.dialog {
  width: min(460px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  padding: 22px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: pop var(--dur) var(--ease);
}

.dialog.wide {
  width: min(760px, 100%);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
}

.dialog h2 {
  margin-bottom: 12px;
  font-size: 16px;
}

.dialog .lede {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.dialog .actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.dialog .actions .spacer {
  flex: 1;
}

.stack {
  display: grid;
  gap: 10px;
}

label.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 540;
}

.conflict-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 520;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input,
select {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xs);
  accent-color: var(--accent);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  padding: 0;
  cursor: pointer;
}

input:hover,
select:hover {
  border-color: var(--faint);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

input::placeholder {
  color: var(--faint);
}

.code-input {
  height: 52px;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-align: center;
}

.secret {
  display: block;
  padding: 9px 11px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12.5px;
  word-break: break-all;
  background: var(--surface-sunken);
  border-radius: var(--radius-xs);
}

.qr {
  width: 190px;
  height: 190px;
  padding: 10px;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.move-list {
  display: grid;
  gap: 3px;
  max-height: 300px;
  overflow: auto;
  margin-top: 10px;
  padding: 6px;
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
}

.move-list button {
  padding: 9px 11px;
  color: var(--ink-soft);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
}

.move-list button:hover {
  color: var(--ink);
  background: var(--surface-strong);
}

.preview {
  max-height: 60vh;
  margin-top: 12px;
  overflow: auto;
  padding: 14px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.preview img {
  display: block;
  max-width: 100%;
  margin: 0 auto;
  border-radius: var(--radius-xs);
}

/* ----------------------------------------------------------------- menu --- */

.menu {
  position: fixed;
  z-index: 95;
  display: grid;
  min-width: 194px;
  padding: 6px;
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  animation: pop var(--dur-fast) var(--ease);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  color: var(--ink-soft);
  font-size: 13px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
}

.menu-item svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.menu-item:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.menu-item.danger {
  color: var(--danger);
}

.menu-item.danger:hover {
  background: var(--danger-soft);
}

.menu-sep {
  height: 1px;
  margin: 5px 6px;
  background: var(--line);
}

/* ------------------------------------------------------------ dropzone --- */

.dropzone {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  pointer-events: none;
  place-items: center;
  padding: 26px;
  background: rgba(10, 14, 26, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

body.dragging .dropzone {
  display: grid;
}

.dropzone-inner {
  display: grid;
  gap: 8px;
  place-items: center;
  width: min(560px, 100%);
  padding: 46px 24px;
  color: var(--ink);
  text-align: center;
  background: var(--surface-strong);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.dropzone-inner svg {
  width: 34px;
  height: 34px;
  color: var(--accent-ink);
}

.dropzone-inner strong {
  font-size: 16px;
}

.dropzone-inner span {
  color: var(--muted);
  font-size: 13px;
}

/* ---------------------------------------------------------------- gate --- */

.gate {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 26px;
}

.gate-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(20px, 3vw, 44px);
  align-items: center;
  width: min(980px, 100%);
}

.gate-wrap.single {
  display: block;
  width: min(440px, 100%);
}

.gate-hero {
  padding: 8px;
}

.gate-hero .brand-mark {
  width: 46px;
  height: 46px;
  margin-bottom: 18px;
  border-radius: 14px;
}

.gate-hero .brand-mark svg {
  width: 24px;
  height: 24px;
}

.gate-hero h1 {
  margin-bottom: 8px;
  font-size: 32px;
  letter-spacing: -0.03em;
}

.gate-hero .lede {
  max-width: 42ch;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 14.5px;
}

.gate-hint {
  margin-top: 12px;
  color: var(--faint);
  font-size: 12px;
}

.gate-card {
  padding: 24px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(var(--blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(150%);
}

.gate-card h2 {
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 620;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.code {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: 0.22em;
  line-height: 1.2;
}

.device-state {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.gate-card .muted {
  margin-top: 14px;
  color: var(--faint);
  font-size: 12.5px;
}

.gate-card .actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  margin-bottom: 14px;
  color: var(--accent-ink);
  font-size: 11.5px;
  font-weight: 620;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--accent-soft);
  border-radius: 999px;
}

.gate-card h1 {
  margin-bottom: 16px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--faint);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.error {
  margin: 14px 0 0;
  padding: 10px 12px;
  color: var(--danger);
  font-size: 13px;
  background: var(--danger-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
}

/* ------------------------------------------------------------- settings --- */

.settings {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 32px) clamp(14px, 3vw, 28px) 80px;
}

.settings-head {
  margin-bottom: 22px;
}

.settings-head .lede {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13.5px;
}

.panel {
  padding: 18px 20px;
  margin-bottom: 14px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(var(--blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(150%);
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel h2 {
  font-size: 15px;
}

.panel .hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.panel .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.factor-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.factor {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-sunken);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.factor-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 10px;
}

.factor-icon svg {
  width: 18px;
  height: 18px;
}

.factor-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.factor-text strong {
  font-size: 13.5px;
  font-weight: 560;
}

.factor-text span {
  color: var(--muted);
  font-size: 12px;
}

.factor .btn {
  margin-left: auto;
}

.vault-card {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: linear-gradient(135deg, var(--accent-soft), var(--enc-soft));
  border-radius: var(--radius);
}

.vault-card .stats {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
}

.vault-card .stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.vault-card .stat b {
  font-size: 17px;
  font-weight: 620;
}

.vault-card .stat span {
  color: var(--muted);
  font-size: 12.5px;
}

.steps {
  display: grid;
  gap: 14px;
}

.step {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.step-label {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 560;
}

/* -------------------------------------------------------------- theme --- */

.theme-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  width: 38px;
  height: 38px;
  color: var(--ink-soft);
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
}

.theme-fab svg {
  width: 17px;
  height: 17px;
}

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

.topbar .icon-btn[data-theme-toggle] svg,
.icon-btn[data-theme-toggle] svg {
  transition: transform var(--dur) var(--ease);
}

/* ---------------------------------------------------------- responsive --- */

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

  .sidenav {
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .sidenav-label,
  .space-note {
    display: none;
  }

  .spaces {
    flex-direction: row;
    padding: 4px;
    background: var(--surface-sunken);
    border-radius: var(--radius-sm);
  }

  .space {
    width: auto;
    padding: 7px 12px;
  }
}

@media (max-width: 760px) {
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
  }

  .toolbar .btn {
    flex: 1;
  }

  .entries thead {
    display: none;
  }

  .entries,
  .entries tbody,
  .entries tr,
  .entries td {
    display: block;
    width: auto;
  }

  .entries tbody tr {
    position: relative;
    padding: 11px 92px 11px 46px;
    border-bottom: 1px solid var(--line);
  }

  .entries tbody tr:last-child {
    border-bottom: 0;
  }

  .entries tbody td {
    padding: 0;
    border: 0;
  }

  .col-check {
    position: absolute;
    top: 15px;
    left: 14px;
    width: auto;
  }

  .col-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    width: auto;
  }

  .entries td.col-size,
  .entries td.col-time {
    display: none;
  }

  .name-meta {
    display: block;
  }

  .upload-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .upload-list {
    max-height: 254px;
  }

  .upload-meta {
    text-align: left;
  }

  .selection {
    right: 12px;
    left: 12px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px;
    border-radius: var(--radius);
    transform: none;
  }

  .selection-summary {
    width: 100%;
    text-align: center;
  }

  .gate-wrap {
    grid-template-columns: minmax(0, 1fr);
  }

  .gate-hero h1 {
    font-size: 27px;
  }

  .gate-card {
    padding: 20px;
  }

  .who {
    display: none;
  }
}

@media (max-width: 560px) {
  .chip span {
    display: none;
  }

  .chip {
    width: 34px;
    padding: 0;
    justify-content: center;
  }
}

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