:root {
    color-scheme: light;
    --ink: #19302a;
    --muted: #687b74;
    --muted-2: #87968f;
    --forest: #173f36;
    --forest-2: #245b4d;
    --leaf: #34745e;
    --mint: #dcebe4;
    --mint-2: #eef5f1;
    --sand: #f4f1e9;
    --paper: #fcfdfb;
    --white: #fff;
    --line: #dce4df;
    --line-strong: #cbd7d0;
    --amber: #b97826;
    --amber-soft: #fff1d9;
    --red: #a7473d;
    --red-soft: #fae8e5;
    --blue: #386b81;
    --blue-soft: #e4f0f5;
    --shadow-sm: 0 4px 16px rgba(23, 63, 54, .07);
    --shadow-lg: 0 24px 64px rgba(19, 48, 41, .2);
    --radius: 18px;
    --radius-sm: 11px;
    --sidebar: 238px;
    --topbar: 74px;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--sand); scroll-behavior: smooth; }

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background:
        radial-gradient(circle at 80% -10%, rgba(168, 203, 183, .24), transparent 35%),
        var(--sand);
    color: var(--ink);
}

button, input, select, textarea { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
img { display: block; max-width: 100%; }
a { color: var(--forest-2); }

:focus-visible {
    outline: 3px solid rgba(52, 116, 94, .35);
    outline-offset: 2px;
}

.skip-link {
    position: fixed;
    top: -60px;
    left: 16px;
    z-index: 200;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--forest);
    color: white;
}
.skip-link:focus { top: 12px; }

.offline-banner {
    position: fixed;
    inset: 0 0 auto;
    z-index: 150;
    padding: 8px 16px;
    background: var(--amber-soft);
    color: #6f4313;
    font-size: .82rem;
    font-weight: 750;
    text-align: center;
}

.app-shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    display: flex;
    width: var(--sidebar);
    flex-direction: column;
    padding: 22px 14px 16px;
    overflow-y: auto;
    background: var(--forest);
    color: rgba(255,255,255,.82);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 22px;
    color: white;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 13px 13px 13px 4px;
    background: rgba(255,255,255,.1);
    font-family: Georgia, serif;
    font-size: 1.45rem;
    font-weight: 700;
}

.brand-copy { display: grid; line-height: 1.1; }
.brand-copy strong { font-family: Georgia, serif; font-size: 1.15rem; letter-spacing: .04em; }
.brand-copy small { margin-top: 4px; color: rgba(255,255,255,.6); font-size: .72rem; }

