/* =====================================================================
   OfficeNumber — Dashboard styles (extends css/style.css)
   ===================================================================== */

body.app {
  background: var(--surface);
  font-size: 15px;
}

/* ============= Layout ============= */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
}

/* ============= Sidebar ============= */
.app-side {
  background: white;
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
@media (max-width: 880px) {
  .app-side {
    position: relative;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 12px 16px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}

.app-side .logo {
  margin-bottom: 18px;
  flex-shrink: 0;
}
@media (max-width: 880px) {
  .app-side .logo { margin-bottom: 0; margin-right: 12px; }
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
@media (max-width: 880px) {
  .app-nav { flex-direction: row; }
}
.app-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  white-space: nowrap;
}
.app-nav a:hover { background: var(--surface); color: var(--ink); }
.app-nav a.active {
  background: var(--ink);
  color: white;
  font-weight: 600;
}
.app-nav a.active svg { color: var(--coral); }
.app-nav svg { color: var(--ink-fade); flex-shrink: 0; }

.app-side-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 0.78rem;
  color: var(--ink-fade);
}
@media (max-width: 880px) { .app-side-foot { display: none; } }

.app-side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  margin-bottom: 10px;
}
.app-side-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--coral), var(--coral-deep));
  color: white;
  font-weight: 700;
  font-size: 0.86rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.app-side-user-info { min-width: 0; flex: 1; }
.app-side-user-info strong {
  display: block;
  font-size: 0.86rem;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-side-user-info span {
  font-size: 0.76rem;
  color: var(--ink-fade);
}

/* ============= Main area ============= */
.app-main {
  padding: 28px 36px;
  max-width: 1200px;
  width: 100%;
}
@media (max-width: 720px) {
  .app-main { padding: 20px 18px; }
}

.app-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.app-page-head h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0;
}
.app-page-head .crumb {
  font-size: 0.85rem;
  color: var(--ink-fade);
  margin-bottom: 4px;
}

/* ============= KPI cards ============= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.kpi-card {
  background: white;
  padding: 18px 18px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
}
.kpi-card-label {
  font-size: 0.78rem;
  color: var(--ink-fade);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.kpi-card-val {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-feature-settings: 'tnum';
}
.kpi-card-sub {
  font-size: 0.78rem;
  color: var(--ink-fade);
  margin-top: 4px;
}
.kpi-card.accent { background: linear-gradient(135deg, var(--ink), var(--navy-soft)); }
.kpi-card.accent .kpi-card-label { color: rgba(255,255,255,0.6); }
.kpi-card.accent .kpi-card-val { color: white; }
.kpi-card.accent .kpi-card-sub { color: rgba(255,255,255,0.55); }

/* ============= Card / panel ============= */
.panel {
  background: white;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  margin-bottom: 24px;
  overflow: hidden;
}
.panel-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.panel-head h3 {
  font-size: 0.96rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}
.panel-body { padding: 18px 20px; }
.panel-body.compact { padding: 0; }

/* ============= Tables ============= */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.table th, .table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.table th {
  background: var(--surface);
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table tbody tr:hover { background: var(--surface); }
.table tbody tr:last-child td { border-bottom: none; }
.table .muted { color: var(--ink-fade); }
.table .num-cell { font-feature-settings: 'tnum'; font-weight: 600; color: var(--ink); }

/* ============= Status pill ============= */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill.green { background: var(--wa-green-bubble); color: var(--wa-green-darkest); }
.pill.blue  { background: var(--blue-soft); color: var(--blue-deep); }
.pill.amber { background: #FEF3C7; color: #92400E; }
.pill.red   { background: #FEE2E2; color: #991B1B; }
.pill.gray  { background: var(--surface-2); color: var(--ink-soft); }

/* ============= Number cards (My Numbers grid) ============= */
.numbers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.number-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 20px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  display: block;
}
.number-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--ink);
}
.number-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.number-card-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}
.number-card.is-whatsapp .number-card-icon { background: linear-gradient(135deg, var(--wa-green), var(--wa-green-deep)); }
.number-card.is-landline .number-card-icon { background: linear-gradient(135deg, var(--blue), var(--blue-deep)); }
.number-card-num {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-feature-settings: 'tnum';
  margin-bottom: 4px;
}
.number-card-meta {
  font-size: 0.82rem;
  color: var(--ink-fade);
  margin-bottom: 12px;
}
.number-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 0.82rem;
  color: var(--ink-soft);
}

