:root {
  color-scheme: dark;
  --page: #0e0e10;
  --bar: #1c1c20;
  --panel: #18181b;
  --raised: #222226;
  --line: #2c2c31;
  --line-soft: #26262a;
  --control-line: #3a3a40;
  --text: #ededef;
  --text-strong: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #8b8b94;
  --accent: #3b82f6;
  --warning: #fbbf24;
  --danger: #f87171;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
}

a { color: var(--accent); }
a:hover { color: var(--text-strong); }

h1, h2, .display { font-family: 'Space Grotesk', Inter, sans-serif; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 14px; margin: 0 0 8px; }

button { font-family: inherit; }

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: var(--bar);
  color: #fff;
  padding: 8px 17px;
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.brand img { height: 52px; width: auto; display: block; }
.brand-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 17px; letter-spacing: .02em; }
.brand-sub { font-size: 12px; color: var(--muted); }

.account { display: flex; align-items: center; gap: 8px; }
.account-name {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  font-size: 13px;
}
.account form { margin: 0; }

.button-quiet {
  min-height: 30px;
  padding: 4px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--control-line);
  background: transparent;
  color: #d4d4d8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.button-quiet:hover { color: var(--text-strong); border-color: #55555e; }

.frame { display: flex; flex-wrap: wrap; flex: 1; }

