/* Fellnasen Manager - Neutral Dark Theme, v1
   Drop-in replacement for static/theme.css.
   Light mode stays defined by static/app.css. */
.theme-control { display:grid; place-items:center; flex:0 0 auto; margin-left:10px; width:38px; height:38px; padding:0; border:0; border-radius:9px; background:transparent; color:var(--muted); cursor:pointer; }
.pill.warning { background:#fff0da; color:#805016; }
.theme-control:hover { background:var(--sage); color:var(--green); }
.theme-control:focus-visible { outline:2px solid var(--green); outline-offset:3px; }
.theme-control svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.theme-control .theme-sun, html[data-theme="dark"] .theme-control .theme-moon { display:none; }
html[data-theme="dark"] .theme-control .theme-sun { display:block; }
.public-topbar { justify-content:flex-end; }
.signed-out main { min-height:calc(100vh - 145px); }
.field #id_practitioners { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:8px; }
.field #id_practitioners label { display:flex; align-items:center; gap:8px; margin:0; padding:8px 10px; border:1px solid var(--line); border-radius:8px; font-weight:400; }
.field #id_practitioners input { width:17px; height:17px; margin:0; accent-color:var(--green); flex:0 0 auto; }
.field #id_practitioners > div[hidden] { display:none; }
.quick-add-toggle { margin-top:9px; }
.quick-add-panel { margin-top:10px; padding:12px; border:1px solid var(--line); border-radius:9px; background:var(--sage); }
.quick-add-panel[hidden] { display:none; }
.quick-add-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:9px; }
.quick-add-panel [data-quick-error] { color:#a74738; }

html[data-theme="dark"] {
  color-scheme: dark;
  /* Semantic surfaces: neutral charcoal, not green tinted */
  --bg: #14171b;
  --paper: #1e232a;
  --ink: #edf1f3;
  --muted: #aab4bd;
  --line: #39414b;
  /* Existing application token: accent only */
  --green: #85cfa9;
  --sage: #292f37;
  --sand: #302d2b;
  --rose: #352b2d;
  --lilac: #2e2b37;
  --radius: 18px;
  /* Future reusable semantic aliases */
  --color-bg: var(--bg);
  --color-surface: var(--paper);
  --color-surface-muted: #292f37;
  --color-text: var(--ink);
  --color-text-muted: var(--muted);
  --color-border: var(--line);
  --color-accent: var(--green);
  --color-on-accent: #12231a;
  --color-accent-soft: #283d32;
}

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .pet-card,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] .brand,
html[data-theme="dark"] .pet-card,
html[data-theme="dark"] .stat,
html[data-theme="dark"] .list-row,
html[data-theme="dark"] .appointment-row,
html[data-theme="dark"] .empty h3 { color: var(--ink); }

html[data-theme="dark"] nav a { color: var(--muted); }
html[data-theme="dark"] nav a:hover,
html[data-theme="dark"] nav a[aria-current] {
  background: var(--color-accent-soft);
  color: var(--green);
}

html[data-theme="dark"] .sidebar-note,
html[data-theme="dark"] .care-note,
html[data-theme="dark"] .filter,
html[data-theme="dark"] .follow-ups,
html[data-theme="dark"] .global-search,
html[data-theme="dark"] .mini-icon,
html[data-theme="dark"] .date-tile,
html[data-theme="dark"] .pill,
html[data-theme="dark"] .file-icon,
html[data-theme="dark"] .attachment,
html[data-theme="dark"] .message,
html[data-theme="dark"] .reminder,
html[data-theme="dark"] .count {
  background: var(--color-surface-muted);
  color: var(--ink);
  border-color: var(--line);
}

html[data-theme="dark"] .global-search input { background: transparent; }
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--muted); opacity:1; }

html[data-theme="dark"] .button,
html[data-theme="dark"] .brand-icon {
  background: var(--green);
  color: var(--color-on-accent);
  border-color: var(--green);
}
html[data-theme="dark"] .button:hover { background:#a0dfbd; border-color:#a0dfbd; color:var(--color-on-accent); }
html[data-theme="dark"] .button.secondary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line);
}
html[data-theme="dark"] .button.secondary:hover { background:var(--color-surface-muted); color:var(--ink); }
html[data-theme="dark"] .secondary:hover { background:var(--color-surface-muted); color:var(--ink); }

