/**
 * Design tokens for the customer support portal (see includes/portal-chrome.php
 * and the shortcodes in includes/portal.php and includes/account.php).
 *
 * Custom properties are declared globally (harmless where unused), but
 * every rule below that actually redraws a shared class name — .bds-btn,
 * .bds-panel, .bds-table, .bds-status, .bds-thread/.bds-msg, .bds-form
 * and its fields, .bds-tile*, .bds-note, .bds-meta, .bds-team*, .bds-chip,
 * .bds-h2/.bds-h3 — is written as ".bds-portal-scope <selector>", a
 * descendant selector with strictly higher specificity than the bare
 * ".bds-x" rule it is overriding further down this file. That is
 * deliberate, not incidental: the agent console (includes/agent-console.php,
 * includes/admin-tickets.php) reuses several of these exact class names
 * for its own dark-themed screens, and is never wrapped in
 * .bds-portal-scope (only bds_portal_page() — portal-chrome.php — adds
 * that wrapper, and only around the five customer-facing shortcodes).
 * A same-specificity redefinition would depend on which rule happens to
 * come LAST in this file — fragile, and wrong the moment either section
 * is reordered. The higher-specificity scope means the two can never
 * fight regardless of order: the portal gets the light redesign, the
 * agent console keeps exactly the rules below untouched.
 */
:root{
  --ground:#eef2f6; --surface:#ffffff; --raised:#f8fafc;
  --ink:#0d1620; --body:#33424f; --muted:#66788a;
  --rule:#dde5ec; --rule-soft:#eaf0f5;
  --site:#0a0e1a; --site-2:#111a2b; --cyan:#00d4ff;
  --accent:#0b6e82;

  --status-open-fg:#5c6f80;     --status-open-bg:#eef2f6;
  --status-progress-fg:#1f6ba8; --status-progress-bg:#e6f0fa;
  --status-reply-fg:#a85f12;    --status-reply-bg:#fdf1e0;
  --status-closed-fg:#2c7a52;   --status-closed-bg:#e6f4ec;

  --sev-down:#b3261e; --sev-degraded:#93650a; --sev-question:#6d7c8a;

  --font-heading:'Archivo',Arial,Helvetica,sans-serif;
  --font-body:'Source Sans 3','Segoe UI',Arial,sans-serif;
  --font-mono:'IBM Plex Mono','SFMono-Regular',Consolas,'Liberation Mono',monospace;
}

.bds-portal{max-width:1100px;margin:0 auto}
.bds-h2{font-size:28px;margin:0 0 18px}
.bds-h3{font-size:18px;margin:28px 0 10px}
.bds-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:14px;margin:0 0 24px}
.bds-tile{display:flex;flex-direction:column;gap:6px;padding:20px;border-radius:10px;
  background:rgba(255,255,255,.04);border:1px solid rgba(0,212,255,.18);
  text-decoration:none;color:inherit;transition:border-color .2s ease,transform .2s ease}
