:root {
  --ink: #17231f;
  --ink-soft: #4f615a;
  --muted: #718079;
  --canvas: #f4f6f1;
  --surface: #ffffff;
  --surface-soft: #edf1eb;
  --line: #dce3dc;
  --primary: #155c46;
  --primary-strong: #0e4937;
  --lime: #c8ee78;
  --amber: #f7c969;
  --blue: #a9d7f7;
  --rose: #f3b7b0;
  --danger: #aa3e3e;
  --shadow: 0 18px 45px rgba(32, 52, 44, .08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }
html { overflow-x: hidden; scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: "DM Sans", sans-serif; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
h1, h2, h3, h4, h5, h6 { margin: 0; font-family: "Manrope", sans-serif; line-height: 1.16; }
p { margin: 0; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; background: var(--ink); color: white; padding: .75rem 1rem; border-radius: 10px; }
.skip-link:focus { top: 1rem; }

.app-sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; display: flex; flex-direction: column; padding: 28px 20px; background: var(--ink); color: white; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: inline-grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; color: var(--ink); background: var(--lime); box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); }
.brand strong { display: block; font: 800 1.1rem/1.1 "Manrope", sans-serif; letter-spacing: -.03em; }
.brand small { display: block; margin-top: 3px; color: #9fb0a9; font-size: .72rem; }
.brand.compact .brand-mark { width: 38px; height: 38px; }
.sidebar-nav { display: grid; gap: 7px; margin-top: 54px; }
.nav-label { margin: 0 12px 8px; color: #81938b; font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-nav a { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 13px; color: #b9c7c1; font-weight: 600; transition: .2s ease; }
.sidebar-nav a i { width: 20px; text-align: center; }
.sidebar-nav a:hover, .sidebar-nav a.is-active { color: white; background: rgba(255,255,255,.09); }
.sidebar-nav a.is-active i { color: var(--lime); }
.sidebar-account { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.1); }
.account-copy { min-width: 0; flex: 1; }
.account-copy strong, .account-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: .88rem; }
.account-copy small { color: #95a69f; font-size: .72rem; text-transform: capitalize; }
.avatar { display: inline-grid; flex: 0 0 auto; place-items: center; width: 52px; height: 52px; border-radius: 18px; background: var(--lime); color: var(--ink); font-weight: 800; }
.avatar-small { width: 38px; height: 38px; border-radius: 12px; font-size: .78rem; }
.icon-button { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 11px; background: transparent; color: #9fb0a9; cursor: pointer; }
.icon-button:hover { background: rgba(255,255,255,.09); color: white; }

.app-main { min-height: 100vh; margin-left: 260px; padding: 40px clamp(24px, 4vw, 64px) 64px; }
.mobile-header, .bottom-nav { display: none; }
.page-shell { width: min(1180px, 100%); margin: 0 auto; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.eyebrow { margin-bottom: 8px; color: var(--primary); font-size: .75rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.page-title { max-width: 760px; font-size: clamp(2rem, 4vw, 3.25rem); letter-spacing: -.055em; }
.page-subtitle { max-width: 680px; margin-top: 10px; color: var(--muted); font-size: 1rem; }
.header-actions, .button-row { display: flex; flex-wrap: wrap; gap: 10px; }

.button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 9px; padding: 0 18px; border: 1px solid transparent; border-radius: 14px; background: var(--primary); color: white; font-weight: 700; cursor: pointer; transition: transform .15s, background .15s, box-shadow .15s; }
.button:hover { background: var(--primary-strong); box-shadow: 0 9px 22px rgba(21,92,70,.16); transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid rgba(21,92,70,.25); outline-offset: 2px; }
.button-secondary { border-color: var(--line); background: var(--surface); color: var(--ink); }
.button-secondary:hover { background: var(--surface-soft); color: var(--ink); box-shadow: none; }
.button-danger { background: #fff0ee; color: var(--danger); }
.button-danger:hover { background: #fbe1de; color: var(--danger); }
.button-small { min-height: 38px; padding: 0 14px; border-radius: 11px; font-size: .86rem; }
.button-block { width: 100%; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.metric-card { min-height: 155px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 8px 26px rgba(30, 50, 42, .04); }
.metric-card .metric-icon { display: grid; width: 42px; height: 42px; place-items: center; margin-bottom: 22px; border-radius: 13px; color: var(--primary-strong); background: var(--surface-soft); }
.metric-card:nth-child(2) .metric-icon { background: #e8f2fb; }
.metric-card:nth-child(3) .metric-icon { background: #fff1d5; }
.metric-card:nth-child(4) .metric-icon { background: #fbe6e3; }
.metric-value { font: 800 2rem/1 "Manrope", sans-serif; letter-spacing: -.05em; }
.metric-label { margin-top: 7px; color: var(--muted); font-size: .86rem; }

.dashboard-grid, .content-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .8fr); gap: 20px; }
.card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 8px 30px rgba(30,50,42,.045); }
.card-pad { padding: 24px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.card-title { font-size: 1.12rem; letter-spacing: -.025em; }
.card-subtitle { margin-top: 4px; color: var(--muted); font-size: .84rem; }
.section-stack { display: grid; gap: 20px; }

.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.action-card { position: relative; display: flex; min-height: 185px; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 20px; border-radius: 18px; background: var(--lime); transition: transform .2s ease; }
.action-card:nth-child(2) { background: var(--blue); }
.action-card:nth-child(3) { background: var(--amber); }
.action-card:hover { transform: translateY(-3px); }
.action-card .action-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 14px; background: rgba(255,255,255,.55); font-size: 1.1rem; }
.action-card h3 { font-size: 1.05rem; }
.action-card p { margin-top: 5px; color: rgba(23,35,31,.7); font-size: .82rem; }
.action-arrow { position: absolute; top: 20px; right: 20px; }

.list { display: grid; gap: 9px; }
.list-item { display: flex; align-items: center; gap: 13px; min-width: 0; padding: 13px; border-radius: 14px; background: var(--canvas); }
.list-item-copy { min-width: 0; flex: 1; }
.list-item-copy strong, .list-item-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item-copy strong { font-size: .9rem; }
.list-item-copy span { margin-top: 2px; color: var(--muted); font-size: .76rem; }
.status, .role-pill { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border-radius: 999px; background: var(--surface-soft); color: var(--ink-soft); font-size: .71rem; font-weight: 700; text-transform: capitalize; }
.status-success { background: #e1f3e9; color: #286345; }
.status-warning { background: #fff0cf; color: #7b5a18; }
.empty-state { padding: 34px 20px; text-align: center; color: var(--muted); }
.empty-state i { display: block; margin-bottom: 12px; color: #afbbb5; font-size: 1.8rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; }
.data-table { width: 100%; border-collapse: collapse; background: white; }
.data-table th, .data-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data-table th { color: var(--muted); background: #f8faf7; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td { font-size: .86rem; }
.table-actions { display: flex; justify-content: flex-end; gap: 7px; }

.form-shell { width: min(780px, 100%); }
.form-card { padding: clamp(22px, 4vw, 38px); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 7px; }
.field-full { grid-column: 1 / -1; }
.field label, .field-label { color: var(--ink-soft); font-size: .8rem; font-weight: 700; }
.field small { color: var(--muted); font-size: .73rem; }
.field input, .field select, .field textarea { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfa; color: var(--ink); box-shadow: none; }
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); background: white; }
.input-with-button { position: relative; }
.input-with-button input { padding-right: 48px; }
.input-with-button button { position: absolute; top: 5px; right: 5px; color: var(--muted); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; grid-column: 1 / -1; margin-top: 8px; padding-top: 20px; border-top: 1px solid var(--line); }
.form-note { padding: 14px 16px; border-radius: 13px; background: #edf5fb; color: #355c70; font-size: .84rem; }

.checklist { display: grid; gap: 12px; }
.check-row { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.check-number { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px; background: var(--surface-soft); font-weight: 800; }
.choice-group { display: flex; gap: 7px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: inline-flex; min-width: 52px; min-height: 38px; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: .8rem; font-weight: 700; }
.choice input:checked + span { border-color: var(--primary); background: var(--primary); color: white; }

.people-grid, .operation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.person-card, .operation-card { padding: 20px; }
.person-top { display: flex; align-items: center; gap: 13px; }
.person-details { margin: 18px 0; padding: 13px; border-radius: 13px; background: var(--canvas); }
.detail-row { display: flex; justify-content: space-between; gap: 20px; padding: 6px 0; font-size: .79rem; }
.detail-row span:first-child { color: var(--muted); }
.person-actions { display: flex; gap: 8px; }
.operation-card { display: flex; min-height: 230px; flex-direction: column; }
.operation-icon { display: grid; width: 50px; height: 50px; place-items: center; border-radius: 16px; background: var(--lime); font-size: 1.2rem; }
.operation-card:nth-child(2) .operation-icon { background: var(--blue); }
.operation-card:nth-child(3) .operation-icon { background: var(--amber); }
.operation-card h2 { margin-top: 20px; font-size: 1.15rem; }
.operation-card p { margin: 7px 0 22px; color: var(--muted); font-size: .86rem; }
.operation-actions { display: flex; gap: 8px; margin-top: auto; }

.report-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.summary-chip { padding: 9px 12px; border-radius: 11px; background: var(--surface-soft); font-size: .8rem; }
.answer-list { display: grid; gap: 10px; }
.answer-row { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border-radius: 13px; background: var(--canvas); }
.answer-row i { color: var(--primary); }
.answer-row.is-no i { color: var(--danger); }

.flash-stack { position: fixed; top: 20px; right: 24px; z-index: 90; display: grid; width: min(420px, calc(100vw - 32px)); gap: 8px; }
.flash { display: flex; align-items: center; gap: 11px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: var(--shadow); transition: .25s; }
.flash-success > i { color: #2c7a50; }
.flash-danger > i { color: var(--danger); }
.flash-dismiss { margin-left: auto; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.flash.is-leaving { opacity: 0; transform: translateY(-8px); }

.public-header { position: relative; z-index: 10; padding: 20px clamp(20px, 5vw, 72px); }
.public-nav { display: flex; width: min(1180px,100%); align-items: center; justify-content: space-between; margin: 0 auto; }
.public-nav nav { display: flex; align-items: center; gap: 24px; font-weight: 600; }
.public-main { min-height: calc(100vh - 160px); }
.hero { display: grid; width: min(1180px, calc(100% - 40px)); min-height: 650px; grid-template-columns: 1.05fr .95fr; align-items: center; gap: clamp(36px, 7vw, 90px); margin: 0 auto; padding: 70px 0 100px; }
.hero-copy { min-width: 0; }
.hero h1 { max-width: 670px; font-size: clamp(3rem, 7vw, 6.5rem); letter-spacing: -.075em; }
.hero h1 em { color: var(--primary); font-style: normal; }
.hero-copy > p { max-width: 570px; margin: 24px 0 30px; color: var(--muted); font-size: 1.1rem; }
.hero-panel { position: relative; min-height: 500px; overflow: hidden; border-radius: 40px; background: var(--ink); box-shadow: var(--shadow); }
.hero-panel::before { position: absolute; inset: -15% 25% 35% -20%; border-radius: 50%; background: var(--lime); content: ""; }
.hero-panel::after { position: absolute; inset: 40% -20% -20% 35%; border-radius: 50%; background: var(--blue); content: ""; }
.mock-card { position: absolute; z-index: 2; width: 75%; padding: 22px; border-radius: 22px; background: rgba(255,255,255,.94); box-shadow: 0 24px 50px rgba(0,0,0,.18); }
.mock-card.one { top: 60px; left: 12%; transform: rotate(-3deg); }
.mock-card.two { right: 8%; bottom: 55px; transform: rotate(4deg); }
.mock-card .mini-line { height: 9px; margin-top: 10px; border-radius: 99px; background: #e3e8e3; }
.mock-card .mini-line.short { width: 55%; }
.features { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 0 0 100px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature-card { padding: 26px; border-radius: var(--radius-lg); background: white; }
.feature-card i { display: grid; width: 46px; height: 46px; place-items: center; margin-bottom: 34px; border-radius: 14px; background: var(--surface-soft); color: var(--primary); }
.feature-card p { margin-top: 9px; color: var(--muted); }
.public-footer { display: flex; width: min(1180px, calc(100% - 40px)); justify-content: space-between; gap: 30px; margin: 0 auto; padding: 34px 0; border-top: 1px solid var(--line); color: var(--muted); }
.footer-links { display: flex; gap: 20px; }
.legal-page { width: min(820px, calc(100% - 40px)); margin: 40px auto 90px; padding: clamp(24px,5vw,50px); border: 1px solid var(--line); border-radius: var(--radius-xl); background: white; }
.legal-page h1 { margin-bottom: 28px; font-size: clamp(2.2rem,5vw,3.5rem); }
.legal-page h2 { margin: 30px 0 10px; font-size: 1.25rem; }
.legal-page p, .legal-page li { color: var(--ink-soft); }

.auth-shell { display: grid; width: min(1050px, calc(100% - 40px)); min-height: 650px; grid-template-columns: .9fr 1.1fr; margin: 40px auto 90px; overflow: hidden; border-radius: 34px; background: white; box-shadow: var(--shadow); }
.auth-aside { display: flex; flex-direction: column; justify-content: space-between; padding: 46px; background: var(--ink); color: white; }
.auth-aside i { color: var(--lime); font-size: 2.3rem; }
.auth-aside h1 { margin-top: 18px; font-size: 2.6rem; letter-spacing: -.05em; }
.auth-aside p { margin-top: 12px; color: #afbeb8; }
.auth-form { align-self: center; padding: clamp(28px,6vw,72px); }
.auth-form h2 { font-size: 2rem; }
.auth-form > p { margin: 9px 0 30px; color: var(--muted); }

@media (max-width: 1050px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid, .content-grid { grid-template-columns: 1fr; }
  .people-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  body.app-authenticated { padding-bottom: 78px; }
  .app-sidebar { display: none; }
  .mobile-header { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--line); background: rgba(244,246,241,.94); backdrop-filter: blur(16px); }
  .app-main { margin-left: 0; padding: 24px 18px 38px; }
  .bottom-nav { position: fixed; inset: auto 12px 12px; z-index: 50; display: grid; grid-template-columns: repeat(3,1fr); padding: 7px; border: 1px solid rgba(255,255,255,.12); border-radius: 19px; background: rgba(23,35,31,.96); box-shadow: 0 18px 42px rgba(23,35,31,.24); }
  .bottom-nav a { display: grid; place-items: center; gap: 3px; padding: 8px 5px; border-radius: 13px; color: #91a39b; font-size: .62rem; font-weight: 700; }
  .bottom-nav a i { font-size: 1rem; }
  .bottom-nav a.is-active { background: rgba(255,255,255,.1); color: var(--lime); }
  .page-header { align-items: flex-start; flex-direction: column; margin-bottom: 24px; }
  .page-title { font-size: 2.2rem; }
  .header-actions { width: 100%; }
  .header-actions .button { flex: 1; }
  .action-grid, .operation-grid { grid-template-columns: 1fr; }
  .action-card { min-height: 145px; }
  .form-grid { grid-template-columns: 1fr; }
  .field-full, .form-actions { grid-column: auto; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .check-row { grid-template-columns: 34px minmax(0,1fr); }
  .choice-group { grid-column: 1 / -1; }
  .choice { flex: 1; }
  .choice span { width: 100%; }
  .people-grid { grid-template-columns: 1fr; }
  .public-nav nav > a:not(.button) { display: none; }
  .hero { min-height: auto; grid-template-columns: 1fr; padding: 45px 0 75px; }
  .hero h1 { font-size: 3.5rem; }
  .hero h1 em { display: block; overflow-wrap: anywhere; }
  .hero-panel { min-height: 390px; }
  .feature-grid { grid-template-columns: 1fr; }
  .auth-shell { min-height: auto; grid-template-columns: 1fr; }
  .auth-aside { min-height: 260px; padding: 30px; }
  .auth-aside h1 { font-size: 2rem; }
  .public-footer { align-items: flex-start; flex-direction: column; }
  .flash-stack { top: 12px; right: 16px; }
}

@media (max-width: 460px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 128px; padding: 16px; }
  .metric-card .metric-icon { margin-bottom: 14px; }
  .metric-value { font-size: 1.6rem; }
  .metric-label { font-size: .75rem; }
  .card-pad { padding: 18px; }
  .hero h1 { font-size: 2.85rem; }
  .hero .button-row { align-items: stretch; flex-direction: column; }
  .hero .button-row .button { width: 100%; }
}

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