/* ============================================================
   FAO IMES — Integration Monitoring & Evaluation System
   FAO blue design system · no external dependencies
   ============================================================ */

:root {
    --fao-950: #0A1F38;
    --fao-900: #0F2B4C;
    --fao-800: #123A63;
    --fao-700: #1B4F8A;
    --fao-600: #2E63A8;
    --fao-500: #447CC4;
    --fao-400: #6E9BD4;
    --fao-300: #9FBEE6;
    --fao-200: #C7DAF2;
    --fao-100: #E4EDF8;
    --fao-50:  #F2F7FD;

    --green:  #1F9D61;
    --amber:  #E39A2D;
    --red:    #D64545;
    --violet: #7C6BD6;

    --ink:    #16283E;
    --ink-2:  #43566E;
    --muted:  #7285A0;
    --line:   #DCE5F0;
    --bg:     #EFF3F9;
    --card:   #FFFFFF;

    --radius:   14px;
    --radius-sm: 9px;
    --shadow:   0 1px 2px rgba(15,43,76,.06), 0 8px 24px -12px rgba(15,43,76,.18);
    --shadow-lg: 0 24px 60px -20px rgba(15,43,76,.35);
    --sidebar-w: 256px;
    --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--fao-900); letter-spacing: -.01em; }
p { margin: 0 0 .6em; }
a { color: var(--fao-600); text-decoration: none; }
a:hover { color: var(--fao-700); }
strong { font-weight: 650; }
code {
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: .86em;
    background: var(--fao-100);
    color: var(--fao-800);
    padding: .1em .4em;
    border-radius: 6px;
}
.muted { color: var(--muted); }
/* .btn sets display, which would otherwise beat the browser's own [hidden] rule */
[hidden] { display: none !important; }
.sm { font-size: .86em; }
.nowrap { white-space: nowrap; }
.link { font-weight: 600; }
.ic { width: 18px; height: 18px; flex: none; }
.ic-xs { width: 14px; height: 14px; }

::selection { background: var(--fao-200); }

