/* Desktop-first layout for the business portal and admin dashboard. Tokens and components come from styles.css. */
body.portal { background: var(--bg); min-height: 100vh; }
.p-top {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.p-top-in { max-width: 1180px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.p-brand { display: flex; align-items: center; gap: 10px; color: var(--accent); }
.p-brand b { font-family: var(--display); font-size: 22px; color: var(--text); }
.p-brand span { font-size: 13px; color: var(--text-muted); }
.p-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.p-nav a { padding: 8px 14px; border-radius: var(--r-pill); font-size: 14px; font-weight: 500; color: var(--text-muted); }
.p-nav a.on { background: var(--accent-soft); color: var(--accent); }
.p-nav a:hover { color: var(--text); }
.p-user { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); }
.p-main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 80px; }
.p-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.p-head .display { font-size: 30px; }
.p-head .meta { margin-top: 4px; }
.p-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.p-section { margin-top: 28px; }
.p-section > h2 { margin-bottom: 12px; }
.p-narrow { max-width: 460px; margin: 48px auto; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px 18px; min-width: 0; }
.kpi .k-label { font-size: 13px; color: var(--text-muted); }
.kpi .k-value { font-family: var(--display); font-size: 30px; line-height: 1.2; margin-top: 6px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi .k-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Tables */
.t-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: start; font-weight: 500; color: var(--text-muted); font-size: 12.5px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
table.t td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.t-empty { padding: 28px; text-align: center; color: var(--text-muted); }
.mini-bar { display: inline-block; vertical-align: middle; width: 80px; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-inline-start: 8px; }
.mini-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* Forms */
.f-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
.f-grid .wide { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 20px 22px; }
.panel + .panel { margin-top: 16px; }

/* Charts (hand-drawn SVG) */
.charts3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px 10px; position: relative; }
.chart-card h3 { font-size: 14px; font-weight: 600; }
.chart-card .total { font-size: 12.5px; color: var(--text-muted); }
.chart-card svg { display: block; width: 100%; height: auto; margin-top: 8px; overflow: visible; }
.chart-card .axis { fill: var(--text-muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chart-card .grid { stroke: var(--border); stroke-width: 1; }
.chart-card .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-card .area { fill: var(--accent); opacity: .1; }
.chart-card .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-card .hit { fill: transparent; cursor: crosshair; }
.chart-card .cross { stroke: var(--text-muted); stroke-dasharray: 3 3; }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--text); color: var(--bg); font-size: 12.5px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; opacity: 0; transition: opacity .1s; }
.tip.show { opacity: 1; }
.funnel { display: grid; gap: 10px; }
.f-row { display: grid; grid-template-columns: 160px 1fr 110px; gap: 12px; align-items: center; font-size: 14px; }
.f-bar { height: 22px; border-radius: 0 4px 4px 0; background: var(--accent); min-width: 2px; }
[dir="rtl"] .f-bar { border-radius: 4px 0 0 4px; }
.f-row .num { text-align: end; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.lists { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }

@media (max-width: 640px) {
  .p-top-in, .p-main { padding-inline: 16px; }
  .f-row { grid-template-columns: 100px 1fr 80px; }
  .p-user { margin-inline-start: 0; width: 100%; }
}
