/* ============ Design tokens ============ */
:root {
  --bg-page: oklch(0.985 0.004 60);
  --bg-sidebar: oklch(0.97 0.006 60);
  --border-sidebar: oklch(0.9 0.008 60);
  --border-subtle: oklch(0.93 0.008 60);
  --border-input: oklch(0.88 0.008 60);

  --text-primary: oklch(0.25 0.01 60);
  --text-secondary: oklch(0.55 0.02 60);
  --text-muted: oklch(0.6 0.02 60);

  --accent: oklch(0.55 0.13 55);
  --accent-hover: oklch(0.5 0.13 55);
  --accent-soft-bg: oklch(0.95 0.02 55);
  --accent-soft-text: oklch(0.45 0.1 55);
  --accent-active-bg: oklch(0.93 0.03 55);
  --accent-active-text: oklch(0.4 0.1 55);
  --accent-ring: oklch(0.6 0.13 55 / 0.12);
  --accent-focus-border: oklch(0.6 0.13 55);

  --pin-fill: oklch(0.6 0.14 55);
  --danger: oklch(0.6 0.15 25);

  --card-bg: #fff;
  --card-border: oklch(0.9 0.008 60);
  --card-shadow-hover: 0 4px 16px oklch(0.2 0.02 60 / 0.08);

  --code-bg: oklch(0.97 0.006 60);

  --modal-shadow: 0 8px 30px oklch(0.2 0.02 60 / 0.06);
  --overlay-shadow: 0 20px 50px oklch(0.15 0.02 60 / 0.25);
  --overlay-bg: oklch(0.2 0.02 60 / 0.45);

  --radius-sm: 7px;
  --radius-md: 9px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 100px;

  --font-ui: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-ui);
}

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

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: oklch(0.88 0.01 60); border-radius: 8px; }

input, textarea, select, button { font-family: inherit; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent-focus-border) !important;
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ============ Layout ============ */
.app-shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.mobile-topbar { display: none; }
.hamburger-btn, .sidebar-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  color: var(--text-primary);
  display: flex;
  transition: background 0.12s ease;
}
.hamburger-btn:hover, .sidebar-close-btn:hover { background: oklch(0.93 0.01 60); }
.hamburger-btn:active, .sidebar-close-btn:active { background: oklch(0.9 0.01 60); }
.sidebar-close-btn { display: none; }

.sidebar-backdrop {
  display: none;
}

.sidebar {
  display: flex;
  flex-direction: column;
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-sidebar);
  padding: 20px 16px;
  gap: 24px;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo span {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.search-box { position: relative; }
.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border-radius: 8px;
  border: 1px solid var(--border-input);
  background: #fff;
  font-size: 13px;
  color: var(--text-primary);
}

.sidebar-section { display: flex; flex-direction: column; gap: 2px; }
.sidebar-section-tags { display: flex; flex-direction: column; gap: 8px; }
.sidebar-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  text-transform: uppercase;
  padding: 0 10px;
  margin-bottom: 6px;
}

.cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text-primary);
  transition: background 0.12s ease;
  font-size: 13.5px;
}
.cat-item:hover { background: oklch(0.95 0.01 60); }
.cat-item:active { background: oklch(0.91 0.01 60); }
.cat-item.active {
  background: var(--accent-active-bg);
  color: var(--accent-active-text);
  font-weight: 600;
}
.cat-item .count { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.cat-item.active .count { color: oklch(0.5 0.08 55); }

.cat-add {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  background: none;
  border: none;
  text-align: left;
  width: 100%;
}
.cat-add:hover { background: oklch(0.95 0.01 60); }
.cat-add:active { background: oklch(0.91 0.01 60); }

.inline-add-form {
  display: flex;
  gap: 6px;
  padding: 4px 10px 2px;
}
.inline-add-form input {
  flex-grow: 1;
  min-width: 0;
  padding: 6px 9px;
  border-radius: 6px;
  border: 1.5px solid var(--border-input);
  font-size: 12.5px;
}
.inline-add-form button {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease;
}
.inline-add-form button:hover { background: var(--accent-hover); }
.inline-add-form button:active { background: oklch(0.46 0.13 55); transform: scale(0.95); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px; }
.tag-pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: #fff;
  border: 1px solid var(--border-input);
  color: oklch(0.4 0.01 60);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.tag-pill:hover { background: oklch(0.95 0.01 60); }
.tag-pill:active { background: oklch(0.91 0.01 60); }
.tag-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tag-pill.active:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.tag-pill.active:active { background: oklch(0.46 0.13 55); border-color: oklch(0.46 0.13 55); }

.sidebar-footer {
  margin-top: auto;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border-sidebar);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.sidebar-footer strong { color: var(--text-primary); font-weight: 400; }
.sidebar-footer .storage { color: oklch(0.4 0.01 60); }

/* ============ Main content ============ */
.main-content { flex-grow: 1; padding: 28px 36px; overflow: auto; min-width: 0; }

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}
.main-header h1 { font-size: 22px; font-weight: 700; margin: 0; color: var(--text-primary); }
.main-header .subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.sort-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.sort-group .sort-label { font-size: 11.5px; color: var(--text-muted); }
.sort-group .tag-pill { font-size: 11.5px; padding: 4px 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  padding: 10px 18px;
  transition: background 0.12s ease, transform 0.08s ease;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: oklch(0.46 0.13 55); }
.btn-secondary { background: #fff; color: var(--text-primary); border-color: var(--border-input); }
.btn-secondary:hover { background: oklch(0.94 0.008 60); }
.btn-secondary:active { background: oklch(0.9 0.008 60); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: oklch(0.53 0.16 25); }
.btn-danger:active { background: oklch(0.48 0.16 25); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.text-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 1100px) { .text-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .text-grid { grid-template-columns: 1fr; } }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  gap: 10px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-1px); }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-title { font-size: 14.5px; font-weight: 600; color: var(--text-primary); }

.pin-btn {
  flex-shrink: 0;
  margin-top: 1px;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 2px;
  cursor: pointer;
  line-height: 0;
  transition: background 0.12s ease, transform 0.08s ease;
}
.pin-btn:hover { background: oklch(0.93 0.01 60); }
.pin-btn:active { background: oklch(0.9 0.01 60); transform: scale(0.9); }

.card-preview {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: oklch(0.5 0.02 60);
  height: 58px;
  overflow: hidden;
  background: var(--code-bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

.card-tags { display: flex; flex-wrap: wrap; gap: 5px; min-height: 20px; }
.card-tags .pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft-bg);
  color: var(--accent-soft-text);
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}
.card-footer-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-footer .used-at { font-size: 11px; color: var(--text-muted); }
.card-footer .char-count-card { font-size: 10.5px; color: var(--text-muted); }
.card-footer-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: oklch(0.5 0.02 60);
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease;
}
.icon-btn:hover { background: oklch(0.93 0.01 60); }
.icon-btn:active { background: oklch(0.9 0.01 60); transform: scale(0.92); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:active { background: oklch(0.93 0.05 25); }

.copy-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease;
}
.copy-btn:hover { background: var(--accent-hover); }
.copy-btn:active { background: oklch(0.46 0.13 55); transform: scale(0.95); }
.copy-btn.copied { background: oklch(0.55 0.13 145); }

