/* ============================================================
   Volt — design tokens
   ============================================================ */
:root {
  --bg: #080b0e;
  --bg-soft: #0b1014;
  --panel: #0f161b;
  --panel-2: #131d23;
  --panel-3: #18252d;
  --line: rgba(231, 245, 239, 0.08);
  --line-strong: rgba(231, 245, 239, 0.15);
  --text: #edf4f0;
  --muted: #8b9ba3;
  --faint: #617079;
  --accent: #5ee6b0;
  --accent-strong: #2ed39a;
  --accent-ink: #052017;
  --accent-soft: rgba(94, 230, 176, 0.1);
  --warm: #f3b95f;
  --warm-soft: rgba(243, 185, 95, 0.12);
  --danger: #ff7b7b;
  --danger-soft: rgba(255, 123, 123, 0.11);
  --info: #83b9ff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 88% -12%, rgba(94, 230, 176, 0.075), transparent 62%),
    radial-gradient(900px 620px at -12% 108%, rgba(243, 185, 95, 0.05), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(94, 230, 176, 0.24);
  color: #fff;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

a {
  color: var(--accent);
  text-decoration: none;
}

h1,
h2,
h3,
p,
ul,
dl,
dd {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

svg {
  display: block;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
}

.hidden {
  display: none !important;
}

.mono {
  font-family: var(--mono);
}

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

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

.skip-link {
  position: fixed;
  z-index: 200;
  top: -60px;
  left: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  transition: top 0.16s ease;
}

.skip-link:focus {
  top: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.pulse-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(94, 230, 176, 0.1);
  animation: pulse 2.6s ease-in-out infinite;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow-danger {
  color: var(--danger);
}

/* ============================================================
   Shared controls
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

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

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 8px 24px rgba(94, 230, 176, 0.14);
}

.btn-primary:hover {
  background: #78f0c1;
}

.btn-secondary {
  background: var(--panel-3);
  border-color: var(--line-strong);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: rgba(94, 230, 176, 0.4);
  background: #1b2a33;
}

.btn-ghost {
  border-color: var(--line);
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
}

.btn-danger {
  background: var(--danger);
  color: #240708;
}

.btn-danger:hover {
  background: #ff9696;
}

.btn-danger-ghost {
  border-color: rgba(255, 123, 123, 0.25);
  color: var(--danger);
  background: var(--danger-soft);
}

.btn-danger-ghost:hover {
  border-color: rgba(255, 123, 123, 0.5);
  background: rgba(255, 123, 123, 0.16);
}

.btn-block {
  width: 100%;
  min-height: 48px;
  font-size: 14px;
}

.btn-compact {
  min-height: 38px;
  padding: 0 13px;
}

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

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.icon-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
}

.icon-btn-sm {
  width: 30px;
  height: 30px;
}

.icon-btn-sm .icon {
  width: 15px;
  height: 15px;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: color 0.16s ease;
}

.text-btn:hover {
  color: var(--accent);
}

.text-btn .icon {
  width: 15px;
  height: 15px;
}

/* ============================================================
   Auth
   ============================================================ */
.auth-body {
  min-height: 100dvh;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(380px, 0.92fr);
  min-height: 100dvh;
}

.auth-story {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 36px;
  min-height: 100dvh;
  padding: clamp(32px, 4.5vw, 64px);
  overflow: hidden;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(900px 640px at 18% 4%, rgba(94, 230, 176, 0.1), transparent 58%),
    radial-gradient(700px 500px at 100% 100%, rgba(243, 185, 95, 0.06), transparent 60%),
    linear-gradient(155deg, #0a1114 0%, #080c0f 58%, #0a0f12 100%);
}

.story-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(230, 244, 238, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(230, 244, 238, 0.035) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse 90% 72% at 42% 38%, #000 20%, transparent 78%);
  pointer-events: none;
}

.auth-story::after {
  content: "";
  position: absolute;
  right: -180px;
  bottom: -240px;
  width: 620px;
  height: 620px;
  border: 1px solid rgba(94, 230, 176, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgba(94, 230, 176, 0.025), 0 0 0 150px rgba(94, 230, 176, 0.018);
  pointer-events: none;
}

.auth-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 11px;
  background: var(--accent);
  color: #04160f;
  box-shadow: 0 0 30px rgba(94, 230, 176, 0.22);
}

.brand-word {
  font-size: 15px;
  font-weight: 850;
  letter-spacing: 0.26em;
}

.brand-tag {
  padding-left: 12px;
  border-left: 1px solid var(--line-strong);
  color: var(--faint);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.story-copy {
  position: relative;
  z-index: 1;
  margin-top: auto;
}

.story-title {
  margin-top: 20px;
  font-size: clamp(3.1rem, 6.3vw, 6.7rem);
  font-weight: 590;
  line-height: 0.88;
  letter-spacing: -0.07em;
}

.story-title em {
  font-style: normal;
  color: transparent;
  background: linear-gradient(100deg, var(--accent) 8%, #b8f6d9 60%, var(--warm) 130%);
  -webkit-background-clip: text;
  background-clip: text;
}

.story-lead {
  max-width: 48ch;
  margin-top: 26px;
  color: #9aaaa9;
  font-size: clamp(0.95rem, 1.1vw, 1.06rem);
  line-height: 1.65;
}

.story-features {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  max-width: 520px;
  margin-bottom: auto;
}

.story-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  color: #9cadaa;
  font-size: 12.5px;
}

.story-features li svg {
  color: var(--accent);
}

.story-features strong {
  color: var(--text);
  font-weight: 650;
}

.story-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.foot-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--faint);
}

.auth-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: clamp(24px, 4vw, 56px);
  background: rgba(8, 12, 15, 0.5);
}

.auth-card {
  width: min(100%, 440px);
  padding: clamp(24px, 3vw, 36px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.035), transparent 44%),
    rgba(15, 22, 27, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-card-head {
  margin-bottom: 26px;
}

.auth-card-head h2 {
  margin-top: 12px;
  font-size: clamp(1.6rem, 2.2vw, 1.9rem);
  font-weight: 620;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.auth-sub {
  margin-top: 11px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.auth-body[data-mode="login"] #setup-panel,
.auth-body[data-mode="setup"] #login-panel {
  display: none;
}

.auth-body[data-mode="setup"] .auth-card {
  width: min(100%, 470px);
  margin: auto 0;
}

.auth-body[data-mode="setup"] .auth-panel {
  justify-content: flex-start;
  overflow-y: auto;
}

.form-stack {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field > label {
  color: #b9c7c3;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.035em;
}

.label-optional {
  margin-left: 4px;
  color: var(--faint);
  font-weight: 500;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(3, 8, 10, 0.5);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.55;
}

.field select {
  appearance: none;
  padding-right: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #53626a;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(94, 230, 176, 0.55);
  box-shadow: 0 0 0 3px rgba(94, 230, 176, 0.09);
  background: rgba(3, 8, 10, 0.72);
}

.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px #0a1216 inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-out;
}

.input-wrap {
  position: relative;
  display: grid;
}

.input-wrap input {
  padding-left: 42px;
  padding-right: 46px;
}

.input-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  display: grid;
  place-items: center;
  color: var(--faint);
  transform: translateY(-50%);
  pointer-events: none;
}

.input-action {
  position: absolute;
  top: 50%;
  right: 7px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--faint);
  transform: translateY(-50%);
}

.input-action:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.input-action .eye-off {
  display: none;
}

.input-action[aria-pressed="true"] .eye-on {
  display: none;
}

.input-action[aria-pressed="true"] .eye-off {
  display: block;
}

.mono-input {
  font-family: var(--mono);
  font-size: 13px !important;
}

.field-hint {
  color: var(--faint);
  font-size: 11px;
  line-height: 1.5;
}

.strength {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 18px;
}

.strength-bars {
  display: flex;
  gap: 3px;
}

.strength-bars i {
  width: 24px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  transition: background 0.2s ease;
}

.strength[data-score="1"] .strength-bars i:nth-child(-n+1),
.strength[data-score="2"] .strength-bars i:nth-child(-n+2),
.strength[data-score="3"] .strength-bars i:nth-child(-n+3),
.strength[data-score="4"] .strength-bars i:nth-child(-n+4) {
  background: var(--warm);
}

.strength[data-score="3"] .strength-bars i:nth-child(-n+3),
.strength[data-score="4"] .strength-bars i:nth-child(-n+4) {
  background: var(--accent);
}

.strength span {
  color: var(--faint);
  font-size: 11px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
}

.check-row input {
  width: 15px;
  height: 15px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.form-error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}

.form-error:empty {
  min-height: 0;
}

.auth-success {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.auth-success .btn {
  margin-top: 6px;
}

.auth-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.6;
}

.auth-note svg {
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--faint);
}

.auth-status {
  min-height: 0;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.auth-status:empty {
  display: none;
}

.auth-status.warn {
  padding: 8px 10px;
  border: 1px solid rgba(243, 185, 95, 0.22);
  border-radius: 8px;
  background: var(--warm-soft);
  color: var(--warm);
  font-size: 11px;
}

.auth-legal {
  margin-top: 24px;
  color: #4e5c63;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}

/* ============================================================
   App shell
   ============================================================ */
.app-body {
  height: 100dvh;
  overflow: hidden;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 64px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 12, 15, 0.82);
  backdrop-filter: blur(18px);
}

.brand-small {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  color: var(--text);
}

.brand-small .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  box-shadow: none;
}

.brand-small .brand-word {
  font-size: 13px;
}

.topbar-menu {
  display: none;
}

.searchbox {
  position: relative;
  flex: 1 1 auto;
  max-width: 560px;
  min-width: 160px;
}

.searchbox input {
  width: 100%;
  height: 38px;
  padding: 0 74px 0 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.028);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.searchbox input::placeholder {
  color: #5c6b72;
}

.searchbox input:focus {
  border-color: rgba(94, 230, 176, 0.4);
  background: rgba(255, 255, 255, 0.045);
}

.searchbox input::-webkit-search-cancel-button {
  filter: invert(0.6);
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--faint);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-kbd {
  position: absolute;
  top: 50%;
  right: 9px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #59676e;
  font-family: var(--mono);
  font-size: 9px;
  transform: translateY(-50%);
  pointer-events: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.app-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  height: calc(100dvh - 64px);
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px 14px 14px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 28%),
    rgba(10, 15, 19, 0.58);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 10px;
}

.sidebar-title {
  color: var(--faint);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 2px;
}

.nav-item,
.folder-select {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 36px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #91a09f;
  font-size: 12.5px;
  text-align: left;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.nav-item:hover,
.folder-select:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}

.nav-item.active,
.folder-select.active {
  color: var(--text);
  border-color: var(--line);
  background: linear-gradient(90deg, rgba(94, 230, 176, 0.09), rgba(255, 255, 255, 0.025));
}

.nav-item.active .icon,
.folder-select.active .icon {
  color: var(--accent);
}

.nav-item .icon,
.folder-select .icon {
  width: 16px;
  height: 16px;
  color: var(--faint);
}

.nav-item span:nth-child(2),
.folder-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-count,
.folder-count {
  margin-left: auto;
  color: #617077;
  font-family: var(--mono);
  font-size: 10px;
}

.folder-tree {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 14px;
  padding-top: 12px;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.folder-tree-empty {
  padding: 10px 9px;
  color: var(--faint);
  font-size: 11px;
}

.folder-row {
  display: flex;
  align-items: center;
  gap: 1px;
  min-height: 34px;
  border-radius: 8px;
}

.folder-row:hover .folder-more {
  opacity: 1;
}

.folder-toggle {
  display: grid;
  place-items: center;
  width: 22px;
  height: 28px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #5c6a71;
}

.folder-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.folder-toggle .icon {
  width: 12px;
  height: 12px;
  transition: transform 0.16s ease;
}

.folder-row.expanded .folder-toggle .icon {
  transform: rotate(90deg);
}

.folder-toggle.is-empty {
  visibility: hidden;
}

.folder-row .folder-select {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 32px;
  padding-left: 4px;
}

.folder-more {
  width: 26px;
  height: 28px;
  flex: 0 0 auto;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.folder-more .icon {
  width: 14px;
  height: 14px;
}

.folder-row.depth-1 {
  padding-left: 10px;
}

.folder-row.depth-2 {
  padding-left: 20px;
}

.folder-row.depth-3 {
  padding-left: 30px;
}

.folder-row.depth-4 {
  padding-left: 40px;
}

.folder-row.depth-5 {
  padding-left: 50px;
}

.folder-row.depth-6 {
  padding-left: 60px;
}

.folder-row.depth-7 {
  padding-left: 70px;
}

.folder-row.depth-8 {
  padding-left: 80px;
}

.sidebar-foot {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px 8px 2px;
  border-top: 1px solid var(--line);
}

.security-chip {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(94, 230, 176, 0.035);
}

.security-chip strong {
  display: block;
  color: #afc5be;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
}

.security-chip small {
  display: block;
  margin-top: 3px;
  color: var(--faint);
  font-size: 9.5px;
}

.sidebar-backdrop {
  display: none;
}

.main {
  min-width: 0;
  overflow-y: auto;
  padding: clamp(24px, 3.6vw, 44px);
  scroll-behavior: smooth;
}

.view {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  animation: fade-up 0.3s var(--ease) both;
}

/* ============================================================
   Home / entry cards
   ============================================================ */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.page-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.page-title {
  margin-top: 9px;
  font-size: clamp(1.65rem, 2.6vw, 2.35rem);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.045em;
}

.page-sub {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.page-actions {
  display: flex;
  gap: 7px;
  flex: 0 0 auto;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(286px, 1fr));
  gap: 12px;
}

.entry-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.028), transparent 44%),
    var(--panel);
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.entry-card::before {
  content: "";
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 0;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--type-accent, var(--accent));
  opacity: 0.75;
}

