:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-strong: #e9eef6;
  --text: #132033;
  --muted: #68758a;
  --line: #dce3ee;
  --brand: #0d1b2a;
  --brand-2: #1e5b80;
  --gold: #f8c14a;
  --lime: #a8ff1a;
  --good: #1f7a4d;
  --warn: #b2551c;
  --danger: #a63232;
  --shadow: 0 14px 36px rgba(16, 31, 52, .16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.day {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-strong: #e9eef6;
  --text: #132033;
  --muted: #68758a;
  --line: #dce3ee;
  --brand: #0d1b2a;
  --brand-2: #1e5b80;
  --gold: #f8c14a;
  --lime: #6ead18;
  --good: #1f7a4d;
  --warn: #b2551c;
  --danger: #a63232;
  --shadow: 0 14px 36px rgba(16, 31, 52, .16);
}

body.night {
  --bg: #050a0e;
  --panel: #111820;
  --panel-strong: #18222d;
  --text: #eef4fb;
  --muted: #9fb0c5;
  --line: #35404a;
  --brand: #f8c14a;
  --brand-2: #a8ff1a;
  --gold: #f8c14a;
  --lime: #a8ff1a;
  --good: #a8ff1a;
  --warn: #db8746;
  --danger: #d76565;
  --shadow: 0 18px 42px rgba(0, 0, 0, .36);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-root,
.phone-shell {
  min-height: 100vh;
}

.splash-screen,
.login-screen {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 28px;
}

.splash-screen {
  justify-items: center;
  color: #fff;
  background: #000;
}

.splash-screen h1,
.login-brand h1 {
  margin: 0;
  letter-spacing: 0;
}

.splash-screen p,
.login-brand p {
  margin: 4px 0 0;
  color: var(--muted);
}

.splash-screen p {
  color: #fff;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-align: center;
}

.app-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--brand);
  background: var(--gold);
  font-size: 32px;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.login-screen {
  min-height: 100svh;
  grid-template-rows: 1fr auto auto 1fr auto;
  align-content: stretch;
  justify-items: stretch;
  gap: 22px;
  padding: max(24px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom));
  color: #f7f3ea;
  background:
    radial-gradient(circle at 50% 34%, rgba(248, 193, 74, .05), transparent 26%),
    #05070a;
}

.login-brand {
  display: grid;
  align-self: end;
  justify-items: center;
  gap: 8px;
  color: #f8c14a;
  text-align: center;
}

.login-brand h1 {
  color: #d6a842;
  font-size: clamp(44px, 15vw, 72px);
  font-weight: 300;
  line-height: .95;
}

.login-brand p {
  margin: 0;
  color: #f4f0e9;
  font-size: clamp(20px, 6.2vw, 30px);
  font-weight: 300;
  line-height: 1;
}