a.bds-tile:hover{border-color:rgba(0,212,255,.5);transform:translateY(-2px)}
.bds-tile-credits{background:rgba(0,212,255,.07)}
.bds-tile-n{font-size:34px;font-weight:600;line-height:1}
.bds-tile-label{font-size:13px;opacity:.75}
.bds-acts{display:flex;gap:10px;flex-wrap:wrap;margin:0 0 20px}
.bds-btn{display:inline-block;padding:11px 20px;border-radius:6px;background:#00d4ff;
  color:#04121b;font-weight:600;text-decoration:none;border:0;cursor:pointer}
.bds-btn-ghost{background:transparent;color:inherit;border:1px solid rgba(0,212,255,.4)}
.bds-panel{padding:24px;border-radius:10px;background:rgba(255,255,255,.04)}
.bds-table{width:100%;border-collapse:collapse}
.bds-table th,.bds-table td{padding:11px 12px;text-align:left;
  border-bottom:1px solid rgba(255,255,255,.09)}
.bds-status{display:inline-block;padding:3px 10px;border-radius:99px;font-size:12px;
  background:rgba(255,255,255,.09)}
.bds-status-waiting{background:rgba(255,176,32,.22)}
.bds-status-resolved,.bds-status-closed{background:rgba(46,204,113,.18)}
.bds-thread{list-style:none;margin:20px 0;padding:0}
.bds-msg{padding:16px 18px;border-radius:8px;background:rgba(255,255,255,.04);margin:0 0 12px}
.bds-msg-head{font-size:12px;opacity:.7;margin:0 0 8px}
.bds-file{margin:8px 0 0;font-size:13px}
.bds-form{display:flex;flex-direction:column;gap:8px;max-width:720px;margin:22px 0 0}
.bds-label{font-size:13px;font-weight:600;margin:10px 0 0}
.bds-input,.bds-textarea{padding:11px 12px;border-radius:6px;
  border:1px solid rgba(255,255,255,.18);background:rgba(0,0,0,.25);color:inherit;font:inherit}
.bds-note{font-size:12px;opacity:.7;margin:4px 0 0}
.bds-team{list-style:none;margin:0;padding:0}
.bds-team-row{padding:8px 0;border-bottom:1px solid rgba(255,255,255,.08)}
.bds-chip{display:inline-block;padding:2px 8px;border-radius:99px;font-size:11px;
  background:rgba(0,212,255,.2)}
.bds-meta{font-size:13px;opacity:.8}
@media (max-width:700px){.bds-table thead{display:none}
  .bds-table td{display:block;border:0;padding:4px 0}
  .bds-row{display:block;padding:12px 0;border-bottom:1px solid rgba(255,255,255,.09)}}

/* --- Agent console: state tiles, per-agent chips, triage. --- */
.bds-console{max-width:1200px;margin:0 auto}
.bds-console-tiles{margin:0 0 16px}
.bds-tile-active{border-color:#00d4ff;background:rgba(0,212,255,.14)}
.bds-agent-chips{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 24px}
.bds-agent-chip{text-decoration:none;color:inherit;cursor:pointer;border:1px solid transparent}
.bds-chip-you{border-color:rgba(0,212,255,.5)}
.bds-chip-active{background:#00d4ff;color:#04121b}
.bds-chip-n{font-weight:700}
.bds-chip-internal{background:rgba(214,54,56,.25)}
.bds-assignee-cell{white-space:nowrap}
.bds-inline-form{display:inline-block;margin:0 0 0 6px}
.bds-btn-small{padding:5px 12px;font-size:12px}
.bds-msg-internal{border-left:4px solid #d63638;background:rgba(214,54,56,.08)}
.bds-internal-toggle{display:flex;align-items:center;gap:6px}
.bds-triage-form{max-width:none;flex-direction:row;flex-wrap:wrap;align-items:flex-end;gap:12px}
.bds-triage-form .bds-label{margin:0}

/* --- Site-wide account bar (signed-in only), injected at wp_body_open. --- */
.bds-account-bar{position:relative;z-index:9999;background:#04121b;color:#e8f6fb;font-size:13px}
.bds-account-bar-inner{display:flex;align-items:center;justify-content:space-between;gap:16px;
  max-width:1200px;margin:0 auto;padding:9px 20px}
.bds-account-bar-right{display:flex;align-items:center;gap:16px}
.bds-account-bar a{color:inherit;text-decoration:none}
.bds-account-bar a:hover{text-decoration:underline}
.bds-bell{position:relative;display:inline-flex;align-items:center;line-height:1}
.bds-bell-badge{position:absolute;top:-7px;right:-11px;background:#d63638;color:#fff;
  font-size:10px;font-weight:700;line-height:1;padding:2px 5px;border-radius:99px}

/* --- Account settings page ([bds_account]). --- */
.bds-account{max-width:640px;margin:0 auto}
.bds-notice{margin:0 0 18px}
.bds-notice-error{border:1px solid rgba(214,54,56,.4)}
.bds-notice-success{border:1px solid rgba(46,204,113,.4)}

/* ================================================================== *
 * .bds-portal-scope — the light working surface every portal/account
 * page renders inside (bds_portal_page(), portal-chrome.php). Every
 * selector below is scoped under it, so none of this touches the agent
 * console or anything else above this line — see the file docblock.
 * ================================================================== */
.bds-portal-scope{background:var(--ground);color:var(--body);font-family:var(--font-body);
  font-size:15px;line-height:1.55}
.bds-portal-scope h2,.bds-portal-scope h3{font-family:var(--font-heading);color:var(--ink)}
.bds-portal-scope .bds-h2{font-size:26px;font-weight:700;margin:0 0 18px;padding:28px 24px 0}
.bds-portal-scope .bds-h3{font-size:15px;font-weight:700;margin:28px 0 12px;
  text-transform:uppercase;letter-spacing:.04em;color:var(--muted)}
.bds-portal-scope .bds-portal,
.bds-portal-scope .bds-ticket,
.bds-portal-scope .bds-ticketlist,
.bds-portal-scope .bds-newticket,
.bds-portal-scope .bds-account{max-width:1100px;margin:0 auto;padding:0 24px 48px}
.bds-portal-scope .bds-account{max-width:680px}
.bds-portal-scope .bds-h2:first-child{padding-top:32px}

/* --- Hero (new markup: bds-chrome/bds-hero/bds-nav have no fallback
   above to worry about, but stay under .bds-portal-scope for hygiene). --- */
.bds-portal-scope .bds-hero{background:linear-gradient(160deg,var(--site),var(--site-2));color:#eaf3f8}
.bds-portal-scope .bds-hero-inner{max-width:1100px;margin:0 auto;padding:26px 24px;
  display:flex;align-items:center;justify-content:space-between;gap:24px;flex-wrap:wrap}
.bds-portal-scope .bds-hero-user,
.bds-portal-scope .bds-hero-company{display:flex;align-items:center;gap:14px}
.bds-portal-scope .bds-hero-company{text-align:right}
.bds-portal-scope .bds-avatar,
.bds-portal-scope .bds-mark{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;
  font-family:var(--font-heading);font-weight:700;color:var(--cyan);
  background:rgba(0,212,255,.14);border:1px solid rgba(0,212,255,.4)}
.bds-portal-scope .bds-avatar{width:50px;height:50px;border-radius:50%;font-size:17px}
.bds-portal-scope .bds-mark{width:40px;height:40px;border-radius:9px;font-size:13px}
.bds-portal-scope .bds-hero-id{display:flex;flex-direction:column;gap:3px}
.bds-portal-scope .bds-hero-company .bds-hero-id{align-items:flex-end}
.bds-portal-scope .bds-hero-name{font-family:var(--font-heading);font-weight:700;font-size:16px}
.bds-portal-scope .bds-hero-role{font-size:12px;color:#9fc0cf;font-family:var(--font-mono)}

/* --- Nav --- */
.bds-portal-scope .bds-nav{background:var(--surface);border-bottom:1px solid var(--rule)}
.bds-portal-scope .bds-nav-inner{max-width:1100px;margin:0 auto;padding:0 24px;
  display:flex;align-items:center;gap:24px;flex-wrap:wrap;min-height:54px}
.bds-portal-scope .bds-nav-link{font-family:var(--font-heading);font-size:13px;font-weight:600;
  color:var(--body);text-decoration:none;padding:17px 0;
  border-bottom:2px solid transparent;white-space:nowrap}
.bds-portal-scope .bds-nav-link:hover{color:var(--ink)}
.bds-portal-scope .bds-nav-active{color:var(--accent);border-bottom-color:var(--accent)}
.bds-portal-scope .bds-nav-help{font-weight:400;color:var(--muted)}
.bds-portal-scope .bds-nav-ext{font-size:10px}
.bds-portal-scope .bds-nav-rule{width:1px;align-self:stretch;background:var(--rule);margin:12px 0}
.bds-portal-scope .bds-nav-new.bds-btn{margin-left:auto;padding:9px 18px}

/* --- Buttons, panels, notes, meta --- */
.bds-portal-scope .bds-btn{display:inline-block;padding:11px 20px;border-radius:6px;
  background:var(--accent);color:#fff;font-family:var(--font-heading);font-weight:600;
  font-size:13px;text-decoration:none;border:0;cursor:pointer}
.bds-portal-scope .bds-btn:hover{background:#0a5f70}
.bds-portal-scope .bds-btn-ghost{background:transparent;color:var(--accent);
  border:1px solid var(--accent)}
.bds-portal-scope .bds-panel{padding:22px 24px;border-radius:10px;
  background:var(--surface);border:1px solid var(--rule);margin:0 24px 20px}
.bds-portal-scope .bds-portal>.bds-panel,
.bds-portal-scope .bds-ticketlist>.bds-panel{margin-left:0;margin-right:0}
.bds-portal-scope .bds-note{font-size:12.5px;color:var(--muted);margin:6px 0 0}
.bds-portal-scope .bds-meta{font-size:13px;color:var(--muted);display:flex;
  align-items:center;gap:8px;font-family:var(--font-mono)}

/* --- Tiles --- */
.bds-portal-scope .bds-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));
  gap:14px;margin:0 0 24px}
.bds-portal-scope .bds-tile{display:flex;flex-direction:column;gap:6px;padding:20px;border-radius:10px;
  background:var(--surface);border:1px solid var(--rule);
  text-decoration:none;color:inherit;transition:border-color .2s ease,transform .2s ease}
.bds-portal-scope a.bds-tile:hover{border-color:var(--accent);transform:translateY(-2px)}
.bds-portal-scope .bds-tile-credits{background:var(--raised)}
.bds-portal-scope .bds-tile-n{font-family:var(--font-mono);font-size:32px;font-weight:600;
  line-height:1;color:var(--ink)}
.bds-portal-scope .bds-tile-label{font-size:12.5px;color:var(--muted)}
.bds-portal-scope .bds-acts{display:flex;gap:10px;flex-wrap:wrap;margin:0 0 20px}

/* --- Ticket-balance tile: responds to the balance, never a gate. --- */
.bds-portal-scope .bds-tile-credits{display:flex;flex-direction:column;gap:6px}
.bds-portal-scope .bds-tile-credits-empty{background:var(--status-reply-bg);border-color:#f0d6ad}
.bds-portal-scope .bds-tile-credits-empty .bds-tile-n,
.bds-portal-scope .bds-tile-credits-empty .bds-tile-label{color:var(--status-reply-fg)}
.bds-portal-scope .bds-tile-credits-low .bds-tile-label{color:var(--status-reply-fg);font-weight:600}
.bds-portal-scope .bds-tile-buy{align-self:flex-start;margin-top:2px;padding:7px 14px;font-size:12px}
.bds-portal-scope .bds-tile-buy-link{font-size:12px;font-weight:600;color:var(--accent);text-decoration:none}
.bds-portal-scope .bds-tile-buy-link:hover{text-decoration:underline}
.bds-portal-scope .bds-tile-buy-quiet{color:var(--muted);font-weight:400}

/* --- Needs your attention --- */
.bds-portal-scope .bds-attention{background:var(--surface);border:1px solid var(--rule);
  border-radius:10px;padding:18px 20px;margin:0 0 24px}
.bds-portal-scope .bds-attention .bds-h3{margin-top:0}
.bds-portal-scope .bds-attention-list{list-style:none;margin:0;padding:0}
.bds-portal-scope .bds-attention-row{display:flex;align-items:center;gap:12px;padding:9px 0;
  border-bottom:1px solid var(--rule-soft)}
.bds-portal-scope .bds-attention-row:last-child{border-bottom:0}
.bds-portal-scope .bds-attention-link{color:var(--ink);text-decoration:none;font-weight:600;font-size:13.5px}
.bds-portal-scope .bds-attention-link:hover{color:var(--accent);text-decoration:underline}

/* --- Deflection panel (dashboard + new-ticket) --- */
.bds-portal-scope .bds-deflect{background:var(--raised);border:1px solid var(--rule);
  border-radius:10px;padding:18px 20px;margin:0 0 22px}
.bds-portal-scope .bds-deflect .bds-h3{margin-top:0}
.bds-portal-scope .bds-deflect-links{display:flex;flex-wrap:wrap;gap:10px 22px}
.bds-portal-scope .bds-deflect-link{color:var(--accent);font-weight:600;font-size:13.5px;text-decoration:none}
.bds-portal-scope .bds-deflect-link:hover{text-decoration:underline}

/* --- Team --- */
.bds-portal-scope .bds-team{list-style:none;margin:0;padding:0}
.bds-portal-scope .bds-team-row{padding:9px 0;border-bottom:1px solid var(--rule-soft)}
.bds-portal-scope .bds-chip{display:inline-block;padding:2px 9px;border-radius:99px;font-size:11px;
  background:var(--status-progress-bg);color:var(--status-progress-fg)}

/* --- Filters (ticket list) --- */
.bds-portal-scope .bds-filters{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 18px}
.bds-portal-scope .bds-filter{font-family:var(--font-heading);font-size:12.5px;font-weight:600;
  padding:7px 14px;border-radius:99px;color:var(--body);background:var(--surface);
  border:1px solid var(--rule);text-decoration:none}
.bds-portal-scope .bds-filter:hover{border-color:var(--accent)}
.bds-portal-scope .bds-filter-active{background:var(--accent);color:#fff;border-color:var(--accent)}

/* --- Table: uppercase letter-spaced headers, row hover, pill first
   column, severity in a muted colour scale. --- */
.bds-portal-scope .bds-table-wrap{overflow-x:auto}
.bds-portal-scope .bds-table{width:100%;border-collapse:collapse;background:var(--surface);
  border:1px solid var(--rule);border-radius:10px;overflow:hidden}
.bds-portal-scope .bds-table th{padding:12px 14px;text-align:left;font-family:var(--font-heading);
  font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;
  color:var(--muted);background:var(--raised);border-bottom:1px solid var(--rule)}
.bds-portal-scope .bds-table td{padding:13px 14px;text-align:left;border-bottom:1px solid var(--rule-soft);
  font-size:13.5px}
.bds-portal-scope .bds-row:hover{background:var(--raised)}
.bds-portal-scope .bds-row:last-child td{border-bottom:0}
.bds-portal-scope .bds-mono{font-family:var(--font-mono);color:var(--muted);font-size:12.5px}
.bds-portal-scope .bds-row-link{color:var(--ink);font-weight:600;text-decoration:none}
.bds-portal-scope .bds-row-link:hover{color:var(--accent);text-decoration:underline}

/* --- Severity: a muted colour scale, never a pill. --- */
.bds-portal-scope .bds-sev{font-size:12.5px;font-weight:600}
.bds-portal-scope .bds-sev-down{color:var(--sev-down)}
.bds-portal-scope .bds-sev-degraded{color:var(--sev-degraded)}
.bds-portal-scope .bds-sev-question{color:var(--sev-question)}
.bds-portal-scope .bds-sev-unknown{color:var(--muted)}

/* --- Status pills: a filled dot, then the label. Amber ('waiting' /
   "Needs your reply") is the only state that means "act now" — every
   other status stays calm. --- */
.bds-portal-scope .bds-status{display:inline-flex;align-items:center;gap:6px;padding:4px 11px 4px 9px;
  border-radius:99px;font-size:11.5px;font-weight:600;white-space:nowrap;
  background:var(--status-open-bg);color:var(--status-open-fg)}
.bds-portal-scope .bds-status-dot{width:6px;height:6px;border-radius:50%;background:currentColor;flex:0 0 auto}
.bds-portal-scope .bds-status.bds-status-new{background:var(--status-open-bg);color:var(--status-open-fg)}
.bds-portal-scope .bds-status.bds-status-open{background:var(--status-progress-bg);color:var(--status-progress-fg)}
.bds-portal-scope .bds-status.bds-status-waiting{background:var(--status-reply-bg);color:var(--status-reply-fg)}
.bds-portal-scope .bds-status.bds-status-resolved,
.bds-portal-scope .bds-status.bds-status-closed{background:var(--status-closed-bg);color:var(--status-closed-fg)}

/* --- Breadcrumb + ticket-to-ticket nav --- */
.bds-portal-scope .bds-crumb{display:flex;align-items:center;gap:8px;font-size:13px;margin:0 0 16px}
.bds-portal-scope .bds-crumb-back{color:var(--accent);text-decoration:none;font-weight:600}
.bds-portal-scope .bds-crumb-back:hover{text-decoration:underline}
.bds-portal-scope .bds-crumb-sep{color:var(--rule)}
.bds-portal-scope .bds-crumb-current{font-family:var(--font-mono);color:var(--muted)}
.bds-portal-scope .bds-ticket-nav{display:flex;justify-content:space-between;gap:16px;margin:0 0 22px;
  padding:12px 16px;background:var(--raised);border:1px solid var(--rule);border-radius:8px}
.bds-portal-scope .bds-ticket-nav-link{color:var(--body);text-decoration:none;font-size:12.5px;font-weight:600;
  max-width:46%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bds-portal-scope .bds-ticket-nav-link:hover{color:var(--accent)}
.bds-portal-scope .bds-ticket-nav-next{margin-left:auto;text-align:right}
.bds-portal-scope .bds-ticket-nav-empty{flex:1}

/* --- Conversation thread: customer left/tinted, BlueDot right/white,
   each with an initials avatar, author and timestamp. --- */
.bds-portal-scope .bds-thread{list-style:none;margin:20px 0;padding:0}
.bds-portal-scope .bds-msg{display:flex;gap:12px;margin:0 0 16px;max-width:82%}
.bds-portal-scope .bds-msg-avatar{flex:0 0 auto;width:32px;height:32px;border-radius:50%;
  display:inline-flex;align-items:center;justify-content:center;
  font-family:var(--font-heading);font-weight:700;font-size:12px}
.bds-portal-scope .bds-msg-card{border-radius:10px;padding:14px 16px;flex:1;min-width:0}
.bds-portal-scope .bds-msg-customer{margin-right:auto}
.bds-portal-scope .bds-msg-customer .bds-msg-avatar{background:var(--rule-soft);color:var(--body)}
.bds-portal-scope .bds-msg-customer .bds-msg-card{background:var(--raised);border:1px solid var(--rule)}
.bds-portal-scope .bds-msg-agent{margin-left:auto;flex-direction:row-reverse}
.bds-portal-scope .bds-msg-agent .bds-msg-avatar{background:var(--accent);color:#fff}
.bds-portal-scope .bds-msg-agent .bds-msg-card{background:var(--surface);border:1px solid var(--rule);
  box-shadow:0 1px 2px rgba(13,22,32,.06)}
.bds-portal-scope .bds-msg-head{display:flex;justify-content:space-between;gap:12px;
  font-size:11.5px;color:var(--muted);margin:0 0 8px}
.bds-portal-scope .bds-msg-author{font-weight:700;color:var(--ink)}
.bds-portal-scope .bds-msg-time{font-family:var(--font-mono)}
.bds-portal-scope .bds-msg-body{font-size:14px;color:var(--body);word-wrap:break-word}
.bds-portal-scope .bds-file{margin:8px 0 0;font-size:12.5px}

/* --- Forms --- */
.bds-portal-scope .bds-form{display:flex;flex-direction:column;gap:8px;max-width:720px;margin:22px 0 0}
.bds-portal-scope .bds-label{font-size:13px;font-weight:600;color:var(--ink);margin:10px 0 0}
.bds-portal-scope .bds-input,
.bds-portal-scope .bds-textarea{padding:11px 12px;border-radius:6px;
  border:1px solid var(--rule);background:var(--surface);color:var(--ink);font:inherit}
.bds-portal-scope .bds-input:focus,
.bds-portal-scope .bds-textarea:focus{outline:2px solid var(--accent);outline-offset:1px}

/* --- Account notices --- */
.bds-portal-scope .bds-account{max-width:680px}
.bds-portal-scope .bds-notice{margin:0 0 18px}
.bds-portal-scope .bds-notice-error{border:1px solid var(--sev-down)}
.bds-portal-scope .bds-notice-success{border:1px solid var(--status-closed-fg)}

@media (max-width:700px){
  .bds-portal-scope .bds-table thead{display:none}
  .bds-portal-scope .bds-table td{display:block;border:0;padding:4px 14px}
  .bds-portal-scope .bds-row{display:block;padding:12px 0;border-bottom:1px solid var(--rule-soft)}
  .bds-portal-scope .bds-msg{max-width:100%}
}