.entry-card:hover {
  border-color: rgba(94, 230, 176, 0.3);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.04), transparent 44%),
    #111a20;
  transform: translateY(-2px);
}

.entry-card.type-password {
  --type-accent: #5ee6b0;
}

.entry-card.type-token {
  --type-accent: #f3b95f;
}

.entry-card.type-note {
  --type-accent: #83b9ff;
}

.entry-card.is-expired {
  opacity: 0.72;
}

.entry-card.is-expired:hover {
  opacity: 0.92;
}

.entry-expired {
  padding: 2px 6px;
  border: 1px solid rgba(255, 123, 123, 0.28);
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.entry-card-link {
  display: block;
  flex: 1 1 auto;
  padding: 17px 18px 12px 20px;
  color: inherit;
}

.entry-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.entry-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--type-accent, var(--accent)) 24%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--type-accent, var(--accent)) 9%, transparent);
  color: var(--type-accent, var(--accent));
}

.entry-icon .icon {
  width: 16px;
  height: 16px;
}

.entry-type {
  color: var(--faint);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.entry-folder {
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  color: #5f7077;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-name {
  margin-top: 14px;
  overflow: hidden;
  font-size: 15px;
  font-weight: 620;
  line-height: 1.3;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-username {
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px 9px 20px;
  border-top: 1px solid var(--line);
}

.entry-updated {
  color: #58666d;
  font-size: 9.5px;
  white-space: nowrap;
}

.entry-actions {
  display: flex;
  gap: 1px;
}

.entry-actions .icon-btn {
  width: 30px;
  height: 30px;
  color: #6b7a81;
}

.entry-actions .icon-btn .icon {
  width: 14px;
  height: 14px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 380px;
  padding: 48px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.012);
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--accent-soft);
  color: var(--accent);
}

