:root {
  --accent: #ed1c24;
  --accent-rgb: 237, 28, 36;
  --ink: #f8fafc;
  --muted: #9199a7;
  --line: rgba(255, 255, 255, 0.09);
  --panel: rgba(21, 24, 31, 0.82);
  --panel-deep: rgba(11, 13, 18, 0.9);
  --canvas: #090b0f;
  color-scheme: dark;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--canvas); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(var(--accent-rgb), 0.13), transparent 30rem),
    linear-gradient(140deg, #101219 0%, #090b0f 48%, #111318 100%);
  overflow-x: hidden;
}

body.theme-redrackx::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("/assets/redrackx-circuit.png") center 12% / min(56vw, 720px) auto no-repeat;
  opacity: 0.055;
  filter: saturate(1.15);
}

body.theme-lokridge {
  --accent: #ec2028;
  --accent-rgb: 236, 32, 40;
  --panel: rgba(31, 33, 36, 0.86);
  --panel-deep: rgba(20, 14, 7, 0.92);
  --canvas: #0d0a07;
  background:
    radial-gradient(circle at 82% 10%, rgba(236, 32, 40, 0.14), transparent 28rem),
    linear-gradient(140deg, #1f2124 0%, #100d0a 54%, #140e07 100%);
}

button, input { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  width: 22rem;
  height: 22rem;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.1);
  filter: blur(90px);
  pointer-events: none;
}
.ambient-one { top: -9rem; right: 8%; }
.ambient-two { bottom: -12rem; left: -5rem; opacity: 0.55; }

.shell { width: min(1500px, calc(100% - 44px)); margin: 0 auto; padding: 24px 0 34px; position: relative; z-index: 1; }

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 4px 22px;
}

