:root {
  --primary: #ffc72c;
  --primary-hover: #f59e0b;
  --primary-strong: #d97706;
  --primary-gradient: linear-gradient(180deg, #fcd34d 0%, #fbbf24 100%);
  --danger-gradient: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  --side-rail-gradient: linear-gradient(180deg, #18191d 0%, #0e0f12 100%);
  --card-gradient: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);

  --ink: #0f172a;
  --text: #111827;
  --muted: #52627a;
  --soft: #f8fafc;
  --surface: #ffffff;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --rail: #121214;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
  --success: #10b981;
  --success-bg: #dff8ee;
  --success-text: #065f46;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --warning-text: #92400e;
  --blue-bg: #eaf2ff;
  --blue-text: #1e40af;

  --font-family: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 30px rgba(15, 23, 42, 0.15);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: #f1f5f9;
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  user-select: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.hidden {
  display: none !important;
}

/* =========================================================================
   Shell Layout
   ========================================================================= */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 114px 1fr;
  transition: all 0.2s ease;
}

/* Side Rail */
.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 24px 14px;
  background: var(--side-rail-gradient);
  border-right: 1px solid #1f242d;
  color: #ffffff;
  z-index: 20;
}

.brand-block {
  display: grid;
  justify-items: center;
  gap: 2px;
  margin-bottom: 38px;
  text-align: center;
}

.brand-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: #090a0d;
  border: 1px solid #232733;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.brand-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.brand-block strong {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.brand-block span {
  font-size: 10px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.rail-nav {
  display: grid;
  gap: 10px;
}

.rail-button {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  transition: all 0.15s ease;
}

.rail-button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.rail-button.active {
  background: var(--primary-gradient);
  color: #111827;
  border-color: #f59e0b;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  font-weight: 700;
}

.rail-footer {
  margin-top: auto;
  display: grid;
  gap: 4px;
  color: #94a3b8;
  font-size: 10px;
  text-align: center;
}

.rail-footer small {
  color: #e2e8f0;
  font-weight: 600;
}

/* =========================================================================
   Workspace
   ========================================================================= */
.workspace {
  min-width: 0;
  padding: 28px 34px 24px;
  display: flex;
  flex-direction: column;
}

/* Top Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.search-shell {
  width: min(520px, 100%);
  min-height: 48px;
  display: grid;
  grid-template-columns: 110px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.search-shell:focus-within {
  border-color: var(--primary-strong);
  box-shadow: 0 0 0 3px rgba(255, 199, 44, 0.25);
}

.search-shell label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.search-shell input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text);
  font-size: 14px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Presence Dropdown Button */
.presence-container {
  position: relative;
}

