:root {
  --bg-a: #0a0714;
  --bg-b: #1e1050;
  --bg-c: #7c3aed;
  --bg-d: #a855f7;
  --glass: rgba(255, 255, 255, .08);
  --glass-2: rgba(255, 255, 255, .05);
  --border: rgba(255, 255, 255, .18);
  --text: #f6f8fc;
  --muted: #b7c0d0;
  --accent: #a78bfa;
  --accent-2: #c4b5fd;
  --accent-strong: #7c3aed;
  --shadow: 0 12px 40px rgba(0, 0, 0, .5);
  --blur: 5px;
  --input-bg: rgba(255, 255, 255, .1);
}

body.light {
  --bg-a: #0d1b4d;
  --bg-b: #2a47a8;
  --bg-c: #c92727;
  --bg-d: #b02222;
  --glass: rgba(255, 255, 255, .32);
  --glass-2: rgba(255, 255, 255, .18);
  --border: rgba(255, 255, 255, .55);
  --text: #0a1330;
  --muted: #0d1a40;
  --accent: #e11d1d;
  --accent-2: #ef4444;
  --accent-strong: #b91c1c;
  --shadow: 0 12px 40px rgba(8, 20, 60, .28);
  --blur: 5px;
  --input-bg: rgba(255, 255, 255, .55);
}

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