html[data-theme="dark"] .stat-icon.sage,
html[data-theme="dark"] .pet-portrait,
html[data-theme="dark"] .pet-avatar,
html[data-theme="dark"] .stat-icon.sand,
html[data-theme="dark"] .avatar,
html[data-theme="dark"] .stat-icon.rose,
html[data-theme="dark"] .stat-icon.lilac { background:var(--color-surface-muted); }

html[data-theme="dark"] .pet-badge { background:var(--paper); color:var(--ink); }
html[data-theme="dark"] .attachment,
html[data-theme="dark"] .follow-ups,
html[data-theme="dark"] .list-row { border-color:var(--line); }
html[data-theme="dark"] .timeline-entry { border-color:var(--line); }
html[data-theme="dark"] .stat-caption,
html[data-theme="dark"] .pet-card-body p,
html[data-theme="dark"] .pet-meta,
html[data-theme="dark"] .list-row small,
html[data-theme="dark"] .sidebar-note p,
html[data-theme="dark"] .care-note p { color:var(--muted); }

html[data-theme="dark"] .field input:disabled { background:#292f37; color:#aab4bd; }
html[data-theme="dark"] .errorlist,
html[data-theme="dark"] .message.error { background:#4b3030; color:#ffbbb6; }
html[data-theme="dark"] .pill.overdue { background:#483625; color:#ffce96; }
html[data-theme="dark"] .pill.success { background:#254636; color:#a5e5c2; }
html[data-theme="dark"] .pill.warning { background:#483625; color:#ffce96; }

html[data-theme="dark"] :is(a,button,input,select,textarea):focus-visible {
  outline:2px solid var(--green);
  outline-offset:3px;
}
html[data-theme="dark"] .skip:focus { background:var(--paper); color:var(--ink); }
@media(max-width:760px) {
  .topbar time { display:none; }
  .topbar .global-search { width:auto; min-width:0; max-width:none; flex:1; margin-right:0; }
  .theme-control { margin-left:auto; }
  .signed-out main { min-height:calc(100vh - 120px); }
}

.attachment-preview { padding:0; color:var(--ink); text-align:left; cursor:zoom-in; font:inherit; }
.image-dialog { width:min(94vw,1100px); max-height:94vh; padding:18px; border:1px solid var(--line); border-radius:var(--radius); background:var(--paper); color:var(--ink); }
.image-dialog::backdrop { background:rgba(8,20,18,.78); }
.image-dialog-bar { display:flex; align-items:center; justify-content:space-between; gap:15px; margin-bottom:14px; }
.image-dialog-bar>div { display:flex; gap:8px; }
.image-dialog>img { display:block; max-width:100%; max-height:calc(94vh - 110px); margin:auto; object-fit:contain; }
.pdf-preview { width:min(90vw,1060px); max-height:calc(94vh - 110px); }
.pdf-controls { display:flex; align-items:center; justify-content:center; gap:12px; flex-wrap:wrap; margin-bottom:10px; font-size:12px; }
.pdf-page-container { height:calc(94vh - 165px); overflow:auto; text-align:center; background:#e5e9e7; padding:12px; }
.pdf-page-container canvas { display:block; margin:auto; max-width:100%; background:#fff; box-shadow:0 3px 12px #0003; }
.pdf-page-container p { padding:20px; color:var(--ink); }
.image-dialog>[hidden] { display:none; }
@media(max-width:760px) { .image-dialog-bar { align-items:stretch; flex-direction:column; } .image-dialog-bar>div { flex-wrap:wrap; } }

#address-search { margin-top:8px; }
.pet-portrait img, .pet-avatar img { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; }
.pet-avatar { position:relative; }
#id_weekdays { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px 12px; }
#id_weekdays label { display:flex; align-items:center; gap:6px; font-weight:400; }
#id_weekdays input { width:auto; }
.time-slot { display:flex; align-items:center; gap:12px; margin:0 0 8px; }
.time-slot input { max-width:180px; }
#add-time { margin-top:4px; }
.autocomplete-results { border:1px solid var(--line); background:var(--paper); border-radius:8px; margin-top:5px; max-height:260px; overflow:auto; }
.autocomplete-results[hidden] { display:none; }
.autocomplete-results button { display:block; width:100%; padding:10px 12px; text-align:left; border:0; background:var(--paper); color:var(--ink); cursor:pointer; }
.autocomplete-results button:hover, .autocomplete-results button:focus-visible { background:var(--sage); }
.autocomplete-results small { display:block; color:var(--muted); }
@media(max-width:760px) { #id_weekdays { grid-template-columns:repeat(2,minmax(0,1fr)); } }