.presence-button {
  min-width: 116px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.presence-button:hover {
  background: #f8fafc;
  border-color: var(--line-strong);
}

.presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.presence-button.available .presence-dot { background: var(--success); }
.presence-button.busy .presence-dot { background: var(--danger); }
.presence-button.ringing .presence-dot { background: var(--warning); animation: pulse 1s infinite; }
.presence-button.dnd .presence-dot { background: #b91c1c; }
.presence-button.away .presence-dot { background: #eab308; }
.presence-button.disconnected .presence-dot { background: #64748b; }

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.presence-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 50;
  display: none;
}

.presence-dropdown.show {
  display: block;
}

.presence-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: left;
}

.presence-item:hover {
  background: #f1f5f9;
}

/* =========================================================================
   Views & Panels
   ========================================================================= */
.view {
  display: none;
  flex: 1;
}

.view.active {
  display: block;
}

.dial-grid,
.two-column {
  display: grid;
  grid-template-columns: minmax(360px, 420px) minmax(540px, 1fr);
  gap: 24px;
  align-items: stretch;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.panel-heading h2 {
  margin: 0 0 4px 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* Status Pill */
.status-pill {
  flex: 0 0 auto;
  min-width: 80px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.status-pill.inactive {
  color: var(--danger-text);
  background: var(--danger-bg);
}

.status-pill.active {
  color: var(--success-text);
  background: var(--success-bg);
}

.status-pill.ringing {
  color: var(--warning-text);
  background: var(--warning-bg);
}

/* Dialer specific styles */
.dial-panel h2 {
  font-size: 28px;
  font-weight: 600;
  margin: 2px 0;
  color: var(--text);
  min-height: 36px;
}

.number-row {
  display: grid;
  grid-template-columns: 1fr 84px;
  gap: 10px;
  margin-bottom: 18px;
}

.number-row input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: #f8fafc;
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  outline: none;
  transition: all 0.15s ease;
}

.number-row input:focus {
  border-color: var(--primary-strong);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 199, 44, 0.2);
}

/* Keypad */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.dialpad-key {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card-gradient);
  color: #111827;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.1s ease;
  user-select: none;
}

.dialpad-key:hover {
  background: var(--primary-gradient);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(245, 158, 11, 0.25);
}

.dialpad-key:active {
  transform: translateY(1px);
}

.key-number {
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.key-letters {
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 2px;
}

.dialpad-key:hover .key-letters {
  color: #4b5563;
}

/* Primary Action Buttons */
.call-button,
.primary-button,
.hangup-button,
.soft-button {
  min-height: 44px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  transition: all 0.15s ease;
}

.call-button,
.primary-button {
  border: 1px solid #f59e0b;
  background: var(--primary-gradient);
  color: #111827;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.call-button:hover,
.primary-button:hover {
  background: #fbbf24;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.hangup-button {
  border: 1px solid #dc2626;
  background: var(--danger-gradient);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
}

.hangup-button:hover {
  background: #dc2626;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.soft-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: #334155;
  box-shadow: var(--shadow-sm);
}

.soft-button:hover {
  background: #f8fafc;
  border-color: var(--line-strong);
  color: #0f172a;
}

/* In-Call Controls */
.in-call-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.icon-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.icon-button:hover {
  background: #f1f5f9;
}

.icon-button.active {
  background: var(--blue-bg);
  border-color: #93c5fd;
  color: var(--blue-text);
}

/* Directory Tabs */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}

.tab-button {
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  transition: all 0.15s ease;
}

.tab-button:hover {
  color: var(--text);
  background: #f1f5f9;
}

.tab-button.active {
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Directory Table */
.directory-table {
  flex: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
  display: flex;
  flex-direction: column;
}

.table-head {
  display: grid;
  grid-template-columns: 1.3fr 1fr 90px;
  gap: 12px;
  align-items: center;
  padding: 8px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.directory-list {
  display: none;
  overflow-y: auto;
  max-height: 380px;
}

.directory-list.active {
  display: block;
}

.directory-row,
.history-row,
.contact-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 90px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s ease;
  cursor: pointer;
}

.directory-row:hover,
.history-row:hover,
.contact-row:hover {
  background: #f8fafc;
}

.directory-row strong,
.contact-row strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.directory-row span,
.contact-row span {
  font-size: 13px;
  color: var(--muted);
}

.quick-call-btn {
  justify-self: end;
  min-width: 64px;
  min-height: 30px;
  border: none;
  border-radius: var(--radius-sm);
  background: #eaf2ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  transition: all 0.15s ease;
}

.quick-call-btn:hover {
  background: #dbeafe;
  color: #1e40af;
}

/* =========================================================================
   Contacts View & Editor
   ========================================================================= */
.contact-list,
.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 520px;
  overflow-y: auto;
}

.contact-row {
  grid-template-columns: 1.3fr 1fr 100px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.contact-row.selected {
  border-color: var(--primary-strong);
  background: #fffdf5;
}

.contact-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-editor label,
.settings-card label,
.transfer-dialog label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.contact-editor input,
.contact-editor textarea,
.settings-card input,
.settings-card select,
.settings-card textarea,
.transfer-dialog input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: all 0.15s ease;
}

.contact-editor input:focus,
.contact-editor textarea:focus,
.settings-card input:focus,
.settings-card select:focus,
.transfer-dialog input:focus {
  border-color: var(--primary-strong);
  box-shadow: 0 0 0 3px rgba(255, 199, 44, 0.2);
}

.checkbox-line {
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  color: var(--text) !important;
  cursor: pointer;
}

.checkbox-line input {
  width: auto !important;
  min-height: auto !important;
  accent-color: var(--primary-strong);
}

.button-row {
  display: flex;
  gap: 10px;
}

/* =========================================================================
   Active Call HUD / Overlay
   ========================================================================= */
.active-call-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 20, 0.88);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  color: #ffffff;
}

.call-card {
  width: min(100%, 460px);
  background: #151821;
  border: 1px solid #2a3040;
  border-radius: var(--radius-xl);
  padding: 36px 30px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.call-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(255, 199, 44, 0.12);
  border: 2px solid var(--primary);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 16px;
}

.call-target {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.call-status {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 24px;
}

.call-quality-card {
  width: 100%;
  background: #0d0f15;
  border: 1px solid #232733;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  text-align: center;
  margin-bottom: 24px;
}

.quality-stat strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--success);
}

