:root {
  --bg: #080716;
  --panel: rgba(18, 16, 40, 0.92);
  --panel-soft: rgba(32, 27, 66, 0.92);
  --text: #f7f3ff;
  --muted: #a7a0c7;
  --line: rgba(154, 126, 255, 0.22);
  --primary: #8b5cf6;
  --primary-dark: #6d28d9;
  --accent: #22d3ee;
  --warning: #f59e0b;
  --danger: #f43f5e;
  --success: #34d399;
  --shadow: 0 18px 50px rgba(4, 3, 18, 0.42);
  --app-width: 520px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

:root[data-theme="ink"] {
  --bg: #eef3ec;
  --panel: rgba(250, 252, 246, 0.9);
  --panel-soft: rgba(232, 241, 226, 0.88);
  --text: #1f2d28;
  --muted: #65766c;
  --line: rgba(50, 96, 78, 0.22);
  --primary: #2f8f74;
  --primary-dark: #1f6f5f;
  --accent: #b88a3d;
  --warning: #a16207;
  --danger: #b91c1c;
  --success: #2f8f74;
  --shadow: 0 18px 42px rgba(37, 64, 50, 0.18);
}

:root[data-theme="ink"] body {
  background:
    radial-gradient(circle at 18% 10%, rgba(190, 218, 196, 0.6), transparent 30%),
    linear-gradient(145deg, rgba(47, 143, 116, 0.14), transparent 32%),
    linear-gradient(225deg, rgba(184, 138, 61, 0.12), transparent 36%),
    var(--bg);
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(139, 92, 246, 0.24), transparent 30%),
    linear-gradient(225deg, rgba(34, 211, 238, 0.12), transparent 34%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.auth-page {
  width: min(100%, var(--app-width));
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: 260px minmax(0, 1fr);
  background: #0f0d24;
  box-shadow: 0 0 0 1px rgba(154, 126, 255, 0.18), 0 28px 80px rgba(0, 0, 0, 0.38);
}

:root[data-theme="ink"] .auth-page,
:root[data-theme="ink"] .app-shell {
  background:
    linear-gradient(180deg, rgba(47, 143, 116, 0.08), transparent 240px),
    repeating-linear-gradient(110deg, rgba(31, 45, 40, 0.035) 0 1px, transparent 1px 34px),
    #f7f8f2;
  box-shadow: 0 0 0 1px rgba(50, 96, 78, 0.16), 0 28px 70px rgba(37, 64, 50, 0.2);
}

.auth-visual {
  position: relative;
  overflow: hidden;
  padding: 26px 22px;
  display: flex;
  align-items: flex-end;
  background:
    linear-gradient(180deg, rgba(10, 8, 28, 0.1), rgba(10, 8, 28, 0.88)),
    linear-gradient(120deg, rgba(139, 92, 246, 0.58), rgba(34, 211, 238, 0.2) 46%, rgba(10, 8, 28, 0.8)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 28px);
}

:root[data-theme="ink"] .auth-visual {
  background:
    linear-gradient(180deg, rgba(15, 32, 28, 0.02), rgba(15, 32, 28, 0.62)),
    radial-gradient(circle at 20% 20%, rgba(250, 252, 246, 0.75), transparent 24%),
    linear-gradient(135deg, rgba(47, 143, 116, 0.45), rgba(192, 218, 198, 0.34) 46%, rgba(31, 45, 40, 0.76)),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 42px);
}

.auth-copy {
  max-width: 680px;
  color: #fff;
}

:root[data-theme="ink"] .auth-copy {
  color: #f9fbf4;
  text-shadow: 0 2px 18px rgba(31, 45, 40, 0.36);
}

:root[data-theme="ink"] .auth-copy p {
  color: rgba(249, 251, 244, 0.88);
}

.auth-copy h1 {
  margin: 0 0 10px;
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: 0;
}

.auth-copy p {
  margin: 0;
  max-width: 620px;
  color: rgba(247, 243, 255, 0.82);
  font-size: 15px;
  line-height: 1.7;
}

.auth-panel {
  display: flex;
  align-items: flex-start;
  background: #100e25;
  padding: 24px 20px 34px;
}

:root[data-theme="ink"] .auth-panel {
  background: rgba(250, 252, 246, 0.94);
}

.auth-card {
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #a78bfa, #7c3aed 54%, #22d3ee);
  border-radius: 8px;
  font-weight: 800;
  box-shadow: 0 0 26px rgba(139, 92, 246, 0.48);
}

:root[data-theme="ink"] .brand-mark {
  background: linear-gradient(135deg, #6fb69b, #2f8f74 55%, #b88a3d);
  box-shadow: 0 0 24px rgba(47, 143, 116, 0.34);
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.auth-theme {
  margin: -6px 0 18px;
  display: grid;
  gap: 10px;
}

.auth-theme-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.auth-theme-title strong {
  color: var(--text);
  font-size: 13px;
}

.auth-tabs,
.view-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 7, 22, 0.72);
}

.auth-tabs button,
.view-tabs button {
  flex: 1;
  border: 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.auth-tabs button.active,
.view-tabs button.active {
  color: var(--text);
  background: rgba(139, 92, 246, 0.22);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.28), 0 0 18px rgba(139, 92, 246, 0.18);
}

:root[data-theme="ink"] .auth-tabs,
:root[data-theme="ink"] .view-tabs {
  background: rgba(232, 241, 226, 0.74);
}

:root[data-theme="ink"] .auth-tabs button.active,
:root[data-theme="ink"] .view-tabs button.active {
  background: rgba(255, 255, 250, 0.78);
  box-shadow: inset 0 0 0 1px rgba(47, 143, 116, 0.22), 0 8px 18px rgba(37, 64, 50, 0.08);
}

.form {
  margin-top: 22px;
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: #d8d1ff;
  font-size: 14px;
  font-weight: 650;
}

:root[data-theme="ink"] .field label,
:root[data-theme="ink"] .section-title,
:root[data-theme="ink"] .detail-header strong {
  color: #28453b;
}

.input,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 13px;
  background: rgba(8, 7, 22, 0.78);
  color: var(--text);
  outline: none;
}

