/* ============================================================================
   AREA STATEMENT panel - built from the Claude Design project "PALM Estate
   Dashboard Area Statement" (claude.ai/design/p/5c38d32d), on the PALM Design
   System: dark only, Manrope for text, IBM Plex Mono for every number, lime
   accent, gain lime / loss amber. Scoped to .as-modal so nothing else on the
   homepage changes.
   ========================================================================= */
.as-modal {
  --pd-app:#0A140D; --pd-header:#112914; --pd-panel:#0E1A12; --pd-surface:#132015; --pd-surface2:#1A2B1D;
  --pd-raised:#16241A; --pd-line:#1F3123; --pd-hair:#1A2A1E; --pd-edge:#294031;
  --pd-text:#E7EFE6; --pd-text2:#C4D2C2; --pd-dim:#8B9C8B; --pd-dim2:#6E8070; --pd-faint:#556358; --pd-headText:#F2F8EF;
  --pd-acc:#A9D96B; --pd-accHov:#B8E27E; --pd-accFg:#0F2314; --pd-accSoft:#1B2E19; --pd-accSoftFg:#BFE398;
  --pd-glass:rgba(14,26,18,.94); --pd-shadow:0 16px 40px rgba(0,0,0,.55); --pd-scroll:#28382B;
  --pd-ui:'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --pd-mono:'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  /* changes: green up, red down (Hafiz, 20 Oct) - the design system's lime/amber read too alike */
  --ei-gain:#7FBF95; --ei-loss:#F87171;
  --lu-planted:#FFFFBE; --lu-plantable:#FFBEE8; --lu-bushes:#9CAF88; --lu-hcv:#267300;
  position: fixed; inset: 0; z-index: 9999; background: rgba(5,10,7,.62);
  font-family: var(--pd-ui); color: var(--pd-text);
}
.as-modal *, .as-modal *::before, .as-modal *::after { box-sizing: border-box; }
.as-panel {
  position: absolute; left: 16px; right: 16px; top: 64px; bottom: 16px;
  background: var(--pd-panel); border: 1px solid var(--pd-line); border-radius: 14px; box-shadow: var(--pd-shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.as-modal ::-webkit-scrollbar { width: 10px; height: 10px; }
.as-modal ::-webkit-scrollbar-thumb { background: var(--pd-scroll); border-radius: 6px; border: 2px solid var(--pd-surface); }
.as-modal ::-webkit-scrollbar-track, .as-modal ::-webkit-scrollbar-corner { background: transparent; }

/* header */
.as-head { position: relative; z-index: 25; display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 18px; border-bottom: 1px solid var(--pd-line); flex: none; }
.as-title { order: 1; flex: 1 1 auto; min-width: 0; font-size: 16px; font-weight: 700; color: var(--pd-headText); letter-spacing: -.01em; }
.as-picks { order: 2; display: flex; gap: 8px; }
.as-acts { order: 3; display: flex; gap: 8px; align-items: center; }
.as-pick { position: relative; height: 36px; display: flex; align-items: center; gap: 9px; padding: 0 10px 0 12px;
  background: var(--pd-surface); border: 1px solid var(--pd-edge); border-radius: 9px; cursor: pointer; }
.as-pick:hover { background: var(--pd-surface2); }
.as-pick:focus-within { border-color: var(--pd-acc); }
.as-pick > span { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--pd-dim2); white-space: nowrap; }
.as-pick select { appearance: none; -webkit-appearance: none; background: transparent; border: 0; outline: 0; color: var(--pd-text);
  font: 500 12.5px var(--pd-mono); padding: 0 18px 0 0; cursor: pointer; min-width: 0; max-width: 260px; }
.as-pick select option { background: #132015; color: #E7EFE6; }
.as-pick::after { content: ''; position: absolute; right: 11px; top: 50%; width: 6px; height: 6px; margin-top: -5px;
  border-right: 1.5px solid var(--pd-dim); border-bottom: 1.5px solid var(--pd-dim); transform: rotate(45deg); pointer-events: none; }
.as-btn-acc { height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--pd-acc); border: 0;
  border-radius: 9px; color: var(--pd-accFg); font: 700 12.5px var(--pd-ui); cursor: pointer; }
.as-btn-acc:hover { background: var(--pd-accHov); }
.as-btn-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: var(--pd-surface);
  border: 1px solid var(--pd-edge); border-radius: 9px; color: var(--pd-dim); cursor: pointer; }
