/* ==========================================================================
   Chamber admin — dashboard shell and components.
   Builds on portal.css (colour tokens, buttons). Same navy + accent, but a
   working surface: light grey canvas, white cards, a navy sidebar.
   ========================================================================== */

.ad-body { background: var(--cp-bg); min-height: 100vh; font-size: .93rem; }
.ad-shell { display: flex; min-height: 100vh; }

/* ---- Sidebar ------------------------------------------------------------ */
.ad-sidebar {
    --bs-offcanvas-width: 284px;
    --bs-offcanvas-bg: var(--cp-primary-dark);
    --bs-offcanvas-color: #fff;
    background: linear-gradient(190deg, var(--cp-primary) 0%, var(--cp-primary-dark) 100%);
    color: #fff; display: flex; flex-direction: column; width: 264px; flex: none;
}
@media (min-width: 992px) {
    .ad-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
.ad-brand { display: flex; align-items: center; gap: .8rem; padding: 1.15rem 1.2rem 1rem; text-decoration: none; color: #fff; }
.ad-brand:hover { color: #fff; }
.ad-brand .cp-mark { background: rgba(255, 255, 255, .14); width: 42px; height: 42px; }
.ad-brand .cp-mark img { background: #fff; }
.ad-brand .cp-mark.is-wide { --cp-wide-h: 42px; width: auto; height: var(--cp-wide-h); background: #fff; }
.ad-brand .cp-mark.is-wide + .ad-brand-text .ad-brand-name { display: none; }
/* Beside a wordmark there is no room for the label of the menu, so it sits under the logo. */
.ad-brand.has-wide-logo { flex-wrap: wrap; row-gap: .5rem; }
.ad-brand.has-wide-logo .ad-brand-text { flex-basis: 100%; }
.ad-brand-text { line-height: 1.15; min-width: 0; }
.ad-brand-name { display: block; font: 800 .98rem 'Montserrat', sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-brand-sub { font-size: .64rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .6); }
.ad-nav { padding: .4rem .8rem 1rem; flex: 1; }
.ad-nav-label { font-size: .64rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .45); padding: 1.1rem .6rem .4rem; }
.ad-link {
    display: flex; align-items: center; gap: .75rem; padding: .62rem .75rem; border-radius: 11px; margin-bottom: 2px;
    color: rgba(255, 255, 255, .82); text-decoration: none; font-weight: 500; position: relative;
}
.ad-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; opacity: .9; }
.ad-link:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.ad-link.active { background: rgba(255, 255, 255, .15); color: #fff; font-weight: 600; }
.ad-link.active::before { content: ""; position: absolute; left: -.8rem; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--cp-accent); }
.ad-link .ad-count { margin-left: auto; font-size: .7rem; font-weight: 700; background: var(--cp-accent); color: #fff; border-radius: 999px; padding: .1rem .5rem; }
.ad-user { padding: .9rem 1rem 1.1rem; border-top: 1px solid rgba(255, 255, 255, .12); display: flex; align-items: center; gap: .7rem; }
.ad-avatar {
    width: 38px; height: 38px; flex: none; border-radius: 12px; display: grid; place-items: center;
    background: var(--cp-accent); color: #fff; font-weight: 700; font-size: .85rem;
}
.ad-user-text { min-width: 0; flex: 1; line-height: 1.2; }
.ad-user-text strong { display: block; font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-user-text a, .ad-user-text button { font-size: .74rem; color: rgba(255, 255, 255, .65); text-decoration: none; background: none; border: 0; padding: 0; }
.ad-user-text a:hover, .ad-user-text button:hover { color: #fff; text-decoration: underline; }

/* ---- Main column -------------------------------------------------------- */
.ad-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ad-topbar {
    position: sticky; top: 0; z-index: 1020; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--cp-line); padding: .8rem 1.5rem; display: flex; align-items: center; gap: 1rem;
}
.ad-topbar h1 { font-size: 1.28rem; margin: 0; line-height: 1.2; }
.ad-topbar .ad-subtitle { color: var(--cp-muted); font-size: .8rem; margin: 0; }
.ad-topbar-lang { margin-left: auto; flex-shrink: 0; }
.ad-actions { margin-left: .75rem; display: flex; gap: .55rem; flex-wrap: wrap; justify-content: flex-end; }
.ad-content { padding: 1.5rem; max-width: 1320px; width: 100%; }
@media (max-width: 575.98px) { .ad-content { padding: 1rem; } .ad-topbar { padding: .7rem 1rem; } .ad-topbar .ad-subtitle { display: none; } }
/* On phones the page's buttons sit under the title instead of squeezing the sticky bar. */
.ad-actions-mobile { margin: 0 0 1rem; justify-content: flex-start; }

/* ---- Cards -------------------------------------------------------------- */
.ad-card { background: #fff; border: 1px solid var(--cp-line); border-radius: var(--cp-radius); box-shadow: 0 1px 2px rgba(16, 32, 56, .04); }
.ad-card-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; padding: 1rem 1.25rem; border-bottom: 1px solid var(--cp-line); }
.ad-card-head h2, .ad-card-head h3 { font-size: 1rem; margin: 0; }
.ad-card-head p { margin: .15rem 0 0; color: var(--cp-muted); font-size: .8rem; }
.ad-card-body { padding: 1.25rem; }
.ad-eyebrow { font-size: .68rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--cp-muted); }

/* Dashboard hero — the navy band, as on the WooWhoLocal dashboard */
.ad-hero {
    position: relative; overflow: hidden; color: #fff; border-radius: 20px; padding: 1.7rem 2rem; margin-bottom: 1.4rem;
    background: linear-gradient(135deg, var(--cp-primary-dark) 0%, var(--cp-primary) 70%);
}
.ad-hero::before { content: ""; position: absolute; width: 380px; height: 380px; right: -90px; top: -160px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--cp-accent) 45%, transparent), transparent 68%); }
.ad-hero > * { position: relative; }
.ad-hero h2 { color: #fff; font-size: 1.5rem; margin: 0 0 .25rem; }
.ad-hero p { margin: 0; color: rgba(255, 255, 255, .78); }
.ad-hero .btn { --bs-btn-font-size: .85rem; }
.ad-hero-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .8rem; border-radius: 999px; font-size: .76rem; font-weight: 600; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2); color: #fff; text-decoration: none; }
a.ad-hero-chip:hover { background: rgba(255, 255, 255, .2); color: #fff; }

/* KPI tiles */
.ad-kpi { padding: 1.1rem 1.25rem; height: 100%; text-decoration: none; color: inherit; display: block; transition: box-shadow .15s, transform .15s, border-color .15s; }
a.ad-kpi:hover { box-shadow: var(--cp-shadow); transform: translateY(-2px); border-color: color-mix(in srgb, var(--cp-accent) 45%, #fff); color: inherit; }
.ad-kpi-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; margin-bottom: .7rem; }
.ad-kpi-value { font: 800 1.75rem/1.1 'Montserrat', sans-serif; color: var(--cp-primary); letter-spacing: -.02em; }
.ad-kpi-label { font-size: .8rem; color: var(--cp-muted); font-weight: 500; margin-top: .15rem; }
.ad-kpi-note { font-size: .74rem; color: var(--cp-muted); margin-top: .35rem; }
.tone-teal { background: var(--cp-accent-soft); color: var(--cp-accent-dark); }
.tone-navy { background: var(--cp-primary-soft); color: var(--cp-primary); }
.tone-amber { background: #fff4e0; color: #b26a00; }
.tone-rose { background: #fdebec; color: #b3261e; }
.tone-violet { background: #f0ebfb; color: #5b3fa8; }
.tone-blue { background: #e8f1fd; color: #1c5fbf; }

/* ---- Tables ------------------------------------------------------------- */
.ad-table { margin: 0; --bs-table-bg: transparent; }
.ad-table thead th { font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--cp-muted); background: #fafbfd; border-bottom: 1px solid var(--cp-line); padding: .7rem 1rem; white-space: nowrap; }
.ad-table tbody td { padding: .8rem 1rem; vertical-align: middle; border-color: var(--cp-line); }
.ad-table tbody tr:hover > * { background: #fafcff; }
.ad-table .num, .ad-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.ad-name { font-weight: 600; color: var(--cp-ink); text-decoration: none; }
a.ad-name:hover { color: var(--cp-accent-dark); text-decoration: underline; }
.ad-sub { display: block; font-size: .76rem; color: var(--cp-muted); }
.ad-thumb { width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .78rem; background-size: cover; background-position: center; overflow: hidden; }
.ad-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-row-actions { display: flex; gap: .35rem; justify-content: flex-end; flex-wrap: wrap; }
.ad-icon-btn { align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--cp-line); background: #fff; color: var(--cp-primary); display: inline-grid; place-items: center; text-decoration: none; padding: 0; }
.ad-icon-btn:hover { border-color: var(--cp-primary); background: var(--cp-primary-soft); color: var(--cp-primary); }
.ad-icon-btn.danger:hover { border-color: #d9534f; background: #fdebec; color: #b3261e; }

@media (max-width: 575.98px) {
    .ad-table thead th, .ad-table tbody td { padding-left: .6rem; padding-right: .6rem; }
    .ad-table .ad-thumb { display: none; }
}

/* ---- Pills -------------------------------------------------------------- */
.ad-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .22rem .65rem; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.ad-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ad-pill.ok { background: #e3f6ee; color: #0d7a52; }
.ad-pill.warn { background: #fff1d6; color: #9a5b00; }
.ad-pill.danger { background: #fde8e8; color: #b3261e; }
.ad-pill.info { background: #e6f0fd; color: #1c5fbf; }
.ad-pill.muted { background: #eceff4; color: #56657a; }
.ad-pill.badge-on { background: var(--cp-accent-soft); color: var(--cp-accent-dark); }

/* ---- Filters ------------------------------------------------------------ */
.ad-filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.ad-filters .form-control, .ad-filters .form-select { border-radius: 10px; font-size: .86rem; }
.ad-search { position: relative; flex: 1 1 240px; max-width: 360px; }
.ad-search i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--cp-muted); pointer-events: none; }
.ad-search .form-control { padding-left: 2.3rem; }
.ad-tabs { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* ---- Forms -------------------------------------------------------------- */
.ad-form .form-label { font-weight: 600; font-size: .82rem; margin-bottom: .3rem; color: var(--cp-ink); }
.ad-form .form-control, .ad-form .form-select { border-radius: 10px; border-color: #d5dce7; font-size: .9rem; }
.ad-form .form-control:focus, .ad-form .form-select:focus { border-color: var(--cp-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cp-accent) 22%, #fff); }
.ad-help { font-size: .76rem; color: var(--cp-muted); margin-top: .3rem; }
.ad-req { color: #b3261e; }

/* Password fields with a show/hide button (added by admin.js). */
.cp-pw > .form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cp-pw-toggle {
    border: 1px solid #d5dce7; border-left: 0; background: #fff; color: var(--cp-muted); padding: 0 .85rem; line-height: 1;
    border-radius: 0 var(--bs-border-radius, .375rem) var(--bs-border-radius, .375rem) 0;
}
.ad-form .cp-pw-toggle { border-radius: 0 10px 10px 0; }
.cp-pw-toggle:hover { color: var(--cp-primary); background: var(--cp-primary-soft); }
.cp-pw-toggle:focus-visible { outline: 2px solid var(--cp-accent); outline-offset: -2px; }
.cp-pw > .form-control.is-invalid ~ .cp-pw-toggle { border-color: var(--bs-form-invalid-border-color, #dc3545); }
.ad-fieldset { margin-bottom: 1.25rem; }
.ad-fieldset > .ad-card-head h3 i { color: var(--cp-accent-dark); margin-right: .45rem; }
.ad-color { display: flex; gap: .6rem; align-items: center; }
.ad-color input[type=color] { width: 46px; height: 40px; padding: 3px; border: 1px solid #d5dce7; border-radius: 10px; background: #fff; flex: none; }
.ad-sticky-save { position: sticky; bottom: 0; z-index: 5; background: rgba(245, 247, 250, .94); backdrop-filter: blur(6px); border-top: 1px solid var(--cp-line); margin: 1.5rem -1.5rem -1.5rem; padding: .85rem 1.5rem; display: flex; gap: .6rem; align-items: center; }
@media (max-width: 575.98px) { .ad-sticky-save { margin: 1.5rem -1rem -1rem; padding: .85rem 1rem; } }

.ad-hours { display: grid; gap: .5rem; }
.ad-hours-row { display: grid; grid-template-columns: 96px 1fr 1fr auto; gap: .6rem; align-items: center; }
.ad-hours-row .day { font-weight: 600; font-size: .84rem; }
.ad-hours-row .form-check { margin: 0; white-space: nowrap; font-size: .82rem; }
.ad-hours-row input:disabled { background: #f1f4f8; }
@media (max-width: 575.98px) { .ad-hours-row { grid-template-columns: 1fr 1fr; } .ad-hours-row .day { grid-column: 1 / -1; } .ad-hours-row .form-check { grid-column: 1 / -1; } }

.ad-preview { border-radius: 14px; overflow: hidden; border: 1px solid var(--cp-line); }
.ad-preview-bar { padding: 1rem 1.2rem; display: flex; align-items: center; gap: .8rem; color: #fff; background: var(--pv-primary, var(--cp-primary)); }
.ad-preview-bar .cp-mark { background: rgba(255, 255, 255, .16); }
.ad-preview-body { padding: 1.1rem 1.2rem; background: #fff; }
.ad-preview-btn { display: inline-block; padding: .5rem 1rem; border-radius: 10px; font-weight: 600; font-size: .85rem; color: #fff; background: var(--pv-accent, var(--cp-accent)); }

/* Upload preview */
.ad-img-preview { width: 100%; max-width: 220px; aspect-ratio: 16 / 10; border-radius: 12px; border: 1px dashed #c4cddb; background: #f6f8fb center / cover no-repeat; display: grid; place-items: center; color: var(--cp-muted); font-size: .76rem; }
.ad-img-preview.logo { aspect-ratio: 1; max-width: 110px; background-size: contain; }

/* ---- Bars (no-JS charts) ------------------------------------------------ */
.ad-bars { display: flex; align-items: flex-end; gap: .7rem; height: 150px; padding-top: 1.4rem; }
.ad-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.ad-bar-fill { width: 100%; max-width: 46px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--cp-accent), var(--cp-accent-dark)); min-height: 3px; position: relative; }
.ad-bar-fill.now { background: linear-gradient(180deg, var(--cp-primary), var(--cp-primary-dark)); }
.ad-bar-val { font-size: .68rem; font-weight: 700; color: var(--cp-primary); margin-bottom: .25rem; white-space: nowrap; }
.ad-bar-label { font-size: .68rem; color: var(--cp-muted); margin-top: .4rem; white-space: nowrap; }
.ad-bars.sm { height: 96px; padding-top: .8rem; gap: .3rem; }
.ad-bars.sm .ad-bar-fill { max-width: 22px; border-radius: 5px 5px 2px 2px; }

.ad-meter { height: 8px; border-radius: 999px; background: #e9edf3; overflow: hidden; }
.ad-meter > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--cp-accent), var(--cp-accent-dark)); }

.ad-funnel { display: grid; gap: .55rem; }
.ad-funnel-row { display: grid; grid-template-columns: 96px 1fr 70px; gap: .8rem; align-items: center; font-size: .84rem; }
.ad-funnel-row .bar { height: 26px; border-radius: 8px; background: #eef2f7; overflow: hidden; }
.ad-funnel-row .bar span { display: block; height: 100%; border-radius: 8px; }
.ad-funnel-row strong { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Misc --------------------------------------------------------------- */
.ad-empty { text-align: center; padding: 2.6rem 1.2rem; color: var(--cp-muted); }
.ad-empty i { font-size: 2rem; color: #b8c2d1; display: block; margin-bottom: .6rem; }
.ad-empty h3 { font-size: 1rem; margin-bottom: .3rem; }
.ad-list { list-style: none; margin: 0; padding: 0; }
.ad-list li { display: flex; align-items: center; gap: .8rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--cp-line); }
.ad-list li:last-child { border-bottom: 0; }
.ad-list .grow { flex: 1; min-width: 0; }
.ad-qr { background: #fff; border: 1px solid var(--cp-line); border-radius: 16px; padding: 1rem; max-width: 280px; }
.ad-qr svg { width: 100%; height: auto; display: block; }
.ad-code { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .12em; background: var(--cp-primary-soft); color: var(--cp-primary); border-radius: 8px; padding: .15rem .55rem; }
.ad-kv { display: grid; grid-template-columns: 9rem 1fr; gap: .4rem 1rem; margin: 0; font-size: .86rem; }
.ad-kv dt { color: var(--cp-muted); font-weight: 500; }
.ad-kv dd { margin: 0; word-break: break-word; }
.ad-alert { border-radius: 12px; border: 1px solid; padding: .8rem 1rem; margin-bottom: 1.1rem; display: flex; gap: .7rem; align-items: flex-start; font-size: .88rem; }
.ad-alert i { margin-top: .1rem; }
.ad-alert.ok { background: #e9f8f1; border-color: #bfe8d5; color: #0b5c3f; }
.ad-alert.err { background: #fdecec; border-color: #f4c5c5; color: #8f1f19; }
.ad-alert.info { background: #eaf2fd; border-color: #c5daf7; color: #1a4f9c; }
.ad-alert ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.ad-pager .pagination { --bs-pagination-color: var(--cp-primary); --bs-pagination-active-bg: var(--cp-primary); --bs-pagination-active-border-color: var(--cp-primary); }

/* ---- Sign-in ------------------------------------------------------------ */
.ad-auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(135deg, var(--cp-primary-dark), var(--cp-primary) 75%); position: relative; overflow: hidden; }
.ad-auth::before { content: ""; position: absolute; width: 640px; height: 640px; right: -180px; top: -240px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--cp-accent) 40%, transparent), transparent 68%); }
.ad-auth-card { position: relative; width: 100%; max-width: 420px; background: #fff; border-radius: 22px; padding: 2rem 2rem 1.6rem; box-shadow: var(--cp-shadow-lg); }
.ad-auth-card h1 { font-size: 1.45rem; margin: 1rem 0 .2rem; }

/* ---- Print (reports) ---------------------------------------------------- */
@media print {
    .ad-sidebar, .ad-topbar .btn, .ad-actions, .no-print, .ad-sticky-save { display: none !important; }
    .ad-body { background: #fff; }
    .ad-card { box-shadow: none; break-inside: avoid; }
    .ad-content { padding: 0; max-width: none; }
    .ad-topbar { position: static; border: 0; }
}