.empty-icon .icon {
  width: 28px;
  height: 28px;
}

.empty-title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.empty-text {
  max-width: 380px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.empty-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(286px, 1fr));
  gap: 12px;
}

.skeleton-card {
  height: 164px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
  position: relative;
}

.skeleton-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.04) 48%, transparent 76%);
  animation: shimmer 1.5s infinite;
}

.skeleton-line {
  height: 10px;
  margin: 20px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

/* ============================================================
   Detail
   ============================================================ */
.detail {
  width: 100%;
  max-width: 920px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.back-link:hover {
  color: var(--accent);
}

.back-link .icon {
  width: 15px;
  height: 15px;
}

.detail-hero {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(600px 180px at 0% 0%, rgba(94, 230, 176, 0.075), transparent 70%),
    linear-gradient(155deg, rgba(255, 255, 255, 0.03), transparent 42%),
    var(--panel);
}

.detail-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--type-accent, var(--accent)) 26%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--type-accent, var(--accent)) 10%, transparent);
  color: var(--type-accent, var(--accent));
}

.detail-icon .icon {
  width: 23px;
  height: 23px;
}

.detail-hero.type-password {
  --type-accent: #5ee6b0;
}

.detail-hero.type-token {
  --type-accent: #f3b95f;
}

.detail-hero.type-note {
  --type-accent: #83b9ff;
}

