/* VetRecords — σχεδιασμένο πρώτα για κινητό/tablet (μία στήλη, μεγάλοι στόχοι αφής), μετά για οθόνη γραφείου. */
:root {
  --ink: #1b2340;
  --muted: #5b6478;
  --line: #d5dae4;
  --bg: #f4f6f9;
  --card: #ffffff;
  --brand: #1f2a5c;
  --accent: #2f8f6f;
  --accent-ink: #ffffff;
  --warn-bg: #fff6dd;
  --warn-ink: #6b4e00;
  --error: #b3261e;
  --error-bg: #fdecea;
  --radius: 10px;
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--brand); }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0.5rem 0 0.75rem; text-wrap: balance; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 0 0 0.25rem; }
p { margin: 0.4rem 0; }

.loading { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.code { font: 600 0.85em ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); white-space: nowrap; }
.tag { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 999px; background: #e3e8f4; color: var(--brand); vertical-align: middle; }

/* ── Κέλυφος ── */
.demo-banner { background: var(--warn-bg); color: var(--warn-ink); padding: 0.5rem 1rem; font-size: 0.875rem; border-bottom: 1px solid #ecd9a0; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: 0.6rem 1rem; background: var(--brand); color: #fff; }
.brand { color: #fff; font-weight: 700; font-size: 1.1rem; text-decoration: none; margin-right: auto; }
.brand span { font-weight: 400; opacity: 0.85; }
.topbar nav { display: flex; gap: 0.25rem; }
.topbar nav a { color: #fff; text-decoration: none; padding: 0.4rem 0.7rem; border-radius: 8px; }
.topbar nav a.is-current { background: rgba(255, 255, 255, 0.18); }
.who { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem; flex: 1 1 100%; }
.who-user { display: flex; flex-direction: column; justify-content: center; min-width: 0; font-size: 0.875rem; line-height: 1.3; overflow-wrap: anywhere; }
.who-user .linklike { text-align: left; align-self: flex-start; min-height: 24px; }
.login { max-width: 26rem; margin: 1.5rem auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem 1.2rem; }
.login .field { margin: 0.8rem 0; }
.login .button { width: 100%; }
.who select { width: 100%; min-width: 0; min-height: 40px; font: inherit; border-radius: 8px; border: 0; padding: 0.3rem 0.5rem; background: #fff; color: var(--ink); text-overflow: ellipsis; }

main { max-width: 60rem; margin: 0 auto; padding: 0.75rem 1rem 6rem; }
.crumbs { font-size: 0.875rem; color: var(--muted); }

/* ── Μηνύματα ── */
.notice, .flash, .error, .form-summary { padding: 0.6rem 0.8rem; border-radius: var(--radius); margin: 0.6rem 0; }
.notice { background: #e8eef9; }
.flash { background: #e0f3ea; color: #12523c; }
.error, .form-summary { background: var(--error-bg); color: var(--error); font-weight: 600; }

/* ── Κουμπιά ── */
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0.5rem 1rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #7aa7ff; outline-offset: 2px; }

/* ── Αναζήτηση και λίστες ── */
.search-input { width: 100%; min-height: 52px; font: inherit; font-size: 1.05rem; padding: 0.6rem 0.9rem; border: 2px solid var(--brand); border-radius: var(--radius); background: #fff; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 0.9rem; margin: 0.6rem 0; }
.card h3 a { text-decoration: none; }
.pets, .list { list-style: none; padding: 0; margin: 0.4rem 0; }
.pets li, .list li { padding: 0.5rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.pets li.is-match a { font-weight: 700; }
.why { font-size: 0.8rem; color: var(--muted); }
.list.visits p { margin: 0.15rem 0 0; }

.facts { display: grid; grid-template-columns: minmax(7rem, max-content) 1fr; gap: 0.25rem 1rem; margin: 0.5rem 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 0.9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ── Φόρμα ── */
.section { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin: 0.9rem 0; padding: 0.5rem 0.9rem 0.9rem; min-width: 0; }
.section legend { font-weight: 700; padding: 0 0.4rem; color: var(--brand); }
.fields { display: grid; grid-template-columns: 1fr; gap: 0.8rem; }
.field { min-width: 0; }
.field-label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.required { color: var(--error); }
.field input:not([type="radio"]), .field textarea { width: 100%; min-height: 46px; font: inherit; padding: 0.5rem 0.7rem; border: 1px solid #aab2c2; border-radius: 8px; background: #fff; color: var(--ink); }
.field textarea { resize: vertical; }
.with-unit { display: flex; align-items: center; gap: 0.5rem; }
.with-unit input { flex: 1 1 auto; min-width: 0; }
.unit { color: var(--muted); min-width: 2.5rem; }
.field-hint { font-size: 0.8rem; color: var(--muted); margin: 0.2rem 0 0; }
.field-message { font-size: 0.85rem; margin: 0.25rem 0 0; font-weight: 600; }
.field-message.is-error { color: var(--error); }
.field-message.is-warning { color: var(--warn-ink); }
.field.has-error input:not([type="radio"]), .field.has-error textarea { border-color: var(--error); border-width: 2px; }

.choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choice { position: relative; display: inline-flex; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice span { display: inline-flex; align-items: center; min-height: 44px; padding: 0.4rem 0.9rem; border: 1px solid #aab2c2; border-radius: 999px; background: #fff; }
.choice input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.choice input:focus-visible + span { outline: 3px solid #7aa7ff; outline-offset: 2px; }

.field select { width: 100%; min-height: 46px; font: inherit; padding: 0.4rem 0.6rem; border: 1px solid #aab2c2; border-radius: 8px; background: #fff; color: var(--ink); }
.year-control { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.6rem; }
.year-control label span { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.15rem; }
.year-control .span-all { grid-column: 1 / -1; }
.year-control input { width: 100%; }
.changes { list-style: none; padding: 0; margin: 0.4rem 0; }
.changes li { padding: 0.35rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.changes .was { color: var(--muted); text-decoration: line-through; }
.entry-mode { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.9rem; margin: 0.9rem 0; }
.check { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: 0 0 auto; }
.entry-mode .field { margin-top: 0.5rem; }
.inline-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.9rem; margin: 0.6rem 0; }
.duplicates .actions .button { min-height: 44px; white-space: normal; text-align: left; }
.signature { color: var(--muted); font-style: italic; }
.readonly-card { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid #ecd9a0; border-radius: var(--radius); padding: 0.6rem 0.8rem; margin: 0.6rem 0; font-weight: 600; }
.reminders { list-style: none; padding: 0; margin: 0.6rem 0; }
ul.reminders:not(.list) li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.4rem 0.8rem; margin: 0.3rem 0; }
.reminders li.is-overdue strong { color: var(--error); }
.topbar nav { flex-wrap: wrap; }
.duplicates { background: var(--warn-bg); border: 1px solid #ecd9a0; border-radius: var(--radius); padding: 0.75rem 0.9rem; margin: 0.9rem 0; }
.savebar { position: sticky; bottom: 0; display: flex; gap: 0.5rem; padding: 0.6rem 0; margin-top: 1rem; background: linear-gradient(to top, var(--bg) 75%, transparent); }
.savebar .button.primary { flex: 1 1 auto; }

/* ── Επίσκεψη (ανάγνωση) ── */
.visit-head { font-weight: 600; }
.read-section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.9rem; margin: 0.6rem 0; }
.read-section h3 { color: var(--brand); }
.read-section dl { margin: 0; }
.read-section dt { color: var(--muted); font-size: 0.85rem; margin-top: 0.4rem; }
.read-section dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.history { margin: 1rem 0; }
.history summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.history li { margin: 0.5rem 0; }

/* ── Tablet και πάνω ── */
@media (min-width: 720px) {
  .who { flex: 0 1 30rem; }
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-textarea, .field-choice { grid-column: 1 / -1; }
  .read-section dl { display: grid; grid-template-columns: minmax(10rem, 16rem) 1fr; gap: 0.3rem 1rem; }
  .read-section dt { margin-top: 0; font-size: 1rem; }
}

@media print {
  .no-print, .demo-banner, .topbar, .savebar { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .read-section { border: 0; border-top: 1px solid #999; border-radius: 0; break-inside: avoid; }
}
