/* Rolume client portal. Tokens and buttons come from ../styles.css */
@font-face { font-family: "Archivo"; src: url("../assets/fonts/archivo.woff2") format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }

body.portal { background: var(--white); font-size: 15px; min-height: 100vh; }
.portal h1 { font-size: 34px; }
.portal h2 { font-size: 18px; text-transform: none; font-stretch: 100%; letter-spacing: 0; line-height: 1.3; font-weight: 600; }
.portal h3 { font-size: 14px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.empty { color: var(--muted); padding: 14px 0; }


.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); background: linear-gradient(to right, var(--paper) 235px, var(--line) 235px, var(--line) 236px, var(--white) 236px); }

/* Sidebar */
.side { background: var(--paper); border-right: 1px solid var(--line); align-self: start; padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.side .logo { padding: 0 8px; }
.biz { padding: 12px; background: var(--white); border: 1px solid var(--line); display: flex; flex-direction: column; line-height: 1.35; }
.biz strong { font-weight: 600; }
.biz span { color: var(--muted); font-size: 13px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a, .tabbar a { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--muted); font-weight: 500; }
.side-nav a { padding: 10px 12px; }
.side-nav a svg, .tabbar a svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.side-nav a:hover { color: var(--ink); background: rgba(0,0,0,.04); }
.side-nav a.active { color: var(--ink); background: var(--white); box-shadow: inset 3px 0 0 var(--hivis); }
.side-foot { margin-top: auto; padding: 0 12px; display: flex; flex-direction: column; font-size: 13px; }

.main { padding: 32px clamp(20px, 3vw, 44px) 60px; min-width: 0; outline: none; }
.page-head { margin-bottom: 22px; }
.page-head p { margin-top: 6px; }

/* Tags */
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; line-height: 1.3; white-space: nowrap; }
.tag-booked, .tag-new { background: #FFE6DA; color: #8A2D08; }
.tag-rebooked { background: var(--ink); color: var(--white); }
.tag-canceled { background: var(--paper); color: var(--muted); text-decoration: line-through; border: 1px solid var(--line); }
.tag-no-booking { background: var(--paper); color: var(--muted); border: 1px solid var(--line); }

/* Overview */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--ink); margin-bottom: 28px; }
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat-n { font-size: 34px; font-weight: 600; font-stretch: 112%; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-n small { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; font-stretch: 100%; }
.stat-l { color: var(--muted); font-size: 13px; }
.meter { display: block; height: 6px; background: var(--paper); border: 1px solid var(--line); }
.meter i { display: block; height: 100%; background: var(--hivis); }

.ov-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--ink); }
.panel-head.sub { margin-top: 26px; }
.panel-head a { font-size: 13px; color: var(--hivis-ink); font-weight: 600; text-decoration: none; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; justify-content: space-between; gap: 16px; width: 100%; padding: 12px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font: inherit; color: inherit; text-decoration: none; cursor: pointer; }
.row:hover { background: var(--paper); }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-main .muted { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.when { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Calls */
.calls { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 0; margin: -32px calc(-1 * clamp(20px, 3vw, 44px)) -60px; min-height: 100vh; }
.call-list { border-right: 1px solid var(--line); padding: 32px 20px 40px clamp(20px, 3vw, 44px); }
.list-tools { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.list-tools input { font: inherit; padding: 10px 12px; border: 1px solid var(--line); background: var(--white); width: 100%; }
.list-tools input:focus { border-color: var(--ink); outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 13px; padding: 5px 10px; border: 1px solid var(--line); background: var(--white); cursor: pointer; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--white); }
.call-items { list-style: none; margin: 0; padding: 0; }
.call-item { display: flex; flex-direction: column; gap: 5px; padding: 14px 10px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.call-item:hover { background: var(--paper); }
.call-item.on { background: var(--paper); box-shadow: inset 3px 0 0 var(--hivis); }
.ci-top { display: flex; justify-content: space-between; gap: 10px; }
.ci-sum { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ci-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; }

.call-detail { padding: 32px clamp(20px, 3vw, 44px) 60px; min-width: 0; max-width: 820px; }
.back { display: inline-block; margin-bottom: 16px; color: var(--hivis-ink); font-weight: 600; text-decoration: none; }
.cd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.cd-head h2 { font-size: 26px; font-stretch: 112%; text-transform: uppercase; letter-spacing: -0.01em; }
.cd-head p { margin-top: 4px; font-size: 14px; }
.cd-head a { color: inherit; }
.cd-summary { margin-top: 18px; font-size: 16px; max-width: 60ch; }
.job-card { margin-top: 18px; display: grid; gap: 2px; width: 100%; max-width: 460px; text-align: left; font: inherit; color: inherit; background: var(--paper); border: 1px solid var(--ink); padding: 14px 16px; cursor: pointer; }
.job-card:hover { background: #ECECE7; }
.jc-label { font-size: 12px; color: var(--muted); }
.jc-open { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--hivis-ink); }
.recording { margin-top: 26px; }
.recording audio { width: 100%; max-width: 460px; margin-top: 8px; }
.recording p { margin-top: 6px; }
.tr-title { margin-top: 26px; }
.tr { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tr li { max-width: 78%; padding: 9px 13px; background: var(--paper); font-size: 14px; line-height: 1.45; }
.tr li.caller { align-self: flex-end; background: var(--white); border: 1px solid var(--line); }
.tr .who { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.tr li.agent .who { color: var(--hivis-ink); }

/* Calendar */
.cal-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--white); font: inherit; font-size: 20px; line-height: 1; cursor: pointer; color: var(--ink); display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--ink); }
.wk-label { font-weight: 600; margin-left: 6px; font-variant-numeric: tabular-nums; }
.legend { list-style: none; display: flex; gap: 18px; padding: 0; margin: 0 0 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; display: inline-block; }
.legend i.ev-new { background: #FFE6DA; border-left: 3px solid var(--hivis); }
.legend i.ev-rebooked { background: var(--ink); }
.legend i.ev-canceled { background: var(--paper); border: 1px dashed #A9ABA6; }

.week { display: grid; grid-template-columns: 76px repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--ink); border-left: 1px solid var(--line); }
.wk-corner, .wk-day, .wk-win, .wk-cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.wk-day { padding: 10px 10px 8px; display: flex; align-items: baseline; gap: 6px; font-size: 13px; color: var(--muted); }
.wk-day b { font-size: 20px; color: var(--ink); font-weight: 600; }
.wk-day.is-today { box-shadow: inset 0 3px 0 var(--hivis); }
.wk-day.is-today b { color: var(--hivis-ink); }
.wk-win { padding: 10px 8px; font-size: 12px; color: var(--muted); }
.wk-cell { min-height: 104px; padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.wk-cell.is-today { background: #FBFBF9; }

.ev { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; font: inherit; font-size: 12px; line-height: 1.3; padding: 7px 8px; border: 0; cursor: pointer; color: var(--ink); }
.ev strong { font-weight: 600; font-size: 13px; }
.ev span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ev em { font-style: normal; font-size: 11px; font-weight: 600; margin-top: 3px; }
.ev-new { background: #FFE6DA; border-left: 3px solid var(--hivis); }
.ev-new:hover { background: #FFD9C7; }
.ev-rebooked { background: var(--ink); color: var(--white); }
.ev-rebooked:hover { background: #2B2F34; }
.ev-canceled { background: var(--white); border: 1px dashed #A9ABA6; color: var(--muted); }
.ev-canceled strong, .ev-canceled span { text-decoration: line-through; }
.cal-note { margin-top: 16px; max-width: 70ch; }

/* Drawer */
.drawer-scrim { position: fixed; inset: 0; background: rgba(22,24,27,.35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--white); border-left: 1px solid var(--ink); z-index: 41; padding: 22px 24px 32px; overflow-y: auto; }
.dr-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.drawer h2 { font-size: 26px; font-stretch: 112%; text-transform: uppercase; letter-spacing: -0.01em; line-height: 1.05; }
.dr-when { font-size: 17px; font-weight: 600; margin-top: 10px; }
.dr-when.struck { text-decoration: line-through; color: var(--muted); }
.dr-list { margin: 20px 0 0; }
.dr-list div { padding: 11px 0; border-top: 1px solid var(--line); }
.dr-list dt { font-size: 12px; color: var(--muted); }
.dr-list dd { margin: 2px 0 0; font-weight: 500; }
.dr-list a { color: inherit; }
.dr-call { margin-top: 22px; width: 100%; }
@media (prefers-reduced-motion: no-preference) {
  .drawer.open { animation: slidein .2s ease-out; }
  @keyframes slidein { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* Phone tab bar */
.tabbar { display: none; }

/* Phone and small tablet */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; min-height: 0; }
  .side { display: none; }
  .main { padding: 20px 16px calc(84px + env(safe-area-inset-bottom)); }
  .portal h1 { font-size: 28px; }
  .tabbar { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--white); border-top: 1px solid var(--ink); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { flex-direction: column; gap: 3px; padding: 10px 0 9px; font-size: 12px; justify-content: center; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--ink); box-shadow: inset 0 3px 0 var(--hivis); }

  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .stat-n { font-size: 28px; }
  .ov-grid { grid-template-columns: minmax(0, 1fr); }
  .shell { background: var(--white); }

  .calls { grid-template-columns: minmax(0, 1fr); margin: 0; min-height: 0; }
  .call-list { border-right: 0; padding: 0; }
  .call-detail { display: none; padding: 0; }
  .calls.detail-only .call-list { display: none; }
  .calls.detail-only .call-detail { display: block; }
  .tr li { max-width: 90%; }
  .cd-head h2 { font-size: 22px; }

  .cal-head { align-items: flex-start; }
  .cal-nav { width: 100%; }
  .wk-label { margin-left: auto; font-size: 13px; }
  .daystrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 18px; }
  .daystrip button { font: inherit; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 0 6px; border: 1px solid var(--line); background: var(--white); color: var(--muted); font-size: 11px; cursor: pointer; }
  .daystrip button b { font-size: 17px; color: var(--ink); font-weight: 600; }
  .daystrip button i { height: 10px; font-style: normal; color: var(--hivis); line-height: 10px; letter-spacing: 1px; }
  .daystrip button.is-today b { color: var(--hivis-ink); }
  .daystrip button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #B9BCC1; }
  .daystrip button[aria-selected="true"] b { color: var(--white); }
  .agenda-day { margin-bottom: 10px; }
  .agenda { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
  .agenda li { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: start; }
  .ag-win { font-size: 12px; color: var(--muted); padding-top: 9px; }
  .agenda .ev { font-size: 13px; padding: 10px 12px; }
  .agenda .ev strong { font-size: 15px; }

  .drawer { width: 100%; border-left: 0; top: auto; max-height: 88vh; border-top: 1px solid var(--ink); }
  @media (prefers-reduced-motion: no-preference) {
    .drawer.open { animation: slideup .22s ease-out; }
    @keyframes slideup { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
  }
}

/* ---------- real-data additions ---------- */
[hidden] { display: none !important; }
.shell { min-height: 100vh; background: linear-gradient(to right, var(--paper) 235px, var(--line) 235px, var(--line) 236px, var(--white) 236px); }
.side { height: 100vh; }
.calls { min-height: 100vh; }
.biz select { font: inherit; font-weight: 600; width: 100%; margin-top: 4px; padding: 6px 8px; border: 1px solid var(--line); background: var(--white); }
.side-foot { gap: 2px; }
.side-foot strong { font-weight: 600; }
.link-btn { font: inherit; font-size: 13px; background: none; border: 0; padding: 4px 0; color: var(--hivis-ink); font-weight: 600; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: #A3261B; }
.side-foot .link-btn { color: var(--muted); font-weight: 500; }
.side-foot .link-btn:hover { color: var(--ink); }

.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--paper); }
.gate-card { width: 100%; max-width: 420px; background: var(--white); border: 1px solid var(--ink); padding: clamp(24px, 5vw, 40px); }
.gate-card .logo { margin-bottom: 28px; }
.gate-card h1 { font-size: 30px; }
.gate-card > p { margin-top: 10px; }
.gate-card .stack { margin-top: 24px; }
.gate-card .btn { width: 100%; }
.gate-card .small { margin-top: 18px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.stack input, .stack select, .stack textarea, .assign select, .crew-filter select {
  font: inherit; font-size: 15px; font-weight: 400; padding: 10px 12px; border: 1px solid #C9C9C2; background: var(--white); color: var(--ink); width: 100%; border-radius: 0; }
.stack textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; }
.stack input:focus, .stack select:focus, .stack textarea:focus, .assign select:focus { outline: 2px solid var(--hivis); outline-offset: 0; border-color: var(--ink); }
.stack input[readonly] { background: var(--paper); color: var(--muted); }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.form-error { color: #A3261B; font-size: 14px; font-weight: 500; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn[disabled] { opacity: .5; cursor: default; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; margin-top: 18px; }
.two-col .wide { grid-column: 1 / -1; }
.admin-form { margin-top: 32px; max-width: 900px; }
.inline-form { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); }
.inline-form h3 { font-size: 15px; }

.notice { border: 1px solid var(--ink); border-left: 4px solid var(--hivis); background: #FFF6F1; padding: 12px 14px; margin-bottom: 20px; font-size: 14px; }
.notice a { color: var(--hivis-ink); font-weight: 600; }
.loading { color: var(--muted); padding: 40px 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.big { font-size: 22px; margin-top: 14px; }
.test-out { white-space: pre-wrap; font-size: 13px; background: var(--paper); padding: 12px; border: 1px solid var(--line); margin-top: 14px; }

.tag-done { background: #E7F2E4; color: #2D5A24; }
.tag-reschedule-request, .tag-cancel-request { background: var(--white); color: var(--ink); border: 1px solid var(--ink); }
.assignee { font-size: 12px; font-weight: 600; padding: 2px 8px; border: 1px solid var(--line); background: var(--white); }
.row.static { cursor: default; }
.row.static:hover { background: none; }
.row.static .row-side { flex-direction: row; gap: 16px; align-items: center; }
.row.inactive strong { color: var(--muted); }

.cal-tools { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-tools .legend { margin: 0; }
.crew-filter { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.crew-filter select { width: auto; padding: 6px 10px; font-size: 14px; }
.who-chip { font-style: normal; font-size: 11px; font-weight: 600; margin-top: 4px; padding-top: 4px; border-top: 1px solid rgba(0,0,0,.12); }
.ev-rebooked .who-chip { border-top-color: rgba(255,255,255,.25); }
.ev.is-done { opacity: .55; }
.unset { border: 1px solid var(--ink); padding: 14px 16px; margin-bottom: 18px; }
.unset h2 { margin-bottom: 2px; }
.unset-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 12px; }

.drawer > .tag { margin-top: 4px; }
.drawer h2 { margin-top: 12px; }
.assign { margin-top: 18px; padding: 14px; background: var(--paper); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.assign label { font-size: 12px; color: var(--muted); font-weight: 600; }
.assign p { font-weight: 600; }
.edit-visit { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 14px; }
.edit-visit summary { cursor: pointer; font-weight: 600; color: var(--hivis-ink); }
.edit-visit form { margin-top: 14px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--white); padding: 12px 18px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 860px) {
  .shell { background: var(--white); min-height: 0; }
  .calls { min-height: 0; }
  .two-col { grid-template-columns: 1fr; }
  .row.static { flex-direction: column; gap: 8px; }
  .row.static .row-side { align-items: flex-start; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .main::before { content: ""; }
}

/* Demo requests */
.leads-panel { max-width: 900px; margin-bottom: 8px; }
.lead .row-main { gap: 3px; }
.lead-contact { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; }
.lead-contact a { color: var(--ink); }
.lead-msg { font-size: 14px; background: var(--paper); padding: 8px 10px; margin-top: 4px; max-width: 60ch; }
.lead select { font: inherit; font-size: 14px; padding: 6px 8px; border: 1px solid #C9C9C2; background: var(--white); }
.lead.new { box-shadow: inset 3px 0 0 var(--hivis); padding-left: 10px; }
.lead.lost .row-main strong { color: var(--muted); }