.as-btn-icon:hover { background: var(--pd-surface2); color: var(--pd-text); }
.as-export { position: relative; }
.as-menu { position: absolute; top: 41px; right: 0; width: 260px; z-index: 30; background: var(--pd-glass); backdrop-filter: blur(10px);
  box-shadow: var(--pd-shadow); border: 1px solid var(--pd-edge); border-radius: 10px; padding: 5px; display: flex; flex-direction: column; gap: 1px; }
.as-menu[hidden] { display: none; }
.as-menu-cap { height: 28px; display: flex; align-items: center; padding: 0 10px; font-size: 10px; font-weight: 700; letter-spacing: .11em;
  text-transform: uppercase; color: var(--pd-dim2); }
.as-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--pd-text); font: 600 12.5px var(--pd-ui); cursor: pointer; text-align: left; }
.as-menu button:hover { background: var(--pd-surface2); }
.as-menu button span { font: 500 11px var(--pd-mono); color: var(--pd-dim); }
.as-menu button:disabled { color: var(--pd-faint); cursor: default; }
.as-menu button:disabled:hover { background: transparent; }

/* tabs */
.as-tabs { display: flex; gap: 2px; padding: 0 18px; border-bottom: 1px solid var(--pd-line); overflow-x: auto; scrollbar-width: none; flex: none; }
.as-tabs button { flex: none; height: 42px; padding: 0 12px; margin-bottom: -1px; background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--pd-dim); font: 700 13px var(--pd-ui); cursor: pointer; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.as-tabs button:hover { color: var(--pd-text); }
.as-tabs button.on { color: var(--pd-text); border-bottom-color: var(--pd-acc); }
.as-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 6px; background: var(--pd-accSoft); color: var(--pd-accSoftFg);
  font: 600 10.5px var(--pd-mono); display: inline-flex; align-items: center; justify-content: center; }
.as-badge[hidden] { display: none; }

/* summary cards */
.as-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 12px 18px 0; flex: none; }
.as-card { border-radius: 12px; background: var(--pd-surface); padding: 11px 13px 10px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.as-card-l { display: flex; align-items: center; gap: 7px; font-size: 9.5px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; color: var(--pd-dim2); }
.as-card-l i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.as-card-v { display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; }
.as-card-v b { font: 500 20px var(--pd-mono); color: var(--pd-text); letter-spacing: -.01em; }
.as-card-v span { font-size: 11px; color: var(--pd-dim); }
.as-card-d { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; min-height: 15px; font-size: 11px; color: var(--pd-dim); }
.as-d { font: 500 11.5px var(--pd-mono); display: inline-flex; align-items: baseline; gap: 3px; }
.as-d small, .as-t small { font-size: 7.5px; }
.as-up { color: var(--ei-gain); } .as-down { color: var(--ei-loss); } .as-zero { color: var(--pd-faint); }

/* bar above the table */
.as-bar { position: relative; z-index: 24; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 18px 10px; flex: none; }
.as-bar-l { font-size: 12px; color: var(--pd-dim); display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.as-bar-l b { font: 500 12px var(--pd-mono); color: var(--pd-text2); }
.as-seg-wrap { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.as-seg-wrap > span { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--pd-dim2); }
.as-seg { display: flex; gap: 2px; padding: 2px; background: var(--pd-surface); border: 1px solid var(--pd-line); border-radius: 8px; }
.as-seg button { height: 26px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--pd-dim);
  font: 600 12px var(--pd-ui); cursor: pointer; white-space: nowrap; }
.as-seg button.on { background: var(--pd-accSoft); color: var(--pd-accSoftFg); }
.as-seg:empty, .as-seg-wrap:has(.as-seg:empty) { display: none; }

/* loading / empty */
.as-loading { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--pd-dim); font-size: 13px; }
.as-empty { flex: 1; margin: 0 18px 18px; border-radius: 12px; background: var(--pd-surface); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; }
.as-empty[hidden] { display: none; }
.as-empty h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--pd-text); }
.as-empty p { margin: 0; font-size: 12.5px; color: var(--pd-dim); max-width: 340px; line-height: 1.5; }
.as-empty button { height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: var(--pd-accSoft); color: var(--pd-accSoftFg);
  font: 700 12.5px var(--pd-ui); cursor: pointer; }