:root[data-theme="ink"] .input,
:root[data-theme="ink"] .textarea {
  background: rgba(255, 255, 250, 0.78);
  color: var(--text);
}

.textarea {
  min-height: 126px;
  resize: vertical;
  line-height: 1.65;
}

.input:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.22), 0 0 24px rgba(139, 92, 246, 0.18);
}

.input::placeholder,
.textarea::placeholder {
  color: rgba(167, 160, 199, 0.76);
}

.btn {
  border: 0;
  border-radius: 8px;
  padding: 11px 15px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed 58%, #5b21b6);
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  touch-action: manipulation;
}

:root[data-theme="ink"] .btn {
  background: linear-gradient(135deg, #6fb69b, #2f8f74 58%, #1f6f5f);
}

:root[data-theme="ink"] .btn:hover {
  background: linear-gradient(135deg, #7fc4a9, #3a9d81 58%, #267c69);
}

:root[data-theme="ink"] .btn.secondary,
:root[data-theme="ink"] .plain-btn {
  background: rgba(255, 255, 250, 0.72);
  color: var(--primary-dark);
}

.btn:hover {
  background: linear-gradient(135deg, #c4b5fd, #8b5cf6 58%, #6d28d9);
}

.btn.secondary {
  border: 1px solid var(--line);
  background: rgba(18, 16, 40, 0.78);
  color: var(--text);
}

.btn.secondary:hover {
  background: var(--panel-soft);
}

.btn.compact {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 13px;
}

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

.btn.danger:hover {
  background: #991b1b;
}

.btn.danger-outline {
  border-color: rgba(244, 63, 94, 0.5);
  color: #fecdd3;
}

.btn.danger-outline:hover {
  background: rgba(244, 63, 94, 0.16);
}

:root[data-theme="ink"] .btn.danger-outline {
  border-color: rgba(185, 28, 28, 0.36);
  color: #8f1d1d;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.btn[hidden] {
  display: none;
}

.force-update-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.force-update-actions[hidden] {
  display: none;
}

.update-progress {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid rgba(34, 211, 238, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.1), rgba(139, 92, 246, 0.14)),
    rgba(8, 7, 22, 0.52);
}

.update-progress[hidden] {
  display: none;
}

:root[data-theme="ink"] .update-progress {
  border-color: rgba(47, 143, 116, 0.26);
  background:
    linear-gradient(135deg, rgba(47, 143, 116, 0.12), rgba(184, 138, 61, 0.12)),
    rgba(250, 252, 246, 0.72);
}

.update-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.update-progress-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
  animation: statusPulse 1.1s ease-in-out infinite;
}

.update-progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

:root[data-theme="ink"] .update-progress-track {
  background: rgba(31, 45, 40, 0.12);
}

.update-progress-track span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--accent), var(--primary));
  animation: progressSweep 1.35s ease-in-out infinite;
}