.login-panel {
  width: 100%;
  max-width: 720px;
  justify-self: center;
  display: grid;
  gap: 13px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.login-panel label {
  display: grid;
  gap: 0;
  min-height: 58px;
  color: #b5bac2;
  font-size: 0;
  font-weight: 400;
}

.login-panel label > span:not(.password-field) {
  display: none;
}

.login-panel .password-field {
  display: block !important;
  min-height: 58px;
}

.login-panel input {
  min-height: 58px;
  width: 100%;
  display: block;
  opacity: 1;
  border: 1px solid rgba(164, 174, 187, .62);
  border-radius: 8px;
  padding: 0 16px;
  color: #f8f5ec;
  -webkit-text-fill-color: #f8f5ec;
  caret-color: #f8f5ec;
  background: rgba(3, 6, 9, .12);
  font-size: 18px;
  font-weight: 650;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.login-panel input:-webkit-autofill,
.login-panel input:-webkit-autofill:hover,
.login-panel input:-webkit-autofill:focus {
  -webkit-text-fill-color: #0b1118;
  caret-color: #0b1118;
  box-shadow: 0 0 0 1000px #e8f0fe inset;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 72px;
}

.login-panel .password-reveal {
  position: absolute;
  right: 8px;
  top: 50%;
  min-height: 34px;
  width: auto;
  margin: 0;
  padding: 0 10px;
  border: 1px solid rgba(248, 193, 74, .42);
  border-radius: 7px;
  color: #f2c660;
  background: rgba(5, 8, 12, .36);
  font-size: 12px;
  font-weight: 800;
  transform: translateY(-50%);
}

.login-panel input::placeholder {
  color: #a8adb6;
}

.login-panel input:focus {
  border-color: rgba(248, 193, 74, .72);
  color: #f8f5ec;
  -webkit-text-fill-color: #f8f5ec;
  box-shadow: 0 0 0 3px rgba(248, 193, 74, .12);
}

body.night .login-panel input,
body.night .field input,
body.night .field select,
body.night .category-card select,
body.night textarea {
  color: var(--text);
  background: #111a25;
}

body.night .login-panel input {
  color: #f8f5ec;
  -webkit-text-fill-color: #f8f5ec;
  background: rgba(3, 6, 9, .12);
}

.login-panel button,
.primary-action {
  min-height: 48px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
}

.login-panel .login-submit-button {
  min-height: 62px;
  margin-top: 5px;
  border-radius: 8px;
  color: #080b0f;
  background: #e6b747;
  font-size: clamp(21px, 6vw, 29px);
  font-weight: 700;
}

body.night .primary-action,
body.night .login-panel button {
  color: #101820;
}

.forgot-password-link {
  justify-self: center;
  margin-top: 18px;
  color: #d9a93d;
  font-size: clamp(17px, 5vw, 23px);
  text-decoration: none;
}

.forgot-password-link:hover {
  text-decoration: underline;
}

.login-update-prompt {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding: 9px 10px;
  border: 1px solid rgba(164, 174, 187, .28);
  border-radius: 8px;
  color: #b8bec8;
  background: rgba(5, 8, 12, .2);
  font-size: 12px;
}

.login-update-prompt strong,
.login-update-prompt span {
  display: block;
}

.login-update-prompt strong {
  color: #f8c14a;
}

.login-panel .login-update-prompt .login-update-button {
  min-height: 30px;
  width: auto;
  margin: 0;
  padding: 0 9px;
  border: 1px solid rgba(248, 193, 74, .42);
  border-radius: 7px;
  color: #f2c660;
  background: rgba(5, 8, 12, .36);
  font-size: 11px;
  font-weight: 850;
}

.login-panel .login-update-prompt .login-update-button:disabled {
  opacity: .78;
}

.login-update-prompt.has-update {
  border-color: rgba(248, 193, 74, .58);
}

.login-environment {
  justify-self: center;
  align-self: end;
  color: #b8bec8;
  font-size: clamp(17px, 4.8vw, 22px);
}

.login-environment::after {
  content: "⌄";
  margin-left: 10px;
  color: #b8bec8;
}

.form-error,
.empty-note {
  color: var(--danger);
  font-size: 13px;
}

.phone-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  padding: max(18px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 22% 8%, rgba(168, 255, 26, .08), transparent 28%),
    radial-gradient(circle at 84% 18%, rgba(248, 193, 74, .08), transparent 26%),
    var(--bg);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0 16px;
  border-bottom: 2px solid color-mix(in srgb, var(--gold) 72%, transparent);
  margin-bottom: 12px;
}

.app-brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-logo {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 68%, transparent);
}

.eyebrow {
  margin: 0;
  color: var(--text);
  font-size: clamp(20px, 6vw, 30px);
  font-weight: 800;
  line-height: 1;
  text-transform: none;
}

.app-header h1 {
  margin: 3px 0 0;
  color: var(--gold);
  font-size: clamp(16px, 4.4vw, 20px);
  letter-spacing: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  transform: translateY(-12px);
}

.header-home-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  margin-left: -10px;
  align-self: flex-start;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gold);
  box-shadow: none;
  transform: translate(-8px, -12px);
}

.header-home-icon {
  width: 20px;
  height: 20px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.header-home-icon img,
.header-home-icon svg {
  width: 100%;
  height: 100%;
}

.role-chip {
  display: none;
  align-items: center;
  min-height: 34px;
  max-width: 136px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  font-size: 20px;
}

.content-area {
  display: grid;
  align-content: start;
  gap: 13px;
  padding-bottom: 0;
}

.status-strip,
.card,
.list-row,
.resource-row,
.form-card,
.mini-card,
.calendar-row,
.calendar-card,
.track-panel,
.theme-toggle,
.report-picker,
.hub-hero,
.hub-card,
.hub-subhead,
.k9-status-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 5px 16px rgba(15, 35, 60, .06);
}

.status-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px;
}

