/* Commodity Intelligence globe. Layout and control idiom follow the IAVT twin (floating panel with an accent top
   border, small-caps section heads, toggle buttons with an "on" state); colours are QDT's, in two themes. */
:root, [data-theme="dark"] {
  --bg: #0b1220; --panel: rgba(15, 23, 42, 0.92); --panel-solid: #0f172a; --border: #22314a; --text: #e2e8f0;
  --muted: #94a3b8; --accent: #2dd4bf; --accent-ink: #042f2e; --head: #5eead4; --btn: #111c31; --btn-hover: #1b2a44;
  --shadow: 0 4px 18px rgba(0, 0, 0, .45); --sample: #f59e0b; --sample-ink: #1f1300; --globe-base: #0d1626;
}
[data-theme="light"] {
  --bg: #f5f8fb; --panel: rgba(255, 255, 255, 0.96); --panel-solid: #ffffff; --border: #c9d6e3; --text: #1e293b;
  --muted: #556479; --accent: #0f766e; --accent-ink: #ffffff; --head: #0f766e; --btn: #ffffff; --btn-hover: #e2eaf2;
  --shadow: 0 2px 10px rgba(15, 50, 90, .18); --sample: #b45309; --sample-ink: #ffffff; --globe-base: #dfe7ef;
}
html, body, #globe { width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden; background: var(--bg); }
body { font: 14px/1.4 'Inter', 'Source Sans 3', 'Segoe UI', Arial, sans-serif; color: var(--text); }
.muted { color: var(--muted); } .small { font-size: 12px; }
button { background: var(--btn); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 4px 10px;
         cursor: pointer; font: inherit; font-weight: 600; }
button:hover { background: var(--btn-hover); }
button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#panel { position: absolute; top: 12px; left: 12px; width: 330px; max-width: calc(100% - 24px); max-height: calc(100% - 120px);
         overflow-y: auto; z-index: 5; background: var(--panel); border: 1px solid var(--border); border-top: 4px solid var(--accent);
         border-radius: 6px; padding: 10px 12px 12px; box-sizing: border-box; box-shadow: var(--shadow); backdrop-filter: blur(6px); }
.brand-row .badge { margin-left: auto; }
.panel-collapsed .brand-row .badge { margin: 0; }
.panel-collapsed #panel-toggle { order: -1; }
#panel-toggle { flex: none; width: 26px; height: 26px; padding: 0; line-height: 1; font-size: 18px; }
#panel-toggle span { display: inline-block; transition: transform .15s; }
/* Collapsed: a slim handle that keeps the brand mark, the SAMPLE badge (rule 5) and the expand control. */
.panel-collapsed #panel { width: auto; padding: 8px 6px; overflow: visible; }
.panel-collapsed #panel-body, .panel-collapsed .brand > div { display: none; }
.panel-collapsed .brand-row { flex-direction: column; gap: 8px; }
.panel-collapsed .badge.sample { writing-mode: vertical-rl; transform: rotate(180deg); padding: 7px 2px; }
.panel-collapsed #panel-toggle span { transform: rotate(180deg); }
#panel h3 { margin: 12px 0 5px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--head); }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.brand-name { font-size: 15px; letter-spacing: .01em; white-space: nowrap; }
.brand-mark { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--accent), transparent 62%),
              conic-gradient(from 210deg, var(--accent), #0ea5e9, var(--accent)); box-shadow: 0 0 0 2px var(--border); flex: none; }
.badge { font-size: 11px; font-weight: 800; letter-spacing: .08em; padding: 2px 7px; border-radius: 3px; }
.badge.sample { background: var(--sample); color: var(--sample-ink); }
.row { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0; align-items: center; }
.seg button { flex: 1 1 auto; }
#layers label { display: flex; align-items: center; gap: 7px; margin: 3px 0; cursor: pointer; }
#layers label.planned { color: var(--muted); cursor: default; }
.tag { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; border: 1px solid var(--border); border-radius: 3px;
       padding: 0 5px; color: var(--muted); margin-left: auto; }
#legend .group { margin: 4px 0 6px; } #legend .gtitle { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
#legend .item { display: inline-flex; align-items: center; margin: 1px 10px 1px 0; font-size: 12px; white-space: nowrap; }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; box-shadow: 0 0 0 1px var(--border); }
.sw.dot { border-radius: 50%; }
#record { position: absolute; top: 56px; right: 12px; width: 320px; max-width: calc(100% - 24px); z-index: 5; background: var(--panel);
          border: 1px solid var(--border); border-top: 4px solid var(--accent); border-radius: 6px; padding: 10px 12px; box-sizing: border-box;
          box-shadow: var(--shadow); backdrop-filter: blur(6px); }
#record .title { font-size: 15px; font-weight: 700; display: block; margin-bottom: 4px; }
#record table { width: 100%; border-collapse: collapse; font-size: 13px; }
#record td { padding: 2px 0; vertical-align: top; } #record td.k { color: var(--muted); padding-right: 8px; width: 46%; }
#record .src { font-size: 11px; color: var(--muted); margin-top: 6px; }
#record .close { float: right; padding: 0 7px; }

#top-right { position: absolute; top: 12px; right: 12px; z-index: 6; display: flex; gap: 6px; }
#top-right form { margin: 0; }
#theme-toggle { min-width: 92px; box-shadow: var(--shadow); }

#sample-banner { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6; background: var(--sample);
                 color: var(--sample-ink); font-weight: 700; font-size: 12px; letter-spacing: .03em; padding: 5px 14px; border-radius: 4px;
                 box-shadow: var(--shadow); max-width: calc(100% - 720px); text-align: center; }
#loading { position: absolute; top: 52px; left: 50%; transform: translateX(-50%); z-index: 6; background: var(--panel); border: 1px solid var(--border);
           padding: 4px 12px; border-radius: 4px; font-size: 12px; }

#bottom { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--panel); border-top: 1px solid var(--border);
          padding: 6px 14px 4px; box-shadow: var(--shadow); font-size: 12px; }
#timebar { display: flex; align-items: center; gap: 8px; }
#scrubber { flex: 1; accent-color: var(--accent); }
.date-label { min-width: 104px; text-align: center; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
#freshness { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 2px 18px; }
#freshness span::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
#freshness .fresh-fresh::before { background: #10b981; } #freshness .fresh-stale::before { background: #eab308; }
#freshness .fresh-old::before, #freshness .fresh-no_data::before, #freshness .fresh-unavailable::before { background: #ef4444; }
#attribution { color: var(--muted); margin-top: 2px; font-size: 11px; }
#cesium-credits { font-size: 10px; color: var(--muted); opacity: .8; }
#cesium-credits .cesium-credit-textContainer, #cesium-credits a { color: var(--muted) !important; }
.cesium-widget-credits { display: none !important; }
.cesium-viewer-fullscreenContainer { bottom: 96px !important; right: 12px !important; }

.login-page { display: grid; place-items: center; height: 100%; }
.login-card { width: 340px; background: var(--panel-solid); border: 1px solid var(--border); border-top: 4px solid var(--accent);
              border-radius: 6px; padding: 18px; box-shadow: var(--shadow); }
.login-card form { display: grid; gap: 8px; margin: 16px 0 10px; }
.login-card input { padding: 7px 9px; border-radius: 4px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; }
.login-card .error { color: #ef4444; margin: 0; }
@media (max-width: 760px) { #panel { width: calc(100% - 24px); max-height: 45%; } #sample-banner { display: none; }
  .panel-collapsed #panel { width: auto; } }
