:root {
  --canvas: #f5f7fb;
  --surface: #fff;
  --surface-muted: #f7f9fc;
  --ink: #17243c;
  --muted: #52627a;
  --line: #e1e7f0;
  --control-line: #cbd5e4;
  --brand: #244dcb;
  --brand-hover: #183cae;
  --brand-soft: #edf2ff;
  --teal: #06756a;
  --teal-soft: #e3f5ef;
  --amber: #8b5211;
  --amber-soft: #fff1d9;
  --violet: #5945a4;
  --violet-soft: #eeeafd;
  --sidebar-width: 244px;
  --topbar-height: 64px;
  --gutter: clamp(20px, 3vw, 42px);
  --panel-radius: 15px;
  --panel-shadow: 0 2px 4px rgb(23 36 60 / 3%);
  --ui-font: "Plus Jakarta Sans", system-ui, sans-serif;
}

.workspace-body, .workspace-body *, .workspace-sidebar *, .workspace-topbar *, .login-branding * { box-sizing: border-box; }
.workspace-body {
  margin: 0 0 0 var(--sidebar-width);
  background: var(--canvas);
  color: var(--ink);
  font: 1rem/1.55 var(--ui-font);
  -webkit-font-smoothing: antialiased;
}

.workspace-body a { color: var(--brand); }
.workspace-body :focus-visible, .workspace-sidebar :focus-visible, .workspace-topbar :focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
.workspace-skip, .ui-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.workspace-skip:focus {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 60;
  width: auto;
  height: auto;
  clip-path: none;
  padding: 8px 14px;
  background: var(--surface);
}
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.ui-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workspace-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--line);
  font: .875rem/1.45 var(--ui-font);
}
.workspace-brand, .workspace-brand:link, .workspace-brand:visited {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: var(--topbar-height);
  padding: 12px 17px;
  color: var(--ink);
  text-decoration: none;
}
.workspace-brand strong { display: block; font-size: .89rem; font-weight: 800; letter-spacing: -.035em; }
.workspace-brand small { display: block; margin-top: 2px; color: var(--muted); font-size: .75rem; }
.brand-mark {
  display: grid;
  flex: 0 0 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  background: var(--brand);
  color: white;
}
.workspace-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding: 23px 13px 16px;
  border-top: 1px solid var(--line);
}
.nav-heading {
  margin: 0 9px 5px;
  color: var(--muted);
  font-size: .69rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.nav-heading:not(:first-child) { margin-top: 21px; }
.workspace-nav a, .workspace-nav a:link, .workspace-nav a:visited {
  display: flex;
  align-items: center;
  min-height: 42px;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 700;
  text-decoration: none;
}
.workspace-nav a:hover { color: var(--ink); background: var(--surface-muted); }
.workspace-nav a.active { color: var(--brand-hover); background: var(--brand-soft); }
.workspace-nav .ui-icon { width: 18px; height: 18px; }
.workspace-account {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 15px 12px 16px 16px;
  border-top: 1px solid var(--line);
}
.account-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-hover);
  font-size: .875rem;
  font-weight: 800;
}
.account-name { min-width: 0; flex: 1; }
.account-name strong { display: block; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name a, .account-name small { color: var(--muted); font-size: .75rem; }
.ui-icon-button, .mobile-navigation summary {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.ui-icon-button:hover, .mobile-navigation summary:hover { color: var(--brand); background: var(--brand-soft); }
.workspace-topbar {
  position: relative;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--topbar-height);
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font: 700 .875rem/1.45 var(--ui-font);
}
.workspace-topbar .workspace-home { color: var(--muted); text-decoration: none; }
.workspace-topbar .workspace-home:hover { color: var(--brand); }
.topbar-divider { color: #7b8aa2; font-weight: 400; }
.topbar-current { color: var(--ink); }
.mobile-navigation { display: none; }

.workspace-content { width: min(100%, 1540px); margin-inline: auto; padding: 29px var(--gutter) 48px; }
.page-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  margin-bottom: 23px;
}
.page-heading h1 { margin: 0; font-size: clamp(1.85rem, 3vw, 2.375rem); font-weight: 800; letter-spacing: -.052em; line-height: 1.2; }
.page-heading p { margin: 7px 0 0; color: var(--muted); font-size: .94rem; }
.heading-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.date-chip { padding: 8px 3px; color: var(--muted); font-size: .8125rem; font-weight: 700; text-transform: lowercase; }
.ui-button, a.ui-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font: 700 .875rem/1.4 var(--ui-font);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.ui-button .ui-icon { width: 17px; height: 17px; }
.ui-button:hover, a.ui-button:hover { background: var(--brand-hover); color: white; }
.ui-button.ui-secondary { background: var(--surface); color: var(--ink); border-color: var(--control-line); }
.ui-button.ui-secondary:hover, .ui-button.ui-text:hover { background: var(--brand-soft); color: var(--brand-hover); }
.ui-button.ui-text { background: transparent; color: var(--brand); }
.ui-panel, .metric {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow);
}
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 16px; }
.metric { padding: 15px 17px; }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.metric h2 { margin: 0; font-size: .875rem; color: var(--muted); font-weight: 700; line-height: 1.35; }
.metric strong { display: block; margin-top: 5px; font-size: 2.125rem; font-weight: 800; line-height: 1.08; letter-spacing: -.052em; font-variant-numeric: tabular-nums; }
.metric p { margin: 6px 0 0; color: var(--muted); font-size: .8125rem; line-height: 1.4; }
.metric-icon {
  display: grid;
  place-items: center;
  flex: 0 0 33px;
  height: 33px;
  border-radius: 9px;
}
.metric-icon .ui-icon { width: 18px; height: 18px; }
.metric-primary { background: linear-gradient(125deg, #2246bf, #3055d5); border-color: transparent; color: white; }
.metric-primary h2, .metric-primary p { color: #f1f4ff; }
.metric-primary .metric-icon { background: rgb(255 255 255 / 15%); color: white; }
.metric-free .metric-icon { color: var(--teal); background: var(--teal-soft); }
.metric-assigned .metric-icon { color: var(--violet); background: var(--violet-soft); }
.metric-recent .metric-icon { color: var(--amber); background: var(--amber-soft); }

.ui-panel h2 { margin: 0; font-size: 1.035rem; font-weight: 800; letter-spacing: -.026em; line-height: 1.4; }
.directory-heading p { margin: 4px 0 0; color: var(--muted); font-size: .83rem; }

.directory { scroll-margin-top: 12px; }
.directory-heading { padding: 16px 19px 9px; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; padding: 0 19px 14px; }
.filter-bar label { min-width: 0; }
.workspace-content input[type="search"], .workspace-content select {
  min-height: 42px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--control-line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: 600 .875rem/1.3 var(--ui-font);
}
.workspace-content select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%2352627a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 9px center;
  background-size: 16px;
  background-repeat: no-repeat;
}
.search-field { position: relative; flex: 1 1 245px; max-width: 420px; }
.search-field .ui-icon { position: absolute; left: 11px; top: 12px; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search-field input[type="search"] { width: 100%; padding-left: 35px; }
.search-field input::placeholder { color: var(--muted); font-weight: 500; opacity: 1; }
.table-scroll { overflow-x: auto; border-radius: 0 0 var(--panel-radius) var(--panel-radius); }
.data { width: 100%; border-collapse: collapse; text-align: left; font-size: .875rem; }
.data thead th { background: var(--surface-muted); color: var(--muted); font-size: .79rem; font-weight: 800; white-space: nowrap; }
.data th, .data td { padding: 11px 13px; border-top: 1px solid var(--line); }
.data tr > :first-child { padding-left: 19px; }
.data tr > :last-child { padding-right: 19px; }
.data tbody tr:hover { background: #f9fbff; }
.territory-number { display: inline-block; min-width: 33px; padding: 4px 6px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-hover); text-align: center; font-variant-numeric: tabular-nums; }
.territory-neighborhood { min-width: 120px; font-weight: 700; }
.status-badge { display: inline-block; padding: 3px 8px; border-radius: 99px; background: var(--teal-soft); color: var(--teal); font-size: .79rem; font-weight: 800; white-space: nowrap; }
.status-in_use { background: var(--violet-soft); color: var(--violet); }
.status-note { display: block; margin-top: 3px; color: var(--muted); font-size: .75rem; white-space: nowrap; }
.table-action { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; text-decoration: none; }
.table-action .ui-icon { width: 15px; height: 15px; }
.table-action:hover { text-decoration: underline; }
.data .empty-row { padding: 30px 19px; text-align: center; color: var(--muted); }

.content-panel { padding: 20px; }
.muted { color: var(--muted); }
.copy-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.copy-actions h2 { margin-right: auto; }
.summary {
  margin: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: .9rem/1.65 ui-monospace, monospace;
}
#copy-status { margin: 11px 0 0; font-size: .875rem; font-weight: 700; color: var(--teal); }
#copy-status:empty { margin: 0; }
.notice { border-left: 3px solid #c78125; }
.notice p { margin: 5px 0 0; }

@media (max-width: 1120px) {
  :root { --sidebar-width: 216px; }
  .metrics { gap: 10px; }
  .metric { padding: 12px; }
}
@media (max-width: 940px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  :root { --sidebar-width: 0px; --topbar-height: 56px; }
  .workspace-sidebar { display: none; }
  .workspace-topbar { gap: 9px; }
  .mobile-navigation { display: block; }
  .mobile-navigation summary { margin-left: -8px; list-style: none; }
  .mobile-navigation summary::-webkit-details-marker { display: none; }
  .mobile-navigation[open] {
    position: absolute;
    top: 8px;
    left: var(--gutter);
    right: var(--gutter);
    z-index: 1;
  }
  .mobile-navigation[open] ~ .workspace-home { margin-left: 40px; }
  .mobile-navigation .workspace-nav, .mobile-account {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--panel-shadow);
  }
  .mobile-navigation .workspace-nav { max-height: 65dvh; padding: 12px; border-radius: 10px 10px 0 0; }
  .mobile-account { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; border-top: 0; border-radius: 0 0 10px 10px; }
  .workspace-content { padding-top: 21px; }
}
@media (max-width: 620px) {
  .heading-actions { width: 100%; }
  .metric p { font-size: .75rem; }
  .filter-bar label:not(.search-field) { flex: 1 1 130px; }
  .filter-bar select { width: 100%; }
  .data { min-width: 670px; }
}
@media print {
  .workspace-body { margin: 0; background: white; }
  .workspace-sidebar, .workspace-topbar, .workspace-skip { display: none !important; }
  .workspace-content { width: auto; margin: 0; padding: 0; }
}
.activity-section {
  margin: 28px 0 26px;
  scroll-margin-top: 12px;
  --chart-urban: #365bd2;
  --chart-rural: #148578;
  --chart-weekday: #365bd2;
  --chart-weekend: #7750b0;
  --chart-unknown: #697991;
}
.dashboard-section-heading, .directory-heading, .chart-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
}
.dashboard-section-heading { margin-bottom: 13px; }
.dashboard-section-heading h2, .directory .directory-heading h2 {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -.035em;
}
.dashboard-section-heading p, .chart-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: .85rem;
}
.view-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-muted);
}
.view-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 9px;
  border-radius: 6px;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 700;
  text-decoration: none;
}
.view-switch a:hover { color: var(--brand); }
.view-switch a[aria-current] { color: var(--brand-hover); background: var(--surface); box-shadow: 0 1px 3px rgb(23 36 60 / 14%); }
.view-switch .ui-icon { width: 15px; height: 15px; }

