/* APEC INFINITE — Apple-inspired design system */
:root {
  /* Brand */
  --mint: #70EABA;
  --mint-strong: #0BD9A5;
  --teal: #0E9C84;
  --navy: #0A0742;
  --navy-2: #1B1664;
  --sky: #8DB6FF;

  /* Apple-style neutrals */
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --text: #1D1D1F;
  --text-2: #6E6E73;
  --muted: #86868B;
  --hairline: #D2D2D7;
  --hairline-soft: #E8E8ED;
  --fill: #E8E8ED;
  --link: #0E9C84;
  --danger: #E30000;

  /* Theme-dependent roles (light) */
  color-scheme: light;
  --surface-2: #FBFBFD;
  --accent: #0A0742;
  --accent-hover: #1B1664;
  --on-accent: #FFFFFF;
  --field-bg: #FFFFFF;
  --menu-bg: rgba(255,255,255,.96);
  --shadow-color: rgba(0,0,0,.06);
  --pill-mint-bg: #DDF8EE; --pill-mint-fg: #067A5F;
  --pill-navy-bg: #E6E5F3; --pill-navy-fg: #0A0742;
  --pill-warn-bg: #FFF2DA; --pill-warn-fg: #8A5300;
  --pill-danger-bg: #FDE8E8;
  --chart-text: #6E6E73;
  --chart-grid: #EBEBF0;
  --chart-1: #0A0742;
  --chart-2: #2F3A8F;
  --chart-3: #0E9C84;

  --radius-lg: 22px;
  --radius: 18px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", Arial, sans-serif;
  --brand-gradient: linear-gradient(90deg, #0BD9A5 0%, #70EABA 45%, #8DB6FF 100%);
}

/* Dark theme — brand navy surfaces, mint accent */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070A1F;
  --surface: #10143A;
  --surface-2: #151A45;
  --text: #F5F5F7;
  --text-2: #A7A9C4;
  --muted: #8C8FAE;
  --hairline: #2B3163;
  --hairline-soft: #212656;
  --fill: #252B5C;
  --link: #70EABA;
  --danger: #FF7A7A;
  --accent: #70EABA;
  --accent-hover: #93F0CC;
  --on-accent: #0A0742;
  --field-bg: #0C1033;
  --menu-bg: rgba(21,26,69,.97);
  --shadow-color: rgba(0,0,0,.35);
  --pill-mint-bg: rgba(112,234,186,.16); --pill-mint-fg: #7EEDC2;
  --pill-navy-bg: rgba(141,182,255,.16); --pill-navy-fg: #B4CCFF;
  --pill-warn-bg: rgba(255,197,107,.16); --pill-warn-fg: #FFC56B;
  --pill-danger-bg: rgba(255,122,122,.16);
  --chart-text: #A7A9C4;
  --chart-grid: #232857;
  --chart-1: #8DB6FF;
  --chart-2: #9085E9;
  --chart-3: #3FD6A4;
}
body { transition: background-color .25s, color .25s; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.47; letter-spacing: -.022em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
.hidden { display: none !important; }
.muted { color: var(--text-2); margin: 0; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); color: var(--text); }
button { font-family: inherit; cursor: pointer; letter-spacing: inherit; }
input, select, textarea { font-family: inherit; font-size: 15px; letter-spacing: -.01em; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }

/* Buttons — Apple pill style */
.btn {
  border: none; border-radius: 980px; padding: 8px 18px; font-size: 14px; font-weight: 400;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center; white-space: nowrap;
  transition: background .2s, color .2s, box-shadow .2s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-mint { background: var(--mint); color: var(--navy); }
.btn-outline { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.btn-outline:hover { background: var(--accent); color: var(--on-accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px rgba(227,0,0,.35); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-lg { padding: 13px 22px; font-size: 17px; }
.btn-block { width: 100%; }
.close-btn { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--fill); color: var(--text-2); font-size: 13px; }
.close-btn:hover { background: var(--hairline); }

/* Segmented control */
.segmented { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--fill); padding: 2px; border-radius: 9px; }
.segmented button { border: none; background: none; padding: 6px 16px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text); }
.segmented button.active { background: var(--surface); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); }