/* ============ Modal: Tambah/Edit Teks ============ */
.modal-overlay-plain {
  position: fixed;
  inset: 0;
  background: oklch(0.2 0.02 60 / 0.25);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  z-index: 40;
}
.modal-panel {
  width: 100%;
  max-width: 600px;
  background: #fff;
  border: 1px solid var(--border-sidebar);
  border-radius: var(--radius-xl);
  box-shadow: var(--modal-shadow);
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-header h2 { font-size: 17px; font-weight: 700; margin: 0; color: var(--text-primary); }
.modal-header .subtitle { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.close-btn {
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: oklch(0.5 0.02 60);
  background: none;
  border: none;
}
.close-btn:hover { background: oklch(0.93 0.01 60); }
.close-btn:active { background: oklch(0.9 0.01 60); transform: scale(0.92); }

.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.field-label {
  font-size: 13px;
  font-weight: 600;
  color: oklch(0.35 0.01 60);
  margin-bottom: 7px;
  display: block;
}
.field-row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.char-count { font-size: 11.5px; color: var(--text-muted); }

.text-input, .textarea-input {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-input);
  font-size: 14px;
  color: var(--text-primary);
  background: #fff;
}
.textarea-input {
  height: 150px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: oklch(0.3 0.01 60);
  resize: vertical;
  background: oklch(0.98 0.004 60);
  position: relative;
}
.textarea-input.has-highlight { background: transparent; }

.textarea-highlight-wrap { position: relative; }
.textarea-highlight-overlay {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 11px 13px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  color: transparent;
  pointer-events: none;
  user-select: none;
}
.textarea-highlight-overlay mark.fr-mark {
  background: oklch(0.85 0.13 95 / 0.65);
  border-radius: 2px;
  color: transparent;
}
.textarea-highlight-overlay mark.fr-mark-current {
  background: oklch(0.7 0.15 55 / 0.75);
}

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: #fff;
  border: 1.5px solid var(--border-input);
  color: oklch(0.4 0.01 60);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.cat-chip:hover { border-color: oklch(0.7 0.02 60); background: oklch(0.97 0.006 60); }
.cat-chip:active { transform: scale(0.96); }
.cat-chip.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.cat-chip.selected:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.cat-chip.selected:active { background: oklch(0.46 0.13 55); border-color: oklch(0.46 0.13 55); }
.cat-chip.new-chip {
  border-style: dashed;
  border-color: oklch(0.8 0.008 60);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}
.cat-chip.new-chip:hover { border-color: var(--accent); color: var(--accent); background: #fff; }

.new-cat-inline { display: flex; gap: 8px; align-items: center; }
.new-cat-inline input {
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-input);
  font-size: 13px;
  min-width: 160px;
}

.tag-input-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-input);
  background: oklch(0.98 0.004 60);
}
.tag-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  padding: 5px 6px 5px 11px;
  border-radius: var(--radius-pill);
  background: #fff;
  border: 1px solid var(--border-input);
  color: oklch(0.4 0.01 60);
}
.tag-chip button {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  color: oklch(0.6 0.02 60);
  transition: color 0.12s ease, transform 0.08s ease;
}
.tag-chip button:hover { color: var(--danger); }
.tag-chip button:active { transform: scale(0.85); }
.tag-input-box input {
  flex-grow: 1;
  min-width: 100px;
  border: none;
  background: transparent;
  font-size: 12.5px;
  padding: 5px 4px;
  color: oklch(0.3 0.01 60);
}
.tag-input-box input:focus { box-shadow: none !important; }

.pin-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  background: var(--accent-soft-bg);
  cursor: pointer;
  transition: background 0.12s ease;
}
.pin-row:hover { background: oklch(0.93 0.03 55); }
.pin-row:active { background: oklch(0.91 0.04 55); }
.pin-row span { font-size: 12.5px; color: var(--accent-soft-text); }
.pin-row input { accent-color: var(--accent); }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 24px;
  border-top: 1px solid var(--border-subtle);
  background: oklch(0.98 0.004 60);
}

.field-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ============ Cari & Ganti (find/replace) ============ */
.fr-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.12s ease, color 0.12s ease;
}
.fr-trigger:hover { background: oklch(0.95 0.01 60); color: var(--accent); }
.fr-trigger:active { background: oklch(0.91 0.01 60); }
.fr-trigger.active { color: var(--accent); background: var(--accent-soft-bg); }