@keyframes progressSweep {
  0% {
    transform: translateX(-115%);
  }

  100% {
    transform: translateX(260%);
  }
}

@keyframes statusPulse {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.86);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.app-shell {
  width: min(100%, var(--app-width));
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  background:
    linear-gradient(180deg, rgba(139, 92, 246, 0.12), transparent 220px),
    repeating-linear-gradient(90deg, rgba(154, 126, 255, 0.06) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(0deg, rgba(34, 211, 238, 0.035) 0 1px, transparent 1px 28px),
    #0b0a1d;
  box-shadow: 0 0 0 1px rgba(154, 126, 255, 0.18), 0 28px 80px rgba(0, 0, 0, 0.38);
}

.h5-shell {
  display: flex;
  flex-direction: column;
}

.mobile-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 68px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(154, 126, 255, 0.2);
  background: rgba(13, 11, 31, 0.86);
  backdrop-filter: blur(16px);
}

:root[data-theme="ink"] .mobile-header,
:root[data-theme="ink"] .bottom-nav {
  background: rgba(250, 252, 246, 0.86);
  border-color: rgba(50, 96, 78, 0.18);
}

.mobile-header .brand {
  margin: 0;
}

.mobile-header .brand-mark {
  width: 36px;
  height: 36px;
}

.plain-btn {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--primary-dark);
  background: rgba(139, 92, 246, 0.16);
  color: #ddd6fe;
  font-weight: 800;
}

.plain-btn:active,
.nav-btn:active,
.btn:active {
  transform: translateY(1px);
}

.sidebar {
  padding: 24px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
}

.side-nav {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.nav-btn {
  border: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-weight: 650;
}

.nav-btn:hover,
.nav-btn.active {
  background: rgba(139, 92, 246, 0.18);
  color: #f4f0ff;
}

.side-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.main {
  min-width: 0;
  flex: 1;
  padding: 18px 16px calc(92px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 16px;
}

.topbar h2 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.panel {
  background: rgba(18, 16, 40, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

:root[data-theme="ink"] .panel,
:root[data-theme="ink"] .note-card {
  background:
    linear-gradient(135deg, rgba(255, 255, 250, 0.9), rgba(237, 246, 232, 0.84)),
    var(--panel);
  border-color: rgba(50, 96, 78, 0.18);
}

.panel-header {
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-header h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-body {
  padding: 16px;
}

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 8px;
  color: #fde68a;
  line-height: 1.55;
  font-size: 14px;
}

:root[data-theme="ink"] .consent {
  background: rgba(184, 138, 61, 0.1);
  border-color: rgba(184, 138, 61, 0.24);
  color: #6f4f16;
}

.recorder {
  display: grid;
  gap: 18px;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 48px;
  font-weight: 800;
  letter-spacing: 0;
}

.recorder-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 650;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #6b638e;
}

.dot.live {
  background: var(--accent);
  animation: pulse 1.1s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.34);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(220, 38, 38, 0);
  }
}

.wave {
  height: 82px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(139, 92, 246, 0.1), rgba(34, 211, 238, 0.08)),
    rgba(8, 7, 22, 0.78);
}

:root[data-theme="ink"] .wave {
  background:
    linear-gradient(90deg, rgba(47, 143, 116, 0.12), rgba(184, 138, 61, 0.08)),
    rgba(255, 255, 250, 0.6);
}