html { background: #0a0714; }
html:has(body.light) { background: #0d1b4d; }
body {
  background: linear-gradient(160deg, var(--bg-a) 0%, var(--bg-b) 42%, var(--bg-c) 78%, var(--bg-d) 130%) fixed;
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ----- glass primitives ----- */

.glass {
  background: linear-gradient(135deg, var(--glass), var(--glass-2));
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--border);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .25), inset 0 -1px 0 rgba(255, 255, 255, .08);
}

/* ----- layout ----- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(135deg, var(--glass), var(--glass-2));
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.brand {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .5px;
  background: linear-gradient(120deg, var(--accent-2), #fff 60%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
body.light .brand { background: linear-gradient(120deg, var(--accent), #fff 60%); }
.brand span { font-weight: 400; }

nav { display: flex; gap: 6px; flex-wrap: wrap; }

nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 12px;
  font-size: 14px;
  transition: background .15s, color .15s, box-shadow .15s;
  border: 1px solid transparent;
}
nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .12);
}
nav a.active {
  color: #fff;
  background: linear-gradient(120deg, var(--accent-strong), var(--accent));
  border-color: rgba(255, 255, 255, .3);
  box-shadow: 0 6px 20px rgba(124, 58, 237, .4), inset 0 1px 0 rgba(255, 255, 255, .3);
}
body.light nav a.active { box-shadow: 0 6px 20px rgba(185, 28, 28, .35), inset 0 1px 0 rgba(255,255,255,.4); }

.theme-btn {
  background: linear-gradient(135deg, var(--glass), var(--glass-2));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .15s, box-shadow .15s, background .15s;
}
.theme-btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, .18); }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.login-btn {
  background: linear-gradient(120deg, var(--accent-strong), var(--accent));
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(124, 58, 237, .4), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: transform .15s, filter .15s, box-shadow .15s;
}
body.light .login-btn { box-shadow: 0 6px 20px rgba(185, 28, 28, .35), inset 0 1px 0 rgba(255,255,255,.4); }
.login-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }

.nav-account {
  color: var(--muted);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  transition: background .15s, color .15s;
}
.nav-account:hover { color: var(--text); background: rgba(255, 255, 255, .12); }
.nav-account.active { color: #fff; background: linear-gradient(120deg, var(--accent-strong), var(--accent)); }

.logout-btn {
  color: var(--muted);
  text-decoration: none;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  transition: color .15s, background .15s;
}
.logout-btn:hover { color: var(--text); background: rgba(255, 255, 255, .12); }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 15, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  width: min(400px, calc(100% - 32px));
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
  transform: translateY(18px) scale(.86);
  opacity: 0;
  transition: transform .34s cubic-bezier(.22, 1.2, .36, 1), opacity .22s ease;
}
.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
  animation: modal-spring .45s cubic-bezier(.22, 1.5, .36, 1);
}
@keyframes modal-spring {
  0% { transform: translateY(18px) scale(.86); }
  60% { transform: translateY(-6px) scale(1.03); }
  80% { transform: translateY(2px) scale(.99); }
  100% { transform: translateY(0) scale(1); }
}

.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { font-size: 20px; margin: 0; }
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover { color: var(--text); }

.modal-hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.login-new { color: var(--muted); font-size: 12px; margin: 10px 0 14px; }

.login-field { position: relative; }

.login-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 46px 12px 14px;
  font-size: 20px;
  letter-spacing: 6px;
  text-align: center;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--glass-2);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 58, 237, .25); }
body.light .login-field input:focus { box-shadow: 0 0 0 3px rgba(185, 28, 28, .25); }

.eye-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  transition: color .15s;
}
.eye-btn:hover { color: var(--text); }
.eye-btn.on { color: var(--accent); }

.btn-block { width: 100%; }

.login-hero {
  min-height: calc(100vh - 170px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-hero-btn {
  background: linear-gradient(120deg, var(--accent-strong), var(--accent));
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  padding: 16px 48px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 12px 40px rgba(124, 58, 237, .5), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: transform .15s, filter .15s, box-shadow .15s;
}
body.light .login-hero-btn { box-shadow: 0 12px 40px rgba(185, 28, 28, .45), inset 0 1px 0 rgba(255,255,255,.4); }
.login-hero-btn:hover { filter: brightness(1.08); transform: translateY(-2px) scale(1.02); }

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  margin: 4px 0 2px;
  user-select: none;
}
.remember-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.remember-row:hover { color: var(--text); }
.remember-row a { color: var(--accent); text-decoration: underline; }
.remember-row a:hover { color: var(--text); }

.agree-modal { width: min(520px, calc(100% - 32px)); }
.agree-text {
  max-height: 50vh;
  overflow-y: auto;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  padding-right: 8px;
}
.agree-text p { margin: 0 0 12px; }
.agree-text b { color: var(--text); }

main { flex: 1; width: 100%; max-width: 1000px; margin: 0 auto; padding: 28px 24px 40px; }

footer {
  border-top: 1px solid var(--border);
  padding: 18px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: linear-gradient(135deg, var(--glass), var(--glass-2));
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
}
footer b { color: var(--text); }

.hero { margin-bottom: 26px; }
.hero h1 { font-size: 28px; margin-bottom: 8px; }
.hero p { color: var(--muted); max-width: 720px; }
.hero b { color: var(--text); }

/* ----- cards ----- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.card {
  background: linear-gradient(135deg, var(--glass), var(--glass-2));
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 18px 46px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.3); }
.card-label { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.card-value { font-size: 26px; font-weight: 800; }
.card-value.sm { font-size: 19px; word-break: break-all; }
.card-note { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ----- panels ----- */

.panel {
  background: linear-gradient(135deg, var(--glass), var(--glass-2));
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.panel h2 { font-size: 18px; margin-bottom: 14px; }

.feature-list { list-style: none; }
.feature-list li { padding: 8px 0; border-bottom: 1px dashed var(--border); color: var(--muted); }
.feature-list li:last-child { border-bottom: none; }
.feature-list a { color: var(--accent-2); text-decoration: none; }
.feature-list a:hover { text-decoration: underline; }

/* ----- page head ----- */

.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 24px; margin-bottom: 4px; }
.page-head p { color: var(--muted); font-size: 14px; }

/* ----- tables ----- */

.table-wrap {
  background: linear-gradient(135deg, var(--glass), var(--glass-2));
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow-x: auto;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .25);
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th {
  text-align: left;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, .08); }
td.dim { color: var(--muted); }
td.money { font-variant-numeric: tabular-nums; font-weight: 600; }
td.empty, .empty { text-align: center; color: var(--muted); padding: 24px; }

.timecell { display: flex; flex-direction: column; line-height: 1.35; white-space: normal; }
.time-range { font-weight: 600; font-variant-numeric: tabular-nums; }
.time-date { color: var(--muted); font-size: 12px; }

