:root {
  --bg: #f4f7fb;
  --card: #fff;
  --ink: #1a2332;
  --muted: #5b6b7c;
  --accent: #0b6e4f;
  --accent2: #145da0;
  --warn: #b45309;
  --err: #b91c1c;
  --border: #d7e0ea;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--ink); }
.topbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem 1rem; padding: 0.75rem 1.25rem; background: #0f2744; color: #fff; }
.topbar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.85rem; max-width: 100%; }
.topbar a { color: #dbeafe; margin-right: 0; text-decoration: none; white-space: nowrap; }
.topbar .user { white-space: nowrap; opacity: 0.95; }
.topbar .code { opacity: 0.8; margin-left: 0.5rem; }
.badge { background: #1d4ed8; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.75rem; margin-left: 0.75rem; }
.container { max-width: 1100px; margin: 1.25rem auto; padding: 0 1rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1.25rem; margin-bottom: 1rem; }
h1, h2 { margin-top: 0; }
label { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 0.6rem; }
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; margin-top: 0.25rem; }
button, .btn { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 0.55rem 1rem; cursor: pointer; text-decoration: none; display: inline-block; }
button.secondary, .btn.secondary { background: var(--accent2); }
button.linkish { background: transparent; color: #dbeafe; padding: 0; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 800px) { .grid { grid-template-columns: 1fr; } }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.error { color: var(--err); background: #fef2f2; padding: 0.75rem; border-radius: 6px; }
.warn { color: var(--warn); background: #fffbeb; padding: 0.75rem; border-radius: 6px; }
.messages { list-style: none; padding: 0; }
.messages li { padding: 0.6rem 0.8rem; border-radius: 6px; margin-bottom: 0.5rem; background: #ecfdf5; }
.messages li.error { background: #fef2f2; color: var(--err); }
.inline { display: inline; }
.muted { color: var(--muted); font-size: 0.9rem; }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 140px; }

.badge-ok { background: #d1fae5; color: #065f46; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.8rem; }
.badge-warn { background: #fffbeb; color: #92400e; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.8rem; }
.badge-err { background: #fef2f2; color: #991b1b; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.8rem; }
.badge-pending { background: #e0e7ff; color: #3730a3; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.8rem; }
button:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; }

.site-footer {
  margin-top: 2rem;
  padding: 1rem 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}
.privacy-line {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}


/* Light polish — hospital-serious, HTMX-friendly */
button, .btn {
  transition: background-color 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}
button:hover:not(:disabled), .btn:hover:not(:disabled) {
  filter: brightness(1.05);
  box-shadow: 0 1px 2px rgba(15, 39, 68, 0.12);
}
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
}
table tbody tr {
  transition: background-color 0.12s ease;
}
table tbody tr:hover {
  background: #f0f7f4;
}
.htmx-request button, button.htmx-request, .btn.htmx-request {
  opacity: 0.7;
  pointer-events: none;
}
.flash-ok {
  animation: softHighlight 1.2s ease;
}
@keyframes softHighlight {
  from { background-color: #d1fae5; }
  to { background-color: transparent; }
}


/* Prevent overlapping text / cramped tables */
.card { overflow-x: auto; }
table { table-layout: auto; }
th, td { overflow-wrap: anywhere; word-break: break-word; vertical-align: top; }
.brand { min-width: 0; overflow-wrap: anywhere; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-indicator.htmx-request { display: inline; }
.live-sync-note { font-size: 0.8rem; color: var(--muted); margin: 0.25rem 0 0.75rem; }