.activity-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}
.activity-metrics div {
  display: grid;
  align-content: space-between;
  gap: 5px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.activity-metrics dt { color: var(--muted); font-size: .875rem; font-weight: 700; line-height: 1.35; }
.activity-metrics dd { margin: 0; font-size: 1.65rem; font-weight: 800; letter-spacing: -.04em; line-height: 1.18; }

.chart-panel { padding: 16px 19px; }
.chart-heading { align-items: start; margin-bottom: 13px; }
.chart-heading h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.025em;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: .8125rem;
  list-style: none;
}
.chart-legend li { display: flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; }
.chart-urban { background-color: var(--chart-urban); }
.chart-rural { background-color: var(--chart-rural); }
.chart-weekday { background-color: var(--chart-weekday); }
.chart-weekend { background-color: var(--chart-weekend); }
.chart-unknown { background-color: var(--chart-unknown); }

.weekly-chart {
  --plot-height: 126px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  padding-top: 14px;
}
.chart-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: calc(var(--plot-height) + 1em);
  margin-top: -.55em;
  padding-right: 8px;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1;
  text-align: right;
}
.weekly-scroll { overflow-x: auto; margin-top: -14px; padding-top: 14px; }
.weekly-columns {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--week-count), minmax(48px, 1fr));
  min-width: calc(var(--week-count) * 48px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.weekly-columns::before {
  position: absolute;
  inset: 0 0 auto;
  height: var(--plot-height);
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 33.333%);
  content: "";
  pointer-events: none;
}
.weekly-column { z-index: 0; text-align: center; }
.weekly-stack {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  height: var(--plot-height);
}
.weekly-stack div { flex-shrink: 0; width: min(60%, 39px); min-height: 1px; }
.weekly-stack div:last-of-type { border-radius: 3px 3px 0 0; }
.week-total { color: var(--muted); font-size: .72rem; font-weight: 800; line-height: 1; padding-bottom: 3px; }
.weekly-column time { display: block; margin: 7px 0 5px; color: var(--muted); font-size: .75rem; }
.weekly-values { margin-top: 8px; font-size: .8125rem; }
.weekly-values summary { width: fit-content; color: var(--brand); cursor: pointer; font-weight: 700; }
.weekly-values table { width: min(100%, 380px); margin-top: 7px; border-collapse: collapse; }
.weekly-values th, .weekly-values td { padding: 5px 3px; border-bottom: 1px solid var(--line); text-align: right; }
.weekly-values th:first-child { text-align: left; }

