/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--epoo-radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  text-decoration: none;
  line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--epoo-green-500);
  color: var(--epoo-blue-900);
  box-shadow: var(--epoo-shadow-sm);
}
.btn-primary:hover:not(:disabled) { background: var(--epoo-green-600); transform: translateY(-1px); }

.btn-secondary {
  background: var(--epoo-blue-900);
  color: var(--epoo-white);
}
.btn-secondary:hover:not(:disabled) { background: var(--epoo-blue-700); transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--epoo-blue-900);
  border-color: var(--epoo-border);
}
.btn-outline:hover:not(:disabled) { border-color: var(--epoo-blue-600); color: var(--epoo-blue-600); }

.btn-danger {
  background: var(--epoo-red-100);
  color: var(--epoo-red-500);
}
.btn-danger:hover:not(:disabled) { background: #fbd6d6; }

.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

/* Cards */
.card {
  background: var(--epoo-surface);
  border: 1px solid var(--epoo-border);
  border-radius: var(--epoo-radius-md);
  padding: 24px;
  box-shadow: var(--epoo-shadow-sm);
}

.card-hover {
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card-hover:hover {
  box-shadow: var(--epoo-shadow-md);
  transform: translateY(-2px);
}

/* Unboxed variant for marketing sections — spacing and typography carry the
   layout instead of a bordered container, closer to how Telnyx structures
   content blocks (no card chrome, generous whitespace) than a classic SaaS
   feature-card grid. */
.card-flat {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

/* Small uppercase label with a rule, used ahead of a section h2 to number
   and scan the page's major sections (e.g. "01 — SERVICES"). */
.section-marker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--epoo-font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--epoo-blue-900);
  margin-bottom: 14px;
}
.section-marker::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--epoo-green-600);
}
.section-marker.on-dark { color: var(--epoo-green-500); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-success { background: var(--epoo-green-100); color: var(--epoo-green-600); }
.badge-warning { background: var(--epoo-amber-100); color: var(--epoo-amber-700); }
.badge-danger { background: var(--epoo-red-100); color: var(--epoo-red-500); }
.badge-neutral { background: var(--epoo-blue-100); color: var(--epoo-blue-700); }

/* Forms */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--epoo-blue-900);
  margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--epoo-border);
  border-radius: var(--epoo-radius-sm);
  background: var(--epoo-white);
  color: var(--epoo-text);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--epoo-blue-600);
  box-shadow: 0 0 0 3px var(--epoo-green-100);
}
.field .hint { font-size: 0.8rem; color: var(--epoo-text-faint); margin-top: 4px; }

/* Country-select + local-number pair (signup, profile editing) */
.phone-field { display: flex; gap: 8px; }
.phone-field select { flex: 0 0 auto; width: auto; max-width: 45%; }
.phone-field input { flex: 1; min-width: 0; }

.form-error {
  background: var(--epoo-red-100);
  color: var(--epoo-red-500);
  border-radius: var(--epoo-radius-sm);
  padding: 12px 14px;
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: none;
}
.form-error.visible { display: block; }

.form-success {
  background: var(--epoo-green-100);
  color: var(--epoo-green-600);
  border-radius: var(--epoo-radius-sm);
  padding: 12px 14px;
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: none;
}
.form-success.visible { display: block; }

/* Tabs */
.tab-nav {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--epoo-border);
  margin-bottom: 22px;
}
.tab-btn {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 4px 2px 12px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--epoo-text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tab-btn:hover { color: var(--epoo-blue-900); }
.tab-btn.active { color: var(--epoo-blue-900); border-bottom-color: var(--epoo-green-500); }
.tab-btn.tab-btn-danger { color: var(--epoo-red-500); }
.tab-btn.tab-btn-danger:hover { color: var(--epoo-red-500); }
.tab-btn.tab-btn-danger.active { border-bottom-color: var(--epoo-red-500); }
.tab-panel[hidden] { display: none; }

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--epoo-border);
  border-radius: var(--epoo-radius-md);
  background: var(--epoo-surface);
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--epoo-border);
  white-space: nowrap;
}
.data-table th {
  background: var(--epoo-blue-100);
  color: var(--epoo-blue-900);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--epoo-bg); }
.data-table .empty-row td {
  text-align: center;
  color: var(--epoo-text-faint);
  padding: 32px;
  white-space: normal;
}

