:root {
  color-scheme: light;
  --page: #f3f6f5;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --surface-strong: #eef4f2;
  --text: #17211f;
  --text-soft: #485652;
  --muted: #6a7773;
  --border: #d9e3df;
  --border-strong: #c4d2cd;
  --brand: #155e52;
  --brand-strong: #0d453d;
  --brand-deep: #082f2b;
  --brand-soft: #e1f0eb;
  --accent: #d7a72d;
  --accent-soft: #fbf3d8;
  --success: #18764f;
  --success-soft: #e5f4ec;
  --warning: #9a6505;
  --warning-soft: #fff3d4;
  --danger: #b53737;
  --danger-soft: #fdeaea;
  --info: #2d6598;
  --info-soft: #e8f1fa;
  --shadow-sm: 0 1px 2px rgb(9 49 43 / 6%);
  --shadow: 0 8px 24px rgb(9 49 43 / 8%);
  --radius-sm: 7px;
  --radius: 11px;
  --sidebar-width: 220px;
  --content-max: 1580px;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-synthesis: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 92% 0, rgb(21 94 82 / 6%), transparent 24rem),
    var(--page);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
}

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

img,
svg {
  max-width: 100%;
}

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--text);
  line-height: 1.2;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  letter-spacing: -0.025em;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

h3 {
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-width);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 12px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 4%), transparent 12rem),
    var(--brand-deep);
  border-right: 1px solid rgb(255 255 255 / 8%);
  color: #f3fbf8;
  scrollbar-width: thin;
  scrollbar-color: rgb(255 255 255 / 24%) transparent;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0 3px 16px;
  padding: 4px 2px 14px;
  border-bottom: 1px solid rgb(255 255 255 / 12%);
}

.brand-mark {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 11px;
  background: linear-gradient(145deg, var(--brand), #207b69);
  box-shadow: 0 5px 18px rgb(0 0 0 / 18%);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand > div {
  min-width: 0;
}

.brand strong,
.brand span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  color: #fff;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.brand span {
  margin-top: 2px;
  color: rgb(235 250 245 / 68%);
  font-size: 0.78rem;
}

.sidebar nav {
  display: grid;
  gap: 3px;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: rgb(239 251 247 / 78%);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.nav-link:hover,
.nav-link.active,
.nav-link[aria-current="page"] {
  border-color: rgb(255 255 255 / 10%);
  background: rgb(255 255 255 / 11%);
  color: #fff;
}

.nav-link.active::before,
.nav-link[aria-current="page"]::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  content: "";
}

.main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid rgb(196 210 205 / 85%);
  background: rgb(255 255 255 / 92%);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.user-box {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.user-box > span:not(.status),
.user-box > a {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-box > a {
  color: inherit;
  text-decoration: none;
}

.user-box > a:hover,
.user-box > a:focus-visible {
  text-decoration: underline;
}

.container {
  width: min(100%, var(--content-max));
  margin: 0 auto;
  padding: 16px 18px 28px;
}

.replica-notice {
  width: min(calc(100% - 36px), calc(var(--content-max) - 36px));
  margin: 14px auto 0;
  padding: 10px 14px;
  border: 1px solid #d9a72e;
  border-radius: var(--radius);
  background: var(--warning-soft);
  color: #604607;
  box-shadow: var(--shadow-sm);
}

.panel,
.metric {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel {
  margin-bottom: 14px;
  padding: 14px;
}

.panel > :last-child {
  margin-bottom: 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: -2px 0 12px;
}

.panel-head > div:first-child {
  min-width: 0;
}

.panel-head h2,
.panel-head p {
  margin-bottom: 0;
}

.panel-head p {
  margin-top: 4px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 1px rgb(9 49 43 / 4%);
  color: var(--text-soft);
  cursor: pointer;
  font-weight: 650;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 80ms ease;
}

.button:hover {
  border-color: #9fb5ad;
  background: var(--surface-soft);
  color: var(--brand-strong);
  box-shadow: 0 3px 10px rgb(9 49 43 / 8%);
}

.button:active {
  transform: translateY(1px);
}

.button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.button.primary:hover {
  border-color: var(--brand-strong);
  background: var(--brand-strong);
  color: #fff;
}

.button.danger {
  border-color: #d78b8b;
  background: var(--surface);
  color: var(--danger);
}

.button.danger:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: #8f2525;
}

.button.compact {
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 0.78rem;
}

.button[disabled],
.button[aria-disabled="true"],
button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  filter: grayscale(18%);
  pointer-events: none;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  position: relative;
  min-width: 0;
  min-height: 88px;
  overflow: hidden;
  padding: 13px 14px 12px;
  background:
    linear-gradient(135deg, rgb(21 94 82 / 5%), transparent 65%),
    var(--surface);
}

.metric-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.metric-link:hover {
  border-color: rgb(21 94 82 / 42%);
  box-shadow: 0 8px 20px rgb(18 53 47 / 12%);
  color: inherit;
  transform: translateY(-2px);
}

.metric-link:focus-visible {
  border-color: var(--brand);
  outline: 3px solid rgb(21 94 82 / 20%);
  outline-offset: 2px;
}

.metric-link small {
  color: var(--brand-strong);
  font-weight: 700;
}

.metric-link small b {
  display: inline-block;
  margin-left: 2px;
  transition: transform 140ms ease;
}

.metric-link:hover small b {
  transform: translateX(3px);
}

.metric::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--brand);
  content: "";
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric span {
  margin-bottom: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(1.25rem, 2.2vw, 1.72rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric small {
  margin-top: 5px;
  font-size: 0.76rem;
}

.compact-metrics {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.section-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin: 0 0 14px;
  padding: 2px 1px 7px;
  scrollbar-width: thin;
}

.section-tab {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
}

.section-tab:hover,
.section-tab:focus-visible {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.section-tab.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.anchor-target {
  scroll-margin-top: 86px;
}

.anchor-target:target {
  padding: 8px;
  border-radius: 8px;
  outline: 3px solid rgb(21 94 82 / 18%);
}

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

.error,
.warning,
.success,
.alert {
  margin: 0 0 12px;
  padding: 9px 11px;
  border: 1px solid;
  border-radius: 8px;
  font-size: 0.86rem;
}

.error,
.alert--danger {
  border-color: #efb4b4;
  background: var(--danger-soft);
  color: #8f2525;
}

.warning,
.alert--warning {
  border-color: #edcf80;
  background: var(--warning-soft);
  color: #775006;
}

.success,
.alert--success {
  border-color: #a8d8bf;
  background: var(--success-soft);
  color: #145b3e;
}

.alert--info {
  border-color: #b7cee3;
  background: var(--info-soft);
  color: #24557f;
}

.error a,
.warning a,
.success a,
.alert a {
  color: inherit;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 11px 14px;
}

.form-grid .wide,
.form-grid > .wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: var(--text-soft);
  font-size: 0.79rem;
  font-weight: 700;
}

label small,
.field-help {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 400;
  line-height: 1.35;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  outline: 0;
  background: #fff;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 400;
  transition: border-color 130ms ease, box-shadow 130ms ease, background-color 130ms ease;
}

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

input::placeholder,
textarea::placeholder {
  color: #96a39f;
  opacity: 1;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aabdb6;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgb(21 94 82 / 13%);
}

input[readonly],
textarea[readonly],
select:disabled {
  background: var(--surface-strong);
  color: var(--text-soft);
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--brand);
}

label:has(> input[type="checkbox"]),
label:has(> input[type="radio"]),
.check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-soft);
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
}