/* Login — navy brand background matching the APEC INFINITE key visual */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 16px 48px; color: #fff; overflow: hidden;
  background:
    radial-gradient(90% 70% at 50% 85%, #13198C 0%, rgba(19,25,140,0) 70%),
    radial-gradient(120% 90% at 50% 40%, #0D1570 0%, #0A1253 55%, #081042 100%);
  background-color: #081042;
}
.login-card { width: 100%; max-width: 440px; text-align: center; }
.login-logo {
  display: block; width: 150%; max-width: 680px; height: auto; margin: 0 auto -8px; position: relative; left: 50%; transform: translateX(-50%);
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 84%, transparent 100%);
  mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 84%, transparent 100%);
}
.login-title { font-size: 40px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; color: #fff; }
.login-sub { color: rgba(235,235,245,.62); font-size: 19px; margin: 8px 0 28px; }
.login .segmented { width: 100%; margin-bottom: 20px; background: rgba(255,255,255,.1); }
.login .segmented button { color: rgba(255,255,255,.8); }
.login .segmented button.active { background: rgba(255,255,255,.95); color: #0A0742; }
#login-form { text-align: left; }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 12px; color: rgba(235,235,245,.62); margin: 0 0 6px 4px; }
.field input, .field select {
  width: 100%; height: 52px; padding: 0 16px; border: 1px solid rgba(255,255,255,.18); border-radius: var(--radius-sm);
  background: rgba(255,255,255,.08); color: #fff; font-size: 17px; -webkit-appearance: none; appearance: none;
}
.field select {
  background: rgba(255,255,255,.08) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ffffff' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") no-repeat right 16px center;
}
.field select option { color: #1D1D1F; }
.field input::placeholder { color: rgba(235,235,245,.45); }
.field input:focus, .field select:focus { outline: none; border-color: var(--mint); box-shadow: 0 0 0 4px rgba(112,234,186,.25); }
.login .btn-primary { background: var(--brand-gradient); color: #0A0742; font-weight: 600; margin-top: 4px; }
.login .btn-primary:hover { filter: brightness(1.06); }
.error { color: #FF8A8A; font-size: 13px; margin: 4px 4px 12px; }
.demo-hint { margin-top: 28px; font-size: 13px; color: rgba(235,235,245,.62); }
.demo-hint summary { cursor: pointer; color: var(--mint); list-style: none; }
.demo-hint summary::-webkit-details-marker { display: none; }
.demo-hint summary::after { content: " ›"; }
.demo-hint code { background: rgba(255,255,255,.1); padding: 2px 7px; border-radius: 6px; cursor: pointer; color: #fff; }
.demo-hint a { color: var(--mint); }
.demo-hint div { margin-top: 10px; }
.demo-hint div p { margin: 6px 0; }

/* Password field */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 72px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: none; background: none; color: var(--mint); font-size: 14px; padding: 6px 10px; border-radius: 8px; }
.pw-toggle:hover { background: rgba(255,255,255,.08); }

/* Global nav (apple.com style) */
.globalnav {
  position: sticky; top: 0; z-index: 30; height: 56px;
  background: #0B1363; backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.globalnav-inner { max-width: 1180px; margin: 0 auto; padding: 0 22px; height: 100%; display: flex; align-items: center; gap: 24px; }
.globalnav-logo { display: flex; align-items: center; flex-shrink: 0; }
.globalnav-logo img { height: 48px; width: auto; display: block;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%), linear-gradient(180deg, transparent 0, #000 7%, #000 93%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent 0, #000 8%, #000 92%, transparent 100%), linear-gradient(180deg, transparent 0, #000 7%, #000 93%, transparent 100%);
  mask-composite: intersect; }
.globalnav-links { display: flex; gap: 4px; flex: 1; justify-content: center; }
.globalnav-links button {
  background: none; border: none; font-size: 12.5px; color: rgba(255,255,255,.72); padding: 6px 10px; border-radius: 980px; letter-spacing: -.01em;
}
.globalnav-links button:hover { color: #fff; }
.globalnav-links button.active { color: #fff; font-weight: 600; background: rgba(255,255,255,.12); }
.globalnav-user { position: relative; flex-shrink: 0; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; border: none; flex-shrink: 0;
  background: var(--mint); color: var(--navy); display: grid; place-items: center; font-weight: 600; font-size: 11px;
}
.user-menu {
  position: absolute; right: 0; top: 42px; width: 260px; background: var(--menu-bg); backdrop-filter: blur(20px);
  border-radius: 14px; padding: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.24); display: none; gap: 2px; color: var(--text);
}
.user-menu.open { display: grid; }
.user-menu strong { font-size: 15px; }
.user-menu small { color: var(--text-2); font-size: 12px; margin-bottom: 12px; text-transform: capitalize; }
.menu-btn { display: none; width: 30px; height: 30px; border: none; background: none; position: relative; flex-shrink: 0; }
.menu-btn span { position: absolute; left: 7px; right: 7px; height: 1.5px; background: #fff; border-radius: 2px; transition: .2s; }
.menu-btn span:first-child { top: 11px; } .menu-btn span:last-child { top: 18px; }
.globalnav.open .menu-btn span:first-child { top: 14.5px; transform: rotate(45deg); }
.globalnav.open .menu-btn span:last-child { top: 14.5px; transform: rotate(-45deg); }

/* Page layout */
.main { max-width: 1180px; margin: 0 auto; padding: 0 22px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; gap: 20px; padding: 56px 0 28px; flex-wrap: wrap; }
.page-head h1 { font-size: 48px; line-height: 1.08; font-weight: 600; letter-spacing: -.015em; flex: 1; min-width: 280px; }
.page-head h1 .sub { color: var(--muted); }
#page-title::after { content: "."; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.page-actions select, .filters select, .filters input {
  appearance: none; -webkit-appearance: none; height: 34px; padding: 0 30px 0 14px; border-radius: 980px; border: 1px solid var(--hairline);
  background: var(--field-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238C8FAE' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") no-repeat right 12px center;
  font-size: 14px; color: var(--text);
}
.page { display: grid; grid-template-columns: minmax(0,1fr); gap: 20px; padding-bottom: 72px; }
.grid > *, .page > * { min-width: 0; }
.footer { max-width: 1180px; margin: 0 auto; padding: 18px 22px 28px; border-top: 1px solid var(--hairline); color: var(--muted); font-size: 12px; }

/* Hero banners — target artwork (assets/target-banner.jpg) with a navy scrim for legible text */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); color: #F5F5F7;
  padding: 48px 48px 40px; min-height: 380px;
  display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; gap: 28px;
  background:
    linear-gradient(90deg, rgba(5,22,64,.96) 0%, rgba(5,22,64,.88) 38%, rgba(5,22,64,.35) 62%, rgba(5,22,64,0) 80%),
    url("assets/target-banner.jpg") right center / cover no-repeat,
    radial-gradient(520px 420px at 82% 60%, rgba(40,150,230,.55), transparent 70%),
    radial-gradient(420px 320px at 100% 0%, rgba(22,210,150,.55), transparent 70%),
    radial-gradient(520px 300px at 0% 0%, rgba(22,170,150,.45), transparent 70%),
    linear-gradient(180deg, #06305E 0%, #04214F 50%, #051640 100%);
  background-color: #051640;
}
.hero > * { max-width: 600px; position: relative; }
.hero .eyebrow { color: var(--mint); font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.hero .big, .perf-banner-total {
  font-family: var(--font-display); font-size: 64px; line-height: 1.05; font-weight: 700; letter-spacing: -.03em; margin: 10px 0 12px;
  background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: rgba(235,235,245,.7); margin: 0; font-size: 17px; }
.hero-progress { margin-top: 28px; }
.bar { height: 6px; background: rgba(255,255,255,.16); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand-gradient); border-radius: 99px; }
.hero-progress .row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: rgba(235,235,245,.7); margin-top: 10px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-stat {
  flex: 1 1 120px; min-width: 0; padding: 14px 18px; border-radius: 16px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.hero-stat:only-child { flex: 0 1 220px; }
.hero-stat small { color: rgba(235,235,245,.7); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.hero-stat strong { display: block; font-family: var(--font-display); font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin-top: 2px; color: #fff; }
.trend { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 500; color: rgba(235,235,245,.7); }
.trend.up { color: var(--mint); }
.trend.down { color: #FFC56B; }
.perf-banner { min-height: 320px; }

/* Tiles */
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-2-1 { grid-template-columns: minmax(0,2fr) minmax(0,1fr); }
.card { background: var(--surface); border-radius: var(--radius); padding: 28px; min-width: 0; transition: box-shadow .3s; }
.card:hover { box-shadow: 2px 4px 16px var(--shadow-color); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.card-head h3 { font-size: 21px; font-weight: 600; letter-spacing: -.012em; line-height: 1.2; }
.card-head p { margin: 3px 0 0; font-size: 14px; color: var(--text-2); }
.card-head .spacer { flex: 1; }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi small { color: var(--text-2); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.kpi strong { font-family: var(--font-display); font-size: 36px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.kpi .pill { align-self: flex-start; margin-top: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chart-box { position: relative; height: 280px; }
.chart-box.tall { height: 340px; }
.chart-box canvas { max-width: 100%; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--hairline); white-space: nowrap; letter-spacing: -.01em; }
td { padding: 13px 12px; border-bottom: 1px solid var(--hairline-soft); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-actions { display: flex; gap: 6px; justify-content: flex-end; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 980px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill-mint { background: var(--pill-mint-bg); color: var(--pill-mint-fg); }
.pill-navy { background: var(--pill-navy-bg); color: var(--pill-navy-fg); }
.pill-warn { background: var(--pill-warn-bg); color: var(--pill-warn-fg); }
.pill-gray { background: var(--fill); color: var(--text-2); }
.pill-danger { background: var(--pill-danger-bg); color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 32px; }
.mini-bar { height: 4px; background: var(--fill); border-radius: 99px; overflow: hidden; min-width: 80px; }
.mini-bar > span { display: block; height: 100%; background: var(--teal); border-radius: 99px; }
td .avatar { background: var(--fill); color: var(--text); }

/* Hierarchy: Broker > Project > Area */
.tree-row td:first-child { white-space: nowrap; }
.tree-toggle { background: var(--fill); border: none; width: 22px; height: 22px; border-radius: 50%; color: var(--text); font-size: 8px; margin-right: 10px; transition: transform .2s, background .2s; vertical-align: middle; }
.tree-toggle:hover { background: var(--hairline); }
.tree-toggle.open { transform: rotate(90deg); background: var(--accent); color: var(--on-accent); }
.lvl-broker td { font-weight: 600; font-size: 15px; }
.lvl-project td:first-child { padding-left: 44px; font-weight: 500; }
.lvl-project td:first-child::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--teal); margin-right: 10px; vertical-align: middle; }
.lvl-area td { color: var(--text-2); }
.lvl-area td:first-child { padding-left: 82px; }
.lvl-area td:first-child::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--muted); margin-right: 10px; vertical-align: middle; }
.lvl-project td, .lvl-area td { background: var(--surface-2); }
.tree-total td { font-weight: 600; border-top: 1px solid var(--text); font-size: 15px; }

/* Credentials & password forms */
.cred-box { background: var(--bg); border-radius: var(--radius-sm); padding: 6px 18px; margin-bottom: 18px; }
.cred-box > div { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--hairline-soft); }
.cred-box > div:last-child { border-bottom: none; }
.cred-box small { color: var(--text-2); font-size: 13px; }
.cred-box span { font-weight: 500; text-align: right; word-break: break-all; }
.cred-pw { font-size: 20px; font-weight: 600; letter-spacing: .06em; color: var(--pill-mint-fg); background: var(--pill-mint-bg); padding: 6px 12px; border-radius: 8px; user-select: all; }
.form-error { color: var(--danger); font-size: 13px; margin: 0 0 12px; }
.modal.locked .close-btn { display: none; }
.menu-item { background: none; border: none; text-align: left; padding: 8px 0; font-size: 14px; color: var(--link); margin-bottom: 8px; border-top: 1px solid var(--hairline-soft); }
.menu-item:hover { text-decoration: underline; }

/* Inventory table */
.inv-project td { font-weight: 600; font-size: 15px; border-top: 1px solid var(--hairline); }
.inv-type td { background: var(--surface-2); color: var(--text-2); }
.inv-type td:nth-child(3) { padding-left: 24px; }

/* Filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.32); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .2s; }
.modal-box { background: var(--surface); color: var(--text); border-radius: var(--radius-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; padding: 28px 32px 32px; box-shadow: 0 20px 60px rgba(0,0,0,.2); animation: pop .25s cubic-bezier(.2,.8,.2,1); }
.modal-box.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-head h3 { font-size: 28px; font-weight: 600; letter-spacing: -.015em; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(8px); } }
form label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 14px; }
.modal form input:not([type=checkbox]), .modal form select, .modal form textarea {
  display: block; width: 100%; margin-top: 6px; height: 44px; padding: 0 14px; border: 1px solid var(--hairline); border-radius: var(--radius-sm); background: var(--field-bg); color: var(--text);
}
.modal form input[type=file] { padding: 10px 14px; height: auto; }
.modal form input:focus, .modal form select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(14,156,132,.18); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.month-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 10px; }
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: rgba(29,29,31,.92); backdrop-filter: blur(20px); color: #fff; padding: 12px 20px; border-radius: 980px; font-size: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.2); animation: pop .25s;
}
.legend-note { font-size: 13px; color: var(--text-2); }
.highlight-best { color: var(--teal); font-weight: 600; }

@media (max-width: 1068px) {
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g3, .g-2-1 { grid-template-columns: 1fr; }
  .hero { padding: 40px 32px; }
  .page-head h1 { font-size: 40px; }
  .globalnav-links button { padding: 6px 7px; }
}
@media (max-width: 833px) {
  .globalnav-inner { gap: 12px; padding: 0 16px; }
  .globalnav-logo { margin-right: auto; }
  .globalnav-logo img { height: 40px; }
  .menu-btn { display: block; }
  .globalnav-links {
    position: fixed; top: 56px; left: 0; right: 0; flex-direction: column; justify-content: flex-start; gap: 0;
    background: rgba(10,18,83,.98); backdrop-filter: blur(20px); padding: 12px 32px 28px; display: none;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .globalnav.open .globalnav-links { display: flex; }
  .globalnav-links button { text-align: left; font-size: 24px; font-weight: 600; padding: 8px 0; color: #fff; border-radius: 0; }
  .globalnav-links button.active { background: none; color: var(--mint); }
  .main, .footer { padding-left: 16px; padding-right: 16px; }
  .page-head { padding: 36px 0 20px; }
  .page-head h1 { font-size: 32px; min-width: 0; }
  .g2, .g4 { grid-template-columns: 1fr; }
  .card { padding: 22px 18px; }
  .hero { padding: 32px 22px; }
  .hero .big, .perf-banner-total { font-size: 40px; }
  .hero { background-position: 0 0, 70% center, 0 0, 0 0, 0 0, 0 0; min-height: 0; }
  .hero::before { content: ""; position: absolute; inset: 0; background: rgba(5,22,64,.55); }
  .hero-stat strong { font-size: 26px; }
  .form-grid, .month-grid { grid-template-columns: 1fr 1fr; }
  .modal-box { padding: 22px 20px; }
  .login-title { font-size: 32px; }
  .login-logo { width: 130%; }
}

/* ---------------- Theme toggle ---------------- */
.theme-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06);
  color: #fff; display: grid; place-items: center; flex-shrink: 0; transition: background .2s;
}
.theme-btn:hover { background: rgba(255,255,255,.14); }
.theme-btn svg { width: 16px; height: 16px; }
.theme-btn .icon-sun { display: none; }
:root[data-theme="dark"] .theme-btn .icon-sun { display: block; }
:root[data-theme="dark"] .theme-btn .icon-moon { display: none; }
.menu-label { font-size: 12px; color: var(--text-2); margin: 4px 0 6px; }
.user-menu .segmented { width: 100%; margin-bottom: 12px; }
.user-menu .segmented button { padding: 6px 8px; }

/* ---------------- Section titles & rankings ---------------- */
.section-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 12px 0 -4px; }
.section-title h2 { font-size: 28px; font-weight: 600; letter-spacing: -.015em; }
.rank-card .card-head { margin-bottom: 8px; }
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-item { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--hairline-soft); }
.rank-item:last-child { border-bottom: none; }
.rank-no {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  font-size: 13px; font-weight: 700; background: var(--fill); color: var(--text-2); font-variant-numeric: tabular-nums;
}
.rank-no.gold { background: linear-gradient(135deg, #FFE08A, #F2B705); color: #5A3E00; }
.rank-no.silver { background: linear-gradient(135deg, #EEF1F6, #B9C2CF); color: #3C4654; }
.rank-no.bronze { background: linear-gradient(135deg, #F6CFA8, #C98B55); color: #4E2D10; }
.rank-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.rank-line { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.rank-line > :first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rank-amt { font-variant-numeric: tabular-nums; flex-shrink: 0; }
.rank-sub { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-btn { background: none; border: none; padding: 0; font: inherit; font-weight: 600; color: var(--text); text-align: left; }
.link-btn:hover { color: var(--link); text-decoration: underline; }
.link-btn.subtle { font-weight: 400; font-size: 12px; color: var(--text-2); }

/* ---------------- Broker view ---------------- */
.bv-picker { max-width: 360px; }
.bv-profile { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 20px 28px; }
.bv-profile small { display: block; font-size: 12px; color: var(--text-2); }
.bv-profile strong { font-weight: 500; overflow-wrap: anywhere; }

/* ---------------- Inventory: form, unit type cards, photos ---------------- */
.inv-filters { margin-top: -4px; }
.price-range { border: none; padding: 0; margin: 0 0 4px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 0 12px; align-items: end; }
.price-range legend { font-size: 12px; color: var(--text-2); margin-bottom: 6px; padding: 0; }
.range-dash { padding-bottom: 26px; color: var(--muted); }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.unit-card {
  border-radius: var(--radius); overflow: hidden; background: var(--surface-2); border: 1px solid var(--hairline-soft);
  cursor: pointer; transition: transform .2s, box-shadow .2s; outline: none;
}
.unit-card:hover, .unit-card:focus-visible { transform: translateY(-2px); box-shadow: 0 8px 24px var(--shadow-color); }
.unit-card:focus-visible { box-shadow: 0 0 0 3px var(--link); }
.unit-card-media { position: relative; aspect-ratio: 4 / 3; background: var(--fill); }
.unit-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.unit-thumb-empty { display: grid; place-items: center; color: var(--muted); background: repeating-linear-gradient(135deg, var(--fill) 0 10px, var(--hairline-soft) 10px 20px); }
.unit-photo-btn {
  position: absolute; right: 10px; bottom: 10px; border: none; border-radius: 980px; padding: 5px 12px; font-size: 12px; font-weight: 500;
  background: rgba(10,7,66,.78); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.unit-photo-btn:hover { background: rgba(10,7,66,.92); }
.unit-card-body { padding: 14px 16px 16px; display: grid; gap: 2px; }
.unit-card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.unit-card-top strong { font-size: 17px; letter-spacing: -.01em; }
.unit-qty { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--link); font-variant-numeric: tabular-nums; }
.unit-qty small { font-size: 12px; font-weight: 400; color: var(--text-2); }
.unit-qty.none { color: var(--muted); }
.unit-card-body p { margin: 0; font-size: 13px; }
.unit-price { color: var(--text); font-variant-numeric: tabular-nums; }
.unit-link { display: inline-flex; align-items: center; gap: 10px; background: none; border: none; padding: 0; color: var(--text); font: inherit; }
.unit-link:hover strong { color: var(--link); text-decoration: underline; }
.unit-thumb.mini { width: 40px; height: 30px; border-radius: 6px; flex-shrink: 0; }
.unit-thumb.mini svg { width: 14px; height: 14px; }
.unit-thumb.large { width: 100%; aspect-ratio: 4 / 3; height: auto; border-radius: var(--radius-sm); }
.photo-preview { margin-bottom: 16px; }
.unit-detail { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: center; }
.unit-detail-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.unit-detail-stats > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; }
.unit-detail-stats .wide { grid-column: 1 / -1; }
.unit-detail-stats small { display: block; font-size: 12px; color: var(--text-2); }
.unit-detail-stats strong { font-family: var(--font-display); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.unit-detail-stats .wide strong { font-size: 16px; }

@media (max-width: 833px) {
  .bv-profile { grid-template-columns: 1fr 1fr; padding: 18px; }
  .unit-detail { grid-template-columns: 1fr; }
  .unit-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .section-title h2 { font-size: 24px; }
}

/* Sales target form: amount is calculated, not typed */
.modal form input.calc { background: var(--surface-2); color: var(--text-2); cursor: default; }
.modal form input.calc:focus { border-color: var(--hairline); box-shadow: none; }
.target-calc { display: grid; gap: 4px; padding: 14px 16px; margin-bottom: 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--hairline); }
.target-calc small { font-size: 12px; color: var(--text-2); }
.target-calc strong { font-size: 26px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.target-calc span { font-size: 12px; }
/* Project inventory total + target units cap */
.inv-total { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 12px; padding: 12px 16px; margin-bottom: 14px; border-radius: var(--radius-sm); border: 1px solid var(--hairline); }
.inv-total[hidden] { display: none; }
.inv-total span { font-size: 12px; color: var(--text-2); }
.inv-total strong { font-size: 17px; font-weight: 600; color: var(--text); }
.inv-total small { grid-column: 1 / -1; font-size: 12px; color: var(--text-2); line-height: 1.5; }
.inv-total small b { color: var(--text); font-weight: 600; }
.field-hint { display: block; margin-top: 6px; font-size: 12px; color: var(--text-2); min-height: 1em; }
.field-hint.error { color: var(--danger); }
.modal form input.invalid, .modal form input.invalid:focus { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(227,0,0,.12); }