/* Nav */
.app-nav {
  background: var(--epoo-white);
  color: var(--epoo-blue-900);
  border-bottom: 1px solid var(--epoo-border);
}
.app-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.app-nav .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--epoo-blue-900);
}
.app-nav .brand .dot { color: var(--epoo-green-600); }
.app-nav ul {
  list-style: none;
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 0;
}
.app-nav a {
  color: var(--epoo-text-muted);
  font-weight: 600;
  font-size: 0.88rem;
}
.app-nav a:hover, .app-nav a.active {
  color: var(--epoo-blue-900);
  text-decoration: none;
}
.app-nav .nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  transition: opacity 0.15s ease;
}

/* Nav dropdown (hover/focus-revealed panel under a nav link) */
.nav-dropdown { position: relative; }
.nav-dropdown-panel {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 12px;
  background: var(--epoo-white);
  border: 1px solid var(--epoo-border);
  border-radius: var(--epoo-radius-md);
  box-shadow: var(--epoo-shadow-lg);
  padding: 18px 20px;
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.nav-dropdown:hover .nav-dropdown-panel,
.nav-dropdown:focus-within .nav-dropdown-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.nav-dropdown-header {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--epoo-green-600);
  font-weight: 700;
  border-bottom: 1px solid var(--epoo-border);
  padding-bottom: 8px;
  margin-bottom: 8px;
}
.nav-dropdown-panel a {
  display: block;
  padding: 6px 0;
  color: var(--epoo-text);
  font-size: 0.9rem;
  font-weight: 500;
}
.nav-dropdown-panel a:hover { color: var(--epoo-green-600); text-decoration: none; }

/* Sidebar layout (client / admin) */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.app-sidebar {
  background: var(--epoo-blue-900);
  color: var(--epoo-white);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.app-sidebar .brand {
  color: var(--epoo-white);
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: 24px;
  padding: 0 12px;
}
.app-sidebar .brand .dot { color: var(--epoo-green-500); }
.app-sidebar a {
  color: rgba(255, 255, 255, 0.75);
  padding: 10px 12px;
  border-radius: var(--epoo-radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
}
.app-sidebar a:hover { background: rgba(255, 255, 255, 0.08); color: var(--epoo-white); text-decoration: none; }
.app-sidebar a.active { background: var(--epoo-green-500); color: var(--epoo-blue-900); font-weight: 700; }
.app-sidebar .sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.app-main {
  padding: 32px 40px;
  max-width: 1100px;
  width: 100%;
}
/* Dashboards are dense utility UI, not marketing pages — cap the heading
   scale here rather than inheriting the bold public-page h1/h2 sizes. */
.app-main h1 { font-size: clamp(1.5rem, 2.4vw, 2rem); letter-spacing: -0.01em; }
.app-main h3 { font-size: 1.15rem; }
.app-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { flex-direction: row; overflow-x: auto; align-items: center; padding: 12px; }
  .app-sidebar .brand { margin-bottom: 0; }
  .app-sidebar .sidebar-footer { margin-top: 0; padding-top: 0; border-top: none; }
  .app-main { padding: 20px; }
}

/* Stat tiles */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-tile {
  background: var(--epoo-surface);
  border: 1px solid var(--epoo-border);
  border-radius: var(--epoo-radius-md);
  padding: 20px;
}
.stat-tile .stat-label {
  font-size: 0.8rem;
  color: var(--epoo-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}
.stat-tile .stat-value {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--epoo-blue-900);
}
.stat-tile.accent .stat-value { color: var(--epoo-green-600); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-overlay.visible { display: flex; }
.modal {
  background: var(--epoo-white);
  border-radius: var(--epoo-radius-md);
  padding: 28px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--epoo-shadow-lg);
}
.modal h3 { margin-bottom: 12px; }
.modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.key-reveal {
  font-family: var(--epoo-font-mono);
  background: var(--epoo-blue-900);
  color: var(--epoo-green-500);
  padding: 14px;
  border-radius: var(--epoo-radius-sm);
  word-break: break-all;
  font-size: 0.9rem;
  margin: 12px 0;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: epoo-spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes epoo-spin { to { transform: rotate(360deg); } }

.text-muted { color: var(--epoo-text-muted); }
.text-faint { color: var(--epoo-text-faint); }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
