:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e9f2;
  --border-strong: #cdd8e7;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ring: rgba(37, 99, 235, .18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
::selection { background: #dbeafe; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.spacer { flex: 1; }
.text-danger { color: var(--danger); }
.req { color: var(--danger); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: .55; }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-ghost { background: transparent; border-color: #fecaca; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-left { margin-right: auto; }
.btn:focus-visible, .text-btn:focus-visible, .link-action:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 1px;
}
.btn-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.text-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--text-2);
  font-size: 12.5px;
}
.text-btn:hover { color: var(--primary); }
.link-action {
  border: 0;
  background: none;
  padding: 0;
  color: var(--text-2);
  font-size: 11.5px;
}
.link-action:hover { color: var(--primary); }
.link-action.is-danger { color: var(--danger); }
.link-action:disabled { color: #cbd5e1; }
.modal-close {
  border: 0;
  background: none;
  padding: 4px;
  color: var(--muted);
  font-size: 12px;
}
.modal-close:hover { color: var(--text); }
.more-summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text-2);
  font-size: 12.5px;
}
.more-summary::-webkit-details-marker { display: none; }
.more-summary:hover { border-color: var(--border-strong); color: var(--text); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label-row label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field > small, .field-hint { font-size: 11.5px; color: var(--muted); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
input[type=text], input[type=password], input[type=search], input[type=number],
input[type=date], input[type=time], input[type=datetime-local], input[type=url],
select, textarea {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { height: auto; min-height: 84px; padding: 9px 10px; line-height: 1.6; resize: vertical; }
input::placeholder, textarea::placeholder { color: #b6c2d3; }
input:focus, select:focus, textarea:focus {
  border-color: #93b4f5;
  box-shadow: 0 0 0 3px var(--ring);
  outline: none;
}
input:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
select {
  appearance: none;
  padding-right: 28px;
  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='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-grid .span-2 { grid-column: span 2; }
.form { display: flex; flex-direction: column; gap: 15px; }
.form-error { padding: 9px 10px; background: var(--danger-soft); border: 1px solid #fecaca; color: #b91c1c; border-radius: 6px; font-size: 12px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 52px; }
.password-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--muted);
  font-size: 11px; padding: 5px 7px; border-radius: 4px;
}
.password-toggle:hover { color: var(--text); background: var(--surface-2); }
.inline-select { display: flex; gap: 6px; align-items: center; }
.inline-select select { flex: 1; }
.inline-cat { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.inline-cat input[type=text] { height: 30px; font-size: 12px; }
.inline-cat input[type=color] { width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 5px; background: #fff; padding: 1px; }
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.color-swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: var(--swatch); box-shadow: 0 0 0 1px var(--border); }
.color-swatch.is-active { box-shadow: 0 0 0 2px var(--primary); }
.color-custom { position: relative; width: 26px; height: 26px; border: 1px dashed var(--border-strong); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; cursor: pointer; overflow: hidden; }
.color-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.color-custom span { pointer-events: none; }
.priority-options { display: flex; gap: 6px; height: 36px; }
.prio-option { flex: 1; position: relative; cursor: pointer; }
.prio-option input { position: absolute; opacity: 0; pointer-events: none; }
.prio-option span {
  display: flex; align-items: center; justify-content: center;
  height: 36px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  transition: all .15s ease;
}
.prio-option input:checked + span { border-color: var(--text); background: var(--text); color: #fff; }
.prio-option.prio-high input:checked + span { background: var(--danger); border-color: var(--danger); }
.prio-option.prio-medium input:checked + span { background: var(--warning); border-color: var(--warning); }
.prio-option.prio-low input:checked + span { background: #64748b; border-color: #64748b; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 0;
}
.switch-row.compact { padding: 7px 0; }
.switch-row strong { font-size: 13px; font-weight: 500; }
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  background: #d8e0ec;
  padding: 0;
  transition: background .18s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .2);
  transition: transform .18s ease;
}
.switch.is-on { background: var(--primary); }
.switch.is-on::after { transform: translateX(16px); }
.switch:has(input:checked) { background: var(--primary); }
.switch:has(input:checked)::after { transform: translateX(16px); }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.switch .switch-track { display: none; }
.switch:disabled { opacity: .45; cursor: not-allowed; }

/* Labels */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 21px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 10.5px;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.chip-danger { background: var(--danger-soft); color: #b91c1c; border-color: #fecaca; }
.chip-success { background: var(--success-soft); color: #15803d; border-color: #bbf7d0; }
.chip-warn { background: var(--warning-soft); color: #b45309; border-color: #fde68a; }
.chip-muted { background: var(--surface-2); color: var(--muted); }
.chip-ghost { background: transparent; }
.prio {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
}
.prio-high { background: var(--danger-soft); color: #b91c1c; }
.prio-medium { background: var(--warning-soft); color: #b45309; }
.prio-low { background: #f1f5f9; color: #64748b; }
.cat-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--primary); }
.dot.is-muted { background: #cbd5e1; }
.status-pill {
  display: inline-flex; align-items: center; height: 21px; padding: 0 7px;
  border-radius: 4px; font-size: 10.5px; font-weight: 500;
}
.status-active { background: var(--success-soft); color: #15803d; }
.status-archived { background: #f1f5f9; color: #64748b; }
.status-deleted { background: var(--danger-soft); color: #b91c1c; }

/* Shell */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 232px;
  display: flex;
  flex-direction: column;
  padding: 22px 12px 16px;
  background: #fff;
  border-right: 1px solid var(--border);
  z-index: 50;
}
.brand { display: flex; align-items: baseline; gap: 8px; padding: 2px 10px 24px; }
.brand-name { font-size: 20px; font-weight: 600; color: var(--primary); letter-spacing: .02em; }
.brand-sub { font-size: 11px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 20px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-2);
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 10px;
  font-weight: 500;
}
.nav-badge-alert { background: var(--danger-soft); color: var(--danger); }
.sidebar-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--border); }
.account { display: flex; align-items: center; gap: 8px; padding: 0 10px; }
.account-name { flex: 1; min-width: 0; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-backdrop { display: none; }

.app-main { margin-left: 232px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 62px;
  padding: 10px 28px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search-input {
  width: 210px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 12.5px;
}
.search-input:focus { background: #fff; }
.notif-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text-2);
  font-size: 12.5px;
  white-space: nowrap;
}
.notif-btn:hover { border-color: var(--border-strong); color: var(--text); }
.notif-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  line-height: 16px;
  text-align: center;
}
.mobile-menu { display: none; }
.view { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px 28px 64px; }

/* Loading / empty */
.page-loading { min-height: 40vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 12px; }
.spinner {
  width: 22px; height: 22px; border: 2px solid #dbeafe; border-top-color: var(--primary);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 46px 20px; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; grid-column: 1 / -1;
}
.empty-state h3 { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.empty-state p { font-size: 12px; color: var(--muted); line-height: 1.6; max-width: 380px; margin-bottom: 14px; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-card {
  display: flex; flex-direction: column; gap: 7px;
  padding: 14px 16px; background: #fff; border: 1px solid var(--border); border-radius: 8px;
}
.stat-label { font-size: 11.5px; color: var(--muted); }
.stat-value { font-size: 25px; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 1px; }
.conflict-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 10px 13px; margin-bottom: 12px;
  background: var(--danger-soft); border: 1px solid #fecaca; border-radius: 7px;
  color: #b91c1c; font-size: 12.5px; text-align: left;
}
.conflict-banner:hover { border-color: #fca5a5; }
.conflict-link { font-size: 12px; color: var(--danger); }

/* Toolbar */
.toolbar-wrap { margin: 0 0 14px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.segmented { display: inline-flex; align-items: center; gap: 2px; padding: 2px; background: #e9eef6; border-radius: 6px; }
.seg-btn {
  height: 28px; padding: 0 10px; border: 0; border-radius: 5px;
  background: transparent; color: var(--text-2); font-size: 12px;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active { background: #fff; color: var(--text); font-weight: 500; box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.toolbar-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.select-wrap { display: flex; align-items: center; height: 32px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.select-wrap select { height: 30px; border: 0; background-color: transparent; box-shadow: none; padding: 0 28px 0 9px; font-size: 12px; min-width: 88px; }
.plain-select { width: auto; height: 32px; font-size: 12px; padding: 0 28px 0 9px; background-color: #fff; }
.view-toggle { display: inline-flex; padding: 2px; background: #e9eef6; border-radius: 6px; }
.view-toggle button { height: 28px; padding: 0 9px; border: 0; border-radius: 5px; background: transparent; color: var(--text-2); font-size: 11.5px; }
.view-toggle button.is-active { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.active-search { display: inline-flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.active-search button { border: 0; background: none; color: var(--primary); font-size: 11.5px; padding: 0; }

/* Dashboard */
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 264px; gap: 18px; align-items: start; }
.timeline-column { min-width: 0; }
.dash-aside { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 78px; }
.tl-section { margin-bottom: 20px; }
.tl-section:last-child { margin-bottom: 0; }
.tl-head { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; padding: 0 1px; }
.tl-head h3 { font-size: 12px; font-weight: 600; color: var(--text-2); }
.tl-date { font-size: 10.5px; color: var(--muted); }
.tl-count { margin-left: auto; font-size: 10.5px; color: var(--muted); }
.tl-list { display: flex; flex-direction: column; gap: 6px; }
.timeline-empty { padding: 14px 15px; background: #fff; border: 1px solid var(--border); border-radius: 7px; font-size: 12px; color: var(--muted); }
.tl-item { display: grid; grid-template-columns: 50px 14px minmax(0, 1fr); align-items: stretch; cursor: pointer; }
.tl-time { display: flex; flex-direction: column; align-items: flex-end; padding: 11px 5px 0 0; }
.tl-time strong { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tl-time span { font-size: 10px; color: var(--muted); margin-top: 2px; }
.tl-rail { position: relative; display: flex; justify-content: center; }
.tl-rail::before { content: ""; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); }
.tl-item:first-child .tl-rail::before { top: 16px; }
.tl-item:last-child .tl-rail::before { bottom: calc(100% - 16px); }
.tl-dot { position: relative; z-index: 1; width: 7px; height: 7px; margin-top: 15px; border-radius: 50%; background: var(--cat, var(--primary)); border: 2px solid var(--bg); }
.tl-card { min-width: 0; padding: 10px 13px; margin-left: 3px; background: #fff; border: 1px solid var(--border); border-radius: 7px; transition: border-color .15s ease; }
.tl-item:hover .tl-card { border-color: var(--border-strong); }
.tl-item.is-overdue .tl-card { border-left: 3px solid var(--danger); }
.tl-item.is-done { opacity: .62; }
.tl-item.is-done h4 { text-decoration: line-through; text-decoration-color: #cbd5e1; }
.tl-card-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.event-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 62%; border: 0; background: none; padding: 0; font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-chip:hover { color: var(--primary); }
.tl-card h4 { margin: 5px 0 0; font-size: 14px; font-weight: 500; line-height: 1.45; }
.tl-notes { margin-top: 3px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.countdown { font-size: 10.5px; color: var(--text-2); }
.countdown.is-late { color: var(--danger); }
.node-check {
  width: 21px; height: 21px; border: 1px solid #cbd5e1; border-radius: 50%;
  background: #fff; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .15s ease;
}
.check-mark {
  width: 5px; height: 9px; border: solid #fff; border-width: 0 1.8px 1.8px 0;
  transform: rotate(42deg) translate(-1px, -1px); opacity: 0;
}
.node-check:hover:not(:disabled) { border-color: var(--primary); }
.node-check.is-checked { background: var(--primary); border-color: var(--primary); }
.node-check.is-checked .check-mark { opacity: 1; }
.node-check:disabled { opacity: .4; cursor: not-allowed; }

/* Aside */
.aside-card { padding: 14px; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.aside-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.aside-head h3 { font-size: 12px; font-weight: 600; }
.aside-head span, .aside-head a { font-size: 10.5px; color: var(--muted); }
.aside-head a:hover { color: var(--primary); }
.today-progress { display: flex; align-items: center; gap: 10px; }
.today-progress strong { font-size: 20px; font-weight: 600; letter-spacing: -.02em; min-width: 44px; }
.today-progress strong small { font-size: 10px; color: var(--muted); }
.progress-track { flex: 1; height: 5px; border-radius: 3px; background: #e9eef6; overflow: hidden; }
.progress-track i { display: block; height: 100%; border-radius: 3px; background: var(--primary); transition: width .25s ease; }
.aside-alert {
  width: 100%; margin-top: 10px; padding: 7px 8px; border: 0; border-radius: 5px;
  background: var(--danger-soft); color: #b91c1c; font-size: 10.5px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left;
}
.aside-alert span { font-size: 10px; }
.cat-bars { display: flex; flex-direction: column; gap: 8px; }
.cat-bar-row { display: flex; flex-direction: column; gap: 4px; }
.cat-bar-label { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-2); }
.cat-bar-label b { margin-left: auto; font-size: 10px; color: var(--muted); font-weight: 400; }
.cat-bar { height: 4px; border-radius: 2px; background: #eef2f7; overflow: hidden; }
.cat-bar i { display: block; height: 100%; border-radius: 2px; }

/* Tabs / list head */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); min-height: 38px; flex-wrap: wrap; }
.tab-bar { display: flex; gap: 0; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 12px; border: 0; background: transparent;
  font-size: 12.5px; color: var(--muted);
}
.tab span { font-size: 9.5px; color: #94a3b8; background: #f1f5f9; border-radius: 999px; padding: 1px 5px; }
.tab:hover { color: var(--text-2); }
.tab.is-active { color: var(--text); font-weight: 500; }
.tab.is-active::after { content: ""; position: absolute; left: 9px; right: 9px; bottom: -1px; height: 2px; background: var(--primary); }
.tab.is-active span { background: var(--primary-soft); color: var(--primary); }
.list-actions { display: flex; align-items: center; gap: 7px; padding-bottom: 8px; flex-wrap: wrap; }
.summary-inline { display: flex; align-items: center; gap: 5px; padding-bottom: 10px; font-size: 12.5px; color: var(--text-2); }
.summary-inline strong { font-size: 18px; font-weight: 600; color: var(--text); }
.summary-inline .divider { margin: 0 5px; color: #cbd5e1; }
.trash-hint { padding: 8px 0 12px; font-size: 11.5px; color: var(--muted); }

/* Event grid */
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 12px; margin-top: 12px; }
.event-card {
  display: flex; flex-direction: column; padding: 14px 15px;
  background: #fff; border: 1px solid var(--border); border-left: 3px solid var(--cat, var(--primary));
  border-radius: 7px; cursor: pointer; transition: border-color .15s ease;
}
.event-card:hover { border-color: var(--border-strong); border-left-color: var(--cat, var(--primary)); }
.event-card-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.event-card h3 { margin: 9px 0 4px; font-size: 15px; font-weight: 600; line-height: 1.4; }
.event-desc { font-size: 11.5px; color: var(--muted); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 18px; }
.event-progress { display: flex; align-items: center; gap: 7px; margin: 11px 0 8px; }
.event-progress-bar { flex: 1; height: 4px; border-radius: 2px; background: #eef2f7; overflow: hidden; }
.event-progress-bar i { display: block; height: 100%; border-radius: 2px; background: var(--primary); }
.event-progress span { font-size: 9.5px; color: var(--muted); }
.mini-nodes { display: flex; flex-direction: column; margin-top: auto; }
.mini-nodes li { display: flex; align-items: center; gap: 6px; padding: 4px 0; font-size: 10.5px; border-bottom: 1px dashed #eef2f7; list-style: none; }
.mini-nodes li:last-child { border-bottom: 0; }
.mini-nodes span { color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; width: 66px; }
.mini-nodes em { font-style: normal; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-nodes b { margin-left: auto; font-size: 9px; font-weight: 500; color: var(--warning); background: var(--warning-soft); border-radius: 3px; padding: 1px 4px; }
.mini-nodes b.is-danger { color: var(--danger); background: var(--danger-soft); }
.trash-note { margin-top: 8px; font-size: 10.5px; color: var(--muted); }
.event-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; padding-top: 8px; border-top: 1px solid #f1f5f9; font-size: 10.5px; color: var(--muted); }
.event-card-actions { display: flex; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid #f1f5f9; }
.event-card-actions .btn { flex: 1; }
.event-card.is-deleted { opacity: .8; }

/* Detail */
.back-link { display: inline-block; margin-bottom: 12px; font-size: 11.5px; color: var(--muted); }
.back-link:hover { color: var(--primary); }
.notice {
  display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline;
  padding: 9px 11px; margin-bottom: 10px; border-left: 3px solid #cbd5e1;
  background: #fff; border-radius: 4px; font-size: 11.5px; color: var(--text-2);
}
.notice strong { font-weight: 500; color: var(--text); }
.notice span { color: var(--muted); }
.notice-warn { border-left-color: var(--warning); }
.notice-danger { border-left-color: var(--danger); }
.notice-info { border-left-color: var(--primary); }
.detail-hero {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  padding: 18px 20px; margin-bottom: 14px; background: #fff;
  border: 1px solid var(--border); border-radius: 8px;
}
.detail-kicker { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 7px; }
.detail-hero h2 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.35; }
.detail-desc { margin-top: 6px; max-width: 720px; color: var(--text-2); font-size: 12px; line-height: 1.65; white-space: pre-wrap; }
.detail-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 11px; font-size: 10.5px; color: var(--muted); }
.detail-hero-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 15px; border-bottom: 1px solid var(--border); }
.panel-head h3 { font-size: 13px; font-weight: 600; }
.panel-actions { display: flex; gap: 6px; }
.detail-aside { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 78px; }
.progress-line { display: flex; align-items: center; gap: 10px; }
.progress-line strong { font-size: 20px; font-weight: 600; min-width: 42px; }
.progress-line small { font-size: 10px; color: var(--muted); }
.next-node { display: flex; flex-direction: column; gap: 2px; margin-top: 11px; padding-top: 10px; border-top: 1px solid #f1f5f9; }
.next-node span { font-size: 9.5px; color: var(--muted); }
.next-node strong { font-size: 12px; font-weight: 500; }
.next-node small { font-size: 10px; color: var(--warning); }
.push-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.push-row > div { display: flex; flex-direction: column; gap: 2px; }
.push-row strong { font-size: 12px; font-weight: 500; }
.push-row small { font-size: 10.5px; color: var(--muted); }
.reminder-summary { margin-top: 10px; padding-top: 9px; border-top: 1px solid #f1f5f9; }
.mini-stats { display: flex; flex-wrap: wrap; gap: 4px 11px; font-size: 10.5px; color: var(--muted); }
.mini-stats b { color: var(--text-2); font-weight: 500; }
.mini-stats .bad b { color: var(--danger); }
.aside-card .btn-block { margin-top: 6px; }
.nodes-panel { min-height: 280px; }
.node-list { padding: 4px 10px 10px; }
.node-row {
  display: grid; grid-template-columns: 20px 22px minmax(0, 1fr) auto;
  gap: 9px; align-items: flex-start; padding: 11px 5px;
  border-bottom: 1px solid #f1f5f9; border-radius: 4px; position: relative;
}
.node-row:last-child { border-bottom: 0; }
.node-row:hover { background: var(--surface-2); }
.node-row.dragging { opacity: .45; }
.node-row.drop-target { box-shadow: inset 0 2px 0 var(--primary); }
.drag-handle {
  width: 20px; height: 24px; border: 0; background: transparent; padding: 0;
  display: flex; align-items: center; justify-content: center; cursor: grab;
}
.drag-dots {
  width: 12px; height: 18px; opacity: .55;
  background-image: radial-gradient(#94a3b8 1.1px, transparent 1.2px);
  background-size: 5px 5px;
}
.node-index { font-size: 9.5px; color: var(--muted); }
.node-row > .node-check { margin-top: 1px; }
.node-main { min-width: 0; cursor: pointer; }
.node-title-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.node-title-row h4 { font-size: 13px; font-weight: 500; line-height: 1.45; }
.node-row.is-done .node-title-row h4 { text-decoration: line-through; text-decoration-color: #cbd5e1; color: var(--muted); }
.node-row.is-done { opacity: .65; }
.node-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 3px; font-size: 10.5px; color: var(--muted); }
.node-meta span { white-space: nowrap; }
.node-notes { margin-top: 3px; font-size: 10.5px; color: var(--muted); line-height: 1.5; }
.node-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.done-at { font-size: 9.5px; color: var(--muted); }
.row-menu { position: relative; }
.row-menu summary { list-style: none; cursor: pointer; font-size: 11px; color: var(--muted); padding: 2px 4px; }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu summary:hover { color: var(--primary); }
.row-menu-pop { position: absolute; right: 0; top: 22px; z-index: 20; min-width: 96px; padding: 3px; background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 6px 18px rgba(15, 23, 42, .1); }
.row-menu-pop button { display: block; width: 100%; padding: 6px 8px; border: 0; border-radius: 4px; background: transparent; color: var(--text-2); font-size: 11px; text-align: left; }
.row-menu-pop button:hover { background: var(--surface-2); color: var(--text); }
.row-menu-pop button.danger { color: var(--danger); }
.row-menu-pop button:disabled { color: #cbd5e1; }
.nodes-empty { padding: 38px 18px; text-align: center; }
.nodes-empty h4 { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.nodes-empty p { font-size: 11.5px; color: var(--muted); margin-bottom: 12px; }
.nodes-empty-actions { display: flex; justify-content: center; gap: 6px; }

/* More menu */
.menu-anchor, .more-menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: 40px; z-index: 40; min-width: 160px;
  padding: 4px; background: #fff; border: 1px solid var(--border);
  border-radius: 7px; box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
}
.menu-pop button {
  display: flex; width: 100%; padding: 8px; border: 0; border-radius: 5px;
  background: transparent; color: var(--text-2); font-size: 12px; text-align: left;
}
.menu-pop button:hover { background: var(--surface-2); color: var(--text); }
.menu-pop button.danger { color: var(--danger); }
.menu-pop button.danger:hover { background: var(--danger-soft); }

/* Conflicts */
.conflict-section { margin-top: 16px; }
.section-heading { display: flex; align-items: baseline; gap: 7px; margin-bottom: 9px; }
.section-heading h3 { font-size: 13px; font-weight: 600; }
.section-heading span { font-size: 10.5px; color: var(--muted); }
.conflict-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 10px; }
.conflict-card { padding: 12px 13px; background: #fff; border: 1px solid var(--border); border-radius: 7px; }
.conflict-card-head { margin-bottom: 8px; }
.gap-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; background: var(--danger-soft); color: #b91c1c; font-size: 10px; }
.conflict-body { display: grid; grid-template-columns: 1fr 44px 1fr; align-items: center; gap: 6px; }
.conflict-side {
  display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 9px 10px;
  border: 1px solid var(--border); border-left: 3px solid var(--cat, var(--danger));
  border-radius: 5px; background: #fff; text-align: left;
}
.conflict-side:hover { border-color: var(--border-strong); border-left-color: var(--cat, var(--danger)); }
.conflict-time { font-size: 9.5px; color: var(--muted); }
.conflict-side strong { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conflict-event { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conflict-edit { margin-top: 2px; font-size: 9.5px; color: var(--primary); }
.conflict-gap-line { display: flex; justify-content: center; }
.conflict-gap-line b { font-size: 10px; color: var(--danger); background: var(--danger-soft); border-radius: 4px; padding: 2px 5px; font-weight: 500; }
.conflict-gap-line small { font-size: 7px; }
.peak-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.peak-card { padding: 12px; background: #fff; border: 1px solid var(--border); border-radius: 7px; }
.peak-card header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.peak-date { display: flex; align-items: baseline; gap: 6px; }
.peak-date strong { font-size: 19px; font-weight: 600; }
.peak-date span { font-size: 10.5px; color: var(--muted); }
.peak-count { font-size: 10px; color: var(--warning); background: var(--warning-soft); border-radius: 4px; padding: 2px 6px; }
.peak-items { display: flex; flex-direction: column; }
.peak-item { display: flex; align-items: center; gap: 7px; padding: 5px; border: 0; border-radius: 4px; background: transparent; text-align: left; font-size: 10.5px; }
.peak-item:hover { background: var(--surface-2); }
.peak-item span { color: var(--muted); width: 34px; }
.peak-item em { font-style: normal; color: var(--text-2); }
.peak-item small { margin-left: auto; color: var(--muted); font-size: 9.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 44%; }

/* Categories */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 12px; }
.category-card {
  display: flex; align-items: center; gap: 10px; padding: 14px;
  background: #fff; border: 1px solid var(--border); border-radius: 7px;
}
.category-color { width: 4px; align-self: stretch; border-radius: 2px; background: var(--cat); flex-shrink: 0; }
.category-body { min-width: 0; flex: 1; }
.category-body h3 { font-size: 13px; font-weight: 500; }
.category-body p { margin-top: 3px; font-size: 10.5px; color: var(--muted); }
.category-actions { display: flex; gap: 6px; opacity: .4; }
.category-card:hover .category-actions { opacity: 1; }
.category-add {
  min-height: 68px; border: 1px dashed var(--border-strong); border-radius: 7px;
  background: transparent; color: var(--muted); font-size: 12px;
}
.category-add:hover { border-color: var(--primary); color: var(--primary); }

/* Stats */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chart-panel { padding: 15px 16px; }
.chart-panel .panel-head { padding: 0 0 12px; border-bottom: 0; }
.chart-total { font-size: 10.5px; color: var(--muted); }
.week-chart { display: flex; align-items: flex-end; gap: 10px; height: 168px; }
.week-col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.week-value { font-size: 9.5px; color: var(--muted); height: 12px; }
.week-track { width: 100%; max-width: 30px; height: 118px; display: flex; align-items: flex-end; background: #f1f5f9; border-radius: 3px; overflow: hidden; }
.week-track i { display: block; width: 100%; background: var(--primary); border-radius: 3px 3px 0 0; }
.week-track i.is-empty { background: #e2e8f0; }
.week-label { font-size: 9.5px; color: var(--muted); }
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut { width: 124px; height: 124px; border-radius: 50%; flex-shrink: 0; background: conic-gradient(var(--primary) var(--p), #eef2f7 0); padding: 8px; }
.donut > div { width: 100%; height: 100%; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut strong { font-size: 23px; font-weight: 600; }
.donut strong small { font-size: 11px; color: var(--muted); }
.donut span { font-size: 9.5px; color: var(--muted); }
.donut-legend { display: flex; flex-direction: column; gap: 6px; }
.donut-legend p { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-2); }
.donut-legend p b { margin-left: auto; font-weight: 500; }
.donut-legend p.muted { display: block; font-size: 10px; line-height: 1.6; color: var(--muted); }
.cat-stats { display: flex; flex-direction: column; gap: 9px; }
.cat-stat-row { display: flex; flex-direction: column; gap: 4px; }
.cat-stat-label { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-2); }
.cat-stat-label b { margin-left: auto; font-size: 10px; color: var(--muted); font-weight: 400; }
.cat-stat-bar { height: 5px; border-radius: 2px; background: #eef2f7; overflow: hidden; }
.cat-stat-bar i { display: block; height: 100%; border-radius: 2px; }
.month-chart { display: flex; align-items: flex-end; gap: 12px; height: 140px; }
.month-col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.month-value { font-size: 9.5px; color: var(--muted); height: 12px; }
.month-track { width: 100%; max-width: 30px; height: 96px; display: flex; align-items: flex-end; background: #f1f5f9; border-radius: 3px; overflow: hidden; }
.month-track i { display: block; width: 100%; background: var(--primary); border-radius: 3px 3px 0 0; }
.month-track i.is-empty { background: #e2e8f0; }
.month-label { font-size: 9.5px; color: var(--muted); }

/* Settings */
.settings-top { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.settings-form { display: flex; flex-direction: column; gap: 10px; }
.settings-panel { padding: 15px 16px; }
.settings-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.settings-head h3 { font-size: 13px; font-weight: 600; }
.settings-form .field-grid { margin: 4px 0 2px; }
.settings-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding-top: 9px; border-top: 1px solid #f1f5f9; }
.settings-savebar { display: flex; justify-content: flex-end; padding-top: 2px; }
.settings-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.password-form { display: flex; flex-direction: column; gap: 10px; }
.export-actions { display: flex; gap: 6px; }
.about-line { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 9px; border-top: 1px solid #f1f5f9; font-size: 9.5px; color: var(--muted); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(15, 23, 42, .38); overflow-y: auto;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 540px; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column; background: #fff;
  border-radius: 8px; box-shadow: 0 20px 60px rgba(15, 23, 42, .18);
  animation: modalIn .18s ease; overflow: hidden;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.modal-sm { max-width: 400px; }
.modal-md { max-width: 540px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; font-weight: 600; }
.modal-head p { margin-top: 3px; font-size: 11px; color: var(--muted); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 7px; padding: 11px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.modal-foot-spacer { flex: 1; }
.confirm-overlay { z-index: 110; }
.confirm-modal { max-width: 360px; padding: 22px; text-align: center; }
.confirm-modal h2 { font-size: 15px; font-weight: 600; }
.confirm-modal p { margin: 7px 0 17px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.confirm-actions { display: flex; gap: 7px; }
.confirm-actions .btn { flex: 1; }

/* Reminder editor */
.reminder-block { padding-top: 2px; }
.reminder-block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.reminder-block-head h4 { font-size: 12px; font-weight: 500; }
.reminder-list { display: flex; flex-direction: column; gap: 6px; }
.reminder-row {
  display: grid; grid-template-columns: 16px 58px minmax(0, 1fr) 100px auto auto;
  align-items: center; gap: 6px; padding: 7px 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px;
}
.rem-index { font-size: 9.5px; color: var(--muted); text-align: center; }
.reminder-row select { height: 29px; font-size: 11px; padding: 0 22px 0 7px; background-position: right 6px center; }
.rem-config { min-width: 0; }
.rem-relative { display: flex; gap: 4px; }
.rem-relative input { width: 58px; height: 29px; font-size: 11px; padding: 0 6px; }
.rem-relative select { width: 58px; }
.rem-absolute input { height: 29px; font-size: 10.5px; padding: 0 6px; }
.rem-enable { display: inline-flex; align-items: center; gap: 3px; font-size: 9.5px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.rem-enable input { width: 12px; height: 12px; accent-color: var(--primary); margin: 0; }
.reminder-row .rem-trigger { width: 58px; }
.reminder-empty { padding: 12px; border: 1px dashed var(--border); border-radius: 6px; font-size: 11px; color: var(--muted); text-align: center; }

/* Parse */
.parse-form { display: flex; flex-direction: column; gap: 12px; }
.parse-textarea { min-height: 120px; font-size: 13px; line-height: 1.65; }
.parse-run-row { display: flex; align-items: center; gap: 10px; }
.parse-status { font-size: 10.5px; color: var(--muted); }
.parse-results { display: flex; flex-direction: column; gap: 6px; }
.parse-result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 2px; }
.parse-result-head h3 { font-size: 12px; font-weight: 600; }
.parse-result-head span { margin-left: 5px; font-size: 10px; color: var(--muted); }
.parse-result-tools { display: flex; gap: 9px; }
.parse-row {
  display: flex; gap: 9px; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
}
.parse-row.is-selected { border-color: #bfdbfe; background: #f8fbff; }
.parse-check { display: flex; align-items: flex-start; padding-top: 4px; cursor: pointer; }
.parse-check input { position: absolute; opacity: 0; }
.parse-check span { width: 15px; height: 15px; border: 1px solid #cbd5e1; border-radius: 3px; display: inline-block; background: #fff; position: relative; }
.parse-check input:checked + span { background: var(--primary); border-color: var(--primary); }
.parse-check input:checked + span::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 7px; border: solid #fff; border-width: 0 1.6px 1.6px 0; transform: rotate(42deg); }
.parse-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.parse-name-line { display: flex; align-items: center; gap: 6px; }
.parse-name { height: 28px; font-size: 12.5px; padding: 0 7px; border-color: transparent; background: transparent; }
.parse-name:hover, .parse-name:focus { border-color: var(--border); background: #fff; }
.confidence { font-size: 8.5px; border-radius: 3px; padding: 2px 4px; flex-shrink: 0; }
.conf-high { background: var(--success-soft); color: #15803d; }
.conf-medium { background: var(--warning-soft); color: #b45309; }
.conf-low { background: #f1f5f9; color: #64748b; }
.parse-time-line { display: flex; align-items: center; gap: 7px; }
.parse-time { width: 178px; height: 28px; font-size: 11px; padding: 0 7px; }
.parse-time-line .text-btn { font-size: 10px; white-space: nowrap; flex-shrink: 0; }
.parse-context { margin: 0; padding: 4px 7px; border-left: 2px solid var(--border); font-size: 10px; line-height: 1.5; color: var(--muted); }
.parse-note { font-size: 9.5px; color: #b45309; }
.parse-empty { display: flex; flex-direction: column; gap: 2px; padding: 15px; background: var(--surface-2); border-radius: 6px; }
.parse-empty strong { font-size: 11.5px; font-weight: 500; }
.parse-empty span { font-size: 10px; color: var(--muted); }
.parse-target { border-top: 1px solid var(--border); padding-top: 11px; }
.parse-target-row .field { width: 100%; }
.parse-new-event { display: flex; flex-direction: column; gap: 9px; margin-top: 9px; padding: 10px; background: var(--surface-2); border-radius: 6px; }
.parse-new-event[hidden] { display: none; }
.parse-fixed-target { display: flex; align-items: baseline; gap: 7px; padding: 8px 10px; border-radius: 5px; background: var(--primary-soft); color: var(--primary); font-size: 11px; }
.parse-fixed-target strong { font-weight: 500; }
.parse-count { font-size: 10.5px; color: var(--muted); margin-right: 8px; }

/* Drawer */
.drawer-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .32); z-index: 70; animation: fadeIn .15s ease; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 430px; max-width: 94vw; z-index: 71;
  display: flex; flex-direction: column; background: var(--surface-2);
  box-shadow: -12px 0 36px rgba(15, 23, 42, .12); animation: drawerIn .2s ease;
}
@keyframes drawerIn { from { transform: translateX(16px); opacity: .7; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 18px 13px; background: #fff; border-bottom: 1px solid var(--border); }
.drawer-head-copy { min-width: 0; }
.drawer-kicker { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 7px; }
.drawer-head h2 { font-size: 19px; font-weight: 600; line-height: 1.4; }
.drawer-head p { margin-top: 3px; font-size: 11px; color: var(--muted); }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 18px 18px; }
.drawer-time-card {
  display: flex; flex-direction: column; gap: 2px; padding: 13px 14px;
  background: var(--primary-soft); border: 1px solid #dbeafe; border-radius: 7px;
}
.drawer-time-card.is-overdue { background: var(--danger-soft); border-color: #fecaca; }
.drawer-date { font-size: 10px; color: var(--text-2); }
.drawer-time-card > strong { font-size: 28px; font-weight: 600; letter-spacing: -.02em; color: var(--text); }
.drawer-countdown { font-size: 10.5px; color: var(--primary); }
.drawer-time-card.is-overdue .drawer-countdown { color: var(--danger); }
.drawer-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 14px; }
.drawer-section { padding: 12px 0; border-top: 1px solid var(--border); }
.drawer-section:first-of-type { border-top: 0; padding-top: 0; }
.drawer-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.drawer-section-head h3 { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; color: var(--muted); }
.markdown-body { font-size: 12px; line-height: 1.7; color: var(--text-2); word-break: break-word; }
.markdown-body p { margin: 0 0 5px; }
.markdown-body p:last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { font-size: 12.5px; margin: 8px 0 4px; color: var(--text); }
.markdown-body ul { padding-left: 17px; margin: 3px 0 6px; }
.markdown-body a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.markdown-body code { font-family: var(--mono); font-size: 10.5px; background: #f1f5f9; padding: 1px 3px; border-radius: 3px; }
.markdown-body pre { background: #f1f5f9; padding: 8px; border-radius: 5px; overflow-x: auto; }
.markdown-body blockquote { margin: 5px 0; padding: 3px 8px; border-left: 2px solid var(--border-strong); color: var(--muted); }
.drawer-reminder { display: flex; align-items: flex-start; gap: 8px; padding: 8px 9px; border: 1px solid var(--border); border-radius: 6px; background: #fff; margin-bottom: 5px; }
.drawer-reminder-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.drawer-reminder-main strong { font-size: 10.5px; font-weight: 500; }
.drawer-reminder .btn { flex-shrink: 0; }
.rem-status { font-size: 9px; align-self: flex-start; border-radius: 3px; padding: 1px 4px; }
.rem-success { color: #15803d; background: var(--success-soft); }
.rem-warn { color: #b45309; background: var(--warning-soft); }
.rem-danger { color: #b91c1c; background: var(--danger-soft); }
.rem-error { font-size: 9.5px; color: var(--danger); line-height: 1.45; word-break: break-word; }
.relation-row { display: flex; align-items: baseline; gap: 6px; padding: 5px 0; font-size: 10.5px; color: var(--muted); }
.relation-row strong { font-size: 11px; color: var(--text-2); font-weight: 500; }
.relation-row em { margin-left: auto; font-style: normal; font-size: 9px; color: var(--muted); }
.drawer-foot { display: flex; gap: 6px; padding: 11px 18px; border-top: 1px solid var(--border); background: #fff; }
.drawer-foot .btn { flex: 1; padding: 0 8px; font-size: 12px; }
.drawer-loading { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 12px; }
.drawer-error { padding: 32px 20px; text-align: center; color: var(--muted); font-size: 12px; }

/* Notifications */
.notifications-panel {
  position: fixed; top: 68px; right: 24px; z-index: 60; width: 360px; max-width: calc(100vw - 24px);
  max-height: min(580px, calc(100vh - 90px)); display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, .14); overflow: hidden;
  animation: notifIn .15s ease;
}
@keyframes notifIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 13px; border-bottom: 1px solid var(--border); }
.notif-head > div { display: flex; align-items: baseline; gap: 6px; }
.notif-head strong { font-size: 12.5px; font-weight: 600; }
.notif-head span { font-size: 9.5px; color: var(--primary); }
.notif-head-actions { display: flex; align-items: center; gap: 9px; }
.notif-head .text-btn { font-size: 10.5px; }
.notif-list { overflow-y: auto; }
.notif-item {
  position: relative; display: flex; gap: 8px; width: 100%; padding: 10px 13px;
  border: 0; border-bottom: 1px solid #f1f5f9; border-left: 3px solid transparent;
  background: #fff; text-align: left;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.is-unread { background: #f8fbff; }
.notif-item.kind-overdue, .notif-item.kind-push_failed { border-left-color: var(--danger); }
.notif-item.kind-digest { border-left-color: var(--primary); }
.notif-item.kind-reminder { border-left-color: var(--success); }
.notif-content { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.notif-content strong { font-size: 11px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-content p { font-size: 10.5px; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-content time { font-size: 9px; color: #b6c2d3; margin-top: 2px; }
.notif-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex-shrink: 0; }
.notif-foot { padding: 8px 13px; border-top: 1px solid var(--border); text-align: center; }
.notif-foot a { font-size: 10px; color: var(--muted); }
.notif-foot a:hover { color: var(--primary); }
.notif-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 11px; }
.notif-loading { padding: 28px; display: flex; justify-content: center; }

/* Toast */
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 130; display: flex; flex-direction: column; gap: 7px; width: 320px; max-width: calc(100vw - 24px); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 8px; padding: 10px 11px;
  background: #fff; border: 1px solid var(--border); border-left: 3px solid var(--success);
  border-radius: 6px; box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.toast-out { opacity: 0; transition: opacity .18s ease; }
.toast-error { border-left-color: var(--danger); }
.toast-warn { border-left-color: var(--warning); }
.toast-body { min-width: 0; flex: 1; }
.toast-body strong { display: block; font-size: 11.5px; font-weight: 500; }
.toast-body p { margin-top: 1px; font-size: 10.5px; color: var(--muted); line-height: 1.45; word-break: break-word; }
.toast-close { border: 0; background: none; color: var(--muted); font-size: 14px; line-height: 1; padding: 0 2px; }

/* Login */
.login-page { background: #f2f6fc; }
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 380px; max-width: 100%; padding: 28px 28px 20px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, .06);
}
.login-brand { display: flex; align-items: baseline; gap: 8px; padding-bottom: 22px; }
.login-brand .brand-name { font-size: 21px; font-weight: 600; color: var(--primary); }
.login-brand .brand-sub { font-size: 11px; color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 13px; }
.auth-form h1 { font-size: 19px; font-weight: 600; margin-bottom: 3px; }
.auth-form .field label { font-size: 11.5px; }
.auth-form input { height: 38px; }
.btn-block { width: 100%; height: 38px; }
.auth-switch { margin-top: 14px; text-align: center; font-size: 11.5px; color: var(--muted); }
.auth-hint { margin-top: 14px; padding: 9px 10px; background: var(--surface-2); border-radius: 5px; font-size: 10px; line-height: 1.55; color: var(--muted); }
.login-card-foot { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); text-align: right; font-size: 9px; color: var(--muted); }
.link-btn { border: 0; background: none; padding: 0; color: var(--primary); font-size: 11.5px; }
.link-btn:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 1100px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 10px 0 30px rgba(15, 23, 42, .12); }
  html.sidebar-open .sidebar { transform: none; }
  html.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 49; background: rgba(15, 23, 42, .35); }
  .app-main { margin-left: 0; }
  .mobile-menu { display: inline-flex; }
  .dash-aside, .detail-aside { position: static; }
}
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dash-aside { display: grid; grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .settings-split { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .conflict-list { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .topbar { min-height: 56px; padding: 8px 14px; gap: 8px; flex-wrap: wrap; }
  .topbar h1 { font-size: 16px; }
  .topbar-actions { width: 100%; order: 3; gap: 6px; }
  .search-input { flex: 1; width: auto; }
  .view { padding: 16px 14px 48px; }
  .stat-grid { gap: 8px; }
  .stat-card { padding: 11px 12px; }
  .stat-value { font-size: 20px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .segmented { width: 100%; overflow-x: auto; }
  .seg-btn { flex: 1; padding: 0 8px; }
  .toolbar-right { width: 100%; }
  .toolbar-right .select-wrap { flex: 1 1 120px; min-width: 118px; }
  .toolbar-right .plain-select { flex: 1 1 102px; min-width: 100px; }
  .select-wrap select { width: 100%; min-width: 0; }
  .toolbar-right .view-toggle { margin-left: auto; flex: 0 0 auto; }
  .dash-aside { grid-template-columns: 1fr; }
  .detail-hero { flex-direction: column; padding: 15px; }
  .detail-hero-actions { width: 100%; justify-content: flex-start; }
  .detail-hero h2 { font-size: 19px; }
  .panel-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .panel-actions { width: 100%; }
  .panel-actions .btn { flex: 1; }
  .node-row { grid-template-columns: 16px 22px minmax(0, 1fr); }
  .node-side { grid-column: 3; align-items: flex-start; }
  .node-actions { opacity: 1; }
  .node-side .done-at { display: none; }
  .event-grid { grid-template-columns: 1fr; }
  .list-head { align-items: flex-start; flex-direction: column; gap: 4px; border-bottom: 0; }
  .tab-bar { width: 100%; border-bottom: 1px solid var(--border); }
  .list-actions { padding-bottom: 0; width: 100%; }
  .list-actions .btn { flex: 1; }
  .modal-overlay { padding: 8px; align-items: flex-end; }
  .modal { max-height: calc(100vh - 16px); border-radius: 8px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 14px; padding-right: 14px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-grid .span-2 { grid-column: auto; }
  .reminder-row { grid-template-columns: 14px 52px minmax(0, 1fr) auto; }
  .reminder-row .rem-channel { grid-column: 2 / 5; }
  .rem-enable { grid-column: 2 / 5; }
  .reminder-row .link-action { grid-column: 4; grid-row: 1; }
  .parse-time { width: 100%; }
  .parse-time-line { flex-wrap: wrap; }
  .parse-result-tools { gap: 7px; }
  .conflict-body { grid-template-columns: 1fr; }
  .conflict-gap-line { display: none; }
  .peak-list { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr; }
  .drawer { width: 100%; }
  .drawer-foot { flex-wrap: wrap; }
  .drawer-foot .btn { flex: 1 0 40%; }
  .notifications-panel { top: 104px; left: 12px; right: 12px; width: auto; }
  .toast-root { left: 12px; right: 12px; bottom: 12px; width: auto; }
  .login-card { padding: 24px 20px 18px; }
}

/* =========================================================
   Readability + H5 pass
   ========================================================= */
html { -webkit-text-size-adjust: 100%; }
body { font-size: 15px; }
.btn { height: 38px; padding: 0 15px; font-size: 14px; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.text-btn { font-size: 13.5px; }
.link-action { font-size: 12.5px; }
.more-summary { height: 38px; padding: 0 12px; font-size: 13.5px; }
.modal-close { font-size: 13px; }
.field { gap: 7px; }
.field label, .label-row label { font-size: 13px; }
.field > small, .field-hint { font-size: 12.5px; }
input[type=text], input[type=password], input[type=search], input[type=number],
input[type=date], input[type=time], input[type=datetime-local], input[type=url],
select, textarea { height: 40px; padding: 0 11px; font-size: 15px; }
textarea { padding: 10px 11px; line-height: 1.65; }
.prio-option span { height: 40px; font-size: 13.5px; }
.priority-options { height: 40px; }
.switch-row strong { font-size: 14px; }
.switch { width: 42px; height: 24px; }
.switch::after { width: 18px; height: 18px; }
.switch.is-on::after, .switch:has(input:checked)::after { transform: translateX(18px); }
.chip { height: 24px; padding: 0 8px; font-size: 12px; }
.prio { height: 22px; padding: 0 7px; font-size: 11px; }
.cat-pill { font-size: 12.5px; }
.status-pill { height: 23px; padding: 0 8px; font-size: 11.5px; }
.brand-name { font-size: 23px; }
.brand-sub { font-size: 12px; }
.nav { gap: 22px; }
.nav-item { height: 42px; padding: 0 11px; font-size: 14.5px; }
.nav-badge { min-width: 20px; height: 20px; font-size: 11px; }
.account-name { font-size: 13.5px; }
.topbar { min-height: 68px; padding: 11px 28px; gap: 16px; }
.topbar h1 { font-size: 20px; }
.search-input { width: 230px; height: 38px; padding: 0 12px; font-size: 14px; }
.notif-btn { height: 38px; padding: 0 12px; font-size: 14px; }
.notif-count { min-width: 18px; height: 18px; line-height: 18px; font-size: 10px; }
.view { padding: 26px 28px 64px; }
.stat-grid { gap: 12px; margin-bottom: 18px; }
.stat-card { padding: 16px 18px; gap: 8px; }
.stat-label { font-size: 13px; }
.stat-value { font-size: 30px; }
.conflict-banner { padding: 12px 14px; font-size: 13.5px; }
.segmented { padding: 3px; }
.seg-btn { height: 34px; padding: 0 12px; font-size: 13px; }
.select-wrap, .plain-select { height: 38px; }
.select-wrap select { height: 36px; font-size: 13px; }
.plain-select { height: 38px; font-size: 13px; padding: 0 30px 0 10px; }
.view-toggle button { height: 34px; padding: 0 10px; font-size: 12.5px; }
.active-search { font-size: 12.5px; }
.active-search button { font-size: 12.5px; }
.tl-head h3 { font-size: 14px; }
.tl-date, .tl-count { font-size: 12px; }
.tl-time strong { font-size: 14px; }
.tl-time span { font-size: 11.5px; }
.tl-card { padding: 12px 14px; }
.tl-card h4 { font-size: 16px; }
.tl-notes { font-size: 13px; }
.tl-meta { margin-top: 8px; gap: 6px; }
.countdown { font-size: 12px; }
.event-chip { font-size: 12px; }
.timeline-empty { font-size: 13px; padding: 15px 16px; }
.node-check { width: 24px; height: 24px; }
.check-mark { width: 6px; height: 10px; }
.aside-head h3 { font-size: 13.5px; }
.aside-head span, .aside-head a { font-size: 12px; }
.today-progress strong { font-size: 23px; }
.aside-alert { font-size: 12px; padding: 9px 10px; }
.cat-bar-label { font-size: 12.5px; }
.cat-bar-label b { font-size: 11.5px; }
.tab { padding: 11px 13px; font-size: 14px; }
.tab span { font-size: 11px; padding: 1px 6px; }
.summary-inline { font-size: 14px; }
.summary-inline strong { font-size: 22px; }
.list-actions { padding-bottom: 9px; }
.trash-hint { font-size: 12.5px; }
.event-grid { gap: 14px; margin-top: 14px; }
.event-card { padding: 17px; }
.event-card h3 { font-size: 17px; }
.event-desc { font-size: 13px; line-height: 1.6; }
.event-progress span { font-size: 11px; }
.mini-nodes li { font-size: 12px; padding: 5px 0; }
.mini-nodes span { width: 74px; }
.mini-nodes b { font-size: 10px; padding: 1px 5px; }
.trash-note { font-size: 12px; }
.event-card-foot { font-size: 12px; }
.category-body h3 { font-size: 15px; }
.category-body p { font-size: 12.5px; }
.category-actions { gap: 8px; }
.category-add { min-height: 76px; font-size: 13.5px; }
.back-link { font-size: 13px; }
.notice { font-size: 13px; padding: 10px 12px; }
.detail-hero { padding: 22px 24px; }
.detail-hero h2 { font-size: 26px; }
.detail-desc { font-size: 14px; line-height: 1.7; }
.detail-meta { font-size: 12.5px; gap: 14px; }
.detail-kicker { gap: 8px; margin-bottom: 9px; }
.panel-head { padding: 14px 16px; }
.panel-head h3 { font-size: 15px; }
.progress-line strong { font-size: 24px; }
.next-node span { font-size: 11px; }
.next-node strong { font-size: 13.5px; }
.next-node small { font-size: 11.5px; }
.push-row strong { font-size: 13.5px; }
.push-row small { font-size: 12px; }
.mini-stats { font-size: 12px; gap: 6px 12px; }
.node-list { padding: 5px 12px 12px; }
.node-row { padding: 13px 6px; gap: 10px; }
.node-title-row h4 { font-size: 15px; }
.node-meta { font-size: 12px; gap: 10px; }
.node-notes { font-size: 12.5px; }
.done-at { font-size: 11px; }
.row-menu summary { font-size: 12.5px; padding: 3px 5px; }
.row-menu-pop button { font-size: 12.5px; padding: 7px 9px; }
.nodes-empty h4 { font-size: 15px; }
.nodes-empty p { font-size: 13px; }
.section-heading h3 { font-size: 14.5px; }
.section-heading span { font-size: 12px; }
.gap-badge { font-size: 11.5px; height: 22px; }
.conflict-time { font-size: 11px; }
.conflict-side strong { font-size: 13.5px; }
.conflict-event { font-size: 11.5px; }
.conflict-edit { font-size: 11px; }
.conflict-gap-line b { font-size: 11.5px; }
.peak-date strong { font-size: 21px; }
.peak-date span { font-size: 12px; }
.peak-count { font-size: 11px; }
.peak-item { font-size: 12px; }
.chart-total { font-size: 12px; }
.week-value, .week-label, .month-value, .month-label { font-size: 11px; }
.donut strong { font-size: 26px; }
.donut span { font-size: 11px; }
.donut-legend p { font-size: 12.5px; }
.donut-legend p.muted { font-size: 11.5px; }
.cat-stat-label { font-size: 12.5px; }
.settings-head h3 { font-size: 15px; }
.settings-head { margin-bottom: 12px; }
.settings-panel { padding: 17px 18px; }
.export-actions .btn { font-size: 13.5px; }
.about-line { font-size: 11.5px; }
.modal-head { padding: 18px 20px 14px; }
.modal-head h2 { font-size: 19px; }
.modal-head p { font-size: 12.5px; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 12px 20px; }
.confirm-modal h2 { font-size: 17px; }
.confirm-modal p { font-size: 13px; }
.reminder-block-head h4 { font-size: 13.5px; }
.reminder-row { padding: 8px 9px; }
.reminder-row select { height: 32px; font-size: 12px; }
.rem-relative input { height: 32px; font-size: 12px; }
.rem-absolute input { height: 32px; font-size: 12px; }
.rem-enable { font-size: 11px; }
.reminder-empty { font-size: 12.5px; }
.parse-textarea { font-size: 14px; min-height: 140px; }
.parse-result-head h3 { font-size: 13.5px; }
.parse-result-head span { font-size: 11.5px; }
.parse-name { height: 32px; font-size: 14px; }
.parse-time { height: 32px; font-size: 12.5px; }
.parse-context { font-size: 11.5px; }
.parse-note { font-size: 11px; }
.parse-empty strong { font-size: 13px; }
.parse-empty span { font-size: 11.5px; }
.parse-fixed-target { font-size: 12.5px; padding: 9px 11px; }
.confidence { font-size: 10px; padding: 2px 5px; }
.drawer-head { padding: 20px 20px 15px; }
.drawer-head h2 { font-size: 22px; }
.drawer-head p { font-size: 12.5px; }
.drawer-body { padding: 16px 20px 20px; }
.drawer-date { font-size: 11.5px; }
.drawer-time-card > strong { font-size: 32px; }
.drawer-countdown { font-size: 12px; }
.drawer-section-head h3 { font-size: 11.5px; }
.markdown-body { font-size: 13.5px; }
.drawer-reminder-main strong { font-size: 12px; }
.rem-status { font-size: 10px; }
.rem-error { font-size: 10.5px; }
.relation-row { font-size: 12px; }
.relation-row strong { font-size: 12.5px; }
.notifications-panel { width: 380px; }
.notif-head strong { font-size: 14px; }
.notif-head span { font-size: 11px; }
.notif-content strong { font-size: 12.5px; }
.notif-content p { font-size: 12px; }
.notif-content time { font-size: 10.5px; }
.notif-foot a { font-size: 11.5px; }
.toast-body strong { font-size: 13px; }
.toast-body p { font-size: 12px; }
.login-card { width: 400px; padding: 30px 30px 22px; }
.login-brand .brand-name { font-size: 24px; }
.login-brand .brand-sub { font-size: 12px; }
.auth-form { gap: 15px; }
.auth-form h1 { font-size: 22px; }
.auth-form input { height: 44px; font-size: 16px; }
.btn-block { height: 44px; font-size: 15px; }
.auth-switch { font-size: 13px; }
.login-card-foot { font-size: 10.5px; }

@media (max-width: 700px) {
  body { font-size: 15px; }
  .topbar { padding: 9px 14px; gap: 8px; }
  .topbar h1 { font-size: 19px; }
  .topbar-actions { gap: 7px; }
  .search-input { flex: 1 1 120px; width: auto; height: 40px; font-size: 16px; }
  .notif-btn { height: 40px; padding: 0 10px; font-size: 14px; }
  .topbar-actions .btn { height: 40px; font-size: 14px; padding: 0 12px; }
  .view { padding: 18px 14px calc(60px + env(safe-area-inset-bottom)); }
  .stat-grid { gap: 9px; }
  .stat-card { padding: 13px 14px; }
  .stat-label { font-size: 13px; }
  .stat-value { font-size: 27px; }
  .conflict-banner { font-size: 13px; }
  .seg-btn { height: 34px; padding: 0 9px; font-size: 13px; }
  .toolbar-right .select-wrap { flex: 1 1 120px; min-width: 118px; }
  .toolbar-right .plain-select { flex: 1 1 102px; min-width: 100px; height: 40px; font-size: 13.5px; }
  .select-wrap { height: 40px; }
  .select-wrap select { height: 38px; font-size: 13.5px; }
  .view-toggle button { height: 34px; font-size: 12.5px; }
  .tl-item { grid-template-columns: 56px 16px minmax(0, 1fr); }
  .tl-time strong { font-size: 14px; }
  .tl-time span { font-size: 11.5px; }
  .tl-card { padding: 12px 13px; }
  .tl-card h4 { font-size: 16px; }
  .tl-notes { font-size: 13px; }
  .tl-meta { gap: 6px; }
  .countdown { font-size: 12px; }
  .chip { height: 23px; font-size: 11.5px; }
  .event-chip { font-size: 12px; }
  .tab { font-size: 14px; padding: 11px 12px; }
  .summary-inline { font-size: 14px; }
  .event-card { padding: 16px; }
  .event-card h3 { font-size: 17px; }
  .event-desc { font-size: 13px; }
  .mini-nodes li { font-size: 12px; }
  .mini-nodes span { width: 74px; }
  .category-actions { opacity: 1; }
  .detail-hero { padding: 18px 16px; }
  .detail-hero h2 { font-size: 24px; }
  .detail-desc { font-size: 14px; }
  .detail-meta { font-size: 12.5px; }
  .node-row { grid-template-columns: 20px 26px minmax(0, 1fr) auto; padding: 12px 6px; gap: 8px; }
  .node-side { grid-column: auto; align-items: flex-end; }
  .node-title-row h4 { font-size: 15px; }
  .node-meta { font-size: 12px; gap: 8px; }
  .node-notes { font-size: 12.5px; }
  .done-at { display: none; }
  .row-menu summary { font-size: 12.5px; }
  .panel-head h3 { font-size: 15px; }
  .settings-head h3 { font-size: 15px; }
  .field label { font-size: 13px; }
  input[type=text], input[type=password], input[type=search], input[type=number],
  input[type=date], input[type=time], input[type=datetime-local], input[type=url],
  select, textarea { height: 44px; font-size: 16px; }
  textarea { height: auto; }
  .btn { height: 42px; font-size: 14px; }
  .btn-sm { height: 34px; font-size: 13px; }
  .switch-row strong { font-size: 14px; }
  .modal-head { padding: 16px 15px 13px; }
  .modal-head h2 { font-size: 19px; }
  .modal-body { padding: 16px 15px; }
  .modal-foot { padding: 12px 15px calc(12px + env(safe-area-inset-bottom)); }
  .modal { max-height: calc(100dvh - 12px); }
  .reminder-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; }
  .rem-index { width: 16px; }
  .rem-trigger { width: 68px; }
  .rem-config { flex: 1 1 140px; }
  .rem-relative input { width: 64px; height: 34px; }
  .rem-relative select { width: 64px; }
  .rem-absolute input { height: 34px; }
  .reminder-row .rem-channel { flex: 1 1 120px; }
  .rem-enable { flex: 0 0 auto; font-size: 11.5px; }
  .reminder-row .link-action { margin-left: auto; }
  .parse-name-line { flex-wrap: wrap; }
  .parse-time { width: 100%; }
  .parse-time-line { flex-wrap: wrap; }
  .parse-row { padding: 10px; }
  .drawer-head h2 { font-size: 22px; }
  .drawer-body { font-size: 14px; }
  .drawer-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .drawer-foot .btn { height: 44px; }
  .notifications-panel { top: 112px; }
  .notif-item { padding: 12px 13px; }
  .notif-content strong { font-size: 13px; }
  .notif-content p { font-size: 12px; }
  .toast-body strong { font-size: 13px; }
  .toast-body p { font-size: 12px; }
  .login-shell { padding: 16px; }
  .login-card { padding: 26px 22px 20px; }
  .auth-form h1 { font-size: 22px; }
  .login-brand .brand-name { font-size: 24px; }
}
@media (max-width: 360px) {
  .topbar-actions .btn { padding: 0 9px; font-size: 13px; }
  .search-input { flex-basis: 100px; }
  .stat-value { font-size: 25px; }
  .toolbar-right .select-wrap { flex-basis: 105px; min-width: 104px; }
  .toolbar-right .plain-select { flex-basis: 92px; min-width: 90px; }
}

@media (max-width: 380px) {
  .toolbar-right .select-wrap,
  .toolbar-right .plain-select { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .toolbar-right .view-toggle { margin-left: auto; }
}

.seg-btn, .tab, .view-toggle button, .notif-btn { white-space: nowrap; }
@media (max-width: 360px) {
  .range-seg { overflow-x: auto; flex-wrap: nowrap; }
  .seg-btn { flex: 0 0 auto; padding: 0 9px; }
}