.sidebar {
  flex: 1 1 220px;
  max-width: 260px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 11px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sidebar-heading {
  margin: 12px 8px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.sidebar-heading:first-child { margin-top: 4px; }
.sidebar-link {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 8px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
}
.sidebar-link:hover { background: var(--raised); color: var(--text-strong); }
.sidebar-link.is-sub { min-height: 30px; padding: 5px 8px 5px 22px; color: var(--muted); }
.sidebar-link.is-current { background: #2e2e34; color: var(--text-strong); font-weight: 600; }

.content {
  flex: 999 1 560px;
  min-width: 0;
  padding: 17px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 14px;
}

.muted { color: var(--muted); }

table { border-collapse: collapse; width: 100%; font-size: 13px; }
th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 7px 8px; border-bottom: 1px solid var(--line-soft); color: var(--text); white-space: nowrap; }

/* Rank colours match the roster sheet so officers recognise them at a glance. The colour is a
   property so badges, bar segments and legend swatches all read it from one place. */
.rank {
  display: inline-block;
  width: 58px;
  padding: 2px 0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
  text-align: center;
  background: var(--rank-colour);
  color: var(--rank-text, #0e0e10);
  flex: none;
}
.rank-cc { --rank-colour: #cc0000; --rank-text: #fff; }
.rank-d-cc { --rank-colour: #c27ba0; }
.rank-a-cc { --rank-colour: #8e7cc3; }
.rank-c-supt { --rank-colour: #e06666; }
.rank-supt { --rank-colour: #e69138; }
.rank-c-insp { --rank-colour: #00ffff; }
.rank-insp { --rank-colour: #ffff00; }
.rank-ds { --rank-colour: #4a86e8; --rank-text: #fff; }
.rank-dc { --rank-colour: #93c47d; }
.rank-spc { --rank-colour: #76a5af; }
.rank-pc { --rank-colour: #efefef; }
.rank-pcso { --rank-colour: #b7b7b7; }
.rank-vacant { background: transparent; border: 1px dashed #55555e; color: var(--faint); padding: 1px 0; }

/* Special department ladders are shaded by seniority, most senior first. */
.tier-0 { --rank-colour: #f4f4f5; }
.tier-1 { --rank-colour: #a1a1aa; }
.tier-2 { --rank-colour: #e06666; }
.tier-3 { --rank-colour: #f6b26b; }
.tier-4 { --rank-colour: #6fa8dc; }
.tier-5 { --rank-colour: #93c47d; }

.tag {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--line);
  color: #d4d4d8;
  font-size: 11px;
  font-weight: 600;
}

/* Each department keeps the tab colour it has on the roster sheet. */
.department-card {
  color: var(--text);
  border-radius: 10px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 3px solid var(--department-colour);
  background: linear-gradient(180deg, color-mix(in srgb, var(--department-colour) 22%, transparent), color-mix(in srgb, var(--department-colour) 8%, transparent)), var(--panel);
}
.department-kavala { --department-colour: #0b5394; }
.department-rpu { --department-colour: #660000; }
.department-sofia { --department-colour: #6047a0; }
.department-npas { --department-colour: #980000; }
.department-tfu { --department-colour: #999999; }
.department-rto { --department-colour: #073763; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 11px; }
.card-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.card-head img { height: 56px; width: auto; display: block; }
.card-title { display: flex; align-items: center; gap: 10px; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 17px; }
.fill { font-size: 13px; color: var(--muted); }
.fill strong { color: var(--text); }

/* Public roster */
.card-link { text-decoration: none; }
.card-link:hover { color: var(--text); filter: brightness(1.12); }
.card-summary { font-size: 13px; color: var(--muted); }

.hero {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 17px 20px;
}
.hero-command { background: var(--bar); border-radius: 10px; }
.hero-main { flex: 1 1 280px; display: flex; flex-direction: column; gap: 7px; }
.hero-title { display: flex; align-items: center; gap: 14px; }
.hero-logo { height: 120px; width: auto; display: block; }
.hero-name { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 700; }
.hero-command .hero-name { font-size: 20px; margin-top: 4px; }
.hero-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.kicker { font-size: 12px; color: #d4d4d8; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

.command { display: flex; flex-wrap: wrap; gap: 15px; }
.command-person { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; width: 104px; }

.group-title { font-size: 15px; margin: 4px 0 0; }

.places-bar { appearance: none; width: 100%; height: 8px; border: none; border-radius: 99px; overflow: hidden; background: var(--line); }
.places-bar::-webkit-progress-bar { background: var(--line); }
.places-bar::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
.places-bar::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
.hero .places-bar { height: 10px; }

.leaders { display: flex; flex-direction: column; gap: 6px; }
.leader { display: flex; align-items: center; gap: 7px; }
.leader-name { font-size: 13px; font-weight: 600; }
.leader-role { font-size: 12px; color: var(--muted); }
.department-leads { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); padding-top: 8px; }
.department-lead { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.department-lead .leader-role { margin-left: auto; }

.mix { flex: 1 1 320px; display: flex; flex-direction: column; gap: 6px; }
.mix-heading { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.mix-bar { display: block; width: 100%; height: 14px; border-radius: 99px; }
.mix-bar rect { fill: var(--rank-colour); }
.mix-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.mix-key { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--rank-colour); }

.teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.team { background: var(--panel); border-radius: 10px; padding: 10px 11px; display: flex; flex-direction: column; gap: 6px; }
.team-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.team-lead { font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.team-places { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.team-places > .muted { white-space: nowrap; }
.slot-dots { display: flex; flex-wrap: wrap; gap: 2px; }
.slot-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px dashed #55555e; }
.slot-dot.is-filled { background: var(--accent); border: none; }

.rank-section { display: flex; flex-direction: column; gap: 7px; }
.section-heading { margin: 4px 0 0; font-size: 13px; display: flex; align-items: center; gap: 8px; color: #d4d4d8; }
.section-heading span { font-size: 11px; font-weight: 600; color: var(--faint); }
.section-heading::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 6px; }
.person-grid-narrow { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.person {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 6px 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: center;
  align-content: start;
}
.person.is-vacant { background: transparent; border: 1px dashed #3f3f46; padding: 5px 9px; color: var(--muted); }
.person-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-detail { font-size: 11px; color: var(--faint); white-space: nowrap; }
.person-tags { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 3px; }
.person-tags .tag { font-size: 10px; white-space: nowrap; }

.notice { max-width: 460px; margin: 60px auto; text-align: center; display: flex; flex-direction: column; gap: 12px; }

.page-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }

/* Action menu: a <details> element so it needs no script. */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--control-line);
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
}
.menu[open] .menu-button { background: #2e2e34; }
.menu-items {
  position: absolute;
  right: 0;
  top: 40px;
  z-index: 20;
  min-width: 200px;
  padding: 5px;
  border-radius: var(--radius);
  border: 1px solid var(--control-line);
  background: #1f1f23;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  display: flex;
  flex-direction: column;
}
.menu-item {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.menu-item:hover { background: var(--raised); color: var(--text-strong); }
.menu-item.is-destructive { color: var(--danger); }

/* Dialogs open when their id is the URL fragment. */
.modal { display: none; position: fixed; inset: 0; z-index: 50; align-items: flex-start; justify-content: center; padding: 60px 16px; }
.modal:target { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); }
.modal-panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--panel);
  border: 1px solid var(--control-line);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .5);
  display: flex;
  flex-direction: column;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-close { color: var(--muted); text-decoration: none; font-size: 20px; line-height: 1; }
.modal-fields { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.modal-foot .button-quiet { display: inline-flex; align-items: center; text-decoration: none; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.field-label { color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea, .search-input {
  padding: 7px 8px;
  border: 1px solid var(--control-line);
  border-radius: var(--radius);
  background: var(--page);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
/* Drop-downs drawn to match the inputs; the arrow is two gradient triangles, since the
   content security policy allows no image data. */
.field select, select.search-input {
  appearance: none;
  padding-right: 28px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.field select:hover, select.search-input:hover { border-color: var(--faint); }
.field select:focus, select.search-input:focus { outline: none; border-color: var(--accent); }
option { background: var(--raised); color: var(--text); }
.field-fixed { padding: 7px 0; font-weight: 600; }
.form-error { margin: 0; padding: 7px 9px; border-radius: 6px; background: #3b1414; color: #fca5a5; font-size: 13px; }

.button-primary {
  min-height: 34px;
  padding: 7px 11px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.button-primary.is-destructive { background: var(--panel); border: 1px solid #7f1d1d; color: var(--danger); }

.pill { padding: 2px 7px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-good { background: #14361f; color: #86efac; }
.pill-neutral { background: #2e2e34; color: var(--text-strong); }
.pill-informative { background: #1e2a44; color: #93c5fd; }
.pill-caution { background: #3a2a0a; color: #fcd34d; }
.pill-bad { background: #3b1414; color: #fca5a5; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 11px; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 20px; font-weight: 700; margin-top: 4px; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { font-size: 13px; font-weight: 600; text-decoration: none; }
.tab-detail { opacity: .75; font-weight: 500; }
.tabs-chips .tab { min-height: 34px; padding: 6px 11px; border-radius: var(--radius); border: 1px solid var(--control-line); background: var(--panel); color: var(--text); }
.tabs-chips .tab.is-current { border-color: var(--accent); background: var(--accent); color: #fff; }
.tabs-segmented { gap: 3px; padding: 3px; background: var(--line); border-radius: var(--radius); align-self: flex-start; }
.tabs-segmented .tab { min-height: 32px; padding: 6px 11px; border-radius: 9px; color: var(--muted); }
.tabs-segmented .tab.is-current { background: var(--accent); color: #fff; }

.page-form { display: flex; flex-direction: column; gap: 10px; }
.problems {
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 8px 14px;
  color: var(--danger);
  font-size: 13px;
}
.problems p { margin: 3px 0; }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.settings-list { display: flex; flex-direction: column; gap: 8px; }
.settings-column { display: flex; flex-direction: column; gap: 10px; }
.settings-column > .panel:last-child { flex: 1; }
.settings-list h2 { margin: 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.number-input {
  width: 64px;
  padding: 5px 7px;
  border: 1px solid var(--control-line);
  border-radius: 6px;
  background: #111113;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: right;
}
.number-input.has-problem { border-color: var(--danger); }
/* Lines a fixed figure up with the numbers typed in the inputs beside it. */
.fixed-number { display: inline-block; width: 64px; padding-right: 8px; text-align: right; }
.align-end { text-align: right; }
.total-row td { font-weight: 700; padding-right: 16px; }
.department-underline { display: inline-block; padding-bottom: 3px; border-bottom: 3px solid var(--department-colour); }
.unit-slots-head { display: flex; align-items: center; gap: 8px; }
.unit-slots-head img { height: 32px; width: auto; }

.table-scroll { overflow-x: auto; }
.panel.flush { padding: 0; }
.strong { font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pager { display: flex; gap: 6px; justify-content: flex-end; }
.pager a { text-decoration: none; display: inline-flex; align-items: center; }
.quiet-link { color: inherit; text-decoration: none; }
.quiet-link:hover { text-decoration: underline; }
.table-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.table-panel + h2 { margin-top: 6px; }
td.wrap { white-space: normal; min-width: 200px; }
.officer-cell { display: flex; align-items: center; gap: 8px; }
.officer-name { color: var(--text); font-weight: 600; text-decoration: none; }
.officer-name:hover { color: var(--accent); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-action { margin: 0; }
.button-small {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--control-line);
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button-small:hover { background: var(--raised); color: var(--text-strong); }
.form-error { margin: 0; padding: 8px 10px; border-radius: var(--radius); background: #3b1414; color: #fca5a5; font-size: 13px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Special departments */
.unit-hero { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 20px; }
.unit-identity { display: flex; flex-direction: column; gap: 10px; }
.unit-hero .card-title { font-size: 20px; }
.unit-hero .card-title img { height: 72px; width: auto; }
.unit-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.rank-mix { flex: 1 1 320px; max-width: 620px; display: flex; flex-direction: column; gap: 6px; }
.rank-mix-heading { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.rank-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; }
.rank-bar > span { flex: 1; }
.rank-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: #d4d4d8; }
.rank-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
/* Unit ranks have their own ladders, so tiers are coloured from most to least senior. */
.tier-0 { background: #f4f4f5; }
.tier-1 { background: #a1a1aa; }
.tier-2 { background: #e06666; }
.tier-3 { background: #f6b26b; }
.tier-4 { background: #6fa8dc; }
.tier-5 { background: #93c47d; }

.unit-group { display: flex; flex-direction: column; gap: 8px; }
.unit-group-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: #d4d4d8; }
.unit-group-title span { color: var(--faint); font-weight: 500; font-size: 12px; }
.unit-group-title::after { content: ''; flex: 1; height: 1px; background: var(--line); margin-left: 6px; }
.unit-members { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.unit-member { background: var(--panel); border-radius: var(--radius); padding: 6px 10px; display: flex; gap: 8px; align-items: center; min-width: 0; }
.unit-member .member-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit-member .member-sub { margin-left: auto; white-space: nowrap; }
.unit-member.is-open { background: transparent; border: 1px dashed #3f3f46; padding: 5px 9px; color: var(--muted); }
.rank-unit { background: #f4f4f5; color: #18181b; width: auto; min-width: 58px; padding: 2px 6px; }

.table-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.table-panel h2 { padding: 11px 14px 0; }
td.strong, div.strong { font-weight: 600; }
td.wrap { white-space: normal; }

.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; align-items: start; }
.board-column { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.board-column h2 { font-size: 13px; margin: 0; }
.board-column h2 .muted { color: var(--faint); font-weight: 500; }
.board-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 7px; font-size: 13px; }

/* Roster */
.page-tools { display: flex; align-items: center; gap: 8px; }
.find { margin: 0; }
.find .search-input { width: 220px; }
.find .search-input.wide { width: 280px; }
.roster-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.group-row td { background: var(--raised); font-weight: 700; font-size: 12px; color: #d4d4d8; padding: 5px 8px; }
.name-link { color: var(--text-strong); font-weight: 600; text-decoration: none; }
.name-link:hover { text-decoration: underline; }
.tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.hpm { display: inline-flex; align-items: center; gap: 8px; }
.hpm-bar { width: 70px; height: 6px; display: block; }
.hpm-track { fill: var(--line); }
.hpm-fill { fill: var(--accent); }
.hpm-value { font-weight: 600; min-width: 20px; }
.hpm.is-low .hpm-fill { fill: var(--warning); }
.hpm.is-low .hpm-value { color: var(--warning); font-weight: 700; }
td.flags { font-weight: 600; }
.flag-concern { color: var(--warning); }
.flag-eligible { color: #86efac; }

/* Profile */
.back-link { align-self: flex-start; font-size: 13px; }
.profile-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.profile-head > div:first-child { display: flex; flex-direction: column; gap: 6px; }
.profile-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ex-cop { font-size: 13px; }
/* Side-by-side panels share a height, and the holidays panel keeps its leave line at the
   foot, so neither panel ends early and leaves a gap. */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 11px; }
.profile-grid > .panel { display: flex; flex-direction: column; }

/* The chart takes whatever height the holidays panel beside it needs, so both panels end
   together with nothing empty in either. */
.activity-chart { display: block; width: 100%; flex: 1 1 0; min-height: 80px; margin-top: 12px; }
.activity-bar { fill: var(--accent); }
.activity-bar.is-empty { fill: var(--line); }
.chart-axis { display: flex; justify-content: space-between; font-size: 11px; margin-top: 4px; }
.big-figure { font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 700; margin: 6px 0; }
.big-figure span { font-family: Inter, sans-serif; font-size: 13px; font-weight: 500; }
.note-box { padding: 7px 9px; border-radius: 6px; background: var(--raised); font-size: 13px; }
td.points { color: var(--warning); font-weight: 600; }
td.align-end { text-align: right; }

.time-in-rank { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; }

/* Phones. The sidebar folds behind a toggle above the page, tables scroll inside their own
   panel rather than widening the page, and dialogs fit the screen. */
.sidebar-toggle, .sidebar-toggle-label { display: none; }
.table-panel, .table-scroll { position: relative; }
.panel { min-width: 0; position: relative; }
/* Only a panel holding a table scrolls sideways; any overflow setting would also clip the
   action menu that opens out of the profile header. */
.panel:has(table) { overflow-x: auto; }

@media (max-width: 760px) {
  .topbar { padding: 8px 12px; gap: 8px; }
  .brand img { height: 40px; }
  .account { flex-wrap: wrap; }

  .frame { flex-direction: column; flex-wrap: nowrap; }
  .sidebar-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 14px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-strong);
    cursor: pointer;
  }
  .sidebar-toggle-icon { font-size: 18px; color: var(--muted); }
  .sidebar { display: none; flex: none; max-width: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-toggle:checked ~ .sidebar { display: flex; }
  .sidebar-link { min-height: 40px; }

  .content { flex: 1 1 auto; padding: 12px; gap: 12px; }
  .page-head { flex-wrap: wrap; }

  .modal { padding: 12px; align-items: flex-start; }
  .modal-panel { max-height: calc(100vh - 24px); overflow-y: auto; }
  .field input, .field select, .field textarea { font-size: 16px; }

  .settings-grid, .board, .profile-grid { grid-template-columns: minmax(0, 1fr); }
  .unit-members { grid-template-columns: 1fr; }
  .unit-hero { padding: 14px; }
  .unit-hero .card-title img { height: 52px; }
}
