/* Hakika portal — builds on styles.css (same tokens) */
.portal-header .nav a.active { color: #fff; }
.user-chip { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255,255,255,.8); }
.user-chip .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }

.portal-top { background: var(--primary); color: #fff; padding: 36px 0 0; }
.portal-top .row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; padding-bottom: 24px; }
.portal-top h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; color: #fff; }
.portal-top .sub { font-size: 14px; color: rgba(255,255,255,.65); margin-top: 6px; }
.grain-tabs { display: flex; gap: 4px; }
.grain-tabs button { background: none; border: 0; border-bottom: 3px solid transparent; color: rgba(255,255,255,.6); font: inherit; font-size: 14px; font-weight: 600; padding: 12px 18px; cursor: pointer; }
.grain-tabs button.active { color: #fff; border-bottom-color: var(--accent); }
.grain-tabs button:disabled { color: rgba(255,255,255,.3); cursor: default; }
.grain-tabs button:disabled small { display: block; font-size: 10px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: rgba(255,255,255,.1); border-top: 1px solid rgba(255,255,255,.1); }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--primary); padding: 20px 24px 22px; }
.kpi .k { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.5); margin-bottom: 8px; }
.kpi .v { font-size: 26px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .v small { font-size: 13px; font-weight: 500; color: rgba(255,255,255,.55); margin-left: 4px; }
.kpi .d { font-size: 13px; margin-top: 4px; color: rgba(255,255,255,.65); }
.up { color: #7bd3a5; } .down { color: #f0a46b; }

.panel-section { padding: 48px 0; }
.panel-section + .panel-section { padding-top: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 20px; }
.section-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.section-head .meta { font-size: 13px; color: var(--fg-muted); }
.card-box { background: #fff; border: 1px solid var(--border); }

/* Map */
.map-wrap { display: grid; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .map-wrap { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); } }
.map-stage { position: relative; background: var(--muted); min-height: 320px; }
.map-stage svg { display: block; width: 100%; height: auto; }
.map-stage .legend { position: absolute; left: 16px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--fg-muted); }
.map-stage .legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-stage .legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.country { fill: #cfe3d8; stroke: #fff; stroke-width: .5; }
.country.has-origin { fill: #9cc4b0; cursor: pointer; transition: fill .15s; }
.country.has-origin:hover, .country.selected { fill: var(--primary); }
.country.destination { fill: #e3c27a; }
.route { fill: none; stroke: var(--primary); stroke-width: 1; stroke-dasharray: 4 4; opacity: .55; }
.route.selected { stroke: var(--accent); stroke-width: 1.8; opacity: 1; }
.pin circle { fill: var(--primary); stroke: #fff; stroke-width: 2; cursor: pointer; transition: r .15s; }
.pin:hover circle, .pin.selected circle { fill: var(--accent); }
.pin text { font-size: 11px; font-weight: 600; fill: var(--fg); pointer-events: none; paint-order: stroke; stroke: var(--muted); stroke-width: 3px; stroke-linejoin: round; }
.pin.destination circle { fill: var(--accent); }
.pin.destination .pulse { fill: none; stroke: var(--accent); stroke-width: 2; opacity: .6; animation: pulse 2.2s ease-out infinite; }
@keyframes pulse { 0% { r: 7; opacity: .7 } 100% { r: 24; opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .pin.destination .pulse { animation: none; opacity: 0; } }

.origin-panel { padding: 24px; border-top: 1px solid var(--border); }
@media (min-width: 1024px) { .origin-panel { border-top: 0; border-left: 1px solid var(--border); } }
.origin-panel .eyebrow { margin-bottom: 8px; }
.origin-panel h3 { font-size: 20px; font-weight: 700; margin-bottom: 2px; }
.origin-panel .port { font-size: 13px; color: var(--fg-muted); margin-bottom: 18px; }
.price-rows { display: flex; flex-direction: column; border-top: 1px solid var(--border); margin-bottom: 18px; }
.price-rows > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.price-rows .p { font-weight: 700; font-variant-numeric: tabular-nums; }
.price-rows .delta { font-size: 12px; font-weight: 600; margin-left: 6px; }
.origin-panel .note { font-size: 14px; line-height: 1.6; color: var(--fg-muted); }
.origin-panel .note b { color: var(--fg); }
.origin-panel .hint { font-size: 13px; color: var(--fg-muted); }
.origin-panel .actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.btn-sm { display: inline-block; padding: 9px 14px; font-size: 13px; font-weight: 600; border: 1px solid var(--primary); color: var(--primary); background: #fff; cursor: pointer; font-family: inherit; }
.btn-sm.solid { background: var(--primary); color: #fff; }
.btn-sm:hover { opacity: .85; }

/* Chart */
.chart-controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--border); font-size: 13px; }
.chart-controls label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--fg-muted); }
.chart-controls input { accent-color: var(--primary); }
.chart-controls .spacer { flex: 1; }
.chart-controls .filter { font-weight: 600; color: var(--primary); }
.chart-controls .filter button { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; margin-left: 6px; }
.chart-stage { padding: 16px 8px 8px; }
.chart-stage svg { display: block; width: 100%; height: auto; }
.chart-stage .axis text { font-size: 11px; fill: var(--fg-muted); }
.chart-stage .axis line, .chart-stage .axis path { stroke: var(--border); }
.chart-stage .grid line { stroke: var(--border); stroke-dasharray: 2 3; }
.chart-stage .series path { fill: none; stroke-width: 2; }
.chart-stage .series circle { stroke: #fff; stroke-width: 1.5; }
.chart-stage .series.dim path, .chart-stage .series.dim circle { opacity: .15; }
.chart-stage .series circle.demo { fill: #fff !important; stroke-width: 2; }
.chart-stage .ref path { fill: none; stroke-width: 1.5; stroke-dasharray: 6 4; }
.chart-stage .ref text { font-size: 11px; font-weight: 600; }
.chart-stage .ref.floor path, .chart-stage .ref.floor text { stroke: #b23b3b; fill: #b23b3b; } .chart-stage .ref.floor text { stroke: none; }
.chart-stage .ref.parity path, .chart-stage .ref.parity text { stroke: var(--accent); fill: var(--accent); } .chart-stage .ref.parity text { stroke: none; }
.legend-list { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 4px 24px 18px; font-size: 12px; }
.legend-list button { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; font: inherit; font-size: 12px; color: var(--fg-muted); cursor: pointer; padding: 2px 0; }
.legend-list button.off { opacity: .35; text-decoration: line-through; }
.legend-list i { width: 14px; height: 3px; display: inline-block; border-radius: 2px; }
.tip { position: absolute; pointer-events: none; background: var(--primary); color: #fff; font-size: 12px; padding: 8px 10px; line-height: 1.4; border-radius: 2px; transform: translate(-50%, calc(-100% - 12px)); white-space: nowrap; opacity: 0; transition: opacity .1s; z-index: 5; }
.tip b { font-variant-numeric: tabular-nums; }
.demo-badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 6px; border: 1px solid var(--accent); color: var(--accent); border-radius: 2px; vertical-align: middle; margin-left: 8px; }

/* Table */
.table-wrap { overflow-x: auto; }
table.prices { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
table.prices th, table.prices td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.prices th { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-muted); background: var(--muted); }
table.prices td.num, table.prices th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.prices td.num b { font-weight: 700; }
table.prices tr.sel td { background: #f3f8f5; }
table.prices tbody tr { cursor: pointer; }
table.prices tbody tr:hover td { background: #f3f8f5; }
.tag-basis { font-size: 11px; font-weight: 600; color: var(--fg-muted); border: 1px solid var(--border); padding: 1px 6px; border-radius: 2px; }

/* Feed */
.feed { display: flex; flex-direction: column; gap: 16px; }
.update { background: #fff; border: 1px solid var(--border); }
.update summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 18px 24px; }
.update summary::-webkit-details-marker { display: none; }
.update .date { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); min-width: 110px; }
.update .ttl { font-size: 16px; font-weight: 700; flex: 1; }
.update .chev { transition: transform .2s; color: var(--fg-muted); }
.update[open] .chev { transform: rotate(180deg); }
.update .body { padding: 0 24px 24px; border-top: 1px solid var(--border); }
.update .body p { font-size: 15px; line-height: 1.65; color: var(--fg-muted); margin: 14px 0 0; max-width: 72ch; }
.update .body p.price-line { margin: 2px 0 0; font-variant-numeric: tabular-nums; color: var(--fg); }
.update .body p.head { font-weight: 700; color: var(--fg); margin-top: 18px; }
.update .body p b { color: var(--fg); }
.update .quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.update .quick span { font-size: 12px; background: var(--muted); padding: 4px 8px; font-variant-numeric: tabular-nums; }

/* Empty state */
.empty { padding: 48px 24px; text-align: center; color: var(--fg-muted); }
.empty b { color: var(--fg); display: block; margin-bottom: 6px; font-size: 16px; }

/* Auth pages */
.auth { min-height: calc(100vh - 80px); display: grid; grid-template-columns: 1fr; }
@media (min-width: 900px) { .auth { grid-template-columns: 1fr 1fr; } }
.auth-side { background: var(--primary); color: #fff; padding: 64px var(--pad); display: flex; flex-direction: column; justify-content: center; }
.auth-side h1 { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-bottom: 16px; color: #fff; }
.auth-side p { color: rgba(255,255,255,.72); font-size: 16px; line-height: 1.6; max-width: 44ch; }
.auth-side ul { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.auth-side li { display: flex; gap: 10px; align-items: flex-start; color: rgba(255,255,255,.85); font-size: 15px; }
.auth-side li::before { content: ""; flex-shrink: 0; width: 8px; height: 8px; margin-top: 8px; background: var(--accent); }
.auth-form { padding: 56px var(--pad); display: flex; align-items: center; }
.auth-form .inner { width: 100%; max-width: 440px; margin: 0 auto; }
.auth-form h2 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px; }
.auth-form .lead { margin-bottom: 28px; font-size: 15px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); }
.seg label { text-align: center; padding: 11px 8px; font-size: 14px; cursor: pointer; border-right: 1px solid var(--border); }
.seg label:last-child { border-right: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.seg label { position: relative; }
.seg input:checked + span { font-weight: 700; color: var(--primary); }
.seg label:has(input:checked) { background: var(--muted); }
.auth-form .foot { margin-top: 20px; font-size: 14px; color: var(--fg-muted); }
.notice { background: var(--muted); border-left: 4px solid var(--accent); padding: 18px 20px; font-size: 15px; line-height: 1.6; }
.notice b { display: block; margin-bottom: 4px; }
.err { color: #b23b3b; font-size: 13px; margin-top: 6px; }

/* Table controls + sortable headers */
.table-controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: end; padding: 14px 24px; border-bottom: 1px solid var(--border); font-size: 13px; }
.table-controls label { display: flex; flex-direction: column; gap: 4px; color: var(--fg-muted); font-weight: 600; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.table-controls select, .chart-controls select { font: inherit; font-size: 13px; font-weight: 500; color: var(--fg); background: #fff; border: 1px solid var(--border); padding: 7px 10px; min-width: 150px; border-radius: 0; text-transform: none; letter-spacing: 0; }
.chart-controls .filter label { display: inline-flex; align-items: center; gap: 8px; }
table.prices th[data-sort] { cursor: pointer; user-select: none; }
table.prices th[data-sort]:hover { color: var(--primary); }
table.prices th[data-sort]::after { content: " ↕"; opacity: .35; }
table.prices th.sorted[data-dir="asc"]::after { content: " ↑"; opacity: 1; color: var(--accent); }
table.prices th.sorted[data-dir="desc"]::after { content: " ↓"; opacity: 1; color: var(--accent); }

/* Admin */
table.members td, table.members th { white-space: normal; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 2px; }
.pill.pending { background: #fff3d6; color: #8a5a00; }
.pill.approved { background: #dff3e7; color: #0b3c2e; }
.pill.blocked { background: #f8dcdc; color: #8a1f1f; }

[hidden] { display: none !important; }

.seg-mini { display: inline-flex; border: 1px solid var(--border); margin-right: 8px; }
.seg-mini button { background: #fff; border: 0; border-right: 1px solid var(--border); padding: 7px 12px; font: inherit; font-size: 13px; font-weight: 600; color: var(--fg-muted); cursor: pointer; }
.seg-mini button:last-child { border-right: 0; }
.seg-mini button.active { background: var(--primary); color: #fff; }
.pin.stale .dot { fill: #6f9c88; }
.pin.stale:hover .dot, .pin.stale.selected .dot { fill: var(--accent); }
table.prices td.stale { color: var(--fg-muted); }

/* Admin editor */
.row3 { display: grid; grid-template-columns: 1fr; gap: 16px; } .row4 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (min-width: 768px) { .row3 { grid-template-columns: repeat(3, 1fr); } .row4 { grid-template-columns: repeat(4, 1fr); } }
.fs { border: 1px solid var(--border); padding: 16px 20px 20px; margin: 0; }
.fs legend { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-muted); padding: 0 6px; }
.fill-box { border: 1px dashed var(--border); padding: 12px 16px; background: var(--muted); }
.fill-box summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.fill-box textarea { width: 100%; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; border: 1px solid var(--border); padding: 10px; background: #fff; }
table.lines td, table.lines th { padding: 8px 10px; white-space: normal; }
table.lines input, table.lines select { width: 100%; min-width: 90px; border: 1px solid var(--border); padding: 7px 8px; font: inherit; font-size: 13px; border-radius: 0; background: #fff; }
table.lines select.l-origin { min-width: 150px; }
.btn-sm.danger { border-color: #b23b3b; color: #b23b3b; }
.form .btn-row { align-items: center; }
code { font-size: 12px; background: var(--muted); padding: 1px 4px; }
