:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #0f172a;
  background: #fff;
  --accent: #075985;
  --line: #e2e8f0;
  --muted: #475569;
  --selection: #f0f9ff;
  --shadow: 0 1px 2px rgb(15 23 42 / .06);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.mast { background: #fff; color: var(--accent); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
.mast > div { max-width: 64rem; margin: auto; padding: .75rem 1.25rem; min-height: 3.5rem; display: flex; align-items: center; justify-content: space-between; font-size: .95rem; font-weight: 700; }
main { max-width: 64rem; margin: auto; padding: clamp(1.25rem, 4vw, 2rem) 1.25rem 3rem; }
h1, h2, h3, p { margin: 0; }
h1 { color: var(--accent); font-size: clamp(1.4rem, 4vw, 1.75rem); line-height: 1.2; letter-spacing: .015em; text-transform: uppercase; }
h2 { color: var(--accent); font-size: 1.125rem; overflow-wrap: anywhere; }
h3 { color: var(--accent); font-size: 1rem; }
button, input, select, textarea { font: inherit; }
button { border: 1px solid transparent; background: var(--accent); color: white; border-radius: .25rem; padding: .55rem .85rem; min-height: 2.65rem; cursor: pointer; font-weight: 650; }
button:hover:not(:disabled) { filter: brightness(.9); }
button:disabled { opacity: .6; cursor: wait; }
:focus-visible { outline: 3px solid #0369a1; outline-offset: 3px; }
button.quiet { border-color: var(--line); color: #0f172a; background: #fff; }
#account-menu { position: relative; z-index: 1; }
#account-menu summary {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: 0;
  border-radius: .25rem;
  list-style: none;
  font-size: 1.35rem;
}
#account-menu summary::-webkit-details-marker { display: none; }
#account-menu summary:hover, #account-menu[open] summary { background: var(--selection); }
#logout {
  position: absolute;
  top: calc(100% + .3rem);
  right: 0;
  min-width: 7rem;
  box-shadow: var(--shadow);
  color: var(--accent);
}
.heading, .actions { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
nav { margin: .65rem 0 .75rem; display: flex; flex-wrap: wrap; gap: .45rem; }
nav button { background: #fff; border-color: var(--line); color: #0f172a; font-size: .9rem; }
nav button[aria-pressed="true"] { background: var(--selection); border-color: #7dd3fc; color: var(--accent); }
#cases { display: grid; gap: .55rem; }
.panel, dialog { background: #fff; padding: clamp(1rem, 4vw, 1.5rem); border: 1px solid var(--line); border-radius: .375rem; box-shadow: var(--shadow); }
.login { max-width: 29rem; margin: 4vh auto; }
.login form, #case-form { display: grid; gap: 1rem; }
.login form { margin-top: 1.5rem; }
label { display: grid; gap: .35rem; font-size: .95rem; font-weight: 650; min-width: 0; }
input, select, textarea { display: block; width: 100%; min-width: 0; padding: .55rem; color: inherit; border: 1px solid #94a3b8; border-radius: .25rem; background-color: #fff; }
select { appearance: none; padding-right: 2.2rem; background: #fff linear-gradient(45deg, transparent 50%, #475569 50%) right 1.2rem center / 6px 6px no-repeat; background-image: linear-gradient(45deg, transparent 50%, #475569 50%), linear-gradient(135deg, #475569 50%, transparent 50%); background-position: right 1.2rem center, right .84rem center; background-size: 6px 6px; background-repeat: no-repeat; }
.date { margin-bottom: .2rem; color: var(--muted); font-size: .875rem; }
.status { border-radius: .1875rem; padding: .3rem .7rem; font-size: .875rem; font-weight: 650; background: #f1f5f9; }
.status[data-status="ogk"] { background: #fff0ce; color: #674709; }
.status[data-status="insurance"] { background: #e0f2fe; color: var(--accent); }
.status[data-status="done"] { background: #d8f0e4; color: #14543c; }
.note { margin-top: .65rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.case-actions { justify-content: flex-start; margin-top: 1rem; }
.docs { border-top: 1px solid var(--line); margin-top: 1.1rem; padding-top: .9rem; }
.docs ul { list-style: none; margin: 0; padding: 0; }
.docs li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; border-bottom: 1px solid var(--line); padding: .5rem 0; }
.docs li span { display: block; color: var(--muted); font-size: .875rem; }
.docs a, summary { color: var(--accent); overflow-wrap: anywhere; }
summary { cursor: pointer; font-weight: 650; margin-top: .75rem; }
.upload { gap: .75rem; margin-top: .7rem; }
.upload label { max-width: 100%; }
.empty { color: var(--muted); }
dialog { width: min(32rem, calc(100% - 2rem)); color: #0f172a; }
dialog::backdrop { background: rgb(15 23 42 / .55); }
#notice, #editor-error { border-radius: .25rem; background: #e0f2fe; padding: .65rem .85rem; }
#notice { margin-bottom: 1rem; }
.badges { display: flex; flex-wrap: wrap; gap: .45rem; }
.status[data-status="unpaid"] { background: #fae6e4; color: #842d25; }
.check { display: flex; align-items: center; gap: .65rem; }
.check input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--accent); }
#reminders { margin-top: 1.25rem; background: var(--selection); border-color: #bae6fd; }
#reminder-list { list-style: none; padding: 0; margin: .6rem 0 0; }
#reminder-list li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .2rem 0; }
#reminder-list button { min-width: 0; text-align: left; overflow-wrap: anywhere; }
#reminder-list li > span { flex: 0 1 auto; font-size: .875rem; }
.overdue { color: #842d25; font-weight: 650; }

/* Start with a single-column layout sized for touch. */
button { min-height: 2.75rem; }
input, select, textarea { font-size: 1rem; }
input, select { min-height: 2.75rem; }
.check { min-height: 2.75rem; }
.heading { align-items: stretch; flex-direction: column; }
.heading > button { width: 100%; }
nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.case-actions { display: grid; grid-template-columns: 1fr; }
.case-actions:has(.pay:not([hidden])) .advance {
  background: #fff;
  color: var(--accent);
  border-color: var(--line);
}
summary { min-height: 2.75rem; align-content: center; }
.upload { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; }
.docs li > div { min-width: 0; }
#reminder-list button { max-width: 100%; }
dialog { max-height: calc(100dvh - 2rem); }
#case-form .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (min-width: 36rem) {
  .heading { flex-direction: row; align-items: center; }
  .heading > button { width: auto; }
  nav, .case-actions { display: flex; }
  #case-form .actions { display: flex; }
}

.drop-zone {
  padding: .85rem;
  border: 1px dashed #699bbd;
  border-radius: .25rem;
  background: var(--selection);
  color: var(--accent);
}
.drop-zone.drag-over { background: #d8efff; border-color: var(--accent); }
.file-actions { display: grid; gap: .5rem; margin-top: .65rem; }
.paste-target {
  margin-top: .65rem;
  padding: .65rem;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: .25rem;
  background: #fff;
  color: var(--ink, #0f172a);
}
.upload-queue li { overflow-wrap: anywhere; }
.upload-message { color: #075985; }
@media (min-width: 36rem) {
  .file-actions { display: flex; flex-wrap: wrap; }
  .upload > label { width: min(100%, 20rem); }
  .send-files { justify-self: start; }
}

.totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin-top: 1.25rem; }
.total { min-width: 0; background: var(--selection); border-color: #bae6fd; }
.total h2 { font-size: .9rem; margin-bottom: .3rem; }
.total strong, .amount { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.total strong { display: block; font-size: clamp(1rem, 4vw, 1.4rem); }
#missing-amounts { grid-column: 1 / -1; color: var(--muted); font-size: .875rem; }
.case-figures { display: grid; gap: .35rem; }
.amount { color: var(--accent); }
@media (min-width: 36rem) {
  .case-figures { justify-items: end; }
}

.list-heading { display: grid; gap: .55rem; margin-top: 1.4rem; }
.list-heading h2 { align-self: center; }
.list-heading input { background: #f8fafc; border-color: var(--line); }
.invoice-card { padding: 0; }
.invoice-summary {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .55rem;
  margin: 0;
  padding: .8rem 2rem .8rem .85rem;
  list-style: none;
  border-radius: .375rem;
}
.invoice-summary::-webkit-details-marker { display: none; }
.invoice-summary::after {
  content: "";
  position: absolute;
  right: .85rem;
  top: 1.1rem;
  width: .42rem;
  height: .42rem;
  border: solid var(--accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.invoice-details[open] > .invoice-summary::after { transform: rotate(225deg); top: 1.35rem; }
.invoice-summary:hover, .invoice-details[open] > .invoice-summary { background: var(--selection); }
.invoice-heading, .case-figures { min-width: 0; }
.invoice-title, .invoice-heading .date { display: block; overflow-wrap: anywhere; }
.invoice-title { margin-bottom: .2rem; }
.invoice-summary .date { font-weight: 500; }
.invoice-summary .date.overdue { color: #842d25; font-weight: 650; }
.invoice-summary .case-figures { max-width: 9.5rem; justify-items: end; text-align: right; }
.invoice-summary .badges { justify-content: flex-end; gap: .25rem; }
.invoice-summary .status { padding: .2rem .4rem; }
.invoice-body { border-top: 1px solid var(--line); padding: .85rem; }
@media (min-width: 36rem) {
  .list-heading { grid-template-columns: 1fr minmax(14rem, 21rem); align-items: center; }
  .invoice-summary { padding-inline-start: 1rem; }
  .invoice-summary .case-figures { max-width: none; }
  .invoice-body { padding: 1rem; }
}