.side-nav { display: grid; gap: 4px; }
.nav-link, .quiet-control {
    display: flex;
    width: 100%;
    min-height: 45px;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: inherit;
    font-size: .87rem;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
}
.nav-link > span, .quiet-control > span { width: 20px; color: #add1c0; font-size: 1.15rem; text-align: center; }
.nav-link:hover, .quiet-control:hover { background: rgba(255,255,255,.07); color: white; }
.nav-link.is-active { background: rgba(255,255,255,.13); color: white; box-shadow: inset 3px 0 #9bc8ad; }
.nav-count {
    min-width: 22px;
    margin-left: auto;
    padding: 3px 6px;
    border-radius: 20px;
    background: rgba(255,255,255,.12);
    color: #d9eee2;
    font-size: .68rem;
    text-align: center;
}

.sidebar-foot { display: grid; gap: 4px; margin-top: auto; padding-top: 26px; }
.sidebar-note {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 13px 10px 4px;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: .72rem;
}
.sidebar-note > span:last-child { display: grid; }
.sidebar-note small { margin-top: 3px; color: rgba(255,255,255,.5); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #7fd09f; box-shadow: 0 0 0 4px rgba(127,208,159,.12); }

.app-column { grid-column: 2; min-width: 0; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    min-height: var(--topbar);
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 11px clamp(20px, 3vw, 42px);
    border-bottom: 1px solid rgba(203, 215, 208, .8);
    background: rgba(252,253,251,.88);
    backdrop-filter: blur(16px);
}

.project-control { display: flex; min-width: 0; align-items: center; gap: 10px; }
.plot-dot { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: var(--leaf); }
.project-control label { display: grid; min-width: 0; }
.project-control small { color: var(--muted); font-size: .67rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.project-control select {
    max-width: 280px;
    padding: 2px 24px 2px 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: .88rem;
    font-weight: 750;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.sync-status { color: var(--muted-2); font-size: .73rem; }
.icon-button {
    position: relative;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--white);
    cursor: pointer;
}
.icon-button:hover { border-color: var(--line-strong); background: var(--mint-2); }
.icon-button b {
    position: absolute;
    top: -4px;
    right: -4px;
    display: grid;
    min-width: 20px;
    height: 20px;
    place-items: center;
    padding: 0 5px;
    border: 2px solid white;
    border-radius: 20px;
    background: var(--red);
    color: white;
    font-size: .62rem;
}
.account-button {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
    padding: 5px 8px 5px 5px;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    cursor: pointer;
}
.account-button:hover { border-color: var(--line); background: var(--white); }
.avatar {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    border-radius: 12px;
    background: var(--mint);
    color: var(--forest);
    font-weight: 800;
}
.account-copy { display: grid; max-width: 150px; text-align: left; }
.account-copy strong, .account-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: .8rem; }
.account-copy small { margin-top: 2px; color: var(--muted); font-size: .66rem; }

.workspace { width: min(1500px, 100%); margin: 0 auto; padding: 34px clamp(20px, 3.2vw, 48px) 110px; }
.loading-state { display: grid; min-height: 55vh; place-items: center; align-content: center; gap: 8px; text-align: center; }
.loading-state p { margin: 0; color: var(--muted); font-size: .9rem; }
.loader { width: 34px; height: 34px; margin-bottom: 8px; border: 3px solid var(--mint); border-top-color: var(--leaf); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-title { margin: 4px 0 7px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.8rem, 3.1vw, 2.7rem); font-weight: 500; line-height: 1.03; letter-spacing: -.025em; }
.page-kicker { margin: 0; color: var(--leaf); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.page-subtitle { max-width: 720px; margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.55; }
.header-actions { display: flex; flex: 0 0 auto; gap: 9px; }

.button {
    display: inline-flex;
    min-height: 43px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: .82rem;
    font-weight: 760;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}
.button.primary { background: var(--forest); color: white; box-shadow: 0 7px 18px rgba(23,63,54,.17); }
.button.primary:hover { background: var(--forest-2); }
.button.secondary { border-color: var(--line-strong); background: var(--white); color: var(--forest); }
.button.secondary:hover { background: var(--mint-2); }
.button.ghost { background: transparent; color: var(--forest-2); }
.button.danger { border-color: #e5bdb7; background: var(--red-soft); color: var(--red); }
.button.small { min-height: 34px; padding: 7px 11px; font-size: .74rem; }
.button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
.metric-card {
    position: relative;
    min-height: 126px;
    padding: 18px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255,255,255,.78);
    box-shadow: var(--shadow-sm);
}
.metric-card::after { content: ""; position: absolute; right: -28px; bottom: -34px; width: 90px; height: 90px; border-radius: 50%; background: var(--mint-2); }
.metric-icon { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; background: var(--mint); color: var(--forest); }
.metric-card strong { display: block; margin-top: 15px; font-family: Georgia, serif; font-size: 1.75rem; font-weight: 500; }
.metric-card small { color: var(--muted); font-size: .75rem; font-weight: 650; }
.metric-card.warning .metric-icon { background: var(--amber-soft); color: var(--amber); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .75fr); gap: 18px; }
.stack { display: grid; align-content: start; gap: 18px; }
.panel {
    min-width: 0;
    padding: 21px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255,255,255,.84);
    box-shadow: var(--shadow-sm);
}
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.panel-head h2, .panel-head h3 { margin: 0; font-family: Georgia, serif; font-size: 1.13rem; font-weight: 600; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: .76rem; }
.link-button { padding: 4px; border: 0; background: transparent; color: var(--leaf); font-size: .75rem; font-weight: 750; cursor: pointer; }

.announcement-card { position: relative; padding: 18px; border-left: 3px solid var(--leaf); border-radius: 0 13px 13px 0; background: var(--mint-2); }
.announcement-card + .announcement-card { margin-top: 10px; }
.announcement-card h3 { margin: 4px 0 7px; font-size: .94rem; }
.announcement-card p { margin: 0; color: #52655e; font-size: .81rem; line-height: 1.55; }
.meta { display: flex; flex-wrap: wrap; gap: 5px 13px; color: var(--muted); font-size: .7rem; }

.action-list { display: grid; gap: 9px; }
.action-row {
    display: grid;
    grid-template-columns: 38px minmax(0,1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--white);
    cursor: pointer;
}
.action-row:hover { border-color: #b9cfc3; transform: translateY(-1px); }
.action-row .action-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; background: var(--mint-2); color: var(--leaf); }
.action-row strong { display: block; font-size: .79rem; }
.action-row small { display: block; margin-top: 3px; color: var(--muted); font-size: .69rem; line-height: 1.3; }
.action-row > span:last-child { color: var(--muted-2); }

.next-event { position: relative; min-height: 250px; padding: 22px; overflow: hidden; background: var(--forest); color: white; }
.next-event::before { content: ""; position: absolute; inset: 0; opacity: .16; background: url('/assets/KSPBackground.png') center/cover; }
.next-event > * { position: relative; }
.next-event .eyebrow { color: #bbdccc; }
.next-event h3 { max-width: 310px; margin: 26px 0 9px; font-family: Georgia, serif; font-size: 1.55rem; font-weight: 500; }
.next-event p { max-width: 330px; color: rgba(255,255,255,.75); font-size: .8rem; line-height: 1.5; }
.next-event .button { margin-top: 18px; background: white; color: var(--forest); }

.eyebrow { margin: 0; color: var(--leaf); font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.badge, .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    border-radius: 20px;
    background: var(--mint-2);
    color: var(--forest-2);
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: .025em;
    text-transform: uppercase;
}
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-badge.warn { background: var(--amber-soft); color: var(--amber); }
.status-badge.danger { background: var(--red-soft); color: var(--red); }
.status-badge.blue { background: var(--blue-soft); color: var(--blue); }
.status-badge.muted { background: #eef0ef; color: #6e7874; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.filters { display: flex; min-width: 0; flex-wrap: wrap; gap: 8px; }
.filter-select, .search-input {
    min-height: 40px;
    padding: 8px 34px 8px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255,255,255,.78);
    color: var(--ink);
    font-size: .76rem;
}
.search-input { width: min(270px, 100%); padding-right: 12px; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; }
.entity-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255,255,255,.9);
    box-shadow: var(--shadow-sm);
    transition: transform .16s ease, border-color .16s ease;
}
.entity-card:hover { border-color: #bdcec5; transform: translateY(-2px); }
.card-image { position: relative; aspect-ratio: 16/7; overflow: hidden; background: var(--mint); }
.card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.entity-card:hover .card-image img { transform: scale(1.025); }
.card-image .status-badge { position: absolute; top: 12px; left: 12px; background: rgba(255,255,255,.92); }
.card-body { padding: 17px; }
.card-body h2, .card-body h3 { margin: 7px 0 7px; font-family: Georgia, serif; font-size: 1.13rem; line-height: 1.2; }
.card-body > p { display: -webkit-box; min-height: 41px; margin: 0 0 14px; overflow: hidden; color: var(--muted); font-size: .78rem; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 13px; border-top: 1px solid var(--line); }
.card-stats { display: flex; gap: 12px; color: var(--muted); font-size: .7rem; }

.detail-hero { position: relative; min-height: 245px; margin-bottom: 18px; overflow: hidden; border-radius: 22px; background: var(--forest); color: white; }
.detail-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .46; }
.detail-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(13,42,34,.93), rgba(13,42,34,.58) 60%, transparent); }
.detail-hero-copy { position: relative; z-index: 1; display: grid; max-width: 680px; min-height: 245px; align-content: end; padding: 28px; }
.detail-hero h1 { margin: 7px 0 8px; font-family: Georgia, serif; font-size: clamp(1.75rem,4vw,2.7rem); font-weight: 500; }
.detail-hero p { margin: 0; color: rgba(255,255,255,.78); font-size: .86rem; line-height: 1.55; }
.detail-hero .meta { margin-top: 16px; color: rgba(255,255,255,.7); }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; padding: 4px; overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.72); }
.tab { min-height: 38px; flex: 0 0 auto; padding: 7px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: .74rem; font-weight: 720; cursor: pointer; }
.tab.is-active { background: var(--forest); color: white; }

