/* Max Method — Operations console. Monochrome, sharp, no branding. */
* { box-sizing: border-box; border-radius: 0 !important; }
html, body { margin: 0; padding: 0; }
body {
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: #000; background: #fff; -webkit-font-smoothing: antialiased;
}
a { color: #000; text-decoration: none; }
#app { display: flex; min-height: 100vh; }

/* Sidebar */
#side { width: 210px; flex: 0 0 210px; border-right: 1px solid #000; position: sticky; top: 0; height: 100vh; overflow: auto; }
#side .brand { font-weight: 700; letter-spacing: 2px; font-size: 12px; text-transform: uppercase; padding: 16px; border-bottom: 1px solid #000; }
#side .grp { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; opacity: .45; padding: 14px 16px 5px; }
#side a.nav { display: block; padding: 7px 16px; font-size: 13px; }
#side a.nav:hover { background: #000; color: #fff; }
#side a.nav.active { background: #000; color: #fff; font-weight: 600; }

/* Main */
#main { flex: 1; min-width: 0; }
#top { display: flex; justify-content: space-between; align-items: center; padding: 11px 22px; border-bottom: 1px solid #000; position: sticky; top: 0; background: #fff; z-index: 2; }
#top .title { font-size: 12px; text-transform: uppercase; letter-spacing: 2px; font-weight: 700; }
#top .status { font-size: 11px; letter-spacing: .5px; }
#top .status b { border: 1px solid #000; padding: 2px 7px; }
#content { padding: 22px; max-width: 1400px; }

h2.sec { font-size: 13px; text-transform: uppercase; letter-spacing: 2px; margin: 0 0 14px; border-bottom: 2px solid #000; padding-bottom: 7px; }
h3.sub { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin: 26px 0 8px; }

/* KPI strip */
.kpis { display: flex; flex-wrap: wrap; border-top: 1px solid #000; border-left: 1px solid #000; margin-bottom: 22px; }
.kpi { flex: 1 1 150px; border-right: 1px solid #000; border-bottom: 1px solid #000; padding: 13px 15px; }
.kpi .l { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; opacity: .55; }
.kpi .n { font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 3px; line-height: 1.1; }
.kpi .s { font-size: 10px; opacity: .55; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 14px; }
th { text-align: left; text-transform: uppercase; font-size: 10px; letter-spacing: .5px; border-bottom: 2px solid #000; padding: 7px 9px; white-space: nowrap; }
td { border-bottom: 1px solid #000; padding: 6px 9px; font-variant-numeric: tabular-nums; vertical-align: middle; }
tr:hover td { background: #f2f2f2; } /* subtle hover — keeps buttons/tags/selects readable */
.r { text-align: right; } .c { text-align: center; }
.muted { opacity: .5; }

/* Bits */
.tag { border: 1px solid #000; padding: 1px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; display: inline-block; white-space: nowrap; }
.tag.on { background: #000; color: #fff; }
button, .btn, select { font: inherit; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; border: 1px solid #000; background: #fff; color: #000; padding: 3px 9px; cursor: pointer; }
button:hover, .btn:hover { background: #000; color: #fff; }
select { text-transform: none; padding: 2px 4px; }
.err { border: 1px solid #000; padding: 12px; margin-bottom: 16px; font-size: 12px; }
.empty { padding: 14px 9px; opacity: .5; }
.spin { padding: 30px; opacity: .5; }
/* Ops board: attention tasks */
.tasks { border: 1px solid #000; margin-bottom: 22px; }
.task { border-bottom: 1px solid #000; padding: 9px 12px; }
.task:last-child { border-bottom: none; }
.task.done { opacity: .45; }
.task-n { display: inline-block; min-width: 22px; text-align: center; background: #000; color: #fff; font-weight: 700; padding: 1px 6px; margin-right: 8px; }
.task a { border: 1px solid #000; padding: 0 6px; margin-left: 6px; }
.task a:hover { background: #000; color: #fff; }
.task-h { margin-top: 6px; }

/* Capacity bars */
.cap { margin-bottom: 10px; }
.cap-l { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.cap-t { border: 1px solid #000; height: 14px; }
.cap-t i { display: block; height: 100%; background: #000; }

/* Forms + add */
.form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.form input, .form select { border: 1px solid #000; padding: 5px 8px; font: inherit; font-size: 12px; }
details.add { border: 1px solid #000; margin-bottom: 16px; }
details.add summary { padding: 8px 12px; cursor: pointer; text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }
details.add[open] summary { border-bottom: 1px solid #000; background: #000; color: #fff; }
details.add .form { margin: 12px; }

.grp2 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin: 16px 0 5px; opacity: .7; }
.kvs { border: 1px solid #000; margin-bottom: 16px; }
.kv { display: flex; border-bottom: 1px solid #000; }
.kv:last-child { border-bottom: none; }
.kv-l { flex: 0 0 180px; padding: 7px 12px; border-right: 1px solid #000; text-transform: uppercase; font-size: 10px; letter-spacing: .5px; opacity: .6; align-self: center; }
.kv-v { padding: 7px 12px; font-variant-numeric: tabular-nums; }
.ctl { display: inline-flex; align-items: center; gap: 6px; margin-right: 18px; font-size: 12px; }
.tag { border: 1px solid #000; padding: 1px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; display: inline-block; white-space: nowrap; }
.tag.on { background: #000; color: #fff; }

/* Code block */
.code { border: 1px solid #000; padding: 12px; font-family: "SF Mono", Consolas, monospace; font-size: 12px; line-height: 1.7; margin-bottom: 12px; }

/* System Status */
.summary { border: 1px solid #000; padding: 20px 22px; margin-bottom: 26px; }
.summary-n { font-size: 46px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.summary-l { text-transform: uppercase; letter-spacing: 1.5px; font-size: 12px; margin-top: 5px; }
.summary-t { font-size: 11px; opacity: .5; margin-top: 9px; }
.comps { border: 1px solid #000; margin-bottom: 24px; }
.comp { display: flex; align-items: center; gap: 13px; padding: 12px 15px; border-bottom: 1px solid #000; }
.comp:last-child { border-bottom: none; }
.dot { width: 13px; height: 13px; border: 1px solid #000; flex: 0 0 13px; }
.dot.up { background: #000; }
.dot.down { background: #fff; }
.dot.warn { background: repeating-linear-gradient(45deg, #000, #000 2px, #fff 2px, #fff 4px); }
.dot.idle { background: #fff; opacity: .35; }
.comp-n { font-weight: 600; min-width: 190px; }
.comp-d { opacity: .6; flex: 1; font-size: 12px; }
.st { font-size: 10px; letter-spacing: 1px; font-weight: 700; border: 1px solid #000; padding: 1px 8px; }
.st.up { background: #000; color: #fff; }
.st.down { background: #fff; color: #000; }
.st.warn { background: #fff; }
.st.idle { opacity: .4; }

.chart { margin-bottom: 20px; }
.chart svg { width: 100%; height: 120px; display: block; border: 1px solid #000; }
.chart-ax { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: .5px; border: 1px solid #000; border-top: none; padding: 3px 8px; }

/* ── Confirmation modal (protection layer for destructive actions) ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-box { background: #fff; border: 2px solid #000; max-width: 440px; width: calc(100% - 40px); padding: 22px 22px 18px; }
.modal-title { font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid #000; padding-bottom: 10px; margin-bottom: 12px; }
.modal-msg { font-size: 13px; line-height: 1.5; color: #000; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal-actions .btn { padding: 6px 16px; font-size: 11px; }
.modal-actions .btn.danger { background: #000; color: #fff; font-weight: 700; }
.modal-actions .btn.danger:hover { background: #fff; color: #000; }
.modal-actions .modal-cancel { font-weight: 700; }

/* ── Collapsible sections (account detail) ── */
.sect-h { cursor: pointer; user-select: none; }
.sect-h:hover { color: #000; }
.sect-h .chev { display: inline-block; width: 15px; font-size: 11px; transition: transform .12s ease; }
.sect.collapsed .sect-h .chev { transform: rotate(-90deg); }
.sect.collapsed .sect-body { display: none; }
.sect-right { float: right; font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ── Account accordion (client page: open an account inline) ── */
.acct-item { border: 1px solid #000; border-top: none; }
.acct-item:first-of-type { border-top: 1px solid #000; }
.acct-head { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; user-select: none; }
.acct-head:hover { background: #f2f2f2; }
.acct-item.open .acct-head { background: #000; color: #fff; }
.acct-item.open .acct-head .muted { color: #bbb; }
.acct-head .chev { display: inline-block; width: 14px; font-size: 11px; transition: transform .12s ease; }
.acct-item.open .acct-head .chev { transform: rotate(0deg); }
.acct-item:not(.open) .acct-head .chev { transform: rotate(-90deg); }
.acct-head .acct-h { font-size: 13px; }
.acct-head .acct-meta { margin-left: 6px; font-size: 11px; }
.acct-head .acct-actions { margin-left: auto; display: flex; gap: 8px; }
.acct-item.open .acct-head .acct-actions .btn { border-color: #fff; color: #fff; background: #000; }
.acct-item.open .acct-head .acct-actions .btn:hover { background: #fff; color: #000; }
.acct-body:not(:empty) { padding: 6px 14px 16px; border-top: 1px solid #000; }

/* accordion open-hint (replaces the old Full-page link) */
.acct-open { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.acct-item.open .acct-open { display: none; }

/* ── Cancellation / retention ── */
.st-cancel { display: inline-block; border: 1px solid #000; background: #000; color: #fff; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding: 2px 7px; }
.warn-h { text-decoration: none; }
.watch { border: 2px solid #000; background: #f2f2f2; padding: 10px 14px; margin: 6px 0 16px; font-size: 13px; }
.watch a { font-weight: 700; }
/* Records / ledger filter chips */
.lchips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 6px; }
.lchips .lc-g { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: #888; margin: 0 2px 0 10px; }
.lchips .lc-g:first-of-type { margin-left: 0; }
.lchip { border: 1px solid #000; background: #fff; padding: 4px 9px; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.lchip:hover { background: #f2f2f2; color: #000; }
.lchip.on, .lchip.on:hover { background: #000; color: #fff; }
.lchip .lc-n { font-size: 10px; opacity: .7; border-left: 1px solid currentColor; padding-left: 5px; }
.lchips.sub { margin-top: 2px; padding-left: 2px; }
.lchip.sm { padding: 3px 8px; font-size: 11px; border-color: #999; }
.lchip.sm.on { border-color: #000; }
tr.sev-warn td { background: #fff8e6; }
tr.sev-err td { background: #fdecec; }
.mini-link { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; font-weight: 400; text-decoration: underline; cursor: pointer; }

/* right-aligned page action buttons (title lives in the sticky top bar, not repeated) */
.page-actions { display: flex; justify-content: flex-end; gap: 8px; margin: -4px 0 12px; }

/* red warning triangle inside the CANCELING pill / retention headings (visibility) */
.warn-ico { color: #ff3b30; font-weight: 700; }

/* system-status "planned / needs implementation" (grey, dashed) */
.dot.planned { background: #fff; border: 1px dashed #999; }
.st.planned { color: #777; border: 1px dashed #999; }

/* affiliate application accordion — pre-rendered body, hidden until the row is opened */
.acct-item:not(.open) .app-body { display: none; }

/* reason modal — text field + quick-pick chips */
.modal-input { width: 100%; box-sizing: border-box; padding: 8px; border: 1px solid #000; margin-bottom: 14px; font: inherit; font-size: 13px; resize: vertical; }
.quick-reasons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.quick-reasons .chip { font-size: 11px; padding: 5px 9px; border: 1px solid #000; background: #fff; color: #000; cursor: pointer; text-transform: none; letter-spacing: 0; text-align: left; }
.quick-reasons .chip:hover { background: #000; color: #fff; }

/* email preview (dry-run visibility) */
.email-body { white-space: pre-wrap; font: inherit; font-size: 12px; line-height: 1.5; border: 1px solid #000; padding: 12px; margin: 0 0 14px; max-height: 320px; overflow: auto; background: #fafafa; }

/* multi-select reason chips + custom-reason sublabel */
.quick-reasons .chip.sel { background: #000; color: #fff; }
.quick-reasons .chip.sel::before { content: "✓ "; }
.modal-sub { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: #777; margin-bottom: 6px; }

/* support ticket thread — chat bubbles */
.thread { border: 1px solid #000; padding: 12px; margin-bottom: 16px; max-height: 460px; overflow: auto; background: #fafafa; }
.msg { margin-bottom: 12px; max-width: 78%; }
.msg.vis { margin-right: auto; }
.msg.op { margin-left: auto; text-align: right; }
.msg-b { display: inline-block; text-align: left; padding: 8px 11px; border: 1px solid #000; white-space: pre-wrap; font-size: 13px; line-height: 1.45; background: #fff; }
.msg.op .msg-b { background: #000; color: #fff; }
.msg-t { font-size: 10px; margin-top: 3px; }

/* ── Floating operator live-chat widget (bottom-right) ── */
#chatw { position: fixed; right: 20px; bottom: 20px; z-index: 900; }
#chatw-bubble { width: 52px; height: 52px; border-radius: 50%; border: 2px solid #000; background: #000; color: #fff; font-size: 22px; cursor: pointer; position: relative; padding: 0; }
#chatw-bubble.has-waiting { animation: chatpulse 1.6s infinite; }
@keyframes chatpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,59,48,.5); } 50% { box-shadow: 0 0 0 6px rgba(255,59,48,0); } }
#chatw-badge { position: absolute; top: -4px; right: -4px; background: #ff3b30; color: #fff; border-radius: 10px; font-size: 11px; font-weight: 700; padding: 1px 6px; }
#chatw-panel { position: absolute; right: 0; bottom: 62px; width: 320px; height: 440px; background: #fff; border: 2px solid #000; display: flex; flex-direction: column; }
#chatw-head { background: #000; color: #fff; padding: 9px 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; font-size: 12px; display: flex; justify-content: space-between; }
#chatw-x, #chatw-back { cursor: pointer; }
#chatw-back { padding: 8px 12px; border-bottom: 1px solid #000; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
#chatw-list { flex: 1; overflow: auto; }
.chatw-sec { padding: 6px 12px; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: #777; background: #f2f2f2; }
.chatw-item { padding: 9px 12px; border-bottom: 1px solid #ddd; cursor: pointer; font-size: 13px; }
.chatw-item:hover { background: #f2f2f2; }
.chatw-wait { color: #ff3b30; font-size: 10px; font-weight: 700; }
.chatw-empty { padding: 20px; text-align: center; color: #777; font-size: 12px; }
#chatw-convo { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#chatw-thread { flex: 1; overflow: auto; padding: 10px; background: #fafafa; }
#chatw-thread .msg { max-width: 85%; margin-bottom: 8px; }
#chatw-reply { border-top: 1px solid #000; padding: 8px; }
#chatw-input { width: 100%; box-sizing: border-box; border: 1px solid #000; padding: 6px; font: inherit; font-size: 13px; resize: none; }
.chatw-actions { display: flex; gap: 6px; margin-top: 6px; }

/* fix: id selectors set display, which overrode the [hidden] attribute → panel wouldn't close */
#chatw-panel[hidden], #chatw-convo[hidden] { display: none !important; }

/* diagnosis report */
.diag { list-style: none; padding: 0; margin: 10px 0; font-size: 13px; line-height: 1.6; }
.diag li { padding: 4px 0; border-bottom: 1px solid #eee; }
.diag-error { color: #b00; font-weight: 600; }

/* badge is enough — no pulsing on the chat bubble */
#chatw-bubble.has-waiting { animation: none !important; }

/* reseller brand swatch */
.rs-swatch { display: inline-block; width: 12px; height: 12px; border: 1px solid #000; vertical-align: middle; }

.fiverr-badge { background:#1dbf73; color:#fff; font-weight:700; font-size:10px; padding:1px 7px; border-radius:3px; letter-spacing:.3px; text-transform:none; }

/* client-detail two-way chat */
.cd-thread { max-height: 300px; overflow-y: auto; border: 1px solid #e6e9ec; border-radius: 8px; padding: 12px; background: #fafafa; display: flex; flex-direction: column; gap: 8px; }
.cd-msg { display: flex; flex-direction: column; max-width: 75%; }
.cd-msg.op { align-self: flex-end; align-items: flex-end; }
.cd-msg.cl { align-self: flex-start; align-items: flex-start; }
.cd-bub { padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.4; }
.cd-msg.op .cd-bub { background: #141414; color: #fff; border-bottom-right-radius: 3px; }
.cd-msg.cl .cd-bub { background: #fff; border: 1px solid #e6e9ec; border-bottom-left-radius: 3px; }
.cd-t { font-size: 10px; color: #8a9199; margin-top: 3px; }