.brand-lockup, .topbar-actions, .agent-card, .availability, .section-heading, .incoming-actions { display: flex; align-items: center; }
.brand-lockup { gap: 18px; }
.brand-mark-wrap {
  width: 174px;
  height: 54px;
  display: grid;
  place-items: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.2);
}
.theme-lokridge .brand-mark-wrap { background: #1f2124; }
.brand-logo { display: block; max-width: 100%; max-height: 34px; object-fit: contain; }
.eyebrow, .panel-label { margin: 0; text-transform: uppercase; letter-spacing: 0.14em; font-size: 10px; font-weight: 800; color: var(--accent); }
.topbar h1 { font-size: 20px; margin: 5px 0 0; letter-spacing: -0.02em; }
.topbar-actions { gap: 10px; }

.status-pill {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  color: #aeb5c0;
  font-size: 12px;
  font-weight: 700;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #707783; box-shadow: 0 0 0 4px rgba(112,119,131,.12); }
.status-pill.connecting .status-dot { background: #eab308; box-shadow: 0 0 0 4px rgba(234,179,8,.12); animation: pulse 1.2s infinite; }
.status-pill.online .status-dot { background: #39d98a; box-shadow: 0 0 0 4px rgba(57,217,138,.13); }
.status-pill.online { color: #d9ffe9; }
.status-pill.error .status-dot { background: var(--accent); }

.icon-button {
  width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 13px; background: rgba(0,0,0,.22); cursor: pointer;
}
.icon-button:hover { border-color: rgba(var(--accent-rgb), .65); background: rgba(var(--accent-rgb), .08); }

.workspace { display: grid; grid-template-columns: minmax(230px, .8fr) minmax(360px, 1.25fr) minmax(250px, .9fr); gap: 16px; align-items: stretch; }
.glass-panel { border: 1px solid var(--line); border-radius: 24px; background: var(--panel); box-shadow: 0 25px 80px rgba(0,0,0,.24); backdrop-filter: blur(24px); }
.side-panel, .activity-panel { padding: 24px; min-height: 675px; }
.phone-panel { padding: 28px clamp(22px, 4vw, 52px); min-height: 675px; background: linear-gradient(160deg, rgba(255,255,255,.055), transparent 38%), var(--panel-deep); }

.agent-card { gap: 14px; }
.avatar, .contact-avatar {
  display: grid; place-items: center; border-radius: 15px; font-weight: 850; background: linear-gradient(145deg, rgba(var(--accent-rgb), .92), rgba(var(--accent-rgb), .55)); box-shadow: 0 10px 25px rgba(var(--accent-rgb), .2);
}
.avatar { width: 52px; height: 52px; font-size: 16px; }
.agent-card h2, .activity-panel h2 { font-size: 17px; margin: 5px 0 2px; }
.muted-text { color: var(--muted); font-size: 11px; margin: 0; word-break: break-word; }
.availability { justify-content: space-between; margin-top: 26px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(0,0,0,.15); }
.availability-value { margin: 5px 0 0; font-size: 13px; font-weight: 750; }
.toggle-button { display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; font-size: 11px; font-weight: 800; color: var(--muted); }
.toggle-track { position: relative; width: 34px; height: 19px; border-radius: 999px; background: #3c424d; transition: .2s; }
.toggle-thumb { position: absolute; left: 3px; top: 3px; width: 13px; height: 13px; border-radius: 50%; background: white; transition: .2s; }
.toggle-button.active .toggle-track { background: var(--accent); }
.toggle-button.active .toggle-thumb { transform: translateX(15px); }
.toggle-button.active { color: var(--ink); }
.divider { height: 1px; background: var(--line); margin: 24px 0; }
.section-heading { justify-content: space-between; gap: 12px; }
.tiny-badge { padding: 5px 8px; border-radius: 999px; color: #9aa1ad; background: rgba(255,255,255,.05); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.contact-list { display: grid; gap: 8px; margin-top: 13px; }
.contact-row { width: 100%; display: grid; grid-template-columns: 38px 1fr auto; gap: 11px; align-items: center; text-align: left; padding: 10px; border: 1px solid transparent; border-radius: 14px; background: transparent; cursor: pointer; }
.contact-row:hover { background: rgba(255,255,255,.04); border-color: var(--line); }
.contact-avatar { width: 38px; height: 38px; border-radius: 11px; font-size: 11px; }
.contact-row strong { display: block; font-size: 12px; }
.contact-row small { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.contact-call { color: var(--accent); font-weight: 900; }
.privacy-note { display: flex; gap: 10px; align-items: flex-start; margin-top: auto; padding-top: 30px; color: #7f8794; font-size: 10px; line-height: 1.5; }
.privacy-note p { margin: 0; }
.shield { color: var(--accent); font-size: 8px; margin-top: 4px; }
.side-panel { display: flex; flex-direction: column; }

.phone-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.phone-heading h2 { margin: 6px 0 0; font-size: clamp(19px, 2vw, 25px); letter-spacing: -0.03em; }
.call-timer { padding: 8px 12px; min-width: 66px; border: 1px solid var(--line); border-radius: 10px; color: #b4bbc5; font-variant-numeric: tabular-nums; text-align: center; font-size: 13px; font-weight: 750; }
.number-field { display: grid; grid-template-columns: 1fr 42px; gap: 6px; align-items: center; margin-top: 25px; padding: 6px 8px 6px 18px; border: 1px solid var(--line); border-radius: 17px; background: rgba(0,0,0,.22); transition: .2s; }
.number-field:focus-within { border-color: rgba(var(--accent-rgb), .6); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .08); }
.number-field input { min-width: 0; height: 48px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 24px; font-weight: 700; letter-spacing: .03em; }
.number-field input::placeholder { color: #525966; font-weight: 500; }
.backspace { height: 40px; border: 0; border-radius: 11px; background: transparent; color: #777f8b; cursor: pointer; font-size: 20px; }
.backspace:hover { color: var(--ink); background: rgba(255,255,255,.05); }
.dial-hint { color: #656d79; font-size: 10px; margin: 8px 4px 0; }
.dialpad { width: min(330px, 100%); margin: 22px auto 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.dialpad button { min-height: 64px; border: 1px solid var(--line); border-radius: 17px; background: linear-gradient(150deg, rgba(255,255,255,.055), rgba(255,255,255,.018)); cursor: pointer; transition: transform .13s, border-color .13s, background .13s; }
.dialpad button:hover { border-color: rgba(var(--accent-rgb), .45); background: rgba(var(--accent-rgb), .08); transform: translateY(-1px); }
.dialpad button:active { transform: translateY(1px) scale(.98); }
.dialpad span { display: block; font-size: 22px; font-weight: 650; line-height: 1; }
.dialpad small { display: block; min-height: 9px; margin-top: 5px; color: #727a87; font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.primary-call-actions { display: flex; justify-content: center; margin-top: 8px; }
.call-button, .hangup-button, .answer-button, .reject-button { border: 0; cursor: pointer; font-weight: 850; }
.call-button, .hangup-button { min-width: 154px; height: 52px; display: inline-flex; justify-content: center; align-items: center; gap: 10px; border-radius: 16px; }
.call-button { color: white; background: linear-gradient(135deg, var(--accent), rgba(var(--accent-rgb), .72)); box-shadow: 0 14px 34px rgba(var(--accent-rgb), .24); }
.call-button:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.call-button:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
.hangup-button { color: #fff; background: #b91c1c; box-shadow: 0 14px 34px rgba(185,28,28,.25); }
.phone-glyph { width: 13px; height: 13px; display: inline-grid; place-items: center; color: currentColor; font-size: 10px; }
.in-call-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.in-call-actions button { min-height: 55px; display: grid; place-items: center; gap: 4px; border: 1px solid transparent; border-radius: 14px; background: transparent; color: #8c94a0; cursor: pointer; }
.in-call-actions button:not(:disabled):hover, .in-call-actions button.active { color: var(--ink); border-color: var(--line); background: rgba(255,255,255,.045); }
.in-call-actions button.active { color: var(--accent); border-color: rgba(var(--accent-rgb), .35); }
.in-call-actions button:disabled { opacity: .3; cursor: not-allowed; }
.in-call-actions span { font-size: 17px; font-weight: 800; }
.in-call-actions small { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }

.text-button { border: 0; background: transparent; color: #77808d; cursor: pointer; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.text-button:hover { color: var(--accent); }
.activity-list { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; }
.empty-state { min-height: 140px; display: grid; place-items: center; align-content: center; gap: 10px; border: 1px dashed var(--line); border-radius: 16px; color: #68717e; text-align: center; font-size: 11px; }
.empty-state p { margin: 0; }
.empty-icon { font-size: 28px; color: #4c535f; }
.activity-entry { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 13px; background: rgba(255,255,255,.025); }
.activity-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: rgba(57,217,138,.1); color: #39d98a; font-weight: 900; }
.activity-entry.failed .activity-icon, .activity-entry.missed .activity-icon { color: var(--accent); background: rgba(var(--accent-rgb),.1); }
.activity-entry strong, .activity-entry small { display: block; }
.activity-entry strong { font-size: 11px; }
.activity-entry small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.activity-entry time { color: #6f7783; font-size: 9px; }
.system-card { margin-top: 24px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(0,0,0,.15); }
.system-card dl { margin: 12px 0 0; display: grid; gap: 10px; }
.system-card dl div { display: flex; justify-content: space-between; gap: 12px; font-size: 10px; }
.system-card dt { color: #727b88; }
.system-card dd { margin: 0; font-weight: 750; color: #bec5ce; }

.modal { width: min(460px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 24px; background: transparent; color: var(--ink); }
.modal::backdrop { background: rgba(2,4,7,.78); backdrop-filter: blur(12px); }
.modal-card { position: relative; padding: 34px; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(145deg, #1b1e26, #0e1015); box-shadow: 0 30px 100px rgba(0,0,0,.55); }
.theme-lokridge .modal-card { background: linear-gradient(145deg, #272326, #140e07); }
.modal-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border: 0; border-radius: 10px; background: rgba(255,255,255,.05); color: #939aa5; cursor: pointer; font-size: 22px; }
.dialog-logo { display: block; width: 170px; height: 44px; object-fit: contain; object-position: left center; margin-bottom: 24px; padding: 8px 10px; border-radius: 12px; background: white; }
.theme-lokridge .dialog-logo { background: #1f2124; }
.modal-card h2 { margin: 7px 0 8px; font-size: 26px; letter-spacing: -.035em; }
.modal-copy { margin: 0 0 23px; color: #8f97a3; font-size: 12px; line-height: 1.6; }
.modal-card label:not(.remember-row) { display: grid; gap: 8px; margin-top: 14px; }
.modal-card label > span { color: #c6ccd4; font-size: 11px; font-weight: 750; }
.modal-card input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px; outline: 0; background: rgba(0,0,0,.28); color: var(--ink); }
.modal-card input:focus { border-color: rgba(var(--accent-rgb),.7); box-shadow: 0 0 0 4px rgba(var(--accent-rgb),.08); }
.remember-row { display: flex; align-items: center; gap: 9px; margin: 14px 0; color: #939ba7; font-size: 10px; cursor: pointer; }
.remember-row input { width: 15px; height: 15px; accent-color: var(--accent); }
.modal-primary, .modal-secondary { width: 100%; height: 49px; margin-top: 8px; border-radius: 13px; cursor: pointer; font-weight: 800; }
.modal-primary { border: 0; background: var(--accent); color: white; box-shadow: 0 12px 28px rgba(var(--accent-rgb),.2); }
.modal-primary:disabled { opacity: .5; cursor: wait; }
.modal-secondary { border: 1px solid var(--line); background: transparent; color: #aab1bb; }
.form-error { min-height: 16px; margin: 4px 0; color: #ff8b8f; font-size: 10px; }
.realm-note { margin: 16px 0 0; text-align: center; color: #69717e; font-size: 9px; }
.realm-note strong { color: #848c98; }
.incoming-card { text-align: center; }
.incoming-pulse { width: 74px; height: 74px; display: grid; place-items: center; margin: 0 auto 20px; border-radius: 50%; color: white; background: var(--accent); box-shadow: 0 0 0 12px rgba(var(--accent-rgb),.08), 0 0 0 24px rgba(var(--accent-rgb),.04); animation: pulse 1.3s infinite; }
.incoming-actions { justify-content: center; gap: 12px; margin-top: 24px; }
.answer-button, .reject-button { width: 130px; height: 48px; border-radius: 13px; color: white; }
.answer-button { background: #159a5d; }
.reject-button { background: #b91c1c; }
.compact-card { padding-top: 42px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .58; } }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(230px,.75fr) minmax(390px,1.25fr); }
  .activity-panel { grid-column: 1 / -1; min-height: auto; }
  .activity-list { grid-template-columns: repeat(3, 1fr); }
  .empty-state { grid-column: 1 / -1; min-height: 100px; }
}

@media (max-width: 760px) {
  .shell { width: min(100% - 22px, 560px); padding-top: 12px; }
  .topbar { align-items: flex-start; }
  .brand-lockup { gap: 10px; }
  .brand-mark-wrap { width: 126px; height: 46px; padding: 9px; }
  .brand-logo { max-height: 27px; }
  .brand-lockup .eyebrow, .brand-lockup h1 { display: none; }
  .status-pill { height: 38px; padding: 0 11px; }
  .icon-button { width: 38px; height: 38px; }
  .workspace { grid-template-columns: 1fr; }
  .phone-panel { grid-row: 1; min-height: auto; padding: 24px 18px; }
  .side-panel, .activity-panel { min-height: auto; padding: 20px; }
  .dialpad { max-width: 310px; }
  .activity-list { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .status-pill span:last-child { display: none; }
  .dialpad button { min-height: 58px; }
  .phone-heading h2 { font-size: 18px; }
  .number-field input { font-size: 20px; }
  .modal-card { padding: 28px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