.detail-title-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.folder-path {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.folder-path .icon {
  width: 12px;
  height: 12px;
}

.detail-title {
  margin-top: 7px;
  overflow-wrap: anywhere;
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.detail-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  color: var(--faint);
  font-size: 10.5px;
}

.detail-meta-line .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #4b585f;
}

.detail-actions {
  display: flex;
  gap: 2px;
  flex: 0 0 auto;
}

.detail-body {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.link-callout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid rgba(94, 230, 176, 0.18);
  border-radius: 11px;
  background: var(--accent-soft);
}

.link-callout > .icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--accent);
}

.link-callout-text {
  flex: 1 1 auto;
  min-width: 0;
}

.link-callout-text strong {
  display: block;
  color: #b7d4c9;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.link-callout-text code {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: #a9beb7;
  font-family: var(--mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
}

.detail-row {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.detail-row:last-child {
  border-bottom: 0;
}

.detail-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.detail-label .icon {
  width: 14px;
  height: 14px;
}

.detail-value {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #d5e0dc;
  font-size: 13px;
  line-height: 1.5;
}

.detail-value.mono {
  font-family: var(--mono);
  font-size: 12px;
}

.detail-value a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--info);
}

.detail-value a .icon {
  width: 12px;
  height: 12px;
}

.detail-value-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.secret-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.secret-text {
  min-width: 0;
  overflow: hidden;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12.5px;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.secret-text.is-masked {
  color: #63736f;
  letter-spacing: 0.16em;
}

.secret-timer {
  color: var(--faint);
  font-size: 9.5px;
  white-space: nowrap;
}

.notes-head {
  padding: 13px 16px 0;
}

.notes-block {
  padding: 10px 16px 17px;
  color: #bcc9c5;
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.meta-item {
  padding: 12px 14px;
  background: var(--panel);
}

.meta-item dt {
  color: var(--faint);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-item dd {
  margin-top: 5px;
  color: #c8d5d1;
  font-size: 11.5px;
}

.danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 123, 123, 0.16);
  border-radius: 12px;
  background: rgba(255, 123, 123, 0.035);
}

.danger-row strong {
  display: block;
  color: #d9b6b6;
  font-size: 12px;
  font-weight: 600;
}

.danger-row p {
  margin-top: 3px;
  color: #806d6d;
  font-size: 10.5px;
}

/* ============================================================
   Dialogs / forms
   ============================================================ */
dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: min(86dvh, 900px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: #0f161b;
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog[open] {
  display: flex;
  flex-direction: column;
  animation: dialog-in 0.22s var(--ease) both;
}

dialog::backdrop {
  background: rgba(2, 5, 7, 0.72);
  backdrop-filter: blur(6px);
}

.dialog-lg {
  width: min(720px, calc(100vw - 32px));
}

.dialog-md {
  width: min(560px, calc(100vw - 32px));
}

.dialog-sm {
  width: min(460px, calc(100vw - 32px));
}

dialog > form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 17px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin-top: 7px;
  font-size: 20px;
  font-weight: 620;
  letter-spacing: -0.035em;
}

.dialog-head .eyebrow {
  font-size: 9px;
}

.dialog-head .icon-btn {
  margin: -3px -5px 0 0;
}

.dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 22px;
  overflow-y: auto;
}