:root[data-theme="ink"] .bar {
  background: linear-gradient(180deg, #b88a3d, #2f8f74);
}

.bar {
  flex: 1;
  min-width: 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--primary));
  opacity: 0.72;
  height: 18px;
  transition: height 0.2s ease;
}

.recording .bar {
  animation: meter 0.9s infinite ease-in-out;
  animation-delay: calc(var(--i) * 45ms);
}

@keyframes meter {
  0%,
  100% {
    height: 18px;
  }
  50% {
    height: calc(24px + var(--i) * 2px);
  }
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
}

.action-row .btn {
  flex: 1;
  min-width: 0;
  padding-left: 10px;
  padding-right: 10px;
}

.upload-box {
  display: grid;
  gap: 14px;
  padding-top: 6px;
}

audio {
  width: 100%;
}

.status-track {
  position: relative;
  display: grid;
  gap: 12px;
}

.status-rail {
  position: relative;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.14);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.25);
}

:root[data-theme="ink"] .status-rail {
  background: rgba(47, 143, 116, 0.14);
}

:root[data-theme="ink"] .status-rail span {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 0 16px rgba(184, 138, 61, 0.34);
}

.status-rail span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.42);
  transition: width 0.28s ease;
}

.status-nodes {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.status-node {
  display: grid;
  justify-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
}

.status-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(167, 139, 250, 0.16);
  color: #d8d1ff;
  font-weight: 800;
  font-size: 12px;
  border: 1px solid rgba(167, 139, 250, 0.26);
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.16);
}

:root[data-theme="ink"] .status-icon {
  background: rgba(47, 143, 116, 0.12);
  color: #28453b;
  border-color: rgba(47, 143, 116, 0.24);
}

.status-node.done .status-icon {
  color: #fff;
  background: linear-gradient(135deg, var(--success), var(--accent));
  border-color: rgba(52, 211, 153, 0.52);
}

.status-node.active .status-icon {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-color: rgba(34, 211, 238, 0.56);
  animation: nodeGlow 1.2s infinite alternate;
}

:root[data-theme="ink"] .status-node.active .status-icon,
:root[data-theme="ink"] .status-node.done .status-icon {
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.status-node strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: inherit;
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-list {
  display: grid;
  gap: 10px;
}

.status-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border-radius: 8px;
  background: rgba(8, 7, 22, 0.55);
}

:root[data-theme="ink"] .status-item,
:root[data-theme="ink"] .empty {
  background: rgba(255, 255, 250, 0.54);
}

.status-item strong {
  display: block;
}

.status-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

@keyframes nodeGlow {
  from {
    box-shadow: 0 0 14px rgba(139, 92, 246, 0.3);
  }
  to {
    box-shadow: 0 0 24px rgba(34, 211, 238, 0.56);
  }
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.search {
  max-width: none;
  flex: 1;
}

.note-list {
  display: grid;
  gap: 12px;
}

.note-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 16, 40, 0.88);
  padding: 15px;
  display: grid;
  gap: 12px;
}

.note-card h3 {
  margin: 0;
  font-size: 18px;
}

.note-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.card-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.18);
  color: #ddd6fe;
  font-size: 12px;
  font-weight: 700;
}

:root[data-theme="ink"] .badge {
  background: rgba(47, 143, 116, 0.12);
  color: var(--primary-dark);
}

:root[data-theme="ink"] .badge.neutral {
  background: rgba(31, 111, 95, 0.1);
  color: #28453b;
}

.badge.neutral {
  color: #c4b5fd;
  background: rgba(167, 139, 250, 0.13);
}

.badge.warning {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.12);
}

.badge.danger {
  color: #fecdd3;
  background: rgba(244, 63, 94, 0.14);
}

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

.theme-grid.compact {
  gap: 8px;
}

.theme-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
  color: var(--text);
  background: rgba(8, 7, 22, 0.42);
  text-align: left;
}

.theme-grid.compact .theme-card {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  padding: 9px;
  gap: 6px 9px;
}

.theme-grid.compact .theme-card small {
  display: none;
}