/* ============= Routing editor ============= */
.routing-row {
  display: grid;
  grid-template-columns: 60px 1fr 140px 1fr 36px;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
}
.routing-row .digit-pill {
  font-feature-settings: 'tnum';
  font-weight: 800;
  text-align: center;
  background: var(--blue-soft);
  color: var(--blue-deep);
  border-radius: 8px;
  padding: 12px 0;
}
.routing-row input, .routing-row select {
  padding: 9px 12px;
  font-size: 0.88rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
}
.routing-row input:focus, .routing-row select:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-soft);
}
.routing-row .row-remove {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-fade);
}
.routing-row .row-remove:hover { background: var(--coral-soft); color: var(--coral-deep); }

/* ============= Voicemail list ============= */
.vm-list { display: flex; flex-direction: column; gap: 10px; }
.vm-item {
  background: white;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  align-items: center;
}
.vm-item.unread { border-color: var(--coral); background: linear-gradient(to right, var(--coral-soft), white 12%); }
.vm-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
}
.vm-item.unread .vm-icon { background: var(--coral); color: white; }
.vm-body strong { display: block; font-size: 0.9rem; color: var(--ink); font-weight: 600; }
.vm-body .vm-transcript {
  font-size: 0.86rem;
  color: var(--ink-soft);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vm-meta {
  font-size: 0.76rem;
  color: var(--ink-fade);
  text-align: right;
  white-space: nowrap;
}

/* ============= Tabs ============= */
.tabs {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface-2);
  border-radius: 10px;
  width: fit-content;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.tab {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.tab:hover { color: var(--ink); }
.tab.active {
  background: white;
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============= Empty state ============= */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-fade);
}
.empty svg { color: var(--ink-fade); margin-bottom: 12px; }
.empty h4 { font-size: 1rem; color: var(--ink); margin-bottom: 4px; }
.empty p { font-size: 0.88rem; }

/* ============= Login page ============= */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth-shell::before, .auth-shell::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
.auth-shell::before {
  top: -150px; right: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.4), transparent 70%);
}
.auth-shell::after {
  bottom: -150px; left: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.4), transparent 70%);
}
.auth-card {
  background: white;
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line-soft);
  position: relative;
  z-index: 1;
}
.auth-card .logo { margin-bottom: 24px; }
.auth-card h1 {
  font-size: 1.5rem;
  margin-bottom: 6px;
  letter-spacing: -0.025em;
}
.auth-card p { color: var(--ink-soft); font-size: 0.92rem; margin-bottom: 24px; }
.auth-card .btn { width: 100%; justify-content: center; }
.auth-card-foot {
  text-align: center;
  margin-top: 18px;
  font-size: 0.86rem;
  color: var(--ink-soft);
}
.auth-card-foot a { color: var(--ink); font-weight: 600; }
.auth-card-foot a:hover { color: var(--coral); }

/* ============= Modal ============= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 21, 48, 0.5);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.modal-backdrop.show { opacity: 1; pointer-events: auto; }
.modal {
  background: white;
  border-radius: 16px;
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px);
  transition: transform 0.25s var(--bounce);
}
.modal-backdrop.show .modal { transform: translateY(0); }
.modal h3 { font-size: 1.15rem; margin-bottom: 14px; }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ============= Toast ============= */
.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}
.toast {
  background: var(--ink);
  color: white;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.3s var(--bounce);
  max-width: 360px;
}
.toast.success { background: var(--wa-green-deep); }
.toast.error { background: #DC2626; }
@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
