:root {
  --bg: #0a0a0b;
  --bg-deep: #08080a;
  --card: #111113;
  --card-hover: #161619;
  --surface: #18181b;
  --surface-hover: #222226;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #fafafa;
  --text-2: #d4d4d8;
  --text-3: #a1a1aa;
  --text-4: #71717a;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.15);
  --success: #34d399;
  --radius: 10px;
  --radius-lg: 14px;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text-2);
  font: 400 14px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

::-webkit-scrollbar-track {
  background: transparent;
}

[hidden] {
  display: none !important;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.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;
}

:focus-visible {
  outline: 2px solid #c8c8ce;
  outline-offset: 2px;
  border-radius: 6px;
}

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

/* ================= Header & Topbar ================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 62px;
  padding: 0 24px;
  background: rgba(10, 10, 11, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.wordmark {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.05em;
  color: var(--text);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: opacity 0.15s;
}

.wordmark:hover {
  opacity: 0.9;
}

.wordmark span {
  color: #8b8b94;
}

.wordmark-badge {
  font-size: 10px;
  font-family: var(--mono);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 20px;
}

.top-nav-link {
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-3);
  transition: all 0.15s;
}

.top-nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.top-nav-link.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.icon-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
}

.search {
  position: relative;
  flex: 1 1 260px;
  max-width: 440px;
}

.search .ic {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-4);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text);
  font: 400 13px var(--sans);
  transition: border-color 0.15s, background 0.15s;
}

.search input::placeholder {
  color: var(--text-4);
}

.search input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
}

.search.mini {
  flex: 1 1 170px;
  max-width: 240px;
}

.search.mini input {
  height: 32px;
  font-size: 12.5px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-2);
  font: 600 11px var(--sans);
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}

.avatar:hover {
  background: rgba(255, 255, 255, 0.13);
}

/* ================= Buttons ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: 600 13px var(--sans);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

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

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

.btn-primary {
  background: #fafafa;
  color: #0a0a0b;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 16px rgba(255, 255, 255, 0.08);
}

.btn-primary:hover {
  background: #e4e4e7;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-2);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.16);
}

.btn-accent {
  background: #38bdf8;
  color: #08080a;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
}

.btn-accent:hover {
  background: #7dd3fc;
}

.btn-lg {
  padding: 12px 22px;
  font-size: 14.5px;
  border-radius: 10px;
}

.btn-xs {
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.btn-block {
  width: 100%;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  padding: 6px 8px;
  border-radius: 7px;
  color: var(--text-3);
  font: 500 12.5px var(--sans);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.link-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2);
}

/* ================= Chips ================= */
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  line-height: 1;
  color: #d4d4d8;
  text-align: center;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.chip-sm {
  padding: 6px 9px;
  font-size: 11.5px;
}

.chip-btn {
  cursor: pointer;
}

.chip-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.chip.active {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.22);
  color: var(--text);
}

.chip .cnt {
  color: var(--text-4);
  margin-left: 6px;
}

.chip .per {
  color: var(--text-4);
  margin-left: 3px;
  font-size: 11px;
}

.chip.neg {
  color: #fda4af;
  border-color: rgba(253, 164, 175, 0.4);
}

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

/* ================= Cards & Containers ================= */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
}

.card-pad {
  padding: 20px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-right: auto;
}

.push {
  margin-left: auto;
}

/* ================= Tabs ================= */
.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-3);
  font: 500 12.5px var(--sans);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.tab .ic {
  width: 14px;
  height: 14px;
}

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

.tab.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* ================= Pills & Speed Badges ================= */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.st-pending {
  color: #fcd34d;
  background: rgba(251, 191, 36, 0.07);
  border-color: rgba(251, 191, 36, 0.18);
}

.st-progress {
  color: #93c5fd;
  background: rgba(96, 165, 250, 0.07);
  border-color: rgba(96, 165, 250, 0.18);
}

.st-completed, .st-active {
  color: #86efac;
  background: rgba(52, 211, 153, 0.07);
  border-color: rgba(52, 211, 153, 0.18);
}

.st-partial {
  color: #fdba74;
  background: rgba(251, 146, 60, 0.07);
  border-color: rgba(251, 146, 60, 0.18);
}

.st-paused {
  color: #a1a1aa;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.14);
}

.st-progress .dot {
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.speed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}

