/* Colours, font and the header come from tools.css (shared with the other Proyecto ART tools).
   Cards, badges, tables and the sign-in card follow medical-records and ART Bot. */
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); background: var(--bg); color: var(--ink); }
input, select, button, textarea { font: inherit; color: inherit; }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
input[type=checkbox] { accent-color: var(--brand); }
input[type=file] { max-width: 100%; min-width: 0; }
textarea { display: block; max-width: 100%; resize: vertical; }
button, a.button { display: inline-block; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; cursor: pointer; white-space: nowrap; text-decoration: none; }
button:hover:not(:disabled), a.button:hover { border-color: var(--accent); }
h1, h2 { font-weight: 500; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 15px; margin: 0; }
small, .muted { color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin: 0; }
.topbar nav a { font-size: 14px; }

main { display: flex; flex-direction: column; gap: 10px; max-width: 860px; margin: 0 auto; padding: 12px 16px; }
main.wide { max-width: none; }
.title { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 4px 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.card > h2 { font-size: 12px; font-weight: 400; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.pad { padding: 12px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.pad > .scroll { align-self: stretch; }
.item { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; }
.item .t { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.item .m { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }

.badge { font-size: 12px; font-weight: 400; padding: 2px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.ok { color: var(--accent); border-color: var(--accent); }
.badge.warn { color: var(--note); border-color: var(--note); }
.badge.failed { color: var(--warn); border-color: var(--warn); }
.badge.running { color: var(--blue); border-color: var(--blue); }
.notice { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.notice.ok { border-color: var(--accent); color: var(--accent); }
.notice.warn { border-color: var(--note); color: var(--note); }
.notice.error { border-color: var(--warn); color: var(--warn); }

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
thead th { border-top: 0; font-size: 12px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.edit { width: auto; }
.edit th, .edit td { padding: 3px 4px; }
.edit th:first-child, .edit td:first-child { position: sticky; left: 0; background: var(--panel); padding-left: 12px; }
.edit td.value { font-variant-numeric: tabular-nums; font-weight: 500; text-align: right; padding-right: 10px; }

.cols { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack label { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
fieldset { display: flex; flex-direction: column; gap: 10px; border: 0; padding: 0; margin: 0; min-width: 0; }
.save { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.files { columns: 18rem; margin: 0; padding: 0; list-style: none; align-self: stretch; }
.files li { padding: 2px 0; overflow-wrap: anywhere; }
details > summary { cursor: pointer; padding: 8px 12px; }
details { border-top: 1px solid var(--line); }
details:first-of-type { border-top: 0; }
details .pad { padding-top: 0; }
pre { margin: 0; align-self: stretch; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg); border-radius: 6px; padding: 10px; max-height: 60vh; overflow: auto; }

body.auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; width: min(420px, calc(100vw - 32px)); text-align: center; }
.auth-card .hero { border-radius: 50%; box-shadow: 0 2px 16px rgba(0,0,0,.15); display: block; margin: 0 auto 12px; }
.auth-card .tagline { margin: 2px 0 16px; font-size: 13px; }
.auth-card form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.auth-card .notice { margin-bottom: 12px; text-align: left; }

@media (max-width: 640px) {
  /* below 16px iOS zooms the page on focus */
  input, select, textarea { font-size: 16px; }
}
/* tools.css styles button.primary and .btn.primary; links styled as buttons need the same */
a.button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
a.button.primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }

/* ---------- settlement tables ---------- */
.numbers th, .numbers td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.numbers th:first-child, .numbers td:first-child, .numbers .left { text-align: left; }
.numbers tr.total td { font-weight: 500; background: var(--sel); }
.numbers td.sub { color: var(--muted); font-size: 12px; }
.numbers td.indent { padding-left: 28px; }
.card > .scroll + .scroll { border-top: 6px solid var(--bg); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