.status-strip strong,
.card strong,
.list-row strong {
  display: block;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.card {
  padding: 14px;
}

.metric {
  color: var(--brand-2);
  font-size: 28px;
  font-weight: 900;
}

.home-hero {
  display: none;
}

.home-tile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.home-tile,
.home-action-list button,
.k9-action-list button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--panel) 94%, #ffffff), color-mix(in srgb, var(--panel-strong) 78%, #000000));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 10px 22px rgba(0,0,0,.14);
}

.home-tile {
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 186px;
  padding: 16px 12px;
  text-align: center;
}

.home-tile strong {
  margin-top: 14px;
  font-size: clamp(25px, 7vw, 33px);
  line-height: 1;
}

.home-tile small,
.home-action-list small,
.k9-action-list small,
.gps-dashboard-row small {
  color: var(--muted);
  font-size: 15px;
}

.home-tile b,
.home-action-list b,
.k9-action-list b {
  color: var(--gold);
  font-size: 36px;
  line-height: 1;
}

.tile-icon,
.k9-hero-icon,
.header-home-icon,
.bottom-nav-icon {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border: 4px solid var(--lime);
  border-radius: 50%;
  color: var(--lime);
  font-size: 48px;
  line-height: 1;
}

.tile-icon img,
.tile-icon svg,
.k9-hero-icon img,
.k9-hero-icon svg,
.header-home-icon img,
.header-home-icon svg,
.bottom-nav-icon img,
.bottom-nav-icon svg {
  width: 74%;
  height: 74%;
  object-fit: contain;
  display: block;
}

.tile-icon:has(img.app-site-icon),
.k9-hero-icon:has(img.app-site-icon),
.header-home-icon:has(img.app-site-icon) {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.tile-icon:has(img.app-site-icon) img,
.k9-hero-icon:has(img.app-site-icon) img,
.header-home-icon:has(img.app-site-icon) img {
  width: 100%;
  height: 100%;
  transform: scale(1.38);
}

.home-action-list .tile-icon:has(img.app-site-icon) img,
.k9-action-list .tile-icon:has(img.app-site-icon) img,
.header-home-icon:has(img.app-site-icon) img,
.bottom-nav-icon:has(img.app-site-icon) img {
  transform: scale(1.22);
}

.header-home-icon:has(img.app-site-icon) img {
  transform: scale(.94);
}

.home-tile [data-icon-name="resources"] {
  width: 66px;
  height: 66px;
  border-width: 1.5px;
  color: #a8ff1a;
  border-color: #a8ff1a;
  transform: translateY(11px);
}

.home-tile [data-icon-name="resources"] svg {
  width: 58%;
  height: 58%;
  stroke-width: 1;
}

.home-tile[data-jump="resources"] strong {
  margin-top: 30px;
  transform: translateY(10px);
}

.home-tile[data-jump="resources"] small {
  margin-top: 5px;
  transform: translateY(5px);
}

.resources-tile .tile-icon:has(img.app-site-icon) img {
  filter: saturate(2.25) brightness(1.5) hue-rotate(24deg) drop-shadow(0 0 12px rgba(182, 255, 0, .42));
}

.tile-icon img,
.k9-hero-icon img,
.header-home-icon img,
.bottom-nav-icon img {
  filter: saturate(1.2) brightness(1.15) drop-shadow(0 0 10px rgba(155, 255, 36, .24));
}

.tile-icon svg,
.k9-hero-icon svg,
.header-home-icon svg,
.bottom-nav-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-site-icon[hidden],
.mapped-icon-fallback[hidden] {
  display: none;
}

.home-section-title {
  margin: 18px 0 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: 22px;
}

.home-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 0 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.home-section-heading .home-section-title {
  margin: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.home-update-action {
  min-height: 32px;
  width: auto;
  padding: 0 9px;
  border-radius: 8px;
  color: var(--gold);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.app-update-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  padding: 10px 11px;
  border: 1px solid color-mix(in srgb, var(--gold) 38%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--gold));
}

.app-update-strip strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  line-height: 1.1;
}

.app-update-strip span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.app-update-strip button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  color: #0b1118;
  background: var(--gold);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.app-update-strip.required {
  border-color: var(--gold);
}

.home-action-list,
.k9-action-list {
  display: grid;
  gap: 10px;
}

.home-action-list button,
.k9-action-list button {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 12px 14px;
  text-align: left;
}

