:root {
  /* Brand */
  --brand-600: #6f896d;
  --brand-700: #3f5b49;
  --brand-050: #eef3ef;

  /* Neutrals */
  --bg: #f6f7f6;
  --surface: #ffffff;
  --surface-2: #f1f4f1;
  --border: #d7ded6;
  --border-strong: #c0c9bf;
  --text: #121612;
  --muted: #5b615b;

  /* Focus */
  --focus-bg: #ffdd00;
  --focus-ring: #0b0c0c;

  /* Semantic */
  --info-700: #1d4ed8;
  --info-050: #eff6ff;
  --ok-700: #166534;
  --ok-050: #ecfdf5;
  --warn-800: #92400e;
  --warn-050: #fffbeb;
  --bad-700: #b42318;
  --bad-050: #fef2f2;
  --neutral-700: #374151;
  --neutral-050: #f3f4f6;

  /* Backward-compatible aliases */
  --brand: var(--brand-600);
  --bg-2: var(--surface-2);
  --card: var(--surface);
  --shadow-sm: 0 1px 2px rgba(16, 24, 20, 0.06);
  --shadow: 0 6px 18px rgba(16, 24, 20, 0.08);
  --shadow-lg: 0 16px 36px rgba(16, 24, 20, 0.14);
  --success: var(--ok-700);
  --warning: var(--warn-800);
  --danger: var(--bad-700);
  --info: var(--info-700);
  --sidebar-width: 260px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
}