.dialog-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 15px 22px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.12);
}

.dialog-foot-split {
  justify-content: space-between;
}

.dialog-foot-right {
  display: flex;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.span-2 {
  grid-column: span 2;
}

.form-grid-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 2px;
}

.form-grid-foot .form-error {
  flex: 1 1 auto;
}

.field-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.field-actions .field-hint {
  margin-left: auto;
}

.token-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.018);
}

.token-form .field {
  gap: 6px;
}

.token-form .field input,
.token-form .field select {
  min-height: 38px;
  font-size: 12px;
}

.token-form .field select {
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px;
}

.token-create {
  grid-column: span 2;
  min-height: 38px;
  padding: 0 12px;
}

.token-list {
  display: grid;
  gap: 7px;
}

.token-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.016);
}

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

.token-name-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.token-name {
  overflow: hidden;
  color: #d2ded9;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-write {
  border-color: rgba(243, 185, 95, 0.24);
  background: var(--warm-soft);
  color: var(--warm);
}

.badge-read {
  border-color: rgba(94, 230, 176, 0.2);
  background: var(--accent-soft);
  color: var(--accent);
}

.token-prefix {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.token-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  margin-top: 4px;
  color: #5f6d74;
  font-size: 9px;
}

.token-empty {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--faint);
  font-size: 11.5px;
  text-align: center;
}