/* the table */
.as-tablewrap { flex: 1; min-height: 0; margin: 0 18px 18px; border: 1px solid var(--pd-line); border-radius: 12px; background: var(--pd-surface);
  overflow: auto; -webkit-overflow-scrolling: touch; }
.as-warn { position: sticky; left: 0; padding: 9px 12px; background: #3a1d14; color: #F6C9B8; font-size: 12px; font-weight: 600; border-bottom: 1px solid #5a2a1c; }
.as-table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-variant-numeric: tabular-nums; }
.as-table th, .as-table td { white-space: nowrap; }
.as-table thead th { position: sticky; z-index: 4; background: var(--pd-raised); font-size: 10px; line-height: 1.3; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--pd-dim); padding: 6px 10px 8px; text-align: right; vertical-align: bottom;
  border-bottom: 1px solid var(--pd-line); }
.as-table thead tr:first-child th { top: 0; height: 28px; }
.as-table thead tr:nth-child(2) th { top: 28px; }
.as-table thead th.grp { text-align: center; color: var(--pd-text2); letter-spacing: .1em; border-bottom: 1px solid var(--pd-hair); vertical-align: middle; }
.as-table thead th.tot { color: var(--pd-text2); }
.as-table thead th.what { text-align: left; color: var(--pd-text2); }
.as-table .bl { box-shadow: inset 1px 0 0 var(--pd-line); }
.as-table th.first, .as-table td.first { position: sticky; left: 0; z-index: 2; text-align: left; box-shadow: inset -1px 0 0 var(--pd-line); }
.as-table thead th.first { z-index: 6; letter-spacing: .1em; }
.as-table td { height: 30px; padding: 0 10px; text-align: right; font: 400 11.5px var(--pd-mono); color: var(--pd-text2);
  border-bottom: 1px solid var(--pd-hair); background: var(--pd-surface); }
.as-table td.first { font-family: var(--pd-ui); font-size: 12.5px; min-width: 212px; max-width: 240px; padding-left: 26px; }
.as-table td.first .tag { float: right; margin-left: 10px; font: 600 9px var(--pd-ui); letter-spacing: .09em; text-transform: uppercase; color: var(--pd-dim2); line-height: 1.9; }
.as-table td.first a { color: var(--pd-text2); text-decoration: underline; text-decoration-color: var(--pd-edge); text-underline-offset: 3px; }
.as-table td.first a:hover { color: var(--pd-accHov); text-decoration-color: var(--pd-acc); }
.as-table td.first a::after { content: ' ↗'; color: var(--pd-acc); font-size: 10px; }
.as-table td.z { color: var(--pd-faint); }
.as-table td.t { font-weight: 600; color: var(--pd-text); }
.as-table td.what { text-align: left; font: 400 11.5px var(--pd-ui); line-height: 1.4; color: var(--pd-text2); white-space: normal;
  min-width: 340px; max-width: 420px; padding: 6px 12px; box-shadow: inset 1px 0 0 var(--pd-line); }