.detail-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 18px; }
.info-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }
.info-cell { padding: 14px; border-radius: 13px; background: var(--mint-2); }
.info-cell small { display: block; margin-bottom: 5px; color: var(--muted); font-size: .66rem; font-weight: 700; text-transform: uppercase; }
.info-cell strong { font-size: .8rem; line-height: 1.4; }

.phase-track { display: grid; grid-template-columns: repeat(6,1fr); margin: 18px 0 6px; }
.phase-step { position: relative; padding-top: 19px; color: var(--muted-2); font-size: .6rem; font-weight: 700; text-align: center; }
.phase-step::before { content:""; position:absolute; top:5px; left:0; right:0; height:2px; background:var(--line); }
.phase-step::after { content:""; position:absolute; top:1px; left:calc(50% - 5px); width:10px; height:10px; border:2px solid var(--paper); border-radius:50%; background:var(--line-strong); }
.phase-step.done { color: var(--forest); }
.phase-step.done::before, .phase-step.done::after { background:var(--leaf); }

.plot-map { position: relative; min-height: 390px; overflow: hidden; border-radius: 16px; background: #c5d2c4 url('/assets/ksp-field.svg') center/cover; }
.map-zone { position: absolute; display: grid; place-items: center; min-width: 90px; min-height: 58px; padding: 10px; border: 2px solid rgba(255,255,255,.8); border-radius: 45% 55% 50% 40%; background: rgba(36,91,77,.76); color: white; font-size: .7rem; font-weight: 800; cursor: pointer; box-shadow: 0 7px 20px rgba(0,0,0,.14); }
.map-zone:hover { background: rgba(23,63,54,.9); transform: scale(1.04); }
.map-zone:nth-child(1) { top:16%; left:18%; transform:rotate(-5deg); }
.map-zone:nth-child(2) { top:48%; left:46%; transform:rotate(4deg); background:rgba(74,111,75,.8); }
.map-zone:nth-child(3) { top:23%; right:12%; transform:rotate(7deg); background:rgba(57,100,122,.8); }
.map-legend { position:absolute; right:12px; bottom:12px; display:grid; gap:5px; padding:10px; border-radius:10px; background:rgba(255,255,255,.9); color:var(--ink); font-size:.64rem; box-shadow:var(--shadow-sm); }

.kanban { display: grid; grid-template-columns: repeat(5, minmax(245px,1fr)); gap: 12px; padding-bottom: 8px; overflow-x: auto; scroll-snap-type: x proximity; }
.kanban-column { min-height: 360px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: rgba(236,241,237,.65); scroll-snap-align: start; }
.column-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; padding: 2px 3px; }
.column-head strong { font-size: .73rem; text-transform: uppercase; letter-spacing: .05em; }
.column-head span { min-width:22px; padding:3px 6px; border-radius:20px; background:var(--white); color:var(--muted); font-size:.65rem; text-align:center; }
.proposal-card, .task-card {
    margin-bottom: 9px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--white);
    box-shadow: 0 3px 10px rgba(23,63,54,.04);
    cursor: pointer;
}
.proposal-card:hover, .task-card:hover { border-color: #aec8ba; }
.proposal-card h3, .task-card h3 { margin: 8px 0 7px; font-size: .83rem; line-height: 1.35; }
.proposal-card p, .task-card p { display:-webkit-box; margin:0 0 11px; overflow:hidden; color:var(--muted); font-size:.71rem; line-height:1.45; -webkit-box-orient:vertical; -webkit-line-clamp:2; }
.mini-progress { height: 5px; overflow:hidden; border-radius:10px; background:var(--line); }
.mini-progress span { display:block; height:100%; border-radius:inherit; background:var(--leaf); }

.proposal-layout { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(260px,.65fr); gap:18px; }
.proposal-summary h3 { margin: 20px 0 8px; font-family:Georgia,serif; font-size:1.05rem; }
.proposal-summary p { color:var(--muted); font-size:.82rem; line-height:1.65; }
.response-scale { display:grid; gap:7px; }
.response-option { display:flex; align-items:center; gap:8px; padding:10px; border:1px solid var(--line); border-radius:10px; font-size:.73rem; font-weight:650; cursor:pointer; }
.response-option:hover { background:var(--mint-2); }
.comment { padding:14px 0; border-bottom:1px solid var(--line); }
.comment:last-child { border-bottom:0; }
.comment-head { display:flex; justify-content:space-between; gap:10px; margin-bottom:7px; }
.comment strong { font-size:.77rem; }
.comment p { margin:0; color:#455a52; font-size:.78rem; line-height:1.55; }

.plan-card { padding:22px; }
.plan-top { display:flex; align-items:start; justify-content:space-between; gap:15px; }
.plan-card h2 { margin:8px 0 8px; font-family:Georgia,serif; font-size:1.35rem; }
.plan-card p { color:var(--muted); font-size:.8rem; line-height:1.55; }
.progress-row { display:grid; grid-template-columns:1fr auto; align-items:center; gap:12px; margin:18px 0; }
.progress-bar { height:9px; overflow:hidden; border-radius:12px; background:var(--mint); }
.progress-bar span { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--leaf),#71a286); }
.split-lists { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.split-lists h3 { margin:0 0 8px; font-size:.73rem; text-transform:uppercase; letter-spacing:.06em; }
.clean-list { display:grid; gap:7px; margin:0; padding:0; list-style:none; }
.clean-list li { position:relative; padding-left:14px; color:var(--muted); font-size:.74rem; line-height:1.4; }
.clean-list li::before { content:""; position:absolute; top:.5em; left:0; width:5px; height:5px; border-radius:50%; background:var(--leaf); }

.task-board { display:grid; grid-template-columns:repeat(5,minmax(220px,1fr)); gap:12px; overflow-x:auto; }
.task-card .priority { float:right; }
.task-card .assignee { display:flex; align-items:center; gap:7px; margin-top:11px; color:var(--muted); font-size:.67rem; }
.mini-avatar { display:grid; width:24px; height:24px; place-items:center; border-radius:8px; background:var(--mint); color:var(--forest); font-size:.62rem; font-weight:800; }
.field-mode { background:var(--forest); color:white; }
.field-mode .page-subtitle, .field-mode .meta { color:rgba(255,255,255,.66); }

.calendar-layout { display:grid; grid-template-columns:minmax(0,1.4fr) minmax(280px,.6fr); gap:18px; }
.agenda { display:grid; gap:1px; }
.agenda-row { display:grid; grid-template-columns:72px 1fr auto; gap:15px; padding:16px 0; border-bottom:1px solid var(--line); }
.agenda-row:last-child { border-bottom:0; }
.date-block { display:grid; align-content:center; text-align:center; }
.date-block strong { font-family:Georgia,serif; font-size:1.45rem; }
.date-block small { color:var(--leaf); font-size:.64rem; font-weight:800; text-transform:uppercase; }
.agenda-copy h3 { margin:2px 0 5px; font-size:.85rem; }
.agenda-copy p { margin:0; color:var(--muted); font-size:.72rem; line-height:1.45; }

.resource-table { width:100%; border-collapse:collapse; }
.resource-table th, .resource-table td { padding:12px 10px; border-bottom:1px solid var(--line); font-size:.73rem; text-align:left; vertical-align:middle; }
.resource-table th { color:var(--muted); font-size:.64rem; letter-spacing:.05em; text-transform:uppercase; }
.resource-table tr:last-child td { border-bottom:0; }
.resource-name { display:grid; gap:3px; }
.resource-name strong { font-size:.77rem; }
.resource-name small { color:var(--muted); }
.shortage { color:var(--red); font-weight:750; }

.community-layout { display:grid; grid-template-columns:1.25fr .75fr; gap:18px; }
.member-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.member-card { display:flex; gap:11px; padding:13px; border:1px solid var(--line); border-radius:13px; background:var(--white); }
.member-card .avatar { flex:0 0 42px; }
.member-card h3 { margin:1px 0 3px; font-size:.78rem; }
.member-card p { margin:5px 0 0; color:var(--muted); font-size:.68rem; line-height:1.4; }
.team-card { padding:16px; border-bottom:1px solid var(--line); }
.team-card:last-child { border-bottom:0; }
.team-card h3 { margin:5px 0 6px; font-family:Georgia,serif; font-size:1rem; }
.team-card p { margin:0 0 11px; color:var(--muted); font-size:.72rem; line-height:1.5; }

.admin-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:15px; }
.admin-action { display:grid; grid-template-columns:42px 1fr auto; align-items:center; gap:12px; padding:17px; border:1px solid var(--line); border-radius:15px; background:var(--white); cursor:pointer; }
.admin-action:hover { border-color:#b7ccbf; }
.admin-action > span:first-child { display:grid; width:42px; height:42px; place-items:center; border-radius:12px; background:var(--mint-2); color:var(--leaf); }
.admin-action h3 { margin:0 0 4px; font-size:.83rem; }
.admin-action p { margin:0; color:var(--muted); font-size:.7rem; }

.empty-state { display:grid; min-height:220px; place-items:center; align-content:center; padding:30px; color:var(--muted); text-align:center; }
.empty-state span { font-size:2rem; }
.empty-state h3 { margin:10px 0 5px; color:var(--ink); }
.empty-state p { max-width:430px; margin:0; font-size:.8rem; line-height:1.5; }

.fab {
    position:fixed;
    right:28px;
    bottom:26px;
    z-index:45;
    display:flex;
    min-height:48px;
    align-items:center;
    gap:8px;
    padding:10px 17px 10px 12px;
    border:0;
    border-radius:16px;
    background:var(--forest);
    color:white;
    box-shadow:0 14px 28px rgba(23,63,54,.25);
    cursor:pointer;
}
.fab span { font-size:1.3rem; }
.fab b { font-size:.76rem; }
.fab:hover { background:var(--forest-2); transform:translateY(-2px); }
.bottom-nav { display:none; }

.modal-backdrop, .sheet-backdrop {
    position:fixed;
    inset:0;
    z-index:120;
    display:grid;
    padding:24px;
    overflow-y:auto;
    place-items:center;
    background:rgba(14,35,29,.54);
    backdrop-filter:blur(5px);
}
.modal-backdrop[hidden], .sheet-backdrop[hidden] { display:none; }
.modal { width:min(760px,100%); max-height:min(860px,calc(100vh - 48px)); overflow:auto; border:1px solid rgba(255,255,255,.4); border-radius:22px; background:var(--paper); box-shadow:var(--shadow-lg); }
.modal.wide { width:min(980px,100%); }
.modal-header { position:sticky; top:0; z-index:2; display:flex; align-items:center; justify-content:space-between; gap:15px; padding:19px 22px; border-bottom:1px solid var(--line); background:rgba(252,253,251,.94); backdrop-filter:blur(12px); }
.modal-header small { color:var(--leaf); font-size:.64rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.modal-header h2 { margin:3px 0 0; font-family:Georgia,serif; font-size:1.45rem; font-weight:500; }
.modal-body { padding:22px; }

.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.field { display:grid; gap:6px; }
.field.full { grid-column:1/-1; }
.field label, .field > span { color:#455a52; font-size:.69rem; font-weight:750; }
.field input, .field select, .field textarea {
    width:100%;
    min-height:44px;
    padding:10px 12px;
    border:1px solid var(--line-strong);
    border-radius:10px;
    background:white;
    color:var(--ink);
    font-size:.8rem;
}
.field textarea { min-height:100px; resize:vertical; line-height:1.5; }
.field-hint { color:var(--muted); font-size:.65rem; line-height:1.35; }
.form-actions { display:flex; justify-content:flex-end; gap:9px; margin-top:19px; padding-top:17px; border-top:1px solid var(--line); }
.form-error { margin:0 0 13px; padding:10px 12px; border-radius:9px; background:var(--red-soft); color:var(--red); font-size:.75rem; }
.auth-tabs { display:flex; gap:4px; margin-bottom:18px; padding:4px; border-radius:11px; background:var(--mint-2); }
.auth-tabs button { flex:1; min-height:38px; border:0; border-radius:8px; background:transparent; color:var(--muted); font-size:.75rem; font-weight:750; cursor:pointer; }
.auth-tabs button.is-active { background:white; color:var(--forest); box-shadow:var(--shadow-sm); }
.auth-note { margin:14px 0 0; padding:11px; border-radius:10px; background:var(--amber-soft); color:#704818; font-size:.68rem; line-height:1.45; }

.bottom-sheet { width:min(520px,100%); align-self:end; padding:10px 18px calc(20px + env(safe-area-inset-bottom)); border-radius:22px 22px 0 0; background:var(--paper); box-shadow:var(--shadow-lg); }
.sheet-backdrop { padding:0; place-items:end center; }
.sheet-handle { width:42px; height:4px; margin:2px auto 16px; border-radius:4px; background:var(--line-strong); }
.sheet-menu { display:grid; gap:5px; }
.sheet-menu h2 { margin:0 0 10px; font-family:Georgia,serif; font-size:1.2rem; }
.sheet-menu button { display:flex; min-height:48px; align-items:center; gap:12px; padding:10px 12px; border:0; border-radius:11px; background:transparent; text-align:left; cursor:pointer; }
.sheet-menu button:hover { background:var(--mint-2); }
.sheet-menu button span { width:24px; color:var(--leaf); text-align:center; }

.toast-region { position:fixed; right:24px; bottom:86px; z-index:180; display:grid; gap:8px; width:min(360px,calc(100vw - 32px)); pointer-events:none; }
.toast { padding:13px 15px; border:1px solid rgba(255,255,255,.14); border-radius:12px; background:var(--forest); color:white; box-shadow:var(--shadow-lg); font-size:.76rem; line-height:1.45; animation:toast-in .2s ease; }
.toast.error { background:#74352f; }
@keyframes toast-in { from { opacity:0; transform:translateY(10px); } }

.compact .workspace { padding-top:22px; }
.compact .panel, .compact .card-body { padding:14px; }
.compact .metrics-grid { gap:8px; margin-bottom:17px; }
.compact .metric-card { min-height:104px; padding:14px; }
.compact .entity-card .card-image { display:none; }
.compact .card-grid { gap:9px; }
.compact .page-header { margin-bottom:18px; }

@media (max-width: 1120px) {
    :root { --sidebar: 210px; }
    .metrics-grid { grid-template-columns:repeat(2,1fr); }
    .card-grid { grid-template-columns:repeat(2,1fr); }
    .dashboard-grid, .calendar-layout { grid-template-columns:1fr; }
    .dashboard-grid > .stack:last-child { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .next-event { min-height:100%; }
}

@media (max-width: 820px) {
    :root { --topbar: 62px; }
    .app-shell { display:block; }
    .sidebar { display:none; }
    .app-column { min-height:100vh; }
    .topbar { padding:8px 14px; }
    .sync-status, .account-copy, .account-button > span:last-child { display:none; }
    .account-button { padding:2px; }
    .project-control select { max-width:180px; }
    .workspace { padding:23px 14px calc(112px + env(safe-area-inset-bottom)); }
    .page-header { align-items:start; margin-bottom:20px; }
    .page-title { font-size:1.8rem; }
    .page-subtitle { font-size:.82rem; }
    .header-actions .secondary { display:none; }
    .card-grid { grid-template-columns:1fr; }
    .detail-grid, .proposal-layout, .community-layout { grid-template-columns:1fr; }
    .dashboard-grid > .stack:last-child { grid-template-columns:1fr; }
    .bottom-nav {
        position:fixed;
        inset:auto 0 0;
        z-index:80;
        display:grid;
        grid-template-columns:repeat(5,1fr);
        padding:6px 8px calc(5px + env(safe-area-inset-bottom));
        border-top:1px solid var(--line);
        background:rgba(252,253,251,.95);
        backdrop-filter:blur(15px);
    }
    .bottom-nav button { display:grid; min-height:52px; place-items:center; align-content:center; gap:3px; border:0; border-radius:10px; background:transparent; color:var(--muted); cursor:pointer; }
    .bottom-nav button span { font-size:1.05rem; line-height:1; }
    .bottom-nav button small { font-size:.61rem; font-weight:720; }
    .bottom-nav button.is-active { background:var(--mint-2); color:var(--forest); }
    .fab { right:17px; bottom:calc(75px + env(safe-area-inset-bottom)); width:52px; height:52px; min-height:0; padding:0; justify-content:center; border-radius:17px; }
    .fab b { display:none; }
    .fab span { font-size:1.45rem; }
    .modal-backdrop { padding:0; place-items:end center; }
    .modal { width:100%; max-height:92vh; border-radius:22px 22px 0 0; }
    .modal.wide { width:100%; }
    .modal-body { padding:18px 15px calc(22px + env(safe-area-inset-bottom)); }
    .modal-header { padding:16px; }
    .form-grid { grid-template-columns:1fr; }
    .field.full { grid-column:auto; }
    .split-lists, .admin-grid { grid-template-columns:1fr; }
    .resource-table th:nth-child(3), .resource-table td:nth-child(3), .resource-table th:nth-child(5), .resource-table td:nth-child(5) { display:none; }
    .toast-region { right:16px; bottom:calc(86px + env(safe-area-inset-bottom)); }
}

@media (max-width: 540px) {
    .metrics-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
    .metric-card { min-height:105px; padding:13px; }
    .metric-card strong { margin-top:10px; font-size:1.45rem; }
    .page-header { display:block; }
    .header-actions { margin-top:14px; }
    .toolbar { align-items:stretch; }
    .toolbar, .filters { flex-direction:column; }
    .filter-select, .search-input { width:100%; }
    .card-image { aspect-ratio:16/6.5; }
    .member-grid, .info-grid { grid-template-columns:1fr; }
    .detail-hero, .detail-hero-copy { min-height:220px; }
    .detail-hero-copy { padding:20px; }
    .phase-step { font-size:0; }
    .phase-step.done:last-child { font-size:.55rem; }
    .plot-map { min-height:300px; }
    .agenda-row { grid-template-columns:56px 1fr; }
    .agenda-row > .button { grid-column:2; justify-self:start; }
    .topbar .icon-button { display:none; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior:auto !important; transition:none !important; animation-duration:.01ms !important; }
}
