:root {
  font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
  color: #18271e;
  background: #f5f6f2;
  --dark: #173828;
  --green: #256345;
  --muted: #526257;
  --line: #dbe2d8;
  --white: #fff;
  --focus: #087844;
  --gold: #d69b3e;
  font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input { font: inherit; }
a { color: var(--green); }
button, .button {
  display: inline-flex; justify-content: center; align-items: center; gap: .5rem;
  min-height: 42px; padding: .55rem .95rem; border: 1px solid transparent; border-radius: 8px;
  background: var(--dark); color: white; text-decoration: none; cursor: pointer; font-weight: 650;
}
button:hover, .button:hover { background: var(--green); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .55; }
.secondary { background: var(--white); border-color: #c9d5c9; color: var(--dark); }
.secondary:hover { background: #eaf2e9; }
.skip { position: fixed; z-index: 5; padding: .7rem; top: 0; left: 1rem; transform: translateY(-110%); background: white; }
.skip:focus { transform: none; }
.shell { min-height: 100svh; display: grid; grid-template-columns: 228px minmax(0, 1fr); }
.side {
  position: sticky; top: 0; height: 100svh; padding: 1.45rem 1.05rem; display: flex;
  flex-direction: column; gap: 2rem; background: var(--dark); color: white;
}
.brand { display: block; align-self: flex-start; background: #fff; padding: .55rem .65rem; border-radius: 9px; line-height: 0; }
.brand img { display: block; max-width: 100%; height: auto; }
.side nav { display: grid; gap: .3rem; }
.side nav button, .logout { width: 100%; justify-content: space-between; text-align: left; background: transparent; color: #ecf4ed; }
.side nav button[aria-current], .side nav button:hover, .logout:hover { background: #315541; }
.side :focus-visible { outline-color: #f3c875; }
.logout { margin-top: auto; border-color: #547564; }
main { min-width: 0; padding: 2.65rem clamp(1rem, 3.7vw, 4rem) 3rem; width: min(100%, 1240px); margin-inline: auto; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 5vw, 3.1rem); line-height: 1.07; letter-spacing: -.045em; overflow-wrap: anywhere; }
h2 { font-size: 1.25rem; letter-spacing: -.025em; }
h3 { font-size: 1rem; }
.muted, .small { color: var(--muted); }
.small { font-size: .875rem; }
.intro { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; align-items: flex-end; margin-bottom: 1.6rem; }
.intro p { margin-bottom: .45rem; font-size: .91rem; font-weight: 675; color: var(--green); }
.period { display: flex; padding: .25rem; gap: .2rem; border: 1px solid var(--line); background: #ebefe9; border-radius: 10px; }
.period button { color: var(--dark); background: transparent; min-height: 36px; border-radius: 7px; padding: .3rem .68rem; font-size: .85rem; white-space: nowrap; }
.period button[aria-pressed="true"] { background: white; box-shadow: 0 1px 2px #17382820; }
.dashboard-filters { display: grid; gap: .7rem; min-width: 0; }
.dashboard-filter-row { display: flex; align-items: end; flex-wrap: wrap; gap: .55rem .7rem; }
.dashboard-filter-row[hidden] { display: none; }
.dashboard-filter-row input, .dashboard-filter-row select { min-height: 40px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 162px), 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi, .panel, .auth { border: 1px solid var(--line); border-radius: 13px; background: var(--white); }
.kpi { padding: 1.05rem; min-height: 117px; }
.kpi h2 { color: var(--muted); font-size: .89rem; font-weight: 640; }
.kpi strong { display: block; font-size: 2.15rem; letter-spacing: -.05em; margin: .35rem 0 .22rem; font-variant-numeric: tabular-nums; }
.kpi .unavailable { font-size: 1.05rem; line-height: 1.15; margin-top: .7rem; letter-spacing: 0; }
.panel { padding: clamp(.8rem, 2.7vw, 1.35rem); margin-bottom: 1rem; min-width: 0; }
.panel h2 { margin-bottom: .55rem; }
.panel > p { margin: .3rem 0 .8rem; }
.panel section + section { border-top: 1px solid var(--line); margin-top: .75rem; padding-top: .75rem; }
.chart-header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .45rem 1rem; align-items: baseline; }
canvas { width: 100%; height: 220px; display: block; }
.legend { display: flex; gap: .65rem 1rem; flex-wrap: wrap; font-size: .84rem; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: .62rem; height: .62rem; margin-right: .32rem; border-radius: 3px; background: #237350; }
.legend span:nth-child(2)::before { background: #9e6411; }
.legend span:nth-child(3)::before { background: #4d60a5; }
.table-wrap { overflow-x: auto; padding: .2rem 0; }
table { width: 100%; text-align: left; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .7rem .6rem; border-bottom: 1px solid #e9eee8; vertical-align: top; }
th { color: #405644; font-size: .78rem; white-space: nowrap; }
td:first-child { overflow-wrap: anywhere; }
.tag { display: inline-block; background: #e8f3ea; color: #16432a; padding: .2rem .45rem; border-radius: 5px; white-space: nowrap; }
.link-list, .partner-list { display: grid; gap: .7rem; margin-top: .9rem; }
.link-row, .partner-row { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem .8rem; padding: .8rem 0; border-bottom: 1px solid #e9eee8; }
.link-row:last-child, .partner-row:last-child { border-bottom: 0; }
.link-row > div, .partner-row > div { min-width: min(100%, 215px); flex: 1; overflow-wrap: anywhere; }
.link-row h3, .partner-row h3 { margin-bottom: .22rem; }
.link-url { display: block; margin: .25rem 0; overflow-wrap: anywhere; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 225px), 1fr)); gap: .9rem; margin-top: 1rem; }
.media-card { display: grid; grid-template-rows: auto 1fr auto; gap: .75rem; min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: .85rem; overflow-wrap: anywhere; }
.media-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #f4f6f2; border-radius: 6px; }
.media-card p { margin-top: .25rem; }
.media-card a { align-self: end; }
.auth { max-width: 460px; margin: clamp(1rem, 7vh, 5.5rem) auto; padding: clamp(1rem, 4vw, 2.15rem); }
.auth h1 { font-size: clamp(1.8rem, 5vw, 2.45rem); margin-bottom: .5rem; }
.auth p { margin-bottom: 1.2rem; }
.form, .fields { display: grid; gap: .85rem; }
.fields { grid-template-columns: repeat(auto-fit, minmax(min(100%, 172px), 1fr)); align-items: end; }
label { display: grid; gap: .3rem; color: var(--dark); font-size: .9rem; font-weight: 650; min-width: 0; }
input, select { padding: .55rem .65rem; min-height: 44px; min-width: 0; width: 100%; border: 1px solid #b9c7bc; border-radius: 7px; color: #18271e; background: white; }
.auth .secondary { margin-top: .8rem; width: 100%; }
#notice:not(:empty) { margin-bottom: 1rem; padding: .7rem .9rem; border: 1px solid #bad2bd; border-radius: 8px; color: #234a2d; background: #eaf5e8; overflow-wrap: anywhere; }
#notice[data-error]:not(:empty) { background: #fff0ec; border-color: #e9b9ae; color: #882d21; }
.loading { color: var(--muted); }
dialog { max-width: min(410px, calc(100vw - 2rem)); width: 100%; border: 1px solid var(--line); border-radius: 15px; padding: 1.2rem; color: #18271e; }
dialog::backdrop { background: #0a281ed1; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.qr-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.qr-actions .button { flex: 1 1 145px; width: auto; }
dialog img { display: block; margin: .7rem auto; width: min(100%, 280px); height: auto; }
dialog .button { width: 100%; }
@media (max-width: 760px) {
  .shell { display: block; }
  .side { position: static; height: auto; padding: .7rem .9rem; gap: .45rem .65rem; display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { align-self: center; padding: .36rem .48rem; }
  .brand img { width: 126px; }
  .side nav { order: 3; flex: 1 0 100%; display: flex; overflow: auto; }
  .side nav button, .logout { width: auto; font-size: .85rem; gap: .35rem; white-space: nowrap; }
  .logout { margin: 0 0 0 auto; }
  .side nav span { display: none; }
  main { padding-top: 1.3rem; }
  canvas { height: 185px; }
}
@media (max-width: 400px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { min-height: 106px; padding: .7rem; }
  .kpi h2 { font-size: .79rem; }
}