.home-action-list .tile-icon,
.k9-action-list .tile-icon {
  width: 52px;
  height: 52px;
  border-width: 2px;
  color: var(--gold);
  border-color: var(--gold);
  font-size: 28px;
}

.home-action-list strong,
.k9-action-list strong {
  display: block;
  font-size: 22px;
}

.handler-review-list,
.pending-track-list {
  display: grid;
  gap: 10px;
}

.handler-review-button {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
}

.handler-review-button.active {
  border-color: color-mix(in srgb, var(--lime) 74%, transparent);
  background: color-mix(in srgb, var(--lime) 12%, var(--panel));
}

.handler-review-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--lime);
}

.handler-review-icon img,
.handler-review-icon svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.handler-review-button strong,
.pending-track-title strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  line-height: 1.15;
}

.handler-review-button small,
.pending-track-title .muted {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.handler-review-button b {
  color: var(--gold);
  font-size: 30px;
}

.handler-review-panel,
.pending-track-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.panel-title strong {
  display: block;
  color: var(--text);
  font-size: 20px;
}

.handler-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.handler-filter-grid .wide {
  grid-column: 1 / -1;
}

.handler-filter-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pending-track-card img,
.pending-track-empty {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  object-fit: cover;
}

.pending-track-empty {
  display: grid;
  place-items: center;
  color: var(--lime);
}

.pending-track-empty span {
  color: #415062;
  font-weight: 900;
}

.pending-track-empty-icon {
  width: 72px;
  height: 72px;
}

.pending-track-info {
  display: grid;
  gap: 10px;
}

.pending-track-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.route-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.route-meta-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel-strong) 72%, transparent);
  padding: 9px;
}

.route-meta-grid span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.route-meta-grid b {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 12px;
}

.pending-track-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.field-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.field-metrics article {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
}

.field-metrics strong {
  display: block;
  color: var(--brand-2);
  font-size: 25px;
}

.field-metrics span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.section-title {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.list {
  display: grid;
  gap: 10px;
}

.list-row,
.resource-row {
  display: grid;
  gap: 5px;
  padding: 13px;
  color: inherit;
  text-align: left;
  text-decoration: none;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--brand);
  background: var(--panel-strong);
  font-size: 12px;
  font-weight: 800;
}

.pill.good {
  color: #fff;
  background: var(--good);
}

.pill.warn {
  color: #fff;
  background: var(--warn);
}

.action-pill {
  min-width: 64px;
  justify-content: center;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-actions button {
  min-height: 48px;
  border-radius: 8px;
  color: var(--brand);
  background: var(--panel-strong);
  font-weight: 900;
}

.hub-hero,
.hub-subhead,
.k9-status-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.hub-hero strong,
.hub-subhead strong,
.k9-status-panel strong,
.hub-card strong {
  display: block;
}

.hub-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.hub-card {
  display: grid;
  gap: 5px;
  min-height: 78px;
  padding: 14px;
  color: inherit;
  text-align: left;
}

.primary-hub-card {
  border-color: color-mix(in srgb, var(--brand) 46%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--panel-strong) 78%, var(--brand)), var(--panel));
}

.hub-card:active,
.mini-card:active,
.quick-actions button:active,
.home-tile:active,
.home-action-list button:active,
.k9-action-list button:active,
.start-track-command:active {
  transform: translateY(1px);
}

.hub-subhead {
  grid-template-columns: auto 1fr;
}

.compact-button {
  min-height: 38px;
  padding: 0 12px;
  white-space: nowrap;
}

.k9-status-panel .primary-action {
  min-width: 116px;
}

.compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mini-card {
  display: grid;
  gap: 5px;
  min-height: 76px;
  padding: 12px;
  color: inherit;
  text-align: left;
}