.activity-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.activity-charts .chart-panel { scroll-margin-top: 12px; }
.ranking-bars { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.ranking-label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 3px; font-size: .875rem; }
.ranking-label span { overflow-wrap: anywhere; }
.bar-track { height: 6px; overflow: hidden; border-radius: 5px; background: var(--line); }
.bar-track span { display: block; height: 100%; border-radius: inherit; }
.chart-empty { margin: 10px 0 0; color: var(--muted); font-size: .875rem; }
.shift-legend { margin-top: -5px; margin-bottom: 12px; }
.shift-chart { display: grid; gap: 8px; }
.shift-row { display: grid; grid-template-columns: 55px minmax(0, 1fr); gap: 8px; align-items: center; }
.shift-row + .shift-row { padding-top: 8px; border-top: 1px solid var(--line); }
.shift-row h4 { margin: 0; font-size: .875rem; }
.shift-row ul { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; }
.shift-row li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(2ch, auto); align-items: center; gap: 8px; }
.shift-row strong { text-align: right; font-size: .75rem; line-height: 1; }

.directory-heading { padding-bottom: 14px; }
.territory-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 255px), 1fr));
  gap: 14px;
  padding: 0 19px 19px;
}
.territory-card { display: flex; flex-direction: column; overflow: hidden; }
.territory-map {
  position: relative;
  height: 158px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}