.theme-card.active {
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 22px rgba(34, 211, 238, 0.16);
}

.theme-card strong,
.theme-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-card small {
  color: var(--muted);
  font-size: 12px;
}

.theme-swatch {
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.theme-grid.compact .theme-swatch {
  width: 34px;
  height: 34px;
  grid-row: 1;
}

.theme-swatch.tech {
  background:
    linear-gradient(135deg, rgba(139, 92, 246, 0.92), rgba(34, 211, 238, 0.66)),
    #0b0a1d;
}

.theme-swatch.ink {
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 250, 0.86), transparent 30%),
    linear-gradient(135deg, #dfeadb, #2f8f74 62%, #b88a3d);
}

:root[data-theme="ink"] .theme-card {
  background: rgba(255, 255, 250, 0.58);
}

:root[data-theme="ink"] .theme-card.active {
  border-color: rgba(47, 143, 116, 0.42);
  box-shadow: 0 0 22px rgba(47, 143, 116, 0.14);
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.detail-shell .main {
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
}

.detail-header {
  min-height: 58px;
}

.detail-header strong {
  min-width: 0;
  color: #f4f0ff;
  font-size: 16px;
}

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

.section-title {
  margin: 0 0 10px;
  color: #ddd6fe;
  font-size: 14px;
  font-weight: 800;
}

.rich-text {
  color: #d9d3f4;
  line-height: 1.78;
  white-space: pre-line;
}

:root[data-theme="ink"] .rich-text {
  color: #314a41;
}

.list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.75;
}

.empty {
  padding: 38px 18px;
  text-align: center;
  color: var(--muted);
  background: rgba(8, 7, 22, 0.48);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: calc(84px + env(safe-area-inset-bottom));
  width: min(calc(100% - 32px), 420px);
  max-width: none;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(8, 7, 22, 0.94);
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 20;
  transform: translateX(-50%);
}

.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(6, 7, 20, 0.72);
  backdrop-filter: blur(14px);
}

.confirm-card {
  width: min(100%, 360px);
  border: 1px solid rgba(244, 63, 94, 0.28);
  border-radius: 8px;
  background: rgba(18, 16, 40, 0.96);
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 14px;
}

:root[data-theme="ink"] .confirm-card {
  background: rgba(250, 248, 241, 0.98);
  border-color: rgba(185, 28, 28, 0.22);
}

.confirm-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fecdd3;
  background: rgba(244, 63, 94, 0.18);
  font-weight: 900;
}

:root[data-theme="ink"] .confirm-mark {
  color: #8f1d1d;
  background: rgba(185, 28, 28, 0.12);
}

.confirm-card h3,
.confirm-card p {
  margin: 0;
}

.confirm-card p {
  color: var(--muted);
  line-height: 1.6;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

:root[data-theme="ink"] .toast {
  background: rgba(31, 45, 40, 0.92);
}

.bottom-nav {
  position: sticky;
  bottom: 0;
  z-index: 11;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(154, 126, 255, 0.2);
  background: rgba(13, 11, 31, 0.92);
  backdrop-filter: blur(16px);
}

.bottom-nav .nav-btn {
  min-height: 54px;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 8px 6px;
  text-align: center;
  font-size: 12px;
}

.bottom-nav .nav-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: currentColor;
}

.bottom-nav .nav-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .auth-page,
  .grid,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .auth-visual {
    min-height: 260px;
    padding: 26px 22px;
  }

  .auth-copy h1 {
    font-size: 38px;
  }

  .auth-panel {
    min-height: auto;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .side-footer {
    margin-top: 20px;
  }
}

@media (max-width: 640px) {
  .auth-panel,
  .sidebar {
    padding: 18px;
  }

  .main {
    padding: 16px 14px calc(92px + env(safe-area-inset-bottom));
  }

  .detail-shell .main {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .topbar,
  .toolbar,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .mobile-header {
    padding-left: 14px;
    padding-right: 14px;
  }

  .side-nav {
    grid-template-columns: 1fr;
  }

  .timer {
    font-size: 40px;
  }

  .auth-page {
    box-shadow: none;
  }

  .auth-visual {
    min-height: 230px;
  }
}