/* ----- badges ----- */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .08);
}
.badge.ok { color: var(--accent-2); }
.badge.warn { color: #ffd28a; }
.badge.bad { color: #ff9aa3; }

/* ----- pager / buttons ----- */

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.page-info { color: var(--muted); font-size: 14px; }

.page-btn, .btn {
  background: linear-gradient(120deg, var(--accent-strong), var(--accent));
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .25);
  text-decoration: none;
  padding: 9px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(124, 58, 237, .35), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: transform .15s, box-shadow .15s, filter .15s;
  display: inline-block;
}
body.light .page-btn, body.light .btn { box-shadow: 0 8px 24px rgba(185, 28, 28, .35), inset 0 1px 0 rgba(255,255,255,.4); }
.page-btn:hover, .btn:hover { filter: brightness(1.08); transform: translateY(-1px); }

table.kv { font-size: 14px; }
table.kv td { border-bottom: 1px solid var(--border); padding: 10px 4px; }
table.kv tr:last-child td { border-bottom: none; }
table.kv td:first-child { color: var(--muted); width: 220px; }

/* ----- calendar ----- */

.calendar-panel {
  background: linear-gradient(135deg, var(--glass), var(--glass-2));
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .25);
  width: min(360px, 100%);
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cal-title { font-size: 16px; font-weight: 700; }
.cal-arrow {
  background: linear-gradient(135deg, var(--glass), var(--glass-2));
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  transition: background .15s, transform .15s;
}
.cal-arrow:hover { background: rgba(255, 255, 255, .16); transform: translateY(-1px); }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: background .12s, color .12s, transform .12s;
  color: var(--text);
}
.cal-cell:hover { background: rgba(255, 255, 255, .14); }
.cal-wd { font-size: 11px; font-weight: 700; color: var(--muted); cursor: default; }
.cal-wd:hover { background: none; }
.cal-empty { cursor: default; }
.cal-empty:hover { background: none; }
.cal-today { border: 1px solid var(--accent); color: var(--accent-2); font-weight: 700; }
.cal-selected {
  background: linear-gradient(120deg, var(--accent-strong), var(--accent));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(124, 58, 237, .4);
}
body.light .cal-selected { box-shadow: 0 4px 14px rgba(185, 28, 28, .35); }
.cal-selected:hover { filter: brightness(1.1); }

.hint { color: var(--muted); font-size: 13px; margin-top: 14px; }
.hint a { color: var(--accent-2); text-decoration: none; }
.hint a:hover { text-decoration: underline; }

.card-note a { color: var(--accent-2); text-decoration: none; }
.card-note a:hover { text-decoration: underline; }

/* ----- forms ----- */

.form-panel { margin-bottom: 18px; }

.record-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }

.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { color: var(--muted); font-size: 13px; }

.form-field input,
.form-field select {
  background: var(--input-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  min-width: 180px;
}
.form-field select option { background: #1c1e26; color: var(--text); }
body.light .form-field select option { background: #fff; color: var(--text); }
.form-field input::placeholder { color: var(--muted); opacity: .7; }
.form-field input:focus,
.form-field select:focus { outline: none; border-color: var(--accent); background: rgba(255,255,255,.16); }

.form-error {
  background: rgba(255, 92, 108, .14);
  color: #ff9aa3;
  border: 1px solid rgba(255, 92, 108, .4);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}

.form-field-wide { flex-basis: 100%; min-width: 100%; }

.rec-modal { width: min(440px, calc(100% - 32px)); }
.rec-details { display: flex; flex-direction: column; gap: 10px; }
.rec-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}
.rec-row:last-child { border-bottom: none; padding-bottom: 0; }
.rec-row span { color: var(--muted); flex-shrink: 0; }
.rec-row b { color: var(--text); text-align: right; word-break: break-word; }

.rec-actions { margin-top: 18px; display: flex; justify-content: flex-end; }
.rec-edit-form { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.rec-edit-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}
.btn-ghost:hover { background: rgba(255, 255, 255, .1); filter: none; }
body.light .btn-ghost { box-shadow: none; }
body.light .btn-ghost:hover { background: rgba(185, 28, 28, .08); }

/* ----- feed ----- */

.feed { display: flex; flex-direction: column; gap: 10px; }

.feed-item {
  display: flex;
  gap: 16px;
  background: linear-gradient(135deg, var(--glass), var(--glass-2));
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 18px;
  align-items: flex-start;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .25);
}

.feed-time {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
  min-width: 110px;
  border-right: 2px solid var(--accent);
  padding-right: 14px;
  margin-right: 2px;
}
.feed-time .time-range { font-weight: 700; font-variant-numeric: tabular-nums; }
.feed-time .time-date { color: var(--muted); font-size: 12px; }

.feed-body { display: flex; flex-direction: column; gap: 6px; }
.feed-title { font-size: 16px; font-weight: 700; }
.feed-meta { display: flex; gap: 8px; flex-wrap: wrap; }

.tag {
  display: inline-block;
  background: rgba(255, 255, 255, .1);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12px;
}
.tag.dim { color: var(--muted); }

/* ----- timeline ----- */

.page-nav { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }

.timeline-wrap {
  display: flex;
  background: linear-gradient(135deg, var(--glass), var(--glass-2));
  backdrop-filter: blur(var(--blur)) saturate(1.4);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .25);
}