.team-row {
  align-items: center;
}

.team-login {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9.5px;
}

.team-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.team-role-select {
  height: 30px;
  max-width: 126px;
  padding: 0 24px 0 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background-color: var(--panel-2);
  color: var(--muted);
  font-size: 9.5px;
  outline: none;
}

.team-role-owner {
  border-color: rgba(243, 185, 95, 0.26);
  background: var(--warm-soft);
  color: var(--warm);
}

.team-role-admin {
  border-color: rgba(131, 185, 255, 0.24);
  background: rgba(131, 185, 255, 0.09);
  color: var(--info);
}

.team-role-member {
  border-color: rgba(94, 230, 176, 0.22);
  background: var(--accent-soft);
  color: var(--accent);
}

.team-role-viewer {
  border-color: var(--line);
  color: var(--muted);
}

@media (max-width: 560px) {
  .team-row {
    flex-wrap: wrap;
  }

  .team-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

.totp-uri {
  display: flex;
  width: fit-content;
  margin: 10px 0 18px;
  color: var(--accent);
  font-size: 11px;
}

#totp-password-field + .field {
  margin-top: 8px;
}

.token-reveal {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 13px 13px 13px 15px;
  border: 1px solid rgba(94, 230, 176, 0.28);
  border-radius: 11px;
  background: rgba(94, 230, 176, 0.055);
}

.token-reveal code {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}

.code-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 13px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.code-hint code {
  overflow: hidden;
  color: #aebdb8;
  font-family: var(--mono);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-body {
  display: grid;
  gap: 28px;
}

.settings-section {
  display: grid;
  gap: 13px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-head h3 {
  font-size: 14px;
  font-weight: 620;
  letter-spacing: -0.015em;
}

.section-head p {
  max-width: 56ch;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.section-head code {
  color: #b8c8c2;
  font-family: var(--mono);
  font-size: 10.5px;
}

.settings-about {
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--line);
}

.meta-grid > div {
  padding: 10px 12px;
  background: var(--panel);
}

.meta-grid dt {
  color: var(--faint);
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-grid dd {
  margin-top: 4px;
  color: #c7d4d0;
  font-family: var(--mono);
  font-size: 10.5px;
}

.settings-danger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 123, 123, 0.14);
  border-radius: 10px;
  background: rgba(255, 123, 123, 0.03);
}

.settings-danger strong {
  display: block;
  color: #d7bcbc;
  font-size: 11.5px;
  font-weight: 600;
}

.settings-danger p {
  margin-top: 3px;
  color: #806e6e;
  font-size: 10px;
}

.confirm-text {
  color: #aebbb7;
  font-size: 13px;
  line-height: 1.65;
}

/* ============================================================
   Toasts
   ============================================================ */
.toasts {
  position: fixed;
  z-index: 300;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(380px, calc(100vw - 36px));
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #162128;
  color: #dce8e3;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  font-size: 12px;
  line-height: 1.4;
  animation: toast-in 0.22s var(--ease) both;
  pointer-events: auto;
}

.toast .icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--accent);
}

.toast-error {
  border-color: rgba(255, 123, 123, 0.3);
  background: #221517;
}

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

.toast.is-leaving {
  animation: toast-out 0.2s ease both;
}

/* ============================================================
   Misc states
   ============================================================ */
.loading-state {
  display: grid;
  gap: 12px;
}

.route-error {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  max-width: 460px;
  margin: 10vh auto 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.route-error .empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 0 4px;
}

.route-error h1 {
  font-size: 20px;
  letter-spacing: -0.03em;
}