.find-replace-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-input);
  background: oklch(0.98 0.004 60);
  margin-top: 10px;
  margin-bottom: -6px;
}
.fr-row { display: flex; gap: 8px; }
.fr-row-meta { align-items: center; justify-content: space-between; }
.fr-input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1.5px solid var(--border-input);
  font-size: 13px;
  color: var(--text-primary);
  background: #fff;
}
.fr-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}
.fr-checkbox input { accent-color: var(--accent); }
.fr-count { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.fr-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.fr-actions .btn { padding: 7px 12px; font-size: 12.5px; border-radius: 7px; }

/* ============ Modal: Isi Variabel ============ */
.modal-overlay-dark {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.overlay-panel {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--overlay-shadow);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
}
.overlay-header h2 { font-size: 16px; font-weight: 700; margin: 0; color: var(--text-primary); }
.overlay-header .subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.overlay-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.var-field { display: flex; flex-direction: column; gap: 6px; }
.var-field label {
  font-size: 12.5px;
  font-weight: 600;
  color: oklch(0.35 0.01 60);
  font-family: var(--font-mono);
}
.var-field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border-input);
  font-size: 13.5px;
  color: var(--text-primary);
}

.preview-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.preview-box {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: oklch(0.4 0.01 60);
  background: var(--code-bg);
  border: 1px solid var(--border-sidebar);
  border-radius: 9px;
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-word;
}
.preview-box mark {
  background: oklch(0.88 0.09 55);
  color: oklch(0.35 0.1 55);
  padding: 1px 3px;
  border-radius: 4px;
  font-weight: 600;
}

.overlay-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border-subtle);
  background: oklch(0.98 0.004 60);
}
.overlay-footer .btn { padding: 9px 18px; font-size: 13px; border-radius: 8px; }

.confirm-panel { max-width: 380px; }
.confirm-body { padding: 28px 24px 22px; text-align: center; }
.confirm-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: oklch(0.94 0.05 25);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.confirm-body h2 { font-size: 16px; font-weight: 700; margin: 0 0 8px; color: var(--text-primary); }
.confirm-body p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin: 0; }
.confirm-body p strong { color: var(--text-primary); font-weight: 600; }
.confirm-panel .overlay-footer { justify-content: center; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: oklch(0.25 0.01 60);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  z-index: 60;
  box-shadow: 0 8px 24px oklch(0.2 0.02 60 / 0.25);
}

/* ============ Login page ============ */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--border-sidebar);
  border-radius: var(--radius-xl);
  box-shadow: var(--modal-shadow);
  padding: 32px 28px;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 6px;
}
.login-logo span { font-size: 19px; font-weight: 700; color: var(--text-primary); }
.login-subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 26px;
}
.login-field { margin-bottom: 16px; }
.login-field label { font-size: 13px; font-weight: 600; color: oklch(0.35 0.01 60); margin-bottom: 7px; display: block; }
.login-field input {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-input);
  font-size: 14px;
}
.login-error {
  background: oklch(0.96 0.03 25);
  color: oklch(0.45 0.15 25);
  border-radius: var(--radius-md);
  padding: 10px 13px;
  font-size: 12.5px;
  margin-bottom: 16px;
}
.login-btn {
  width: 100%;
  justify-content: center;
  margin-top: 6px;
}

/* ============ Mobile ============ */
@media (max-width: 860px) {
  .app-shell { flex-direction: column; }

  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-sidebar);
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .mobile-topbar .sidebar-logo span { font-size: 16px; }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: oklch(0.2 0.02 60 / 0.4);
    z-index: 45;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(300px, 85vw);
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 40px oklch(0.2 0.02 60 / 0.2);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close-btn { display: flex; position: absolute; top: 14px; right: 14px; }

  .main-content { padding: 20px 16px 40px; }
  .main-header { flex-direction: column; align-items: flex-start; }
  .main-header > div:last-child { width: 100%; display: flex; gap: 10px; }
  .main-header > div:last-child form { display: flex; flex: 1; }
  .main-header > div:last-child .btn { flex: 1; justify-content: center; }

  .modal-overlay-plain { padding: 0; align-items: stretch; }
  .modal-panel { max-width: none; min-height: 100vh; border-radius: 0; border: none; }

  .modal-overlay-dark { padding: 14px; }
}