.form-card {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.form-title {
  display: grid;
  gap: 3px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field.wide {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.field input,
.field select,
.category-card select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  color: var(--text);
  background: var(--panel);
}

.field input,
.field select,
.category-card select {
  min-height: 44px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

textarea[data-wide-editor] {
  cursor: zoom-in;
}

.category-list {
  display: grid;
  gap: 10px;
}

.category-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.category-head {
  display: grid;
  grid-template-columns: 1fr minmax(112px, 38%);
  gap: 10px;
  align-items: center;
}

.calendar-row {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 12px;
  padding: 13px;
}

.calendar-row time {
  color: var(--brand-2);
  font-size: 13px;
  font-weight: 900;
}

.calendar-card {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.calendar-nav {
  min-height: 36px;
  border-radius: 8px;
  color: var(--brand);
  background: var(--panel-strong);
  font-size: 22px;
  font-weight: 900;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.calendar-weekdays span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--panel);
  font-size: 13px;
  font-weight: 900;
}

.calendar-day.empty {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.calendar-day small {
  position: absolute;
  right: 3px;
  bottom: 2px;
  min-width: 14px;
  height: 14px;
  border-radius: 999px;
  color: #fff;
  background: var(--brand-2);
  font-size: 9px;
  line-height: 14px;
}

.calendar-day.today {
  border-color: var(--gold);
}

.calendar-day.selected {
  color: #fff;
  background: var(--brand);
}

body.night .calendar-day.selected {
  color: #101820;
}

.report-picker {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.report-type-list {
  display: grid;
  gap: 9px;
}

.track-panel {
  display: grid;
  gap: 13px;
  padding: 14px;
}

.track-panel-dashboard {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.track-panel-dashboard .track-heading,
.track-panel-dashboard .gps-quality-row {
  display: none;
}

.k9-hero {
  display: grid;
  grid-template-columns: 108px 1fr;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
}

.k9-hero-icon {
  width: 102px;
  height: 102px;
  display: grid;
  place-items: center;
  border: 4px solid var(--lime);
  border-radius: 50%;
  color: var(--lime);
}

.k9-hero strong {
  display: block;
  color: var(--text);
  font-size: clamp(38px, 12vw, 54px);
  line-height: 1;
}

.k9-hero span:last-child {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: clamp(17px, 5vw, 23px);
}

.content-area[data-active-view="k9"] {
  gap: 10px;
}

.content-area[data-active-view="k9"] .k9-hero {
  grid-template-columns: 92px 1fr;
  gap: 12px;
  margin-top: 0;
}

.content-area[data-active-view="k9"] .k9-hero-icon {
  width: 88px;
  height: 88px;
  border-width: 3px;
}

.content-area[data-active-view="k9"] .k9-hero strong {
  font-size: clamp(31px, 9.5vw, 43px);
}

.content-area[data-active-view="k9"] .k9-hero span:last-child {
  margin-top: 5px;
  font-size: clamp(14px, 4vw, 18px);
}

.content-area[data-active-view="k9"] .start-track-command {
  grid-template-columns: 54px auto;
  gap: 12px;
  min-height: 66px;
}

.content-area[data-active-view="k9"] .start-track-command span {
  width: 44px;
  height: 44px;
}

.content-area[data-active-view="k9"] .start-track-command strong {
  font-size: clamp(24px, 7.4vw, 34px);
}

.content-area[data-active-view="k9"] .gps-dashboard-row {
  grid-template-columns: 62px 1fr;
  min-height: 62px;
  padding: 10px 12px;
}

.content-area[data-active-view="k9"] .gps-dashboard-row strong {
  font-size: 18px;
}

.content-area[data-active-view="k9"] .gps-bars {
  height: 34px;
}

.content-area[data-active-view="k9"] .gps-bars i:nth-child(1) { height: 14px; }
.content-area[data-active-view="k9"] .gps-bars i:nth-child(2) { height: 22px; }
.content-area[data-active-view="k9"] .gps-bars i:nth-child(3) { height: 28px; }
.content-area[data-active-view="k9"] .gps-bars i:nth-child(4) { height: 34px; }

.content-area[data-active-view="k9"] .track-metrics div {
  min-height: 64px;
  padding: 8px 8px 8px 38px;
}

.content-area[data-active-view="k9"] .track-metrics span {
  font-size: 17px;
}

.content-area[data-active-view="k9"] .track-metrics div::before {
  left: 10px;
  top: 18px;
  font-size: 22px;
}

.content-area[data-active-view="k9"] .phone-track-map {
  min-height: 190px;
  height: clamp(190px, 35vh, 300px);
}

.content-area[data-active-view="k9"] .k9-action-list {
  gap: 8px;
}

.content-area[data-active-view="k9"] .k9-action-list button {
  grid-template-columns: 50px 1fr auto;
  gap: 11px;
  min-height: 72px;
  padding: 10px 12px;
}

.content-area[data-active-view="k9"] .k9-action-list .tile-icon {
  width: 44px;
  height: 44px;
  font-size: 23px;
}

.content-area[data-active-view="k9"] .k9-action-list strong {
  font-size: 19px;
}

.content-area[data-active-view="k9"] .k9-action-list small {
  font-size: 13px;
}

.start-track-command {
  display: grid;
  grid-template-columns: 62px auto;
  justify-content: center;
  align-items: center;
  gap: 16px;
  min-height: 76px;
  border: 1px solid color-mix(in srgb, var(--lime) 70%, #ffffff);
  border-radius: 8px;
  color: #050a0e;
  background: linear-gradient(180deg, #c8ff24, #98df08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 10px 24px rgba(168,255,26,.22);
}

.start-track-command.active {
  color: #fff;
  background: linear-gradient(180deg, #d76565, #9f2d2d);
  border-color: #d76565;
}

.start-track-command span {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--lime);
  background: #050a0e;
  font-size: 24px;
}

.start-track-command strong {
  font-size: clamp(29px, 9vw, 40px);
  line-height: 1;
}

.gps-dashboard-row {
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 80%, transparent);
}

.gps-dashboard-row strong {
  display: block;
  color: var(--lime);
  font-size: 21px;
}

.gps-dashboard-row small {
  display: block;
}

.gps-bars {
  display: flex;
  align-items: end;
  gap: 6px;
  height: 42px;
}

.gps-bars i {
  width: 9px;
  border-radius: 5px 5px 2px 2px;
  background: var(--lime);
}

.gps-bars i:nth-child(1) { height: 18px; opacity: .65; }
.gps-bars i:nth-child(2) { height: 27px; opacity: .78; }
.gps-bars i:nth-child(3) { height: 35px; opacity: .9; }
.gps-bars i:nth-child(4) { height: 42px; }

.track-heading {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.track-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.track-metrics div {
  display: grid;
  gap: 2px;
  position: relative;
  align-content: center;
  min-height: 78px;
  padding: 10px 10px 10px 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.track-metrics span {
  display: block;
  font-size: 20px;
  font-weight: 900;
}

.track-metrics small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.track-metrics div::before {
  position: absolute;
  left: 14px;
  top: 22px;
  color: var(--gold);
  font-size: 26px;
}

.track-metrics [data-app-icon="distance"]::before { content: "~"; }
.track-metrics [data-app-icon="time"]::before { content: "⏱"; }
.track-metrics [data-app-icon="flag"]::before { content: "⚑"; }

.phone-track-map {
  width: 100%;
  min-height: 220px;
  height: clamp(220px, 42vh, 360px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
}

.track-panel-dashboard .phone-track-map {
  min-height: 212px;
  height: clamp(190px, 30vh, 260px);
  border-radius: 8px;
}

.phone-track-map .leaflet-control-attribution {
  font-size: 10px;
}

.mapbox-wordmark {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 650;
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .24);
  color: #111 !important;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .01em;
  text-decoration: none;
}

.mapbox-wordmark.hide {
  display: none;
}

.track-map-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.gps-quality-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
}

.gps-quality {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.gps-quality.good {
  background: var(--good);
}

.gps-quality.fair {
  background: #d97706;
}

.gps-quality.weak {
  background: var(--warn);
}

.track-map-note:empty {
  display: none;
}

.track-map-note.warn-note {
  border: 1px solid rgba(234, 179, 8, .42);
  border-radius: 8px;
  background: rgba(234, 179, 8, .09);
  color: #ffe08a;
  padding: 8px 9px;
}

body.day .track-map-note.warn-note {
  background: #fff8df;
  border-color: #d7ae35;
  color: #3f3105;
}

.track-license-note {
  border: 1px solid rgba(234, 179, 8, .46);
  border-radius: 9px;
  background: rgba(234, 179, 8, .11);
  color: #ffe08a;
  padding: 9px 10px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

body.day .track-license-note {
  background: #fff8df;
  border-color: #d7ae35;
  color: #3f3105;
}

.phone-track-review {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.phone-track-review label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 900;
  color: var(--text);
}

.phone-track-review input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.phone-track-tile {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.form-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.form-actions.single-row {
  grid-template-columns: 1fr 1fr;
}

.secondary-action,
.theme-toggle {
  min-height: 48px;
  border-radius: 8px;
  color: var(--brand);
  background: var(--panel-strong);
  font-weight: 900;
}

.theme-toggle {
  display: grid;
  gap: 4px;
  padding: 13px;
  color: inherit;
  text-align: left;
}

.app-update-action {
  min-height: 42px;
  border-radius: 8px;
  color: var(--brand);
  background: var(--panel-strong);
  font-size: 13px;
  font-weight: 900;
}

.status-note {
  padding: 12px;
  border-radius: 8px;
  color: #fff;
  background: var(--good);
  font-size: 13px;
  font-weight: 900;
}

.wide-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: end;
  padding: 12px 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(5, 12, 20, .62);
}

.wide-editor-modal.show {
  display: flex;
}

.wide-editor-panel {
  display: grid;
  width: 100%;
  max-width: 720px;
  max-height: min(82vh, 720px);
  margin: 0 auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .36);
}

.wide-editor-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.wide-editor-panel textarea {
  min-height: 42vh;
  max-height: 58vh;
  resize: vertical;
  font-size: 16px;
  line-height: 1.45;
}

.resource-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.resource-tabs button {
  min-height: 40px;
  border-radius: 8px;
  color: var(--brand);
  background: var(--panel-strong);
  font-weight: 800;
}

.resource-tabs button.active {
  color: #fff;
  background: var(--brand);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  padding: 7px 10px max(9px, env(safe-area-inset-bottom));
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-bottom: 0;
  border-radius: 0;
  background: color-mix(in srgb, var(--bg) 94%, #000000);
  box-shadow: 0 -12px 28px rgba(0,0,0,.22);
  backdrop-filter: blur(14px);
}

.bottom-nav button {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 58px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.bottom-nav button.active {
  color: var(--gold);
  background: transparent;
}

.bottom-nav-icon {
  width: 30px;
  height: 30px;
  border: 0;
  color: currentColor;
  font-size: 20px;
}

.bottom-nav-icon img,
.bottom-nav-icon svg {
  width: 100%;
  height: 100%;
}

.bottom-nav [data-nav-icon="more"] .bottom-nav-icon {
  font-size: 24px;
}

.bottom-nav button.active::after {
  content: "";
  display: block;
  width: 58px;
  height: 3px;
  border-radius: 999px;
  background: var(--lime);
}

body.day .bottom-nav {
  background: rgba(255,255,255,.94);
}

body.night .bottom-nav {
  background: rgba(5,10,14,.94);
}

.profile-stack {
  display: grid;
  gap: 10px;
}

.app-version-label {
  justify-self: center;
  color: color-mix(in srgb, var(--muted) 78%, transparent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}

.danger-action {
  min-height: 48px;
  border-radius: 8px;
  color: #fff;
  background: var(--danger);
  font-weight: 900;
}

@media (min-width: 700px) {
  body {
    background: #dfe6ef;
  }

  .phone-shell {
    width: min(430px, 100%);
    margin: 0 auto;
    background: var(--bg);
    box-shadow: 0 0 0 1px var(--line), var(--shadow);
  }

  .bottom-nav {
    width: min(430px, 100%);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .role-chip {
    display: inline-flex;
  }
}

/* Responsive fit pass: keep the phone app shell from horizontal crowding. */
@media(max-width:700px){
  html,body{min-width:0;overflow-x:hidden}
  .app-shell,.app-page,.app-card,.sheet,.modal-card{max-width:100%;overflow-wrap:anywhere}
  .app-grid,.form-grid,.detail-grid,.summary-grid,.task-grid,.test-grid{grid-template-columns:1fr!important}
  .app-toolbar,.app-actions,.button-row{flex-wrap:wrap}
  input,select,textarea,button{max-width:100%}
}

@media(max-width:430px){
  .phone-shell{padding-left:14px;padding-right:14px}
  .brand-logo{width:52px;height:52px}
  .header-actions{gap:6px}
  .icon-button{width:38px;height:38px;font-size:20px}
  .home-tile{min-height:178px;padding:14px 8px}
  .tile-icon{width:96px;height:96px;font-size:40px}
  .home-action-list .tile-icon,
  .k9-action-list .tile-icon{width:52px;height:52px}
  .home-tile strong{font-size:25px}
  .home-tile small{font-size:13px}
  .k9-hero{grid-template-columns:92px 1fr;gap:12px}
  .k9-hero-icon{width:88px;height:88px}
  .track-metrics{gap:7px}
  .track-metrics div{padding-left:38px}
  .track-metrics div::before{left:10px;font-size:22px}
  .track-metrics span{font-size:17px}
}
