/* ============================================================
   Design tokens — shared across every page.
   Light palette lives on :root; dark overrides mirror it under
   prefers-color-scheme and the explicit [data-theme] toggle.
   ============================================================ */

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

:root {
  --bg: #f7f5f3;
  --bg-elevated: #ffffff;
  --bg-subtle: #faf8f6;
  --bg-hover: #f0ece7;

  --border: #e8e2db;
  --border-strong: #d4cbc0;

  --text: #211a14;
  --text-muted: #6b5d51;
  --text-faint: #9c8d7e;

  --primary: #f97316;
  --primary-hover: #ea580c;
  --primary-soft: #ffedd5;
  --primary-text-on: #ffffff;

  --accent: #d97706;

  --success: #16a34a;
  --success-soft: #ecfdf3;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fef2f2;
  --warning: #d97706;
  --warning-soft: #fffbeb;

  --focus-ring: #f97316;

  --shadow-sm: 0 1px 2px rgba(33, 26, 20, 0.06);
  --shadow-md: 0 4px 16px rgba(33, 26, 20, 0.08);
  --shadow-lg: 0 16px 48px rgba(33, 26, 20, 0.16);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 999px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Helvetica, Arial, sans-serif;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  --grain-texture: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #17130f;
    --bg-elevated: #211a15;
    --bg-subtle: #28201a;
    --bg-hover: #2f2620;

    --border: #3a2f27;
    --border-strong: #4c3e33;

    --text: #f5efe9;
    --text-muted: #b3a598;
    --text-faint: #7a6c60;

    --primary: #fb923c;
    --primary-hover: #fdba74;
    --primary-soft: #40200a;
    --primary-text-on: #170f06;

    --accent: #fbbf24;

    --success: #34d399;
    --success-soft: #103228;
    --danger: #f87171;
    --danger-hover: #fb9292;
    --danger-soft: #351c1f;
    --warning: #fbbf24;
    --warning-soft: #332608;

    --focus-ring: #fb923c;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);

    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #17130f;
  --bg-elevated: #211a15;
  --bg-subtle: #28201a;
  --bg-hover: #2f2620;

  --border: #3a2f27;
  --border-strong: #4c3e33;

  --text: #f5efe9;
  --text-muted: #b3a598;
  --text-faint: #7a6c60;

  --primary: #fb923c;
  --primary-hover: #fdba74;
  --primary-soft: #40200a;
  --primary-text-on: #170f06;

  --accent: #fbbf24;

  --success: #34d399;
  --success-soft: #103228;
  --danger: #f87171;
  --danger-hover: #fb9292;
  --danger-soft: #351c1f;
  --warning: #fbbf24;
  --warning-soft: #332608;

  --focus-ring: #fb923c;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: var(--font-sans);
  background:
    radial-gradient(ellipse 720px 480px at 8% -8%, color-mix(in srgb, var(--primary) 6%, transparent) 0%, transparent 62%),
    radial-gradient(ellipse 640px 460px at 100% 108%, color-mix(in srgb, var(--accent) 5%, transparent) 0%, transparent 62%),
    var(--grain-texture),
    var(--bg);
  background-attachment: fixed, fixed, fixed;
  overflow-x: hidden;
  width: 100%;
  color: var(--text);
  min-height: 100vh;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

@media (max-width: 768px) {
  body {
    /* Fixed backgrounds force a repaint on every scroll frame on many mobile
       browsers — switch to scroll attachment there to avoid jank. */
    background-attachment: scroll, scroll, scroll;
  }
}

::selection {
  background: var(--primary);
  color: var(--primary-text-on);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg);
}

.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.35);
}

.brand-mark .icon {
  width: 18px;
  height: 18px;
  stroke: #fff;
}

.brand-name {
  font-size: 16px;
}

@media (max-width: 720px) {
  .brand-name {
    display: none;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-actions > * {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  box-sizing: border-box;
}

.btn-label {
  display: inline;
}

@media (max-width: 860px) {
  .btn-label {
    display: none;
  }
  .btn-ghost.btn-sm {
    padding: 0 10px;
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 12px 16px;
  }
  .topbar-actions {
    gap: 6px;
  }
}

.avatar-chip {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.3);
}

/* ---------- Icon button (theme toggle etc.) ---------- */
.icon-btn-round {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s var(--ease), box-shadow 0.15s var(--ease);
}

.icon-btn-round:hover {
  background: var(--bg-hover);
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 10%, transparent);
}

.icon-btn-round:active {
  transform: scale(0.93);
}

.theme-toggle .icon-moon {
  display: none;
}
:root[data-theme='dark'] .theme-toggle .icon-sun {
  display: none;
}
:root[data-theme='dark'] .theme-toggle .icon-moon {
  display: inline-block;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .icon-sun {
    display: none;
  }
  :root:not([data-theme='light']) .theme-toggle .icon-moon {
    display: inline-block;
  }
}

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  height: 38px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s var(--ease), box-shadow 0.15s var(--ease), filter 0.15s var(--ease);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--accent)));
  color: var(--primary-text-on);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--primary) 35%, transparent), 0 6px 16px -6px color-mix(in srgb, var(--primary) 55%, transparent);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--primary) 40%, transparent), 0 10px 26px -6px color-mix(in srgb, var(--primary) 65%, transparent);
}

.btn-primary:active {
  filter: brightness(0.96);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid transparent;
}

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

.btn-danger-solid {
  background: var(--danger);
  color: #fff;
  border: none;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--danger) 35%, transparent);
}

.btn-danger-solid:hover {
  background: var(--danger-hover);
  box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--danger) 55%, transparent);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.card h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  color: var(--text);
}