.tl-gutter {
  width: 62px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, .05);
  border-right: 1px solid var(--border);
}

.tl-label {
  height: 44px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tl-sched {
  flex: 1;
  position: relative;
  background: repeating-linear-gradient(
    to bottom,
    var(--border) 0 1px,
    transparent 1px 44px
  );
}

.tl-item {
  position: absolute;
  left: 6px;
  right: 6px;
  background: linear-gradient(135deg, rgba(167, 139, 250, .32), rgba(167, 139, 250, .12));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent-2);
  border-radius: 12px;
  padding: 4px 8px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 40px;
  box-shadow: 0 6px 18px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.2);
  cursor: pointer;
  transition: filter .15s, transform .15s, box-shadow .15s;
}
.tl-item:hover { filter: brightness(1.12); box-shadow: 0 8px 22px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.25); }
body.light .tl-item {
  background: linear-gradient(135deg, rgba(225, 29, 29, .28), rgba(225, 29, 29, .08));
}

.tl-item-time { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent-2); line-height: 1.25; }
body.light .tl-item-time { color: var(--accent); }
.tl-item-title { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.tl-item-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-item-meta.dim { color: var(--muted); opacity: .85; }
.tl-item-doctor {
  position: absolute;
  right: 8px;
  bottom: 4px;
  font-size: 11px;
  color: var(--muted);
  opacity: .9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
}

.tl-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
  }
  .topbar-left {
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }
  .topbar-right {
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }
  nav {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding-bottom: 2px;
  }
  nav::-webkit-scrollbar { display: none; }
  nav a {
    flex: 0 0 auto;
    padding: 7px 12px;
    font-size: 13px;
    white-space: nowrap;
  }
  main { padding: 18px 14px 30px; }
  .card-value { font-size: 22px; }
  .record-form { flex-direction: column; align-items: stretch; }
  .form-field input, .form-field select { min-width: 0; }
  .tl-gutter { width: 44px; }
  .feed-item { flex-direction: column; gap: 8px; }
  .feed-time { border-right: none; border-bottom: 2px solid var(--accent); padding-right: 0; padding-bottom: 8px; }
  .page-head h1 { font-size: 20px; }
  .hero h1 { font-size: 22px; }
  .modal { padding: 18px; }
  .login-field input { font-size: 18px; letter-spacing: 4px; }
  .table-wrap { border-radius: 14px; }
  th, td { padding: 10px 12px; }
  .tl-sched { overflow-x: auto; }
}

@media (max-width: 420px) {
  .login-hero-btn { width: min(260px, 80vw); font-size: 16px; padding: 14px 24px; }
  .theme-btn, .login-btn, .logout-btn, .nav-account { font-size: 12px; padding: 7px 10px; }
  .card { padding: 14px; }
  .panel { padding: 16px; }
  .form-field { flex-direction: column; align-items: stretch; }
  .form-field label { margin-bottom: 4px; }
  .tl-gutter { width: 38px; }
}