.territory-map-link {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  background: var(--surface-muted);
}
.territory-map-link[hidden], .territory-map-link:not([hidden]) + .map-placeholder { display: none; }
.territory-map-link:focus-visible { outline-offset: -3px; }
.territory-map-link img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.map-link-label {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--control-line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--brand-hover);
  font-size: .78rem;
  font-weight: 800;
}
.map-link-label .ui-icon { width: 15px; height: 15px; }
.territory-map-link:hover .map-link-label { background: var(--brand-soft); }
.map-placeholder { display: flex; justify-content: center; align-items: center; gap: 7px; height: 100%; color: var(--muted); font-size: .875rem; }

.territory-card-content { display: flex; flex: 1; flex-direction: column; padding: 14px; }
.territory-card-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 6px; }
.territory-card-heading h3 { margin: 0; color: var(--ink); font-size: 1rem; font-weight: 800; overflow-wrap: anywhere; }
.territory-card-heading .territory-number { min-width: 29px; padding: 2px 4px; }
.territory-card-heading p { margin: 5px 0 0; color: var(--muted); font-size: .8125rem; }
.territory-card-heading .territory-status { text-align: right; }
.territory-card-heading .status-note { max-width: 86px; white-space: normal; line-height: 1.3; }
.card-facts { display: grid; gap: 3px; margin: 12px 0; font-size: .8125rem; }
.card-facts div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; }
.card-facts dt, .card-stats dt { color: var(--muted); }
.card-facts dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.card-stats { display: grid; grid-template-columns: 1fr 1.2fr; gap: 8px; margin: 0; }
.card-stats div { display: grid; align-content: space-between; gap: 5px; padding: 8px; border-radius: 7px; background: var(--surface-muted); }
.card-stats dt { font-size: .77rem; line-height: 1.3; }
.card-stats dd { margin: 0; font-weight: 800; font-size: .93rem; line-height: 1.3; }
.card-stats dd span { color: var(--muted); font-size: .75rem; }
.card-history { margin-top: 14px; }
.card-history h4 { margin: 0 0 3px; font-size: .875rem; }
.card-history ol { margin: 0; padding: 0; list-style: none; }
.card-history li { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 5px 0; }
.card-history li + li { border-top: 1px solid var(--line); }
.card-history strong { display: block; font-size: .8125rem; overflow-wrap: anywhere; }
.card-history time, .card-history p { color: var(--muted); font-size: .78rem; }
.card-history p { margin: 6px 0 0; }
.gallery-empty { margin: 14px 0 20px; color: var(--muted); text-align: center; }
@media (max-width: 980px) {
  .activity-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .activity-charts { grid-template-columns: 1fr; }
  .activity-section { margin-top: 22px; }
  .chart-panel { padding-inline: 13px; }
  .territory-gallery { padding-inline: 12px; }
}
/* S-13 report: screen preview and print (@page A4). */