/* ---------- Form controls ---------- */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
  width: 100%;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
  background: var(--bg-elevated);
}

textarea {
  resize: vertical;
  font-family: inherit;
}

.field-error {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--danger);
  min-height: 0;
}

.form-alert {
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.input-icon-wrap {
  position: relative;
}

.input-icon-wrap input {
  padding-left: 38px;
}

.input-icon-wrap:has(.field-toggle) input {
  padding-right: 40px;
}

.input-icon-wrap > .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.input-icon-wrap .field-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.input-icon-wrap .field-toggle .icon {
  position: static;
  width: 16px;
  height: 16px;
  color: inherit;
  pointer-events: auto;
}

.input-icon-wrap .field-toggle:hover {
  color: var(--text-muted);
  background: var(--bg-hover);
}

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
  white-space: nowrap;
}

/* ---------- Type/kind icon badge (color set per-page) ---------- */
.type-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.type-icon .icon {
  width: 16px;
  height: 16px;
}

/* ---------- Summary cards (dashboard-style stat tiles) ---------- */
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.summary-card:hover {
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
  box-shadow: var(--shadow-md), 0 0 0 1px color-mix(in srgb, var(--primary) 10%, transparent);
  transform: translateY(-2px);
}

.summary-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.summary-icon .icon {
  width: 20px;
  height: 20px;
}

.summary-icon-primary {
  background: var(--primary-soft);
  color: var(--primary);
}
.summary-icon-success {
  background: var(--success-soft);
  color: var(--success);
}
.summary-icon-warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.summary-icon-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.summary-card .label {
  display: block;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.summary-card .value {
  display: block;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-top: 2px;
}

/* ---------- Skeleton loaders ---------- */
.skel {
  background: linear-gradient(
    90deg,
    var(--bg-subtle) 25%,
    var(--bg-hover) 50%,
    var(--bg-subtle) 75%
  );
  background-size: 200% 100%;
  animation: skel-shine 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skel-shine {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-state .icon {
  width: 40px;
  height: 40px;
  color: var(--text-faint);
  margin-bottom: 4px;
}

.empty-state strong {
  color: var(--text);
  font-size: 14px;
}

.empty-state span {
  font-size: 13px;
}

/* ---------- Toasts ---------- */
.toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  animation: toast-in 0.25s var(--ease);
}

.toast.leaving {
  animation: toast-out 0.2s var(--ease) forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(24px) scale(0.96);
  }
}

.toast .icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-success .icon {
  color: var(--success);
}
.toast-error .icon {
  color: var(--danger);
}
.toast-info .icon {
  color: var(--primary);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 13, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 90;
  animation: overlay-in 0.15s var(--ease);
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.2s var(--ease);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal h2 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions-center {
  justify-content: center;
}

.confirm-modal {
  max-width: 360px;
}

.confirm-text {
  color: var(--text-muted);
  font-size: 13.5px;
  margin-top: 6px;
}

/* ---------- Utility ---------- */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Filter bar (search + filter dropdowns above a list) ---------- */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
  padding: 14px 16px;
}

.search-wrap {
  flex: 1;
  min-width: 220px;
}

.filter-bar select {
  width: auto;
  min-width: 140px;
}

@media (max-width: 560px) {
  .filter-bar select {
    flex: 1;
    min-width: 130px;
  }
}

.pin-filter {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.pin-filter input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.checkbox-row {
  flex-direction: row;
}

/* ---------- Custom scrollable dropdown (category picker/filter) ---------- */
.dropdown {
  position: relative;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: auto;
  min-width: 150px;
  height: 38px;
  padding: 0 10px 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.dropdown-trigger:hover {
  background: var(--bg-hover);
}

.dropdown-trigger .icon {
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  transition: transform 0.15s var(--ease);
  flex-shrink: 0;
}

.dropdown.open .dropdown-trigger .icon {
  transform: rotate(180deg);
}

.dropdown-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 230px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  list-style: none;
}

.dropdown-list.hidden {
  display: none;
}

.dropdown-item {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-item:hover,
.dropdown-item.highlighted {
  background: var(--bg-hover);
}

.dropdown-item.selected {
  color: var(--primary);
  font-weight: 700;
  background: var(--primary-soft);
}

.dropdown-empty {
  padding: 10px;
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
}

/* ---------- "More" nav menu (cross-page links, topbar) ---------- */
.dropdown-list.nav-menu-list {
  left: auto;
  right: 0;
  min-width: 190px;
  max-height: none;
}

.nav-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.nav-menu-item .icon {
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  flex-shrink: 0;
}

.nav-menu-item:hover .icon {
  color: var(--primary);
}

/* ---------- Type/kind picker (segmented tab control inside a modal form) ---------- */
.type-picker {
  display: grid;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  overflow: hidden;
}

.type-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  border: none;
  background: transparent;
  padding: 9px 4px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.type-option span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.type-option:not(.active):not(:disabled):hover {
  color: var(--text);
  background: color-mix(in srgb, var(--bg-elevated) 60%, transparent);
}

.type-option.active {
  background: var(--bg-elevated);
  color: var(--primary);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent);
}

.type-option:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

@media (max-width: 420px) {
  .type-picker {
    gap: 3px;
    padding: 3px;
  }
  .type-option {
    gap: 3px;
    padding: 8px 2px;
    font-size: 11px;
  }
  .type-option .icon {
    width: 15px;
    height: 15px;
  }
}

/* ---------- Modal form (New/Edit forms living inside .modal) ---------- */
.modal form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.modal form small {
  display: block;
  color: var(--text-faint);
  font-size: 11.5px;
  margin-top: -4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