.route-error p {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.callout {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.callout .icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--warm);
}

.callout-danger {
  border-color: rgba(255, 123, 123, 0.22);
  background: var(--danger-soft);
  color: #d7b5b5;
}

.callout-danger .icon {
  color: var(--danger);
}

/* ============================================================
   Audit
   ============================================================ */
.audit-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--line);
}

.audit-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  background: var(--panel);
}

.audit-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--faint);
}

.audit-dot.audit-danger {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.audit-dot.audit-warn {
  background: var(--warm);
  box-shadow: 0 0 0 3px var(--warm-soft);
}

.audit-dot.audit-accent {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.audit-main {
  min-width: 0;
}

.audit-event {
  color: #d2ded9;
  font-size: 11.5px;
  font-weight: 600;
}

.audit-meta {
  margin-top: 3px;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.45;
}

.share-status-active {
  border-color: rgba(94, 230, 176, 0.24);
  background: var(--accent-soft);
  color: var(--accent);
}

.share-status-used,
.share-status-revoked {
  border-color: var(--line);
  color: var(--faint);
}

/* ============================================================
   One-time share page
   ============================================================ */
.share-body {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 28px 18px;
  background:
    radial-gradient(800px 500px at 50% 0%, rgba(94, 230, 176, 0.07), transparent 65%),
    var(--bg);
}

.share-shell {
  display: grid;
  gap: 18px;
  width: min(100%, 590px);
  margin: auto;
}

.share-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: var(--text);
}

.share-brand .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  box-shadow: none;
}

.share-card {
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.035), transparent 42%),
    var(--panel);
  box-shadow: var(--shadow);
}

.share-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 0;
  color: var(--muted);
  font-size: 13px;
}