.as-table td.what div b { font: 500 11.5px var(--pd-mono); color: var(--pd-text); margin-left: 5px; }
.as-table td.what div em { font: 400 11px var(--pd-mono); color: var(--pd-dim); font-style: normal; margin-left: 4px; }
.as-table td.what.none { color: var(--pd-dim2); }
/* more than 4 moves: two columns, a touch smaller, the cell widens to fit */
.as-table td.what:has(.two) { max-width: none; }
.as-table td.what .two { display: grid; grid-auto-flow: column; grid-template-rows: repeat(var(--rows), auto); column-gap: 18px; font-size: 11px; }
.as-table td.what .two > div { white-space: nowrap; }
.as-table td.what .two b, .as-table td.what .two em { font-size: 10.5px; }
/* row levels told apart (Hafiz, 20 Oct), as in the workbooks: estate plain, PT bold white on a lighter band,
   region bold pale green on a green band, Grand Total the workbook's dark green #2E5E3E */
.as-table tbody tr:not(.pt):not(.region):not(.grand) td.t { font-weight: 500; color: var(--pd-text2); }
.as-table tr.pt td { background: #1E3022; color: #FFFFFF; font-weight: 700; border-top: 1px solid var(--pd-edge); border-bottom-color: var(--pd-edge); }
.as-table tr.pt td.first { font-weight: 800; padding-left: 12px; }
.as-table tr.region td { background: #25422C; color: #D6EDBA; font-weight: 700; border-top: 1px solid #3B6043; border-bottom: 1px solid #3B6043; }
.as-table tr.region td.first { font-weight: 800; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding-left: 12px; }
.as-table tr.region td.first .tag { color: #9DBF94; }
.as-table tr.grand td { background: #2E5E3E; color: #FFFFFF; font-weight: 700; }
.as-table tr.grand td.first { font-weight: 800; padding-left: 12px; }
.as-table tr.grand td.first .tag { color: #CFE3C8; }
.as-table tr.blk td.first { font: 500 12px var(--pd-mono); padding-left: 12px; min-width: 96px; }
.as-table tfoot td { position: sticky; bottom: 0; z-index: 3; }
.as-table tfoot tr:nth-last-child(2) td { bottom: 30px; }
.as-table tfoot tr:nth-last-child(3) td { bottom: 60px; }
.as-table tfoot td.first { z-index: 5; }
.as-table tfoot tr:first-child td { box-shadow: 0 -1px 0 var(--pd-line); }
.as-table tfoot tr:first-child td.first { box-shadow: 0 -1px 0 var(--pd-line), inset -1px 0 0 var(--pd-line); }

/* tablet */
@media (max-width: 1023px) {
  .as-panel { left: 12px; right: 12px; top: 60px; bottom: 12px; }
  .as-table td.first { min-width: 184px; }
}
/* phone: a full-screen sheet; pickers stacked under the title; 2 x 2 cards */
@media (max-width: 640px) {
  .as-panel { left: 0; right: 0; top: 0; bottom: 0; border-radius: 0; border: 0; }
  .as-head { padding: 12px; }
  .as-title { font-size: 17px; }
  .as-acts { order: 2; }
  .as-picks { order: 3; width: 100%; flex-direction: column; }
  .as-pick > span { min-width: 96px; }
  .as-pick select { flex: 1; max-width: none; }
  .as-tabs { padding: 0 12px; }
  .as-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 12px 0; }
  .as-card-v b { font-size: 18px; }
  .as-bar { padding: 12px 12px 10px; }
  .as-seg-wrap > span { display: none; }
  .as-tablewrap { margin: 0 12px 12px; }
  .as-empty { margin: 0 12px 12px; }
  .as-table td.first { min-width: 128px; max-width: 150px; padding-left: 14px; overflow: hidden; text-overflow: ellipsis; }
  .as-table td.first .tag { display: none; }
  .as-table td.what { min-width: 250px; }
  .as-table td.what .two { grid-auto-flow: row; grid-template-rows: none; }
  .as-table td.what .two > div { white-space: normal; }
}

/* change cells: the whole figure in green (up) / red (down), on every row type */
.as-table td.as-up { color: var(--ei-gain) !important; }
.as-table td.as-down { color: var(--ei-loss) !important; }
.as-table tr.grand td.as-up { color: #BDE8C9 !important; } .as-table tr.grand td.as-down { color: #FFB8B8 !important; }
.as-card .as-up { color: var(--ei-gain); } .as-card .as-down { color: var(--ei-loss); }