/* ------------------------------------------------ buttons ------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 600;
    font-size: .92em;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s;
    white-space: nowrap;
    user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .ic { width: 16px; height: 16px; }

.btn-primary {
    background: linear-gradient(160deg, var(--fao-600), var(--fao-700));
    color: #fff;
    box-shadow: 0 6px 16px -6px rgba(27,79,138,.55);
}
.btn-primary:hover { background: linear-gradient(160deg, var(--fao-700), var(--fao-800)); color: #fff; }
.btn-ghost {
    background: var(--card);
    border-color: var(--line);
    color: var(--ink-2);
}
.btn-ghost:hover { border-color: var(--fao-400); color: var(--fao-700); background: var(--fao-50); }
.btn-soft {
    background: var(--fao-100);
    color: var(--fao-800);
}
.btn-soft:hover { background: var(--fao-200); color: var(--fao-900); }
.btn-danger {
    background: #FBECEC;
    color: var(--red);
    border-color: #F2CFCF;
}
.btn-danger:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: 12px 20px; font-size: 1em; }
.btn-sm { padding: 5px 10px; font-size: .84em; gap: 5px; }
.btn-sm .ic { width: 14px; height: 14px; }
.btn-ic { width: 15px; height: 15px; }

/* ------------------------------------------------ pills & chips ------------------------------------------------ */
.pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 11px;
    border-radius: 999px;
    font-size: .78em;
    font-weight: 650;
}
.pill-soft { background: var(--fao-100); color: var(--fao-800); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .76em;
    font-weight: 650;
    white-space: nowrap;
}
.chip-sm { padding: 2px 8px; font-size: .72em; }
.chip-xs { padding: 1px 7px; font-size: .7em; }
.chip-blue   { background: #E4EDF8; color: var(--fao-700); }
.chip-green  { background: #E2F4EB; color: #177A4B; }
.chip-amber  { background: #FBF0DC; color: #A96F14; }
.chip-red    { background: #FBE9E9; color: #B03030; }
.chip-violet { background: #ECE9F9; color: #5B4BB5; }
.chip-grey   { background: #EEF1F6; color: var(--ink-2); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Activity numbering + implementing partner, the two first columns of the activity list */
.code-ref {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .86em;
    font-weight: 650;
    color: var(--fao-700);
    background: #F2F6FB;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 2px 6px;
}
.partner-cell .partner-unit { margin-top: 2px; }

/* "Add manually…" text box that sits under a dropdown */
.pick-other { margin-top: 6px; }

/* Dashboard period filter: the years the programme's project runs span */
.year-filter {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.year-filter-label {
    font-size: .78em;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-right: 2px;
}
.year-chip {
    display: inline-block;
    padding: 4px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: .86em;
    font-weight: 600;
    color: var(--ink-2);
    text-decoration: none;
    background: var(--bg);
}
.year-chip:hover { border-color: var(--fao-200); color: var(--fao-700); background: #F2F6FB; }
.year-chip.is-active {
    background: var(--fao-700);
    border-color: var(--fao-700);
    color: #fff;
}
.year-filter-note { font-size: .82em; color: var(--muted); margin-left: 6px; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .76em;
    font-weight: 650;
    color: var(--bc, var(--ink-2));
    background: color-mix(in srgb, var(--bc, #7285A0) 12%, #fff);
    border: 1px solid color-mix(in srgb, var(--bc, #7285A0) 30%, #fff);
}
.badge i {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--bc, var(--muted));
    flex: none;
}

.code-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 7px;
    background: var(--fao-900);
    color: #fff;
    font-size: .76em;
    font-weight: 700;
    letter-spacing: .04em;
}
.code-chip-sm { font-size: .7em; padding: 2px 7px; }

/* ------------------------------------------------ app shell ------------------------------------------------ */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: none;
    background:
        radial-gradient(130% 60% at 8% 0%, rgba(110,155,212,.34) 0%, rgba(110,155,212,0) 62%),
        radial-gradient(120% 55% at 100% 100%, rgba(46,99,168,.45) 0%, rgba(46,99,168,0) 60%),
        linear-gradient(178deg, #16457B 0%, var(--fao-900) 52%, var(--fao-950) 100%);
    color: #D5E5F8;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 40;
    border-right: 1px solid rgba(159,190,230,.16);
}
.brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 18px 18px;
    border-bottom: 1px solid rgba(159,190,230,.16);
}
.brand-logo { display: block; flex: none; }
.brand-logo img {
    display: block;
    width: 205px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 3px 9px rgba(6,20,38,.5));
}
.brand-text { display: flex; flex-direction: column; line-height: 1.22; }
.brand-text strong { color: #fff; font-size: 1.1em; letter-spacing: .02em; }
.brand-text small { color: var(--fao-300); font-size: .72em; }
/* programme line between the logo and the product name */
.brand-text .brand-prog, .pub-brand-text .brand-prog {
    color: var(--fao-200);
    font-size: .66em;
    font-weight: 650;
    line-height: 1.32;
    letter-spacing: .015em;
    margin-bottom: 4px;
}
.auth-brand .brand-prog { color: var(--fao-200); font-size: .78em; font-weight: 650; margin-bottom: 3px; }

.side-section {
    padding: 16px 20px 7px;
    font-size: .68em;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #9BBBE2;
}
.side-nav { display: flex; flex-direction: column; gap: 4px; padding: 0 10px; }
.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 11px;
    color: #E1EDFB;
    font-weight: 600;
    font-size: .93em;
    transition: background .16s, color .16s, box-shadow .16s;
}
.side-link .ic {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border-radius: 9px;
    background: rgba(159,190,230,.15);
    color: var(--fao-300);
    opacity: 1;
    transition: background .16s, color .16s;
}
.side-link .ic svg { width: 17px; height: 17px; display: block; fill: currentColor; }
.side-link:hover { background: rgba(159,190,230,.12); color: #fff; }
.side-link:hover .ic { background: rgba(159,190,230,.28); color: #fff; }
.side-link.active {
    background: linear-gradient(90deg, rgba(110,155,212,.36), rgba(68,124,196,.10));
    color: #fff;
    box-shadow: inset 3px 0 0 var(--fao-300);
}
.side-link.active .ic {
    background: var(--fao-300);
    color: var(--fao-950);
    box-shadow: 0 5px 14px -6px rgba(159,190,230,.9);
}

.side-foot { margin-top: auto; padding: 14px; border-top: 1px solid rgba(159,190,230,.16); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; }
.side-user-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.side-user-meta strong { color: #fff; font-size: .88em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-meta small { color: var(--fao-300); font-size: .72em; }
.logout-form { margin: 0; }
.logout-form .btn {
    background: rgba(159,190,230,.13);
    border-color: transparent;
    color: #EAF2FC;
}
.logout-form .btn:hover { background: rgba(159,190,230,.24); color: #fff; }
.logout-form .btn .ic { fill: currentColor; }

.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(140deg, var(--fao-300), var(--fao-500));
    color: var(--fao-950);
    box-shadow: 0 0 0 2px rgba(159,190,230,.34);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: .82em;
    flex: none;
}
.avatar-sm { width: 30px; height: 30px; font-size: .74em; }

/* --------------------------------------------------------------- profile -- */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1080px) { .profile-grid { grid-template-columns: 1fr; } }
.profile-id { display: flex; align-items: center; gap: 13px; margin-bottom: 14px; }
.avatar-lg { width: 54px; height: 54px; font-size: 1.15em; }
.profile-name { font-size: 1.05em; font-weight: 700; color: var(--ink); }
.profile-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 0; }
.profile-foot { margin: 12px 0 0; font-size: .78em; }
.sub-head {
    margin: 22px 0 12px; padding-top: 16px; font-size: 1.02em;
    border-top: 1px solid var(--line, #E2E8F0);
}
.side-profile { margin-top: 4px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 26px;
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 30;
}
.burger {
    display: none;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    padding: 7px;
    cursor: pointer;
    color: var(--fao-800);
}
.burger svg { width: 18px; height: 18px; display: block; }
.topbar-title h1 { font-size: 1.18em; }
.crumb { font-size: .76em; color: var(--muted); }
.topbar-right { margin-left: auto; }

.content {
    flex: 1;
    padding: 24px 26px 40px;
    width: 100%;
    max-width: 1460px;
    margin: 0 auto;
}
.foot {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    padding: 14px 26px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .78em;
    background: var(--card);
}

/* ------------------------------------------------ cards ------------------------------------------------ */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    margin-bottom: 20px;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.card-head.wrap { flex-wrap: wrap; }
.card-head h2 { font-size: 1.02em; }
.card-head h2 .pill { vertical-align: 2px; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.page-head h1 { font-size: 1.5em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head .muted { margin-top: 3px; }
.head-actions { display: flex; gap: 9px; flex: none; }
.back-link {
    display: inline-block;
    font-size: .84em;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
}
.back-link:hover { color: var(--fao-700); }

/* ------------------------------------------------ KPI grid ------------------------------------------------ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
.kpi {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.kpi-hero {
    background: linear-gradient(150deg, var(--fao-800), var(--fao-600));
    border-color: transparent;
}
.kpi-hero div strong, .kpi-hero div span { color: #fff; }
.kpi-ic {
    width: 40px; height: 40px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    flex: none;
    background: color-mix(in srgb, var(--c) 13%, #fff);
    color: var(--c);
}
.kpi-ic svg { width: 21px; height: 21px; fill: currentColor; }
.kpi div { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.kpi strong { font-size: 1.42em; color: var(--fao-900); letter-spacing: -.02em; }
.kpi span { font-size: .74em; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

/* ------------------------------------------------ dashboard grid & charts ------------------------------------------------ */
.dash-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    margin-bottom: 0;
}
.dash-grid > .card { margin-bottom: 20px; }
.dash-grid-2 { grid-template-columns: 1fr 1fr; }

.donut-wrap { position: relative; display: grid; place-items: center; padding: 6px 0 2px; }
.donut svg { display: block; }
.donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.donut-center strong { font-size: 1.7em; color: var(--fao-900); letter-spacing: -.02em; }
.donut-center span { font-size: .74em; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }

.legend { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.legend li { display: flex; align-items: center; gap: 9px; font-size: .86em; color: var(--ink-2); }
.legend li strong { margin-left: auto; color: var(--fao-900); }
.legend-center { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 14px; }
.legend-center li { font-size: .8em; }

.dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--fao-500)); flex: none; }
.dot-blue { background: var(--fao-500); border-radius: 50%; }

.chart { display: flex; align-items: stretch; gap: 10px; padding: 10px 4px 0; height: 252px; }
.chart .col { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; }
.chart .stack {
    flex: 1;
    display: flex;
    flex-direction: column-reverse;
    gap: 2px;
}
.chart .seg { width: 100%; border-radius: 3px 3px 0 0; min-height: 0; transition: height .5s ease; }
.chart .col-label {
    text-align: center;
    font-size: .68em;
    color: var(--muted);
    font-weight: 650;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.chart .col-total {
    text-align: center;
    font-size: .72em;
    font-weight: 700;
    color: var(--fao-800);
    margin-bottom: 4px;
}
.chart .col-empty .col-total { visibility: hidden; }

/* ------------------------------------------------ activity calendar ------------------------------------------------ */
.calendar { position: relative; }
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cal-title { font-size: 1.04em; color: var(--fao-900); min-width: 148px; }
.cal-nav { display: flex; gap: 6px; }
.cal-btn {
    width: 30px; height: 30px; display: grid; place-items: center;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: #fff; color: var(--fao-700); font-size: 1.1em; line-height: 1; cursor: pointer;
    transition: .15s;
}
.cal-btn:hover { background: var(--fao-50); border-color: var(--fao-400); }
.cal-spacer { flex: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow-row { margin-bottom: 4px; }
.cal-dow { text-align: center; font-size: .7em; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 3px 0; }
.cal-cell {
    position: relative; min-height: 74px; padding: 6px 7px; display: flex; flex-direction: column; gap: 5px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; transition: .14s;
}
.cal-cell.other { background: var(--bg); }
.cal-cell .dnum { font-size: .78em; font-weight: 700; color: var(--ink-2); }
.cal-cell.other .dnum { color: var(--muted); font-weight: 500; }
.cal-cell.today { border-color: var(--fao-500); box-shadow: inset 0 0 0 1px var(--fao-300); }
.cal-cell.today .dnum { color: var(--fao-700); }
.cal-cell.has:hover { border-color: var(--fao-400); box-shadow: var(--shadow); transform: translateY(-1px); }
.cal-cell.sel { border-color: var(--fao-600); box-shadow: 0 0 0 2px var(--fao-200); }
.cal-dots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; align-items: center; }
.cal-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.cal-more { font-size: .66em; font-weight: 700; color: var(--muted); margin-left: 1px; }
.cal-pop {
    position: absolute; z-index: 30; width: min(320px, 88%); max-height: 300px; overflow: auto;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg); padding: 10px 12px; opacity: 0; transform: translateY(4px);
    pointer-events: none; transition: opacity .12s ease, transform .12s ease;
}
.cal-pop.show { opacity: 1; transform: none; pointer-events: auto; }
.cal-pop h4 { font-size: .8em; color: var(--fao-900); margin-bottom: 4px; }
.cal-pop .ev { padding: 8px 0; border-top: 1px solid var(--line); }
.cal-pop .ev:first-of-type { border-top: 0; padding-top: 3px; }
.cal-pop .ev-title { font-size: .85em; font-weight: 600; color: var(--ink); line-height: 1.3; }
.cal-pop .ev-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.cal-pop .ev-when { font-size: .72em; color: var(--muted); }
.cal-pop .ev-proj { font-size: .74em; color: var(--ink-2); margin-top: 3px; }
.cal-pop .ev-people { font-size: .74em; color: var(--ink-2); margin-top: 3px; }
.cal-pop .ev-people b { color: var(--muted); font-weight: 600; }
.cal-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 14px; margin: 14px 0 0; padding: 0; }
.cal-legend li { display: flex; align-items: center; gap: 6px; font-size: .76em; color: var(--ink-2); }

/* ------------------------------------------------ distribution map ------------------------------------------------ */
.map-layout { display: grid; grid-template-columns: 1fr 322px; gap: 18px; align-items: start; }
.map-stage { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.map-canvas {
    height: 432px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    /* the sea: the province polygons are the whole basemap, so this tint is the map's background */
    background: #E4EDF6;
    overflow: hidden;
}
.leaflet-container { font: inherit; }
/* two classes: leaflet.css ships `.leaflet-container { background: #ddd }` and loads after this file */
.map-canvas.leaflet-container { background: #E4EDF6; }
/* Leaflet makes the canvas tabbable for keyboard panning; without this a click leaves the
   browser's heavy black ring around the whole map. Keyboard users still get a ring. */
.leaflet-container:focus { outline: none; }
.map-canvas.leaflet-container:focus-visible { outline: 2px solid var(--fao-600); outline-offset: -2px; }
.leaflet-container a { color: var(--fao-600); }
.leaflet-control-attribution { font-size: 10px; background: rgba(255,255,255,.82); }
.map-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.map-legend { display: inline-flex; gap: 3px; }
.map-legend-step { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.map-legend-step i { width: 26px; height: 11px; display: block; border-radius: 2px; border: 1px solid var(--line); }
.map-legend-step b { font-size: .66em; font-weight: 600; color: var(--muted); }
.map-ramp-label { font-size: .74em; color: var(--muted); }
.map-legend-dots { display: inline-flex; align-items: center; gap: 6px; font-size: .74em; color: var(--ink-2); }

.map-rank {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--fao-50);
    padding: 11px 12px;
}
.map-rank h3 {
    margin: 0 0 8px;
    font-size: .78em;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--fao-800);
}
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 344px; overflow-y: auto; }
.rank-row {
    display: grid;
    grid-template-columns: 18px 1fr auto;
    gap: 9px;
    align-items: center;
    padding: 6px 7px;
    border-radius: 8px;
    cursor: pointer;
}
.rank-row:hover, .rank-row.is-hot { background: var(--card); box-shadow: inset 0 0 0 1px var(--fao-300); }
.rank-row.is-active { background: var(--card); box-shadow: inset 0 0 0 2px var(--fao-700); }
.rank-row:focus-visible { outline: 2px solid var(--fao-600); outline-offset: 1px; }
.rank-n { font-size: .7em; color: var(--muted); text-align: right; }
.rank-name { display: block; font-size: .84em; font-weight: 600; color: var(--ink); }
.rank-bar { display: block; height: 5px; border-radius: 3px; background: var(--fao-100); margin: 4px 0 3px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--fao-400), var(--fao-700)); }
.rank-sub { display: block; font-size: .7em; color: var(--muted); }
.rank-total { font-size: .95em; color: var(--fao-900); }
.map-extra {
    list-style: none;
    margin: 10px 0 0;
    padding: 9px 0 0;
    border-top: 1px dashed var(--line);
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: .74em;
    color: var(--ink-2);
}
.map-extra li { display: flex; align-items: center; gap: 7px; }
/* round, like the points on the map they stand for */
.dot-green, .dot-amber, .dot-grey { border-radius: 50%; }
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-grey { background: var(--muted); }

.map-tip { border-radius: 8px; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 7px 10px; font-size: .82em; }
.map-tip-title { font-weight: 700; color: var(--fao-900); }
.map-tip-sub { color: var(--ink-2); margin-top: 2px; }
.leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: var(--shadow-lg); }
.leaflet-popup-content { margin: 12px 14px; }
/* a busy place has more activities than the map can show: popup options.maxHeight caps this box and
   Leaflet adds .leaflet-popup-scrolled (overflow:auto) — its rule loads after this file, so it takes
   two classes here to keep the scrollbar tidy and the place's name always in sight */
.map-pop .leaflet-popup-content {
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
    padding-right: 4px;
}
.map-pop .leaflet-popup-content::-webkit-scrollbar { width: 8px; }
.map-pop .leaflet-popup-content::-webkit-scrollbar-thumb { background: #C2CFDE; border-radius: 4px; }
.map-pop .leaflet-popup-content::-webkit-scrollbar-track { background: transparent; }
.map-pop-top {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--card);
    padding-bottom: 2px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
}
/* the close button floats in the popup's top-right corner: keep the place name clear of it */
.map-pop-head { font-weight: 700; color: var(--fao-900); padding-right: 16px; }
.map-pop-meta { font-size: .8em; color: var(--ink-2); margin: 2px 0 9px; }
.map-pop-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.map-pop-list li {
    display: grid;
    grid-template-columns: 10px 1fr;
    gap: 2px 8px;
    align-items: baseline;
    font-size: .84em;
    border-top: 1px solid var(--line);
    padding-top: 7px;
}
.map-pop-list li:first-child { border-top: 0; padding-top: 0; }
.map-pop-list .dot { align-self: center; }
.map-pop-event { color: var(--ink); font-weight: 600; }
.map-pop-list small, .map-pop-list a { grid-column: 2; font-size: .9em; }
.map-pop-list small { color: var(--muted); }
.map-pop-more { font-size: .78em; color: var(--muted); margin: 9px 0 0; }

@media (max-width: 1100px) {
    .map-layout { grid-template-columns: 1fr; }
    .map-canvas { height: 372px; }
    .rank-list { max-height: 260px; }
}

/* ------------------------------------------------ project cards ------------------------------------------------ */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.project-grid-page { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

.project-card {
    display: flex;
    flex-direction: column;
    gap: 9px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    color: inherit;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
}
a.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--fao-300); color: inherit; }
.project-card header { display: flex; align-items: center; justify-content: space-between; }
.project-card h3 { font-size: 1.04em; }
.project-card .muted { font-size: .84em; margin: 0; }
.project-card-lg { padding: 20px; }
/* the corner that holds the donut and the administrator's BAST / delete buttons */
.card-side { display: inline-flex; align-items: center; gap: 5px; }
a.project-card.is-closed { border-color: #A9D2BC; box-shadow: inset 4px 0 0 var(--green), var(--shadow); }
.proj-flag { margin: -3px 0 1px; }
.hint.is-warn { color: #A96F14; }

.donut-sm { display: inline-grid; place-items: center; }
.donut-sm svg { display: block; }

.progress {
    height: 8px;
    background: var(--fao-100);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}
.progress i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--fao-500), var(--fao-700));
    border-radius: 999px;
}
.progress-lg { height: 22px; }
.progress-lg i { background: linear-gradient(90deg, #2E8FD6, var(--fao-600)); }
.progress-lg span {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: .74em;
    font-weight: 700;
    color: var(--fao-900);
    letter-spacing: .02em;
}
.project-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: .8em;
    color: var(--muted);
}
.project-card-meta strong { color: var(--fao-800); }

.clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ------------------------------------------------ meta grids ------------------------------------------------ */
.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 18px;
    margin: 4px 0 0;
}
.meta-grid-3 { grid-template-columns: repeat(3, 1fr); }
.meta-grid dt {
    font-size: .7em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    margin-bottom: 2px;
}
.meta-grid dd { margin: 0; font-size: .88em; color: var(--ink); font-weight: 550; }

/* ------------------------------------------------ project hero ------------------------------------------------ */
.project-hero { display: flex; flex-direction: column; gap: 18px; }
.hero-stats {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}
.hero-kpis { display: flex; gap: 26px; flex-wrap: wrap; }
.hero-kpis > div { display: flex; flex-direction: column; }
.hero-kpis strong { font-size: 1.5em; color: var(--fao-900); letter-spacing: -.02em; }
.hero-kpis span { font-size: .72em; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.c-green { color: var(--green) !important; }
.c-blue { color: var(--fao-600) !important; }
.c-amber { color: var(--amber) !important; }

.prose { color: var(--ink-2); font-size: .92em; margin: 0; }
.prose-list { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: .92em; display: flex; flex-direction: column; gap: 7px; }
.prose-list li::marker { color: var(--fao-500); }

/* ------------------------------------------------ tables ------------------------------------------------ */
/* The scroller keeps both scrollbars inside the visible box, so the horizontal one is
   always reachable instead of sitting at the very bottom of a long table. */
.table-scroller { position: relative; }
.table-wrap {
    overflow: auto;
    max-height: 72vh;
    margin: 0 -6px;
    padding: 0 6px;
    overscroll-behavior-x: contain;
    scrollbar-color: var(--fao-400) #E7EEF8;
    scrollbar-width: thin;
}
.table-wrap::-webkit-scrollbar { width: 12px; height: 14px; }
.table-wrap::-webkit-scrollbar-track { background: #E7EEF8; border-radius: 9px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--fao-400); border-radius: 9px; border: 3px solid #E7EEF8; }
.table-wrap::-webkit-scrollbar-thumb:hover { background: var(--fao-600); }
.table-wrap::-webkit-scrollbar-corner { background: #E7EEF8; }

.scroll-x {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    width: 32px; height: 54px;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255,255,255,.93);
    color: var(--fao-700);
    font-size: 1.35em;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow);
    opacity: .9;
}
.table-scroller.has-overflow .scroll-x { display: inline-flex; }
.scroll-x:hover { background: var(--fao-100); border-color: var(--fao-300); opacity: 1; }
.scroll-x:disabled { opacity: .25; cursor: default; }
.scroll-x-l { left: 6px; }
.scroll-x-r { right: 6px; }

.table { width: 100%; border-collapse: collapse; font-size: .88em; }
.table th {
    text-align: left;
    font-size: .7em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    padding: 8px 10px;
    border-bottom: 2px solid var(--line);
    white-space: nowrap;
}
/* sticky header survives the internal vertical scroll */
.table-wrap .table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--card);
    border-bottom: 0;
    box-shadow: inset 0 -2px 0 var(--line);
}
.table td { padding: 9px 10px; border-bottom: 1px solid #EDF2F8; vertical-align: top; }
.table tbody tr:hover { background: var(--fao-50); }
.table-compact td { padding: 7px 10px; }
.table-sm { font-size: .84em; }
.col-no { width: 34px; color: var(--muted); }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }
.col-actions .btn + .btn { margin-left: 4px; }

.event-name { font-weight: 600; color: var(--fao-900); }
/* Activity titles run to 200+ characters; on a narrow column they stack into six wrapped
   lines that push every other row out of view, so this one column carries the extra width. */
.col-event { min-width: 440px; }
.col-event .event-name { display: block; line-height: 1.45; overflow-wrap: break-word; }
.sub { display: block; font-size: .78em; color: var(--muted); font-weight: 500; }

/* start / end date columns */
.date-cell { width: 88px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* extra MoV wording under the five document rows */
.mov-item {
    display: block;
    width: fit-content;
    max-width: 100%;
    padding: 2px 7px;
    border: 1px solid #BFE3CF;
    border-radius: 7px;
    background: #EAF7EF;
    color: #177A4B;
    font-size: .74em;
    font-weight: 600;
    line-height: 1.35;
}

.result-details { margin-top: 5px; font-size: .84em; }
.result-details summary {
    cursor: pointer;
    color: var(--fao-600);
    font-weight: 600;
    font-size: .84em;
}
.result-details[open] summary { margin-bottom: 4px; }
.result-details p { margin: 0 0 4px; color: var(--ink-2); background: var(--fao-50); padding: 8px 10px; border-radius: 8px; }

.empty-note {
    text-align: center;
    color: var(--muted);
    padding: 22px 0 8px;
    font-size: .9em;
}

.audit-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.audit-list li {
    display: flex;
    gap: 11px;
    padding: 9px 2px;
    border-bottom: 1px solid #EDF2F8;
    font-size: .86em;
    align-items: baseline;
}
.audit-list li:last-child { border-bottom: 0; }
.audit-list small { display: block; color: var(--muted); font-size: .78em; }

/* ------------------------------------------------ filters / inputs ------------------------------------------------ */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters-bar .input { max-width: 260px; }

input, select, textarea {
    font: inherit;
    font-size: .92em;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    transition: border-color .12s, box-shadow .12s;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--fao-500);
    box-shadow: 0 0 0 3px rgba(68,124,196,.18);
}
.input-sm { padding: 6px 9px; font-size: .84em; width: auto; }
.filters .input-sm { width: auto; }
.input-xs { padding: 4px 8px; font-size: .8em; width: auto; }
.status-edit { min-width: 108px; }
.search-input { max-width: 240px; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.field > span { font-size: .8em; font-weight: 650; color: var(--ink-2); }
.field input, .field select, .field textarea { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: .78em; color: var(--muted); margin: -4px 0 12px; }

/* ------------------------------------------------ forms & alerts ------------------------------------------------ */
.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: .88em;
    margin-bottom: 14px;
    border: 1px solid;
}
.alert-error { background: #FBECEC; border-color: #F2CFCF; color: #A03030; }
.alert-success { background: #E5F5EC; border-color: #C4E8D4; color: #177A4B; }
.alert-info { background: var(--fao-50); border-color: var(--fao-200); color: var(--fao-800); }
.alert a { font-weight: 700; text-decoration: underline; }

/* ------------------------------------------------ auth pages ------------------------------------------------ */
.guest-body {
    min-height: 100vh;
    background:
        radial-gradient(1100px 500px at 85% -10%, rgba(68,124,196,.20), transparent 60%),
        radial-gradient(800px 400px at -10% 110%, rgba(27,79,138,.16), transparent 60%),
        var(--bg);
}
.auth-split {
    display: grid;
    grid-template-columns: minmax(380px, 46%) 1fr;
    min-height: 100vh;
}
.auth-brand {
    background: linear-gradient(160deg, var(--fao-900) 0%, var(--fao-800) 55%, var(--fao-700) 100%);
    color: #D5E2F2;
    display: flex;
    flex-direction: column;
    padding: 44px 48px 30px;
    position: relative;
    overflow: hidden;
}
.auth-brand::after {
    content: "";
    position: absolute;
    right: -140px; bottom: -140px;
    width: 380px; height: 380px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(110,155,212,.28), transparent 65%);
    pointer-events: none;
}
.auth-brand-inner { position: relative; z-index: 1; max-width: 520px; }
.auth-logo-row { display: flex; align-items: center; gap: 22px; margin-bottom: 44px; }
.auth-logo {
    width: 168px; height: auto;
    object-fit: contain;
    filter: drop-shadow(0 8px 22px rgba(6,20,38,.35));
}
.auth-app { color: #fff; font-size: 1.5em; font-weight: 800; letter-spacing: .02em; line-height: 1.1; }
.auth-tag { color: var(--fao-300); font-size: .84em; }
.auth-brand h2 { color: #fff; font-size: 1.65em; margin-bottom: 14px; }
.auth-brand > .auth-brand-inner p { color: #B9CBE2; font-size: .95em; max-width: 46ch; }
.auth-points { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.auth-points li {
    padding: 11px 15px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
    font-size: .88em;
}
.auth-points li strong { color: #fff; }
.auth-brand-foot { margin-top: auto; padding-top: 30px; font-size: .76em; color: #8FA6C4; position: relative; z-index: 1; }

.auth-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 28px;
}
.auth-card {
    width: 100%;
    max-width: 430px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    padding: 32px 34px;
}
.auth-card h1 { font-size: 1.45em; margin-bottom: 5px; }
.auth-links {
    display: flex;
    gap: 10px;
    justify-content: center;
    font-size: .86em;
    margin-top: 16px;
    color: var(--muted);
}
.demo-mail {
    margin-bottom: 14px;
    border: 1px solid #C4E8D4;
    background: #F0FAF5;
    border-radius: 10px;
    padding: 13px 15px;
    font-size: .86em;
}
.demo-mail strong { color: #177A4B; }
.auth-foot { margin-top: 18px; font-size: .76em; color: var(--muted); }

/* ------------------------------------------------ admin ------------------------------------------------ */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
.mini-stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
}
.mini-num { font-size: 1.5em; font-weight: 750; color: var(--fao-900); letter-spacing: -.02em; }
.mini-lbl { font-size: .74em; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.mini-stat.warn .mini-num { color: var(--amber); }
.mini-stat.ok .mini-num { color: var(--green); }

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--line);
    margin-bottom: 18px;
    overflow-x: auto;
}
.tab {
    border: 0;
    background: none;
    font: inherit;
    font-weight: 600;
    font-size: .92em;
    color: var(--muted);
    padding: 9px 16px;
    cursor: pointer;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -2px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}
.tab:hover { color: var(--fao-700); }
.tab.active { color: var(--fao-800); border-bottom-color: var(--fao-600); }
.tab-badge {
    background: var(--amber);
    color: #fff;
    border-radius: 999px;
    font-size: .72em;
    font-weight: 700;
    padding: 1px 7px;
}
.user-cell { display: flex; align-items: center; gap: 10px; }
.empty-card { text-align: center; padding: 44px 20px; }
.empty-card h3 { margin: 10px 0 5px; }
.empty-ic {
    width: 54px; height: 54px;
    margin: 0 auto;
    border-radius: 50%;
    background: #E5F5EC;
    color: var(--green);
    display: grid;
    place-items: center;
}
.empty-ic .ic { width: 26px; height: 26px; }

/* ------------------------------------------------ modal ------------------------------------------------ */
dialog.modal {
    border: 0;
    padding: 0;
    background: transparent;
    max-width: min(560px, calc(100vw - 32px));
    width: 100%;
}
dialog.modal::backdrop { background: rgba(10,31,56,.5); backdrop-filter: blur(3px); }
.modal-card {
    background: var(--card);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
}
.modal-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.modal-card header h3 { font-size: 1.1em; }
.modal-x {
    border: 0;
    background: var(--fao-50);
    color: var(--muted);
    width: 30px; height: 30px;
    border-radius: 8px;
    font-size: 1.2em;
    cursor: pointer;
    line-height: 1;
}
.modal-x:hover { background: var(--fao-100); color: var(--ink); }
.modal-card footer { display: flex; justify-content: flex-end; gap: 9px; margin-top: 6px; }
dialog.modal .modal-card { max-height: calc(100vh - 48px); overflow-y: auto; }
dialog.modal.modal-lg { max-width: min(720px, calc(100vw - 32px)); }

/* Import activity: the sheet preview is a wide table, so the dialog is wider than the rest */
dialog.modal#import-modal { max-width: min(1120px, calc(100vw - 32px)); }
#import-modal .import-note { background: var(--fao-50); border-radius: 10px; padding: 9px 12px; font-size: .92em; }
#import-modal .import-template { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
#import-table { min-width: 940px; }
#import-table td { vertical-align: top; }
#import-table .import-project { min-width: 96px; }
.import-notes { display: block; margin-top: 3px; font-size: .82em; line-height: 1.35; }
tr.import-no-event td, tr.import-no-project td { color: var(--muted); }
tr.import-no-event .import-notes { color: var(--red); }
tr.import-alike { background: #FFF8EA; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.field .req { color: var(--danger, #D64545); }
.auto-tag {
    font-style: normal; font-size: .74em; font-weight: 700; letter-spacing: .04em;
    color: var(--fao-700); background: var(--fao-50); border: 1px solid var(--fao-100);
    border-radius: 5px; padding: 1px 5px; margin-left: 5px;
}
.field input.is-auto { background: #F4F8FD; border-color: var(--fao-200); color: var(--ink-2); }
.doc-event-line { margin: -6px 0 12px; font-size: .9em; }

/* ------------------------------------------- searchable dropdown ---------------------------------- */
/* the select behind data-combo keeps the real value; the box in front of it is what the user types in */
.combo-select { display: none; }
.combo-panel {
    margin-top: 6px;
    max-height: 262px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--fao-200, #BBE0F0);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(16, 42, 67, .13);
}
.combo-group {
    position: sticky; top: 0; z-index: 1;
    margin: 0; padding: 5px 9px;
    font-size: .7em; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
    color: var(--fao-800, #14456E); background: var(--fao-50, #EFF7FC);
    border-bottom: 1px solid var(--fao-100, #DBEEF9);
}
.combo-row, .combo-other {
    display: flex; align-items: baseline; gap: 8px; width: 100%;
    padding: 7px 9px; border: 0; border-radius: 7px;
    background: none; color: var(--ink); font-size: .86em; text-align: left; cursor: pointer;
}
.combo-row:hover { background: var(--fao-50, #EFF7FC); }
.combo-row.is-active { background: var(--fao-50, #EFF7FC); box-shadow: inset 0 0 0 1px var(--fao-300, #A9C7E8); }
.combo-prov { margin-left: auto; font-size: .86em; color: var(--muted); white-space: nowrap; }
.combo-more {
    margin: 0; padding: 6px 9px;
    font-size: .76em; font-style: italic; color: var(--muted);
}
.combo-other {
    margin-top: 3px; border-radius: 0 0 7px 7px;
    border-top: 1px dashed var(--line, #E2E8F0);
    color: var(--fao-700, #1E5A96); font-weight: 650;
}
.combo-input.combo-manual {
    border-style: dashed; border-color: #E3B341; background: #FFFDF6;
}

/* row action icon buttons */
.row-actions { display: inline-flex; gap: 4px; justify-content: flex-end; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; padding: 0;
    border: 1px solid var(--line, #E2E8F0); background: #fff; color: var(--fao-700, #1E5A96);
    border-radius: 8px; cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.icon-btn .ic { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--fao-50); border-color: var(--fao-300, #A9C7E8); }
.icon-btn-danger { color: #D64545; }
.icon-btn-danger:hover { background: #FCECEC; border-color: #F0B4B4; }

/* the five MoV documents of an activity, each with its own Drive link action */
.doc-cell { white-space: normal; min-width: 340px; }
.doc-group { display: flex; align-items: center; gap: 7px; margin: 3px 0; }
.doc-kind {
    flex: 0 0 112px; font-size: .68em; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: var(--fao-700); background: var(--fao-50); border: 1px solid var(--fao-100);
    border-radius: 5px; padding: 2px 6px; text-align: center;
}
.doc-item { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.doc-link {
    display: inline-flex; align-items: center; gap: 5px; min-width: 0;
    color: var(--fao-700); text-decoration: none; font-size: .82em; font-weight: 550;
    border: 1px solid transparent; border-radius: 7px; padding: 2px 6px; max-width: 190px;
}
.doc-link:hover { background: var(--fao-50); border-color: var(--fao-100); text-decoration: none; }
.doc-link .ic-xs { flex: 0 0 auto; }
.doc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-del {
    flex: 0 0 auto; border: 0; background: transparent; color: var(--muted);
    width: 20px; height: 20px; border-radius: 6px; font-size: 1em; line-height: 1; cursor: pointer;
}
.doc-del:hover { background: #FCECEC; color: #D64545; }
.doc-none { color: var(--muted); font-size: .8em; font-style: italic; }
.doc-file-cell { max-width: 260px; }
/* the small add / change action that sits beside every MoV item */
.icon-btn-xs { width: 25px; height: 25px; border-radius: 7px; }
.icon-btn-xs .ic { width: 13px; height: 13px; }
.mov-extra { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 7px; padding-top: 6px; border-top: 1px dashed var(--line); }
.mov-extra-key { font-size: .68em; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sheet-row-empty td { color: var(--muted); }
.sheet-note { font-size: .78em; margin: 10px 0 0; }
.icon-btn:disabled { opacity: .55; cursor: progress; }
.icon-btn.is-busy { background: var(--fao-50); border-color: var(--fao-300, #A9C7E8); color: var(--fao-700); }

/* e-mail reminder */
.icon-btn-mail { color: #1F9D61; }
.icon-btn-mail:hover { background: #F0FAF5; border-color: #C4E8D4; }
/* document link already recorded */
.icon-btn-set { color: var(--fao-700); background: var(--fao-50); border-color: var(--fao-200); }
.doc-url { word-break: break-all; }
.field small { font-size: .74em; color: var(--muted); }
/* read-only status for staff: only an administrator, or the automatic flip, changes it */
.status-static { display: flex; align-items: center; min-height: 34px; }
#status-hint { line-height: 1.45; }
.mail-preview { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: .84em; }
.mail-row { display: grid; grid-template-columns: 72px 1fr; gap: 10px; padding: 2px 0; }
.mail-key { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: .82em; letter-spacing: .04em; }
.mail-body {
    grid-column: 1 / -1; margin: 10px 0 0; padding: 12px 14px;
    background: var(--bg); border-radius: 8px; white-space: pre-wrap;
    font-family: inherit; font-size: .95em; max-height: 300px; overflow: auto;
}

/* ------------------------------------- reminder: ask first, then report ------------------------------ */
/* the styled replacement for the browser's own confirm box */
.mail-card { gap: 14px; }
.mail-hero { display: flex; gap: 14px; align-items: flex-start; }
.mail-hero-ic {
    flex: none;
    width: 46px; height: 46px;
    border-radius: 14px;
    display: grid; place-items: center;
    color: #fff;
    background: linear-gradient(150deg, var(--green), #177A4B);
    box-shadow: 0 10px 22px -10px rgba(31, 157, 97, .8);
}
.mail-hero-ic .ic { width: 22px; height: 22px; }
.mail-hero h3 { font-size: 1.06em; }
.mail-hero-event { font-weight: 650; line-height: 1.42; margin-top: 3px; }
.mail-hero-when { font-size: .82em; color: var(--muted); margin-top: 3px; }

.mail-to-wrap {
    display: grid; gap: 9px;
    border: 1px solid var(--fao-200);
    background: var(--fao-50);
    border-radius: 12px;
    padding: 12px 14px;
}
.mail-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mail-chip {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--card);
    border: 1px solid var(--fao-200);
    border-radius: 999px;
    padding: 4px 12px 4px 4px;
    font-size: .84em;
    max-width: 100%;
}
.mail-chip-av {
    flex: none;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: .78em; font-weight: 700; color: #fff;
    background: linear-gradient(150deg, var(--fao-500), var(--fao-700));
}
.mail-chip b { font-weight: 650; color: var(--fao-900); }
.mail-chip i { font-style: normal; color: var(--muted); word-break: break-all; }
.mail-chip-none { border-style: dashed; background: #FDF7EC; border-color: #F2DDB8; color: #8A5A12; }

.mail-rows { display: grid; gap: 3px; }
.mail-note {
    font-size: .82em; line-height: 1.5;
    color: var(--ink-2);
    background: var(--fao-50);
    border: 1px solid var(--fao-100);
    border-radius: 10px;
    padding: 10px 13px;
}
.mail-note-warn { background: #FDF7EC; border-color: #F2DDB8; color: #8A5A12; }
.btn-mail-send {
    background: linear-gradient(160deg, var(--green), #177A4B);
    box-shadow: 0 6px 16px -6px rgba(31, 157, 97, .65);
}
.btn-mail-send:hover { background: linear-gradient(160deg, #177A4B, #0F5C38); color: #fff; }

.demo-mail { display: flex; gap: 12px; align-items: flex-start; }
.mail-result-ic {
    flex: none;
    width: 36px; height: 36px;
    border-radius: 11px;
    display: grid; place-items: center;
    background: #D8F0E3; color: #177A4B;
}
.mail-result-ic .ic { width: 19px; height: 19px; }
#mail-recipients { margin: -4px 0 12px; }

/* activity highlighted after opening a reminder link */
.act-row.act-focus > td { background: #FFF7E0; box-shadow: inset 0 2px 0 #E39A2D, inset 0 -2px 0 #E39A2D; transition: background .3s; }

/* printable activity sheet */
.sheet { margin-bottom: 16px; }
.sheet-title { font-size: 1.35em; margin-bottom: 14px; }
.sheet-sub { font-size: 1.05em; margin-bottom: 12px; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 22px; margin: 0; }
.sheet-grid > div { display: flex; flex-direction: column; gap: 2px; }
.sheet-grid dt { font-size: .74em; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #8A97A8); font-weight: 700; }
.sheet-grid dd { margin: 0; font-size: .95em; }
.sheet-block { margin-top: 18px; }
.sheet-block h3 { font-size: .95em; margin-bottom: 6px; }
.doc-notes-row td { font-size: .88em; }

/* ------------------------------------------------ toasts ------------------------------------------------ */
.toasts {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    z-index: 100;
    max-width: min(360px, calc(100vw - 40px));
}
.toast {
    background: var(--fao-900);
    color: #fff;
    border-radius: 12px;
    padding: 12px 15px;
    font-size: .88em;
    font-weight: 550;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border-left: 3px solid rgba(255, 255, 255, .38);
    cursor: pointer;
    animation: toast-in .22s ease;
}
.toast-ic { flex: none; display: grid; place-items: center; margin-top: 1px; }
.toast-ic .ic { width: 17px; height: 17px; }
.toast-text { line-height: 1.45; }
.toast-success { background: linear-gradient(150deg, #1F9D61, #177A4B); }
.toast-error { background: linear-gradient(150deg, #D64545, #B03030); }
.toast-warn { background: linear-gradient(150deg, #E39A2D, #C87F14); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------ print-only helpers ------------------------------------------------ */
.print-header, .print-only { display: none; }

/* ------------------------------------------- public (guest) shell ------------------------------------- */
.pub-body {
    min-height: 100vh;
    background:
        radial-gradient(1100px 480px at 88% -12%, rgba(68,124,196,.22), transparent 62%),
        radial-gradient(760px 420px at -8% 108%, rgba(27,79,138,.15), transparent 60%),
        var(--bg);
}
.pub-wrap { display: flex; flex-direction: column; min-height: 100vh; }
.pubbar {
    display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
    padding: 12px 26px;
    background:
        radial-gradient(120% 180% at 0% 0%, rgba(110,155,212,.35), transparent 60%),
        linear-gradient(120deg, var(--fao-950), var(--fao-900) 45%, var(--fao-700));
    color: #D5E5F8;
    position: sticky; top: 0; z-index: 30;
    box-shadow: 0 10px 26px -14px rgba(10,31,56,.55);
}
.pub-brand { display: flex; align-items: center; gap: 12px; color: inherit; }
.pub-logo { display: block; flex: none; }
.pub-logo img { width: 78px; height: auto; filter: drop-shadow(0 3px 8px rgba(6,20,38,.5)); }
.pub-brand-text { display: flex; flex-direction: column; line-height: 1.18; }
.pub-brand-text strong { color: #fff; font-size: 1.12em; font-weight: 800; letter-spacing: .02em; }
.pub-brand-text small { color: var(--fao-300); font-size: .72em; }
.pub-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.pub-link {
    padding: 8px 14px; border-radius: var(--radius-sm);
    color: #C6DAF2; font-weight: 650; font-size: .92em;
    transition: background .15s ease, color .15s ease;
}
.pub-link:hover { background: rgba(159,190,230,.16); color: #fff; }
.pub-link.active { background: var(--fao-300); color: var(--fao-950); }
.pub-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.pub-tag {
    padding: 5px 11px; border-radius: 999px;
    border: 1px solid rgba(159,190,230,.34);
    color: var(--fao-200); font-size: .72em; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
}
.pub-actions .btn-soft { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.26); color: #E7F1FD; }
.pub-actions .btn-soft:hover { background: rgba(255,255,255,.2); color: #fff; }
.pub-actions .btn-primary { background: #fff; border-color: #fff; color: var(--fao-800); }
.pub-actions .btn-primary:hover { background: var(--fao-100); color: var(--fao-900); }
.pub-actions .btn .ic, .pub-actions .btn-primary .ic { fill: none; stroke: currentColor; }

.pub-notice {
    display: flex; align-items: flex-start; gap: 13px;
    padding: 14px 16px; margin-bottom: 20px;
    background: linear-gradient(120deg, var(--fao-50), #E7F0FB);
    border: 1px solid var(--fao-200); border-left: 4px solid var(--fao-500);
    border-radius: var(--radius-sm); color: var(--ink-2); font-size: .92em;
}
.pub-notice-ic {
    flex: none; width: 32px; height: 32px; display: grid; place-items: center;
    border-radius: 9px; background: var(--fao-100); color: var(--fao-700);
}
.pub-notice-ic .ic { width: 17px; height: 17px; }
.pub-notice strong { color: var(--fao-900); }
.pub-notice a { font-weight: 700; }

.pubfoot {
    margin-top: auto; padding: 22px 26px 26px;
    background: var(--card); border-top: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 12px; align-items: flex-start;
}
.pubfoot-main { display: flex; gap: 14px; align-items: flex-start; max-width: 1460px; width: 100%; margin: 0 auto; }
.pubfoot strong { color: var(--fao-900); font-size: .96em; }
.pubfoot p { margin: 3px 0 0; color: var(--muted); font-size: .84em; max-width: 78ch; }
.pubfoot > span { color: var(--muted); font-size: .76em; }

/* ------------------------------------------- add new project card ------------------------------------- */
.project-card-add {
    align-items: flex-start; text-align: left;
    border: 1.5px dashed var(--fao-400);
    background: linear-gradient(160deg, var(--fao-50), #E9F1FB);
    box-shadow: none; color: inherit; cursor: pointer;
    font: inherit;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.project-card-add h3 { color: var(--fao-800); }
button.project-card-add:hover, a.project-card-add:hover {
    transform: translateY(-3px); border-color: var(--fao-600); border-style: solid;
    box-shadow: var(--shadow); background: linear-gradient(160deg, #fff, var(--fao-50)); color: inherit;
}
.add-ic {
    width: 40px; height: 40px; display: grid; place-items: center;
    border-radius: 12px; background: var(--fao-600); color: #fff;
    box-shadow: 0 8px 18px -8px rgba(27,79,138,.7);
}
.add-ic .ic { width: 21px; height: 21px; }
.add-cta {
    margin-top: auto; display: inline-flex; align-items: center; gap: 7px;
    font-size: .84em; font-weight: 750; color: var(--fao-700);
}
.add-cta .ic { width: 15px; height: 15px; }
.project-card-add.is-locked { border-color: #C9D6E6; background: linear-gradient(160deg, #F7FAFD, #EDF2F8); }
.project-card-add.is-locked .add-ic { background: var(--fao-300); color: var(--fao-900); box-shadow: none; }
.project-card-add.is-locked .add-cta { color: var(--muted); }

/* -------------------------------------------------- sign-in note -------------------------------------- */
.auth-note { margin: 12px 0 0; font-size: .82em; }

/* ------------------------------------------------- manager dashboard ------------------------------------ */
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.kpi-alert { border-color: #F3D7A8; background: linear-gradient(150deg, #FFF9EE, #fff); }
.callout {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 13px 16px; margin-bottom: 18px; border-radius: var(--radius-sm);
    border: 1px solid #F3D7A8; background: linear-gradient(120deg, #FFF8EC, #FDF3E2); color: #7A5312;
}
.callout-warn strong { color: #8A4B08; }
.callout-ic {
    flex: none; width: 30px; height: 30px; display: grid; place-items: center;
    border-radius: 9px; background: rgba(227,154,45,.18); color: #B87515;
}
.callout-ic .ic { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.callout a { font-weight: 700; text-decoration: underline; }
.progress-cell { min-width: 160px; }
.progress-cell .progress { display: inline-block; width: 100px; vertical-align: middle; margin-right: 8px; }
.activity-feed { margin-bottom: 20px; }
.feed-detail { display: block; color: var(--muted); font-size: .86em; }
.quick-card { margin-bottom: 20px; }
.quick-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.quick {
    display: flex; flex-direction: column; gap: 3px; padding: 13px 15px;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--fao-50); color: inherit;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.quick:hover { transform: translateY(-2px); border-color: var(--fao-300); box-shadow: var(--shadow); color: inherit; }
.quick-ic { color: var(--fao-600); }
.quick-ic .ic { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; }
.quick strong { color: var(--fao-900); font-size: .93em; }
.quick small { color: var(--muted); font-size: .78em; }
dialog.modal-lg { max-width: 760px; }

/* ------------------------------------------------ responsive ------------------------------------------------ */
@media (max-width: 1240px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
    .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: var(--shadow-lg);
    }
    .shell.nav-open .sidebar { transform: translateX(0); }
    .burger { display: grid; place-items: center; }
    .auth-split { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .meta-grid-3 { grid-template-columns: repeat(2, 1fr); }
    .pubbar { gap: 12px 16px; padding: 11px 18px; }
    .pub-actions { margin-left: 0; }
    .pub-tag { display: none; }
    .page-actions .btn { flex: 1; justify-content: center; }
}
@media (max-width: 720px) {
    .content { padding: 16px 14px 32px; }
    .topbar { padding: 12px 14px; }
    .topbar-right { display: none; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-stats { grid-template-columns: repeat(2, 1fr); }
    .page-head { flex-direction: column; }
    .grid-2 { grid-template-columns: 1fr; }
    .meta-grid, .meta-grid-3 { grid-template-columns: 1fr; }
    .hero-stats { gap: 18px; }
    .foot { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