.report-controls { margin-bottom: 16px; }
.report-controls .filter-bar { padding: 15px 19px; }
.report-controls label { display: flex; flex-direction: column; gap: 4px; font-size: .875rem; font-weight: 700; }
.report-controls label:nth-child(2) { flex: 1 1 220px; max-width: 360px; }
.report-preview { overflow-x: auto; }

.s13-page {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto 16px;
  padding: 12mm;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--panel-shadow);
  color: #000;
  font-family: "Helvetica Neue", Arial, sans-serif;
}

.s13-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 8px; }
.s13-head h1 { font-size: 1.35rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin: 0; }
.s13-code { font-size: 0.9rem; font-weight: 700; }
.s13-year { font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; }
.underline { border-bottom: 1px solid #000; display: inline-block; min-width: 90px; padding: 0 8px; }

.s13-table {
  width: 100%;
  border-collapse: collapse;
  border: 2px solid #000;
  font-size: 11px;
  text-align: center;
  table-layout: fixed;
}

.s13-table th, .s13-table td { border: 1px solid #000; padding: 3px 2px; }

.s13-table thead th {
  font-size: 11px;
  vertical-align: middle;
}
.s13-table th.sub { font-weight: 400; }

.s13-table .c-num { width: 9%; }
.s13-table .c-last { width: 11%; }
.s13-table td.assignee { font-weight: 500; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s13-table td.num { font-weight: 700; font-size: 13px; }
.s13-table td.d { height: 18px; }

.footnote { font-size: 9px; margin-top: 6px; color: #000; }

@media print {
  @page { size: A4 portrait; margin: 10mm; }
  body { background: #fff; margin: 0; }
  .no-print { display: none !important; }
  .report-preview { overflow: visible; }
  .s13-page {
    width: auto;
    min-height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    page-break-after: always;
    break-after: page;
  }
  .s13-page:last-child { page-break-after: auto; break-after: auto; }
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font: 1rem/1.5 system-ui, sans-serif; }
main { width: min(100% - 2rem, 1250px); margin: 2rem auto; }
.site-navigation { display: flex; align-items: center; flex-wrap: wrap; gap: .85rem; background: var(--surface); padding: .8rem max(1rem, calc((100% - 1250px)/2)); border-bottom: 1px solid var(--line); }
.site-navigation a { color: var(--brand); text-decoration: none; font-weight: 600; }
.site-navigation form { margin-left: auto; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
form label { display: flex; flex-direction: column; gap: .25rem; }
input, select, textarea { min-width: 0; border: 1px solid var(--control-line); border-radius: .45rem; padding: .45rem .6rem; background: var(--surface); color: var(--ink); }
.form-stack { display: grid; gap: .85rem; }
.form-stack button { justify-self: start; }
.login-panel { max-width: 28rem; margin: 8vh auto; }
h1 { line-height: 1.15; }
.content-panel { padding: 1rem; }
.notice { padding: .65rem; background: var(--amber-soft); color: var(--amber); }
.table-scroll { overflow: auto; }
.record-table { border-collapse: collapse; width: 100%; }
.record-table th, .record-table td { padding: .5rem; text-align: left; border-bottom: 1px solid var(--line); }
.record-table th { white-space: nowrap; }
.action-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
@media print { body { background: white; } main { width: auto; margin: 0; } }