.quality-stat span {
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
}

.call-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  width: 100%;
  margin-bottom: 28px;
}

.call-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.call-action-btn:hover {
  color: #ffffff;
}

.action-icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.15s ease;
}

.call-action-btn:hover .action-icon-circle {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

.call-action-btn.active {
  color: var(--primary);
}

.call-action-btn.active .action-icon-circle {
  background: rgba(255, 199, 44, 0.2);
  border-color: var(--primary);
}

/* =========================================================================
   Modals (Incoming, Transfer, Settings, Permission Gate)
   ========================================================================= */
.modal-overlay,
.permission-gate,
.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 13, 20, 0.75);
  backdrop-filter: blur(4px);
}

.setup-card,
.incoming-card,
.settings-dialog {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: #ffffff;
  box-shadow: var(--shadow-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
}

.setup-logo,
.incoming-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  margin-bottom: 14px;
}

.setup-card h1,
.incoming-card h2 {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 6px 0;
}

/* Settings Window */
.settings-window {
  width: min(100%, 820px);
  height: min(92vh, 620px);
  display: grid;
  grid-template-columns: 210px 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-lg);
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px 16px;
  background: #f8fafc;
  border-right: 1px solid var(--line);
}

.settings-nav h2 {
  margin: 0 0 14px 0;
  font-size: 18px;
  font-weight: 700;
}

.settings-tab {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: #475569;
  text-align: left;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.15s ease;
}

.settings-tab:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.settings-tab.active {
  background: var(--primary-gradient);
  color: #111827;
  border-color: #f59e0b;
}

.settings-content {
  display: grid;
  grid-template-rows: 1fr auto;
  min-width: 0;
  padding: 24px 28px;
}

.settings-page {
  display: none;
  overflow-y: auto;
  padding-right: 8px;
}

.settings-page.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f8fafc;
  padding: 16px;
}

.settings-card h3 {
  margin: 0 0 12px 0;
  font-size: 15px;
  font-weight: 700;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* =========================================================================
   Diagnostics Console
   ========================================================================= */
.diagnostics-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
}

.diag-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.diag-progress-bar {
  flex: 1;
  height: 10px;
  background: #e2e8f0;
  border-radius: 5px;
  overflow: hidden;
}

.diag-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary-gradient);
  transition: width 0.3s ease;
}

.diag-console {
  flex: 1;
  min-height: 360px;
  max-height: 480px;
  background: #0d1017;
  border: 1px solid #232733;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: #10b981;
  overflow-y: auto;
  white-space: pre-wrap;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* =========================================================================
   Footer Notice
   ========================================================================= */
.footer-notice {
  margin-top: auto;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-notice.neutral {
  background: #eaf2ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.footer-notice.success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid #a7f3d0;
}

.footer-notice.error {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid #fecaca;
}

.footer-notice.warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid #fde68a;
}

/* =========================================================================
   Mini-Widget Mode
   ========================================================================= */
body.mini-widget-mode {
  background: #0f1117;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

body.mini-widget-mode .app-shell {
  min-height: auto;
  height: 640px;
  width: 380px;
  grid-template-columns: 1fr;
  border: 1px solid #2d3345;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  background: #ffffff;
}

body.mini-widget-mode .side-rail {
  display: none;
}

body.mini-widget-mode .workspace {
  padding: 16px;
}

body.mini-widget-mode .dial-grid {
  grid-template-columns: 1fr;
}

body.mini-widget-mode .directory-panel {
  display: none;
}

/* =========================================================================
   Responsive Breakpoints
   ========================================================================= */
@media (max-width: 1024px) {
  .dial-grid,
  .two-column {
    grid-template-columns: 1fr;
  }
  
  .settings-window {
    grid-template-columns: 1fr;
    height: min(94vh, 720px);
  }
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  
  .side-rail {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
  }

  .brand-block {
    margin-bottom: 0;
    grid-template-columns: auto auto;
    align-items: center;
    gap: 8px;
  }

  .brand-icon-wrapper {
    margin-bottom: 0;
    width: 38px;
    height: 38px;
  }

  .brand-icon {
    width: 24px;
    height: 24px;
  }

  .rail-nav {
    display: flex;
    gap: 6px;
  }

  .workspace {
    padding: 16px;
  }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--bg-card);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  margin: 8px 0;
}

.dialpad-key:focus-visible {
  outline: 2px solid var(--primary-strong);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .top-bar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .search-shell {
    max-width: 100%;
    width: 100%;
  }

  .presence-container {
    width: 100%;
    justify-content: flex-end;
  }
}



/* =========================================================================
   BLF Switchboard Wallboard Styles
   ========================================================================= */
.blf-quick-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.blf-wallboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.blf-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.blf-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}