@font-face {
  font-family: "Poppins";
  src: url("/static/fonts/poppins/Poppins-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("/static/fonts/poppins/Poppins-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("/static/fonts/poppins/Poppins-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 17px; }
body.fs-s { font-size: 15px; }
body.fs-m { font-size: 17px; }
body.fs-l { font-size: 19px; }
a { color: var(--brand); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

h1, h2, h3 { margin: 0 0 8px; font-weight: 600; color: var(--text); }
p { margin: 0 0 10px; color: var(--text); }

:focus-visible {
  outline: 3px solid var(--focus-bg);
  outline-offset: 1px;
  box-shadow: 0 0 0 2px var(--focus-ring);
  border-radius: 6px;
}

.muted { color: var(--muted); }
.right { text-align: right; }

.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.app-content { padding: 28px; max-width: 1600px; width: 100%; margin: 0 auto; animation: fadeIn 0.25s ease; }
.app-content--wide { max-width: 1900px; }

.auth .sidebar,
.auth .topbar,
.auth .sidebar__overlay,
.auth .sidebar-toggle { display: none !important; }
.auth .app-shell { display: block; min-height: 100vh; }
.auth .app-main { min-height: 100vh; }
.auth .app-content { max-width: none; }

.public .sidebar,
.public .topbar,
.public .sidebar__overlay,
.public .sidebar-toggle { display: none !important; }
.public .app-shell { display: block; min-height: 100vh; }
.public .app-main { min-height: 100vh; }
.public .app-content { max-width: 1100px; }

.auth-content { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-content .card { width: 420px; max-width: 100%; }
.auth-card { width: 420px; max-width: 100%; margin: 0 auto; text-align: left; }
.auth-logo { height: 56px; margin: 0 auto 12px; }
.auth-title { text-align: center; margin-bottom: 6px; }
.auth-subtitle { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); margin-top: 10px; }

.sidebar-toggle { position: absolute; opacity: 0; pointer-events: none; }

.sidebar { width: var(--sidebar-width); background: var(--brand-700); border-right: 2px solid rgba(255, 255, 255, 0.18); padding: 18px 14px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; z-index: 40; }
.sidebar__brand { display: flex; align-items: center; justify-content: center; padding: 6px 8px; }
.sidebar__logo { display: inline-flex; align-items: center; justify-content: center; padding: 6px 10px; background: #fff; border-radius: 12px; box-shadow: var(--shadow-sm); }
.sidebar__logo img { height: 52px; }
.sidebar__nav { display: flex; flex-direction: column; gap: 16px; overflow: auto; padding-right: 4px; color: #fff; }
.sidebar__section { display: flex; flex-direction: column; gap: 6px; }
.sidebar__heading { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(244, 247, 244, 0.74); padding: 0 10px; }
.sidebar__link { padding: 9px 12px; border-radius: 10px; color: #f4f7f4; font-weight: 600; display: flex; align-items: center; gap: 8px; border-left: 4px solid transparent; }
.sidebar__link:hover { background: rgba(111, 137, 109, 0.14); color: #f4f7f4; text-decoration: none; }
.sidebar__link.active { background: rgba(111, 137, 109, 0.18); border-left-color: var(--brand-600); color: #f4f7f4; text-decoration: none; }

.sidebar__overlay { display: none; }

.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, 0.98); backdrop-filter: blur(6px); border-bottom: 2px solid var(--border); padding: 12px 20px; display: flex; align-items: center; gap: 16px; }
.topbar__left { display: flex; align-items: center; gap: 12px; }
.topbar__title { font-size: 14px; font-weight: 600; color: var(--muted); }
.topbar__menu { display: none; padding: 8px 10px; border-radius: 8px; border: 2px solid var(--border); background: #fff; cursor: pointer; font-weight: 600; }
.topbar__search { flex: 1; max-width: 520px; position: relative; }
.topbar__search input { width: 100%; padding: 10px 14px; border-radius: 999px; border: 2px solid var(--border); background: #fff; font-size: 13px; }
.search-suggest { position: absolute; top: 46px; left: 0; right: 0; background: #fff; border: 2px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 20; }
.search-suggest[hidden] { display: none; }
.search-suggest__group { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.search-suggest__item { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 10px; color: var(--text); }
.search-suggest__item:hover { background: #f3f7f3; text-decoration: none; }
.search-suggest__title { font-weight: 600; font-size: 13px; }
.search-suggest__meta { font-size: 11px; color: var(--muted); }
.search-suggest__empty { padding: 8px 10px; font-size: 12px; color: var(--muted); }
.topbar__actions { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.topbar-icon { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--border); background: #fff; color: var(--text); display: inline-flex; align-items: center; justify-content: center; position: relative; }
.topbar-icon__img { width: 18px; height: 18px; display: block; }
.notification-badge { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; border-radius: 999px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; background: var(--bad-700); color: #fff; border: 1px solid #fff; }
.notification-badge[hidden] { display: none; }

.dropdown { position: relative; }
.dropdown summary { list-style: none; cursor: pointer; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown__menu { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 2px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 180px; padding: 8px; display: none; z-index: 100; font-size: 14px; font-family: inherit; }
.dropdown[open] .dropdown__menu { display: block; }
.dropdown__menu a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); font-weight: 600; font-size: 14px; font-family: inherit; }
.dropdown__menu a:hover { background: #f0f5f1; text-decoration: none; }
.dropdown__header { padding: 8px 10px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.dropdown--right .dropdown__menu { right: 0; }
.dropdown__menu form { margin: 0; }
.dropdown__button { width: 100%; text-align: left; border: none; background: none; padding: 8px 10px; border-radius: 8px; font-weight: 600; color: var(--text); cursor: pointer; font-size: 14px; font-family: inherit; line-height: 1.2; }
.dropdown__button:hover { background: #f0f5f1; }
.dropdown__button.is-active { background: var(--surface-2); border: 2px solid var(--border); }
.dropdown__button--danger { color: var(--danger); }
.dropdown__menu--notifications { width: min(420px, 90vw); min-width: min(360px, 90vw); padding: 0; overflow: hidden; }

.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.u-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; padding: 0; }

.notifications { display: flex; flex-direction: column; max-height: 430px; }
.notifications__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 0; }
.notifications__mark[disabled] { opacity: 0.6; cursor: not-allowed; }
.notifications__list { max-height: 360px; overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.notifications__item { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 10px; color: var(--text); border: 2px solid transparent; }
.notifications__item:hover { background: var(--surface-2); text-decoration: none; border-color: var(--border); }
.notifications__content { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notifications__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-700); margin-top: 6px; flex-shrink: 0; }
.notifications__dot.is-read { background: var(--border); }
.notifications__title { font-size: 13px; font-weight: 600; color: var(--text); }
.notifications__body { font-size: 12px; color: var(--muted); line-height: 1.3; }
.notifications__meta { font-size: 11px; color: var(--muted); }
.notifications__empty,
.notifications__loading { padding: 16px; color: var(--muted); font-size: 13px; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; padding: 14px 16px; border: 2px solid var(--border); border-radius: var(--radius); background: linear-gradient(135deg, #ffffff 0%, #f1f6f1 100%); box-shadow: var(--shadow-sm); }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs span { color: var(--text); font-weight: 600; }
.breadcrumbs a + a::before,
.breadcrumbs a + span::before,
.breadcrumbs span + a::before,
.breadcrumbs span + span::before {
  content: "/";
  margin-right: 6px;
  color: var(--border-strong);
}
.page-header__title h1 { margin: 0; font-size: 28px; display: flex; align-items: center; gap: 10px; }
.page-header__subtitle { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.page-header__back { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--brand-700); text-decoration: none; }
.page-header__back::before { content: "<"; font-size: 12px; }
.page-header__back:hover { text-decoration: underline; }
.page-header__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.page-filters { margin-bottom: 16px; }
.page-filters--sticky {
  position: sticky;
  top: 72px;
  z-index: 18;
}

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; background: var(--surface-2); border: 2px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow-sm); }
.filters--mb10 { margin-bottom: 10px; }
.list-action-rail {
  position: sticky;
  top: 72px;
  z-index: 16;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
}
.filters .field { display: flex; flex-direction: column; gap: 6px; }
.filters__actions { display: flex; gap: 8px; align-items: center; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters--map .field { min-width: 180px; }
.filters--map .field.field--wide { min-width: 240px; }
.filters__row { display: flex; flex-wrap: wrap; gap: 12px; width: 100%; align-items: flex-end; }
.filters__row + .filters__row { border-top: 1px dashed var(--border); padding-top: 12px; margin-top: 4px; }

.btn { border: 1px solid var(--brand-700); padding: 10px 14px; min-height: 38px; background: var(--brand-700); cursor: pointer; text-decoration: none; color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; font-weight: 600; line-height: 1.1; transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--brand-700); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.secondary.is-active { background: var(--surface-2); border-color: var(--brand-700); color: var(--brand-700); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn.subtle { background: #f2f4f2; border-color: #e3e7e3; color: #2a342f; }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { width: 34px; min-width: 34px; padding: 6px 0; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
summary.btn { list-style: none; }
summary.btn::-webkit-details-marker { display: none; }

.link { color: var(--brand); font-weight: 600; text-decoration: none; cursor: pointer; }
.link:hover { text-decoration: underline; }

.card { border: 2px solid var(--border); background: var(--surface); padding: 18px; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card--clickable { transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.card--clickable:hover { border-color: var(--brand-600); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08); transform: translateY(-1px); }
.card + .card { margin-top: 14px; }
.card__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.card__titles { display: flex; flex-direction: column; gap: 4px; }
.card__title { margin: 0; font-size: 18px; font-weight: 600; }
.card__subtitle { margin: 0; font-size: 12px; color: var(--muted); }
.card__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card__body { display: block; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.quick-card { background: var(--brand); border: 2px solid var(--brand); border-radius: 12px; padding: 16px; text-align: center; text-decoration: none; color: #fff; font-weight: 700; box-shadow: var(--shadow-sm); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.quick-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.app-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.app-tile { background: linear-gradient(150deg, #ffffff 0%, #edf4ed 100%); border: 2px solid #c9d6cb; border-radius: 18px; padding: 16px; text-align: center; text-decoration: none; color: #102010; font-weight: 700; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; aspect-ratio: 1 / 1; }
.app-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand); text-decoration: none; }
.app-icon { width: 52px; height: 52px; border-radius: 16px; background: #ffffff; color: var(--brand); border: 2px solid #bfd0c2; display: flex; align-items: center; justify-content: center; font-weight: 700; letter-spacing: 0.5px; }
.app-icon svg { width: 24px; height: 24px; stroke: var(--brand); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

label { display: block; margin: 8px 0 6px; font-weight: 600; color: #2a332f; font-size: 14px; }
input, select, textarea { width: 100%; padding: 10px 12px; box-sizing: border-box; border: 2px solid var(--border); border-radius: 10px; font-family: inherit; background: #fff; font-size: 15px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-700); box-shadow: 0 0 0 2px rgba(63, 91, 73, 0.2); }
textarea { min-height: 90px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.form-section { margin-top: 12px; }
.help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row__label { margin: 0; }
.form-row__control { display: flex; flex-direction: column; gap: 6px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-error { font-size: 12px; color: var(--danger); display: none; }
.form-error.is-visible { display: block; }
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(180, 35, 24, 0.18);
}

.table-wrap { border: 2px solid var(--border); border-radius: var(--radius); overflow-x: auto; overflow-y: visible; background: var(--surface); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td, th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 1; text-transform: uppercase; font-size: 12px; letter-spacing: 0.05em; color: var(--muted); }
.table tbody tr:nth-child(even) { background: #f8faf8; }
.table tbody tr:hover { background: rgba(111, 136, 109, 0.08); }
.table tbody tr[data-href] { cursor: pointer; }
.table td.money, .table th.money, .table td.right, .table th.right { text-align: right; font-variant-numeric: tabular-nums; }
.table-group td { background: var(--surface-2); font-weight: 700; text-transform: uppercase; font-size: 12px; letter-spacing: 0.05em; color: #4a5a52; }
.table-total td { border-top: 1px solid var(--border); background: #f6faf6; }

/* Help page */
.help-hero { display: grid; gap: 16px; }
.help-kicker { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.help-figures { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.help-figure-card { display: flex; gap: 12px; align-items: center; padding: 12px; border: 2px solid var(--border); border-radius: 12px; background: #ffffff; box-shadow: var(--shadow-sm); }
.help-figure-card__icon { min-width: 38px; height: 38px; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 12px; letter-spacing: 0.06em; }
.help-figure-card__title { font-weight: 700; }
.help-figure-card__desc { font-size: 13px; color: var(--muted); }

.help-steps { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.help-step { display: flex; gap: 12px; align-items: center; padding: 12px; border: 2px solid var(--border); border-radius: 10px; background: #f8fbf8; text-decoration: none; color: inherit; }
.help-step:hover { background: #f1f6f1; }
.help-step__num { width: 28px; height: 28px; border-radius: 999px; background: var(--brand); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.help-step__title { font-weight: 700; }
.help-step__desc { font-size: 13px; color: var(--muted); }
.help-flow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.help-node { padding: 8px 12px; border: 2px solid var(--border); border-radius: 999px; background: #fff; font-weight: 600; font-size: 13px; }
.help-arrow { color: var(--muted); font-weight: 700; }
.help-caption { margin-top: 10px; }
.help-figure__title { font-weight: 700; font-size: 16px; }
.help-figure__body { margin-top: 6px; }
.help-figure__caption { margin-top: 10px; font-size: 13px; color: var(--muted); }
.help-task-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.help-list { margin: 0; padding-left: 18px; }
.help-list--spaced li + li { margin-top: 6px; }
.help-nav-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.help-nav-item {
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.help-nav-item:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.help-nav-item__title { font-weight: 700; }
.help-nav-item__desc { font-size: 13px; color: var(--muted); margin-top: 4px; }
.table--compact th, .table--compact td { padding: 10px 12px; }
.actions-cell { min-width: 140px; position: relative; }

.chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}
.chip--info,
.badge--info {
  background: var(--info-050);
  color: var(--info-700);
  border-color: #c6d6fb;
}
.chip--ok,
.badge--ok,
.chip--success,
.badge--success {
  background: var(--ok-050);
  color: var(--ok-700);
  border-color: #b6e4cf;
}
.chip--warn,
.badge--warn,
.chip--warning,
.badge--warning {
  background: var(--warn-050);
  color: var(--warn-800);
  border-color: #f3d9a4;
}
.chip--bad,
.badge--bad,
.chip--danger,
.badge--danger {
  background: var(--bad-050);
  color: var(--bad-700);
  border-color: #f0c3bf;
}
.chip--neutral,
.badge--neutral {
  background: var(--neutral-050);
  color: var(--neutral-700);
  border-color: #d4d8de;
}

.select-badge {
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
  background: var(--info-050);
  color: var(--info-700);
  border: 1px solid #c6d6fb;
}

.tabs { display: flex; gap: 8px; border-bottom: 2px solid var(--border); margin: 16px 0; flex-wrap: wrap; }
.tab { padding: 8px 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; }
.tab.active { color: var(--brand); border-color: var(--brand); }
.section { margin-bottom: 24px; }
.stack { display: flex; flex-direction: column; gap: 24px; }

.summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary-card { background: linear-gradient(145deg, #ffffff 0%, #f2f7f2 100%); border: 2px solid #c9d6cb; border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm); border-left: 4px solid var(--brand); }
.summary-card--link { display: block; color: inherit; text-decoration: none; transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease; }
.summary-card--link:hover { box-shadow: var(--shadow); border-color: var(--brand); transform: translateY(-1px); }
.summary-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.summary-value { font-size: 20px; font-weight: 700; margin-top: 6px; }
.summary-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }
.calendar-cell--today { box-shadow: 0 0 0 2px rgba(111, 137, 109, 0.35); background: #f2f7f2 !important; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--card); border: 2px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm); }
.stat-card--link { display: block; color: inherit; text-decoration: none; transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease; }
.stat-card--link:hover { box-shadow: var(--shadow); border-color: var(--brand); transform: translateY(-1px); }
.stat-card--brand { border-left: 4px solid var(--brand); }
.stat-card--neutral { border-left: 4px solid var(--neutral-700); }
.stat-card--info { border-left: 4px solid var(--info); }
.stat-card--success { border-left: 4px solid var(--success); }
.stat-card--warning { border-left: 4px solid var(--warning); }
.stat-card--danger { border-left: 4px solid var(--danger); }
.stat-card--active { border-color: var(--brand); background: var(--brand); color: #fff; box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card--active .stat-label { font-weight: 700; color: #fff; }
.stat-card--active .stat-value { color: #fff; }
.stat-card--active .stat-sub { color: rgba(255, 255, 255, 0.82); }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stat-value { font-size: 20px; font-weight: 700; margin-top: 6px; }
.stat-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }


.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi-card { background: var(--card); border: 2px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; text-decoration: none; color: var(--text); display: block; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-card::after { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--brand); }
.kpi-card--info::after { background: var(--info); }
.kpi-card--success::after { background: var(--success); }
.kpi-card--warning::after { background: var(--warning); }
.kpi-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.kpi-value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi-bar { height: 6px; background: #e8eee8; border-radius: 999px; overflow: hidden; margin-top: 12px; }
.kpi-bar span { display: block; height: 100%; background: var(--brand); }
.kpi-card--info .kpi-bar span { background: var(--info); }
.kpi-card--success .kpi-bar span { background: var(--success); }
.kpi-card--warning .kpi-bar span { background: var(--warning); }

.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart-card { background: var(--card); border: 2px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.chart-bars { display: flex; flex-direction: column; gap: 12px; }
.chart-bar { display: grid; grid-template-columns: 90px 1fr 50px; align-items: center; gap: 10px; font-size: 13px; }
.chart-track { height: 8px; background: #e9efe9; border-radius: 999px; overflow: hidden; }
.chart-fill { height: 100%; background: var(--brand); border-radius: 999px; }
.chart-fill--info { background: var(--info); }
.chart-fill--success { background: var(--success); }
.chart-fill--danger { background: var(--danger); }
.chart-fill--accent { background: #3b7a57; }
.chip-group { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { cursor: default; }
a.chip { cursor: pointer; text-decoration: none; }
a.chip:hover { text-decoration: none; }
.chip.active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.chip--remove {
  cursor: pointer;
  text-decoration: none;
  gap: 8px;
}
.chip--remove::after {
  content: "x";
  display: inline-flex;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  background: rgba(0, 0, 0, 0.08);
}

.timeline { display: flex; flex-direction: column; gap: 14px; }
.timeline__item { display: flex; gap: 12px; }
.timeline__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); margin-top: 6px; box-shadow: 0 0 0 4px rgba(111, 137, 109, 0.15); }
.timeline__content { flex: 1; background: #fff; border: 2px solid var(--border); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow-sm); }
.timeline__title { font-weight: 600; margin-bottom: 4px; }
.timeline__body { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.timeline__meta { font-size: 12px; color: var(--muted); }

.empty-state { border: 2px dashed var(--border); border-radius: var(--radius); padding: 20px; text-align: center; color: var(--muted); background: #f9fbf9; }
.state-loading {
  display: none;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
  margin-bottom: 10px;
}
.state-loading__row {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, #f1f4f1 25%, #e7ece7 37%, #f1f4f1 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  margin-bottom: 10px;
}
.state-loading__row:last-child {
  margin-bottom: 0;
}
body.nav-loading .state-loading[data-soft="1"] {
  display: block;
}
.attachment-list { display: flex; flex-direction: column; gap: 12px; }
.attachment-card { border: 2px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; }
.attachment-preview iframe { width: 100%; height: 360px; border: 2px solid var(--border); border-radius: 8px; margin-top: 8px; }
.pdf-frame { width: 100%; height: 600px; border: 1px solid #e1e6df; border-radius: 8px; }
.pdf-frame--detail { height: min(1100px, calc(100vh - 210px)); min-height: 720px; }
.pdf-frame--files { height: min(1300px, calc(100vh - 140px)); min-height: 980px; }
.pdf-preview-actions { margin: 10px 0; display: flex; flex-wrap: wrap; gap: 8px; }

.flash { padding: 10px 12px; border-radius: 10px; border: 1px solid; font-weight: 600; }
.flash--success { background: #e8f6ef; border-color: #cbead9; color: #1f8b5a; }
.flash--error { background: #fdecec; border-color: #f5c7c7; color: #b00020; }

.tag { display: inline-block; padding: 6px 10px; background: rgba(111, 137, 109, 0.1); color: var(--brand); border-radius: 6px; font-size: 12px; font-weight: 500; }

.table-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.bulk-bar {
  position: sticky;
  bottom: 10px;
  z-index: 10;
  margin-top: 12px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.bulk-bar__text { font-weight: 600; color: var(--text); }

details.collapse { padding: 0; border: 2px solid var(--border); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); }
details.collapse > summary { list-style: none; cursor: pointer; padding: 14px 18px; font-weight: 600; display: flex; align-items: center; gap: 8px; color: var(--brand); }
details.collapse > summary::-webkit-details-marker { display: none; }
details.collapse[open] > summary { border-bottom: 2px solid var(--border); }
details.collapse .collapse-body { padding: 18px; }
details.collapse.quote-group > summary { justify-content: space-between; color: var(--text); }
details.collapse.quote-group > summary .muted { color: var(--muted); font-weight: 500; }

.quote-builder { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; overflow-anchor: none; }
.quote-builder__main { min-width: 0; }
.quote-builder__summary { min-width: 0; }
.quote-summary { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 16px; }
.quote-summary__section { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.quote-summary__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; }
.quote-summary__row strong { font-size: 14px; }
.quote-summary__total { font-size: 18px; font-weight: 700; }
.quote-summary__muted { color: var(--muted); font-size: 12px; }
.quote-group__header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.quote-group { scroll-margin-top: 96px; border: 2px solid var(--border); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-sm); margin-bottom: 12px; }
.quote-group__title { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 2px solid var(--border); font-weight: 600; color: var(--text); }
.quote-group__title .muted { color: var(--muted); font-weight: 500; }
.quote-group__body { padding: 18px; }
.quote-group__meta { color: var(--muted); font-size: 12px; }
.quote-group__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.quote-group__footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-weight: 600; }
.quote-group__empty { color: var(--muted); font-size: 12px; }
.quote-item-table td { vertical-align: middle; }

.table--sticky thead th { position: sticky; top: 0; }

.table-meta { font-size: 12px; color: var(--muted); }

.skeleton { background: linear-gradient(90deg, #f1f4f1 25%, #e7ece7 37%, #f1f4f1 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.toast { padding: 12px 14px; border-radius: 10px; border: 2px solid var(--border); background: #fff; box-shadow: var(--shadow); font-weight: 600; }
.toast--success { border-color: #cbead9; color: var(--success); }
.toast--error { border-color: #f5c7c7; color: var(--danger); }

.u-m0 { margin: 0 !important; }
.u-mt-6 { margin-top: 6px !important; }
.u-mt-8 { margin-top: 8px !important; }
.u-mt-10 { margin-top: 10px !important; }
.u-mt-12 { margin-top: 12px !important; }
.u-mt-14 { margin-top: 14px !important; }
.u-mt-24 { margin-top: 24px !important; }
.u-mb-0 { margin-bottom: 0 !important; }
.u-mb-6 { margin-bottom: 6px !important; }
.u-mb-8 { margin-bottom: 8px !important; }
.u-mb-10 { margin-bottom: 10px !important; }
.u-mb-12 { margin-bottom: 12px !important; }
.u-py-6 { padding-top: 6px; padding-bottom: 6px; }
.u-text-12 { font-size: 12px; }
.u-word-break { word-break: break-all; }
.u-inline { display: inline; }
.u-font-600 { font-weight: 600; }
.u-min-h-80 { min-height: 80px; }
.u-min-h-100 { min-height: 100px; }
.u-min-h-120 { min-height: 120px; }
.u-flex-between { display: flex; justify-content: space-between; align-items: center; }
.u-grid-7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; font-size: 12px; }

.field--w140 { min-width: 140px; }
.field--w160 { min-width: 160px; }
.field--w170 { min-width: 170px; }
.field--w180 { min-width: 180px; }
.field--w220 { min-width: 220px; }
.field--w240 { min-width: 240px; }
.field--align-end { align-self: flex-end; }

.detail-list { display: flex; flex-direction: column; gap: 6px; }
.detail-list p { margin: 0; }
.section-heading { margin: 0 0 10px; }
.section-heading--tight { margin: 0; }
.table-wrap--mt10 { margin-top: 10px; }
.table-cell--changed { font-weight: 600; }

.detail-intro { margin: 0 0 10px; color: var(--muted); }
.detail-note-split { margin: 10px 0; }
.detail-note { margin: 0; }

.dashboard-grid--spaced { margin-top: 14px; }
.calendar-shell { margin-top: 14px; }
.calendar-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.calendar-month { margin: 0; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  text-align: center;
  font-size: 12px;
  align-items: stretch;
}
.calendar-cell {
  padding: 6px 0;
  border-radius: 6px;
  border: 1px solid transparent;
}
.calendar-cell--active {
  display: block;
  background: #eaf3ea;
  color: #1b2a1b;
}
.calendar-cell--empty {
  background: #f5f5f5;
}
.calendar-cell--selected {
  border: 2px solid #6f896d;
}
.calendar-cell--today {
  box-shadow: inset 0 0 0 1px #6f896d;
}
.calendar-cell-count { font-size: 10px; color: #2e7d32; }
.calendar-cell-note { font-size: 10px; color: #6f896d; }
.calendar-notes { margin-top: 12px; }
.calendar-notes h3 { margin: 0 0 8px; font-size: 14px; }
.calendar-notes ul { margin: 0; padding-left: 18px; }
.calendar-notes li { margin: 4px 0; }

.detail-actions-form { margin-top: 14px; }

.mobile-action-bar {
  display: none;
}

body.density-compact .card {
  padding: 14px;
}
body.density-compact .summary-card {
  padding: 10px 12px;
}
body.density-compact .table th,
body.density-compact .table td {
  padding: 8px 10px;
}
body.density-compact .timeline__content {
  padding: 8px 10px;
}
body.density-comfortable .card {
  padding: 18px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 1100px) {
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform 0.2s ease; }
  .sidebar-toggle:checked ~ .app-shell .sidebar { transform: translateX(0); }
  .sidebar__overlay { display: block; position: fixed; inset: 0; background: rgba(15, 25, 20, 0.4); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; z-index: 20; }
  .sidebar-toggle:checked ~ .app-shell .sidebar__overlay { opacity: 1; pointer-events: auto; }
  .topbar__menu { display: inline-flex; }
  .topbar__title { display: none; }
  .topbar__search { max-width: none; }
  .grid2 { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .quote-builder { grid-template-columns: 1fr; }
  .quote-summary { position: static; }
  .table-wrap.table-wrap--stack {
    border: none;
    box-shadow: none;
    background: transparent;
    overflow: visible;
  }
  .table.table--stack thead {
    display: none;
  }
  .table.table--stack,
  .table.table--stack tbody,
  .table.table--stack tr,
  .table.table--stack td {
    display: block;
    width: 100%;
  }
  .table.table--stack tr {
    margin-bottom: 10px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }
  .table.table--stack td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
    text-align: left !important;
    font-size: 13px;
  }
  .table.table--stack td:last-child {
    border-bottom: none;
  }
  .table.table--stack td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    min-width: 92px;
    flex-shrink: 0;
  }
  .table.table--stack td.actions-cell::before {
    display: none;
  }
  .table.table--stack td.actions-cell {
    justify-content: flex-end;
  }
  .action-buttons {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .page-filters--sticky,
  .list-action-rail {
    position: static;
  }
  .page-with-mobile-actions {
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }
  .mobile-action-bar {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    background: rgba(255, 255, 255, 0.98);
    border-top: 2px solid var(--border);
    box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.08);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }
  .mobile-action-bar__inner {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .mobile-action-bar .btn,
  .mobile-action-bar .btn.secondary,
  .mobile-action-bar .btn.subtle {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .app-content { padding: 18px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header__title h1 { font-size: 22px; }
  .page-header__subtitle { font-size: 13px; }
  .page-header__actions { width: 100%; flex-direction: column; align-items: stretch; }
  .page-header__actions .btn-group { width: 100%; }
  .page-header__actions .btn { flex: 1 1 auto; width: 100%; }
  .summary-strip { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .table { font-size: 14px; }
  .table th, .table td { padding: 10px 10px; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters__actions { width: 100%; justify-content: flex-start; }
  .filters__actions .btn { flex: 1 1 auto; }
  .topbar { flex-wrap: wrap; }
  .topbar__actions { width: 100%; justify-content: flex-end; }
  #map { height: 380px !important; }
  .pdf-frame--detail { min-height: 520px; height: 70vh; }
  .pdf-frame--files { min-height: 760px; height: 84vh; }
}

.action-buttons { justify-content: flex-end; flex-wrap: nowrap; }