.sp-instant .dot { background: #6ee7b7; }
.sp-fast .dot { background: #7dd3fc; }
.sp-normal .dot { background: #a1a1aa; }
.sp-drip .dot { background: #fcd34d; }

/* ================= Forms ================= */
.field {
  margin-bottom: 16px;
}

.label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
  margin-bottom: 7px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.input, .select {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font: 400 13.5px var(--sans);
  transition: border-color 0.15s, background 0.15s;
}

.input.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.input::placeholder {
  color: var(--text-4);
}

.input:focus, .select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.06);
}

textarea.input {
  resize: vertical;
  min-height: 110px;
}

.select {
  appearance: none;
  cursor: pointer;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.err {
  display: none;
  font-size: 12px;
  color: #fda4af;
  margin-top: 6px;
}

.field.invalid .err {
  display: block;
}

.field.invalid .input, .field.invalid .select {
  border-color: rgba(253, 164, 175, 0.5);
}

.hint {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  color: var(--text-4);
  margin-top: 6px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  color: var(--text-3);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  accent-color: #fafafa;
  cursor: pointer;
}

/* ================= Tables ================= */
.tbl-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

th {
  padding: 11px 16px;
  text-align: left;
  font: 500 11px var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-4);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr {
  transition: background 0.12s;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

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

.th-r, .td-r {
  text-align: right;
}

.td-mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  white-space: nowrap;
}

.td-time {
  color: var(--text-4);
  font-size: 12px;
  white-space: nowrap;
}

/* ================= Icons ================= */
.ic {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ic-12 { width: 12px; height: 12px; }
.ic-13 { width: 13px; height: 13px; }
.ic-14 { width: 14px; height: 14px; }
.ic-15 { width: 15px; height: 15px; }
.ic-20 { width: 20px; height: 20px; }
.ic-24 { width: 24px; height: 24px; }

.pic {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-2);
}

.pic-sm {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

/* ================= Toasts ================= */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(340px, calc(100vw - 36px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  animation: toastIn 0.18s ease;
}

.toast.out {
  animation: toastOut 0.18s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(6px); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(6px); }
}

.toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.toast-msg {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
  word-break: break-word;
}

.toast-close {
  margin-left: auto;
  background: none;
  border: 0;
  padding: 2px;
  border-radius: 4px;
  color: var(--text-4);
  cursor: pointer;
  flex: none;
}

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

.t-success > .ic { color: #86efac; }
.t-error > .ic { color: #fda4af; }
.t-info > .ic { color: #a1a1aa; }

/* ================= Shell & Sidebar (Dashboard Layout) ================= */
.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: calc(100vh - 62px);
}

.sidebar {
  position: sticky;
  top: 62px;
  height: calc(100vh - 62px);
  align-self: start;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  background: var(--bg-deep);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--text-3);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-item .ic {
  width: 16px;
  height: 16px;
  color: var(--text-4);
  transition: color 0.15s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-2);
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
  color: var(--text);
}

.nav-item.active .ic {
  color: var(--text-2);
}

.side-foot {
  margin-top: auto;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: #5b5b63;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 40;
}

.backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.main {
  padding: 24px 28px 48px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}

/* ================= Footer ================= */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-deep);
  padding: 48px 24px 28px;
}

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 36px;
  margin-bottom: 40px;
}

.footer-brand p {
  color: var(--text-4);
  font-size: 13px;
  margin-top: 12px;
  max-width: 320px;
  line-height: 1.6;
}

.footer-col-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 14px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.footer-links a {
  color: var(--text-4);
  font-size: 13px;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--text-4);
  font-size: 12px;
}

.footer-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-3);
}

.footer-status .dot {
  background: #34d399;
}

/* ================= Auth Pages Layout ================= */
.auth-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 18px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

.auth-head {
  text-align: center;
  margin-bottom: 24px;
}

.auth-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-top: 10px;
}

.auth-sub {
  font-size: 13px;
  color: var(--text-4);
  margin-top: 4px;
}

.auth-foot {
  margin-top: 22px;
  text-align: center;
  font-size: 13px;
  color: var(--text-4);
}

.auth-foot a {
  color: var(--text);
  font-weight: 500;
}

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

/* ================= Content / Prose Pages (Legal, Blog) ================= */
.prose-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.prose-header {
  margin-bottom: 36px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 24px;
}

.prose-header h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.prose-header .sub {
  font-size: 14px;
  color: var(--text-4);
  margin-top: 8px;
}

.prose {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--text-2);
}

.prose h2 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 32px 0 12px;
}

.prose h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 8px;
}

.prose p {
  margin-bottom: 16px;
}

.prose ul, .prose ol {
  margin: 0 0 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prose li {
  color: var(--text-2);
}

/* ================= Responsive Breakpoints ================= */
@media (max-width: 960px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .main {
    padding: 20px 16px 36px;
  }
  .sidebar {
    position: fixed;
    top: 62px;
    bottom: 0;
    left: 0;
    width: 256px;
    height: auto;
    z-index: 45;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.5);
  }
  .sidebar.open {
    transform: none;
  }
  .icon-btn#menuBtn {
    display: inline-flex;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .top-nav {
    display: none;
  }
}

@media (max-width: 600px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 0 16px;
  }
  .auth-card {
    padding: 24px 20px;
  }
}