.blf-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.blf-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  border: 2px solid #e2e8f0;
}

.blf-avatar.online { border-color: var(--success); background: var(--success-bg); color: var(--success-text); }
.blf-avatar.busy { border-color: var(--danger); background: var(--danger-bg); color: var(--danger-text); }
.blf-avatar.ringing { border-color: #f59e0b; background: #fef3c7; color: #92400e; animation: pulse 1s infinite; }
.blf-avatar.away { border-color: #eab308; background: #fef9c3; color: #854d0e; }
.blf-avatar.offline { border-color: #cbd5e1; color: #94a3b8; }

.blf-info {
  flex: 1;
  min-width: 0;
}

.blf-info strong {
  display: block;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blf-info span {
  font-size: 12px;
  color: var(--muted);
}

.blf-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
}

.blf-status-pill.online { background: var(--success-bg); color: var(--success-text); }
.blf-status-pill.busy { background: var(--danger-bg); color: var(--danger-text); }
.blf-status-pill.ringing { background: #fef3c7; color: #92400e; }
.blf-status-pill.away { background: #fef9c3; color: #854d0e; }
.blf-status-pill.offline { background: #f1f5f9; color: #64748b; }

.blf-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 4px;
}

.blf-btn {
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: var(--radius-sm);
  text-align: center;
  transition: all 0.15s ease;
}

.blf-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #000000;
}

/* =========================================================================
   Voicemail & PBX Features Styles
   ========================================================================= */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.feature-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.feature-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.feature-icon-badge {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: #f1f5f9;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.feature-card-header h3 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 700;
}

.feature-card-header p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.feature-action-box {
  display: flex;
  gap: 10px;
}

.parking-slots-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.parking-slot-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
  text-align: center;
}

.parking-slot-btn strong {
  font-size: 13px;
  color: var(--ink);
}

.parking-slot-btn span {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.parking-slot-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #000000;
}

.parking-slot-btn:hover strong,
.parking-slot-btn:hover span {
  color: #000000;
}

.feature-codes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

/* =========================================================================
   In-Call Audio Recordings Library
   ========================================================================= */
.recordings-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.recording-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1.5fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.rec-meta strong {
  display: block;
  font-size: 14px;
}

.rec-meta span {
  font-size: 12px;
  color: var(--muted);
}

.rec-audio-shell {
  display: flex;
  align-items: center;
}

.rec-audio-shell audio {
  height: 32px;
  width: 100%;
}

.rec-actions {
  display: flex;
  gap: 8px;
}

/* =========================================================================
   Top Bar Badges & Indicators
   ========================================================================= */
.mwi-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.mwi-icon {
  font-size: 14px;
}

.recording-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid #fca5a5;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: recBlink 1s infinite;
}

@keyframes recBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* =========================================================================
   Line Selector Bar
   ========================================================================= */
.line-selector-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.line-tab {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-align: center;
  transition: all 0.15s ease;
}

.line-tab.active {
  background: #1e293b;
  border-color: #1e293b;
  color: #ffffff;
}

.line-tab.conf-tab {
  background: #0f766e;
  border-color: #0f766e;
  color: #ffffff;
}

/* =========================================================================
   Audio Waveform Canvas in Active Call HUD
   ========================================================================= */
.waveform-container {
  width: 100%;
  height: 48px;
  background: #0a0c10;
  border: 1px solid #1e2433;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-waveform-canvas {
  width: 100%;
  height: 100%;
}
