:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #18202a;
  --muted: #667085;
  --line: #d8dee6;
  --primary: #2563eb;
  --danger: #c62828;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
header {
  min-height: 58px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #172033;
  color: white;
}
header a { color: inherit; text-decoration: none; }
.brand { font-weight: 750; letter-spacing: .01em; }
nav { display: flex; align-items: center; gap: 20px; }
nav form, .actions form { display: inline; }
.link-button, .danger-link {
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
main { max-width: 1440px; margin: 0 auto; padding: 28px 24px 48px; }
h1 { margin: 0 0 6px; font-size: 25px; }
p { color: var(--muted); }
.card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 2px 8px rgb(16 24 40 / 5%);
}
.login-card { max-width: 440px; margin: 8vh auto 0; }
.connection-info { margin: 24px 0; }
.connection-info div { display: flex; padding: 8px 0; border-bottom: 1px solid var(--line); }
.connection-info dt { width: 90px; color: var(--muted); }
.connection-info dd { margin: 0; font-family: ui-monospace, monospace; }
label { display: block; margin-bottom: 7px; font-weight: 650; }
input, textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #b9c1cc;
  border-radius: 7px;
  background: white;
  color: var(--text);
  font: inherit;
}
input:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
input:disabled { background: #eef1f5; color: var(--muted); }
button, .button {
  display: inline-block;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  font-weight: 650;
}
.login-card button { width: 100%; margin-top: 14px; }
.hint { margin: 18px 0 0; font-size: 13px; }
.flash { margin-bottom: 18px; padding: 12px 14px; border-radius: 8px; background: #e8f0ff; }
.flash.error { background: #feecec; color: #9f1c1c; }
.flash.success { background: #e7f7ed; color: #176c38; }
.flash.warning { background: #fff5d9; color: #765300; }
.page-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-heading p { margin: 0; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 9px; background: white; }
table { width: 100%; border-collapse: collapse; font-size: 14px; white-space: nowrap; }
th, td { max-width: 360px; padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; overflow: hidden; text-overflow: ellipsis; }
th { position: sticky; top: 0; background: #eef2f6; font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.actions { width: 105px; text-align: right; }
.actions a { margin-right: 10px; color: var(--primary); }
.danger-link { color: var(--danger); }
.empty { padding: 38px; color: var(--muted); text-align: center; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 20px; }
.record-form { max-width: 760px; }
.field { margin-bottom: 20px; }
.label-row { display: flex; justify-content: space-between; }
.label-row span, small { color: var(--muted); font-size: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; }
.error-message { padding: 12px; border-radius: 7px; background: #feecec; color: #9f1c1c; word-break: break-word; }
@media (max-width: 640px) {
  header { padding: 0 14px; }
  nav { gap: 11px; font-size: 14px; }
  main { padding: 20px 12px 36px; }
  .page-heading { align-items: flex-end; }
  .card { padding: 18px; }
}