.share-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.share-invalid {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.share-invalid .empty-icon {
  margin-bottom: 8px;
}

.share-invalid h1,
.share-content h1 {
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  font-weight: 620;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.share-invalid p {
  max-width: 42ch;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.share-hint {
  color: var(--faint) !important;
  font-size: 11px !important;
}

.share-heading {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-top: 14px;
}

.share-title-wrap {
  min-width: 0;
}

.share-folder {
  color: var(--faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.share-meta {
  margin-top: 6px;
  color: var(--faint);
  font-size: 10.5px;
}

.share-fields {
  display: grid;
  gap: 1px;
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--line);
}

.share-field {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  background: rgba(0, 0, 0, 0.12);
}

.share-field .detail-label {
  font-size: 9px;
}

.share-field code {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #d5e0dc;
  font-family: var(--mono);
  font-size: 12px;
}

.share-secret {
  color: var(--accent) !important;
  word-break: break-all;
}

.share-secret.is-masked {
  color: var(--faint) !important;
  letter-spacing: 0.16em;
}

.share-field-actions {
  display: flex;
  gap: 10px;
}

.share-timer {
  grid-column: 2 / -1;
  color: var(--faint);
  font-size: 9px;
}

.share-notes {
  grid-column: 2 / -1;
  color: #bcc9c5;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.share-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 18px;
  padding: 11px 12px;
  border: 1px solid rgba(243, 185, 95, 0.18);
  border-radius: 9px;
  background: var(--warm-soft);
  color: #c4ad8b;
  font-size: 10.5px;
  line-height: 1.55;
}

.share-warning svg {
  flex: 0 0 auto;
  color: var(--warm);
}

.share-foot {
  color: #4e5c63;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.07em;
  text-align: center;
  text-transform: uppercase;
}

.share-toast {
  position: fixed;
  z-index: 200;
  right: 18px;
  bottom: 18px;
  animation: toast-in 0.2s ease both;
}

@media (max-width: 560px) {
  .share-field {
    grid-template-columns: 1fr auto;
  }

  .share-field .detail-label {
    grid-column: span 2;
  }

  .share-field-actions {
    grid-column: 2;
  }

  .share-timer {
    grid-column: span 2;
  }

  .share-notes {
    grid-column: span 2;
  }
}

.clipboard-helper {
  position: fixed;
  top: -1000px;
  left: -1000px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1020px) {
  .auth-shell {
    grid-template-columns: minmax(0, 0.9fr) minmax(370px, 1.1fr);
  }

  .story-title {
    font-size: clamp(2.8rem, 6vw, 4.4rem);
  }

  .token-form {
    grid-template-columns: 1fr 1fr;
  }

  .token-create {
    grid-column: span 2;
  }
}

@media (max-width: 860px) {
  .auth-shell {
    display: block;
  }

  .auth-story {
    min-height: 0;
    gap: 20px;
    padding: 26px 22px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .auth-story::after,
  .story-grid,
  .story-features,
  .story-foot {
    display: none;
  }

  .story-copy {
    margin-top: 0;
  }

  .story-title {
    margin-top: 12px;
    font-size: clamp(2.2rem, 8vw, 3.1rem);
  }

  .story-title br {
    display: none;
  }

  .story-lead {
    margin-top: 12px;
    font-size: 12.5px;
  }

  .auth-panel {
    min-height: auto;
    padding: 24px 18px 40px;
  }

  .auth-card {
    padding: 24px 20px;
  }

  .auth-body[data-mode="setup"] .auth-panel {
    padding-top: 18px;
  }

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

  .topbar {
    gap: 10px;
    padding: 0 12px;
  }

  .topbar-menu {
    display: inline-grid;
  }

  .brand-small .brand-word {
    display: none;
  }

  .searchbox {
    max-width: none;
  }

  .search-kbd {
    display: none;
  }

  .searchbox input {
    padding-right: 12px;
  }

  .sidebar {
    position: fixed;
    z-index: 60;
    top: 64px;
    bottom: 0;
    left: 0;
    width: min(300px, 86vw);
    border-right: 1px solid var(--line-strong);
    background: #0b1115;
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.42);
    transform: translateX(-104%);
    transition: transform 0.24s var(--ease);
  }

  .app-body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 50;
    inset: 64px 0 0;
    display: block;
    background: rgba(2, 5, 7, 0.62);
    backdrop-filter: blur(3px);
  }

  .sidebar-backdrop[hidden] {
    display: none !important;
  }

  .main {
    padding: 22px 16px 40px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .page-actions {
    width: 100%;
  }

  .entry-grid,
  .skeleton-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .detail-hero {
    flex-wrap: wrap;
    padding: 18px;
  }

  .detail-actions {
    margin-left: 64px;
  }

  .detail-row {
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
    padding: 12px 14px;
  }

  .detail-label {
    grid-column: span 2;
  }

  .detail-value {
    grid-column: 1;
  }

  .detail-value-actions {
    grid-column: 2;
  }

  .link-callout {
    align-items: flex-start;
  }

  .token-form {
    grid-template-columns: 1fr;
  }

  .token-create {
    grid-column: auto;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .form-grid-foot {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .topbar {
    height: 58px;
  }

  .app-shell {
    height: calc(100dvh - 58px);
  }

  .sidebar {
    top: 58px;
  }

  .sidebar-backdrop {
    inset: 58px 0 0;
  }

  .btn-text {
    display: none;
  }

  .btn-compact {
    width: 38px;
    padding: 0;
  }

  .topbar-actions {
    gap: 1px;
  }

  .searchbox {
    min-width: 0;
  }

  .searchbox input {
    font-size: 12px;
  }

  .entry-grid,
  .skeleton-grid {
    grid-template-columns: 1fr;
  }

  .page-title {
    font-size: 1.55rem;
  }

  .detail-hero {
    gap: 12px;
  }

  .detail-icon {
    width: 40px;
    height: 40px;
  }

  .detail-actions {
    margin-left: 52px;
  }

  .link-callout {
    flex-wrap: wrap;
  }

  .link-callout .btn {
    width: 100%;
  }

  .danger-row,
  .settings-danger {
    align-items: flex-start;
    flex-direction: column;
  }

  .token-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .dialog-head,
  .dialog-body,
  .dialog-foot {
    padding-left: 16px;
    padding-right: 16px;
  }

  dialog {
    width: calc(100vw - 20px);
    border-radius: 14px;
  }

  .dialog-lg,
  .dialog-md,
  .dialog-sm {
    width: calc(100vw - 20px);
  }
}

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

/* ============================================================
   Animations
   ============================================================ */
@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(94, 230, 176, 0.1);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(94, 230, 176, 0.03);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.988);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

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