legend {
  padding: 0 6px;
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 750;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

table {
  width: 100%;
  border-spacing: 0;
  border-collapse: separate;
  font-variant-numeric: tabular-nums;
}

th,
td {
  min-width: 0;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f0f5f3;
  color: #4f5d59;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  color: var(--text-soft);
  font-size: 0.83rem;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #f8fbfa;
}

td a {
  font-weight: 650;
}

td.num,
th.num,
.num {
  text-align: right;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 23px;
  max-width: 100%;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text-soft);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.015em;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.status::before {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  opacity: 0.7;
}

.status--success,
.status--approved,
.status--closed,
.status--paid {
  border-color: #add8c1;
  background: var(--success-soft);
  color: var(--success);
}

.status--warning,
.status--pending,
.status--review {
  border-color: #e9cd83;
  background: var(--warning-soft);
  color: var(--warning);
}

.status--danger,
.status--error,
.status--overdue,
.status--blocked {
  border-color: #efb4b4;
  background: var(--danger-soft);
  color: var(--danger);
}

.status--info,
.status--collecting {
  border-color: #b7cee3;
  background: var(--info-soft);
  color: var(--info);
}

.status--neutral,
.status--draft {
  border-color: var(--border-strong);
  background: var(--surface-strong);
  color: var(--muted);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 9px;
}

.info-grid > div {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
}

.info-grid span,
.info-grid strong,
.info-grid small {
  display: block;
}

.info-grid span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.info-grid strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.9rem;
}

.info-grid small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.evidence-photo-link {
  display: block;
  width: 92px;
  height: 72px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
}

.evidence-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.evidence-guidance ol {
  margin: 8px 0 10px;
  padding-left: 22px;
}

.evidence-guidance li + li {
  margin-top: 5px;
}

code {
  overflow-wrap: anywhere;
  color: var(--brand-strong);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.76rem;
}

input[type="file"] {
  min-height: 44px;
  padding: 8px;
  background: var(--surface-soft);
}

.totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.totals > span,
.totals > div {
  display: flex;
  min-width: 0;
  min-height: 58px;
  flex-direction: column;
  justify-content: center;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.totals strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

details {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

details + details {
  margin-top: 7px;
}

summary {
  position: relative;
  min-height: 38px;
  padding: 9px 36px 9px 11px;
  color: var(--text-soft);
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  position: absolute;
  top: 50%;
  right: 13px;
  color: var(--brand);
  content: "+";
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1;
  transform: translateY(-50%);
}

details[open] > summary {
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

details[open] > summary::after {
  content: "−";
}

details > :not(summary) {
  margin-right: 11px;
  margin-left: 11px;
}

details > :last-child {
  margin-bottom: 11px;
}

.hierarchy {
  display: grid;
  gap: 8px;
}

.hierarchy-item,
.hierarchy-node {
  position: relative;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.hierarchy-title,
.hierarchy-node > strong:first-child {
  color: var(--text);
  font-weight: 750;
}

.hierarchy-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

.hierarchy-children {
  display: grid;
  gap: 7px;
  margin: 8px 0 0 18px;
  padding-left: 14px;
  border-left: 2px solid var(--brand-soft);
}

.hierarchy-children > .hierarchy-item::before,
.hierarchy-children > .hierarchy-node::before {
  position: absolute;
  top: 18px;
  left: -16px;
  width: 14px;
  border-top: 2px solid var(--brand-soft);
  content: "";
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 18% 18%, rgb(215 167 45 / 18%), transparent 20rem),
    radial-gradient(circle at 82% 76%, rgb(47 129 111 / 20%), transparent 26rem),
    var(--brand-deep);
}

.login-card {
  width: min(430px, 100%);
  padding: 22px;
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 15px;
  background: rgb(255 255 255 / 97%);
  box-shadow: 0 24px 70px rgb(0 0 0 / 28%);
}

.login-card .brand {
  margin: 0 0 18px;
  border-color: var(--border);
}

.login-card .brand strong {
  color: var(--text);
}

.login-card .brand span {
  color: var(--muted);
}

.login-card .form-grid {
  grid-template-columns: minmax(0, 1fr);
}

.login-card .button.primary {
  width: 100%;
}

.empty-state {
  padding: 26px 16px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text-soft);
}

.inline-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 7px;
}

.inline-form label {
  min-width: 130px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

:focus-visible {
  outline: 3px solid rgb(215 167 45 / 62%);
  outline-offset: 2px;
}

@media (max-width: 1280px) and (min-width: 981px) {
  :root {
    --sidebar-width: 190px;
  }

  .sidebar {
    padding-right: 9px;
    padding-left: 9px;
  }

  .brand {
    gap: 8px;
  }

  .nav-link {
    padding-right: 8px;
    padding-left: 8px;
    font-size: 0.84rem;
  }

  .container {
    padding: 12px;
  }
}

@media (max-width: 980px) {
  .sidebar {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    padding: 10px 12px;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid rgb(255 255 255 / 10%);
  }

  .brand {
    margin: 0 0 8px;
    padding: 0 0 8px;
  }

  .brand-mark {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }

  .sidebar nav {
    display: flex;
    max-width: 100%;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .nav-link {
    min-height: 32px;
    flex: 0 0 auto;
    padding: 6px 10px;
    white-space: nowrap;
  }

  .nav-link.active::before,
  .nav-link[aria-current="page"]::before {
    inset: auto 9px 1px;
    width: auto;
    height: 2px;
    border-radius: 2px 2px 0 0;
  }

  .main {
    margin-left: 0;
  }

  .topbar {
    min-height: 56px;
    padding: 9px 12px;
  }

  .container {
    padding: 12px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel {
    padding: 12px;
  }

  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 13.5px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .user-box {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .user-box > span:not(.status),
  .user-box > a {
    max-width: 180px;
  }

  .container {
    padding: 10px;
  }

  .metrics,
  .form-grid,
  .info-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .metric {
    min-height: 78px;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
  }

  .panel-head .actions {
    justify-content: flex-start;
  }

  .actions {
    justify-content: flex-start;
  }

  .actions > .button {
    flex: 1 1 auto;
  }

  .inline-form {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
  }

  .inline-form label {
    min-width: 0;
  }

  table {
    min-width: 620px;
  }

  th,
  td {
    padding: 8px 9px;
  }

  .totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hierarchy-children {
    margin-left: 8px;
    padding-left: 10px;
  }

  .hierarchy-children > .hierarchy-item::before,
  .hierarchy-children > .hierarchy-node::before {
    left: -12px;
    width: 10px;
  }

  .login-shell {
    padding: 14px;
  }

  .login-card {
    padding: 17px;
  }
}

@media (max-width: 420px) {
  .totals {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar .button.compact {
    min-height: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
  }

  .sidebar,
  .topbar,
  .actions,
  .button,
  .no-print {
    display: none !important;
  }

  .main {
    margin-left: 0;
  }

  .container {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .panel,
  .metric,
  .table-wrap {
    break-inside: avoid;
    box-shadow: none;
  }

  th {
    position: static;
  }
}
