/* Houghton Country house style: professional blue and grey */
:root {
  --navy: #1d3557;
  --blue: #2c6aa0;
  --blue-soft: #e6eef7;
  --grey-900: #22272e;
  --grey-700: #4a535e;
  --grey-500: #7b8590;
  --grey-300: #cfd5db;
  --grey-200: #e3e7eb;
  --grey-100: #f2f4f6;
  --white: #ffffff;
  --green: #2e7d4f;  --green-soft: #e3f2e9;
  --amber: #a86400;  --amber-soft: #fbefdc;
  --red: #b23a3a;    --red-soft: #f8e4e4;
  --radius: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--grey-900); background: var(--grey-100);
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* top bar */
.topbar { background: var(--navy); color: var(--white); }
.topbar .inner { max-width: 1400px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center;
  gap: 24px; height: 56px; }
.brand { font-weight: 600; font-size: 16px; letter-spacing: .2px; white-space: nowrap; }
.brand small { display: block; font-weight: 400; font-size: 11px; color: #a9bbd1; letter-spacing: .6px;
  text-transform: uppercase; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav a { color: #cfdbe8; padding: 8px 12px; border-radius: var(--radius); white-space: nowrap; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: var(--white); }
.nav a.on { background: rgba(255,255,255,.14); color: var(--white); }
.who { color: #a9bbd1; font-size: 13px; white-space: nowrap; }
.who a { color: #cfdbe8; margin-left: 8px; }

main { max-width: 1400px; margin: 0 auto; padding: 20px; }
h1 { font-size: 20px; margin: 0 0 4px; color: var(--navy); }
h2 { font-size: 16px; margin: 24px 0 8px; color: var(--navy); }
.sub { color: var(--grey-500); margin: 0 0 16px; }

.card { background: var(--white); border: 1px solid var(--grey-200); border-radius: var(--radius); }
.card + .card { margin-top: 16px; }
.pad, .card .pad { padding: 14px 16px; }

/* filters */
form.filters { display: grid; grid-template-columns: 2fr repeat(5, minmax(120px, 1fr)) auto; gap: 8px;
  padding: 12px; }
input[type=text], input[type=search], input[type=password], input[type=number], select {
  width: 100%; padding: 7px 9px; border: 1px solid var(--grey-300); border-radius: var(--radius);
  background: var(--white); font: inherit; color: var(--grey-900);
}
input:focus, select:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }
button, .btn {
  display: inline-block; padding: 7px 14px; border: 1px solid var(--blue); border-radius: var(--radius);
  background: var(--blue); color: var(--white); font: inherit; cursor: pointer; white-space: nowrap;
}
button:hover, .btn:hover { background: var(--navy); border-color: var(--navy); text-decoration: none; }
.btn.light, button.light { background: var(--white); color: var(--blue); border-color: var(--grey-300); }
.btn.light:hover, button.light:hover { background: var(--blue-soft); }
button.danger { background: var(--white); color: var(--red); border-color: var(--grey-300); }
button.small, .btn.small { padding: 3px 9px; font-size: 12px; }

/* summary chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 12px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 999px;
  background: var(--grey-100); border: 1px solid var(--grey-200); color: var(--grey-700); font-size: 12px; }
.chip b { color: var(--grey-900); }
.chip.on { background: var(--blue-soft); border-color: var(--blue); color: var(--navy); }

/* tables */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--grey-200); vertical-align: top; }
th { background: var(--grey-100); color: var(--grey-700); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .4px; position: sticky; top: 0; }
tr:hover td { background: #f8fafc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 12.5px; }
.muted { color: var(--grey-500); }
.small { font-size: 12px; }
.prod { font-weight: 500; }
tr.off td { color: var(--grey-500); }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500;
  white-space: nowrap; }
.s-available { background: var(--green-soft); color: var(--green); }
.s-due { background: var(--blue-soft); color: var(--blue); }
.s-out, .s-low { background: var(--grey-200); color: var(--grey-700); }
.b-GREEN { background: var(--green-soft); color: var(--green); }
.b-AMBER { background: var(--amber-soft); color: var(--amber); }
.b-RED { background: var(--red-soft); color: var(--red); }
.b-NONE, .b-OFF { background: var(--grey-200); color: var(--grey-700); }
.s-stale, .s-dropped { background: var(--amber-soft); color: var(--amber); }
.s-discontinued, .s-blocked { background: var(--red-soft); color: var(--red); }

/* on/off switch */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--grey-300); border-radius: 22px;
  transition: background .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: var(--white); border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:disabled + span { cursor: not-allowed; opacity: .6; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 12px; }
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; }
.flash.ok { background: var(--green-soft); color: var(--green); }
.flash.error { background: var(--red-soft); color: var(--red); }
.banner { padding: 10px 14px; border-radius: var(--radius); background: var(--amber-soft); color: var(--amber);
  margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--grey-300); }
.tabs a { padding: 8px 14px; color: var(--grey-700); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--navy); border-color: var(--blue); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.ok { background: var(--green); } .dot.warn { background: var(--amber); } .dot.bad { background: var(--red); }

.login { max-width: 360px; margin: 10vh auto; }
.login .card { padding: 24px; }
.login label { display: block; margin: 12px 0 4px; color: var(--grey-700); }
.login button { width: 100%; margin-top: 18px; padding: 9px; }

@media (max-width: 900px) {
  form.filters { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .who { display: none; }
}

/* sortable table headings */
th.sorthead { cursor: pointer; user-select: none; }
th.sorthead:hover { color: var(--navy); }
th.sorthead.asc::after { content: " ▲"; }
th.sorthead.desc::after { content: " ▼"; }
th a { color: inherit; }
