@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@500;700&display=swap');

:root {
  --navy: #0F2A4A;
  --blue: #1E6FD9;
  /* Dashboard/stat tiles: dark grey rather than the navy used for the header
     and printed documents - easier on the eye across a screen full of tiles. */
  --tile: #33383F;
  --tile-num: #E8EBEF;
  --tile-label: #A8B0BA;
  --bg: #F4F6F9;
  --card: #FFFFFF;
  --border: #DCE3EC;
  --text: #1B2733;
  --muted: #64748B;
  --danger: #C0392B;
  --ok: #1E8E3E;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header.topbar {
  background: var(--navy);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
}
header.topbar a { color: white; text-decoration: none; }
header.topbar .brand { font-weight: 700; font-size: 1.1rem; }
nav.mainnav { display: flex; gap: 4px; background: var(--blue); padding: 0 16px; flex-wrap: wrap; }
nav.mainnav a {
  color: white; text-decoration: none; padding: 10px 14px; font-size: 0.92rem; display: inline-block;
}
nav.mainnav a:hover, nav.mainnav a.active { background: rgba(255,255,255,0.18); }

main { max-width: 1750px; margin: 24px auto; padding: 0 20px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 18px; margin-bottom: 18px; }
h1 { color: var(--navy); font-size: 1.5rem; margin: 0 0 12px; }
h2 { color: var(--navy); font-size: 1.15rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 0.75rem; }
tr:hover td { background: #FAFBFD; }

.btn {
  display: inline-block; background: var(--blue); color: white; border: none; padding: 8px 16px;
  border-radius: 6px; text-decoration: none; font-size: 0.9rem; cursor: pointer;
}
.btn:hover { background: var(--navy); }
.btn.secondary { background: white; color: var(--navy); border: 1px solid var(--border); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 0.8rem; }

.pill { padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.pill.Draft { background: #E5E7EB; color: #374151; }
.pill.Sent { background: #DBEAFE; color: #1E40AF; }
.pill.Won { background: #DCFCE7; color: #15803D; }
.pill.Lost { background: #FEE2E2; color: #B91C1C; }
.pill.Expired { background: #F3E8FF; color: #7E22CE; }
.pill.Open { background: #DBEAFE; color: #1E40AF; }
.pill.Complete { background: #DCFCE7; color: #15803D; }
.pill.Cancelled { background: #FEE2E2; color: #B91C1C; }
.pill.Part-shipped { background: #FEF3C7; color: #92400E; }
.pill.In-progress { background: #FEF3C7; color: #92400E; }
.pill.Part-received { background: #FEF3C7; color: #92400E; }
.pill.Received { background: #DCFCE7; color: #15803D; }
.pill.Investigating { background: #FEF3C7; color: #92400E; }
.pill.Closed { background: #DCFCE7; color: #15803D; }
.pill.Overdue { background: #FEE2E2; color: #B91C1C; }
.pill.Due-Soon { background: #FEF3C7; color: #92400E; }
.pill.OK { background: #DCFCE7; color: #15803D; }
.pill.Never-calibrated { background: #FEE2E2; color: #B91C1C; }
.pill.In-Stock { background: #DCFCE7; color: #15803D; }
.pill.Low-Stock { background: #FEF3C7; color: #92400E; }
.pill.Out-of-Stock { background: #FEE2E2; color: #B91C1C; }
.pill.ISO-Approved { background: #DCFCE7; color: #15803D; }
.pill.ISO-Pending { background: #FEF3C7; color: #92400E; }
.pill.Internal { background: #E5E7EB; color: #374151; }
.pill.External { background: #FEF3C7; color: #92400E; }

form.stacked label { display: block; margin: 10px 0 4px; font-size: 0.85rem; color: var(--muted); }
form.stacked input, form.stacked select, form.stacked textarea {
  width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.92rem;
}
form.stacked textarea { min-height: 70px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 180px; }

/* Shared "Details" card treatment, used on every module's header card: every
   input/select lands on the same baseline no matter how long its label is or
   whether it wraps, and a darker grey divider separates fields and rows so a
   wide card doesn't read as one undifferentiated jumble. */
.details-card .row { align-items: flex-end; }
.details-card .row > div { min-height: 34px; }
.details-card .row > div:not(:last-child) { border-right: 1px solid #B7C1CF; padding-right: 16px; }
.details-card .row + .row { border-top: 1px solid #B7C1CF; padding-top: 14px; margin-top: 14px; }
.details-card label { display: block; margin: 0 0 4px; font-size: 0.85rem; color: var(--muted); }
.details-card input, .details-card select, .details-card textarea {
  width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.92rem;
}
.details-card input[type="checkbox"] { width: auto; }
.details-card .value { padding: 8px 0; font-size: 0.92rem; }

.stat-strip { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.stat-tile {
  background: var(--tile); color: white; border-radius: 8px; padding: 16px 20px; min-width: 140px; flex: 1;
  text-align: center;
}
.stat-tile .num {
  font-family: 'IBM Plex Mono', monospace; font-weight: 700; font-size: 1.8rem; color: var(--tile-num);
  text-decoration: none;
}
.stat-tile .label { font-size: 0.78rem; text-transform: uppercase; color: var(--tile-label); margin-top: 4px; text-decoration: none; }
a.stat-tile, a.stat-tile:hover, a.stat-tile:visited { text-decoration: none; }
a.stat-tile { display: block; transition: transform 0.1s ease, box-shadow 0.1s ease; }
a.stat-tile:hover { box-shadow: 0 4px 10px rgba(0,0,0,0.25); transform: translateY(-1px); }

.flash { background: #DCFCE7; border: 1px solid #86EFAC; color: #15803D; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.error { background: #FEE2E2; border: 1px solid #FCA5A5; color: #B91C1C; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.warning { background: #FEF3C7; border: 1px solid #FCD34D; color: #92400E; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-weight: 500; }

.muted { color: var(--muted); }
.mono { font-family: 'IBM Plex Mono', monospace; }
a.link { color: var(--blue); text-decoration: none; }
a.link:hover { text-decoration: underline; }
