:root {
  --bg: #06131f;
  --bg-soft: #0e2233;
  --panel: rgba(8, 18, 29, 0.84);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --panel-muted: rgba(255, 255, 255, 0.08);
  --text: #f4f7fb;
  --text-dark: #0f1720;
  --muted: #97a9ba;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #ff8a3d;
  --accent-2: #28d4c5;
  --danger: #ff6b6b;
  --success: #34d399;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --font-ui: "Avenir Next", "Segoe UI", sans-serif;
  --font-display: "Trebuchet MS", "Avenir Next Condensed", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(40, 212, 197, 0.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(255, 138, 61, 0.2), transparent 28%),
    linear-gradient(135deg, #04111d 0%, #0a2131 48%, #05111d 100%);
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.page-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.eyebrow {
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  color: var(--accent-2);
}

.app-panel h2,
.table-card h3 {
  font-family: var(--font-display);
  letter-spacing: 0.01em;
}

.app-panel {
  width: min(1080px, 100%);
}

.login-card,
.dashboard {
  width: min(1080px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.login-card {
  max-width: 520px;
  padding: 36px;
}

.card-header p:last-child {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.login-form label,
.search-field {
  display: grid;
  gap: 8px;
}

.login-form span,
.search-field span {
  font-size: 0.9rem;
  color: var(--muted);
}

.login-form input,
.search-field input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 15px 16px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.search-field input {
  background: rgba(8, 18, 29, 0.42);
}

.login-form input:focus,
.search-field input:focus {
  outline: none;
  border-color: var(--accent-2);
  transform: translateY(-1px);
}

.primary-button,
.ghost-button {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), #ffb26a);
  color: #201306;
  font-weight: 700;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.form-message,
.error-message {
  min-height: 1.4rem;
  margin: 0;
  color: var(--danger);
}

.dashboard {
  padding: 28px;
}

.dashboard-header,
.toolbar,
.table-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

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

.status-pill {
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.9rem;
}

.status-pill.online {
  background: rgba(52, 211, 153, 0.16);
  color: #8cf7c4;
}

.status-pill.offline {
  background: rgba(255, 107, 107, 0.16);
  color: #ffb0b0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 28px 0;
}

.stat-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.stat-card.accent {
  background: linear-gradient(135deg, rgba(255, 138, 61, 0.2), rgba(255, 138, 61, 0.06));
}

.stat-card__label {
  display: block;
  color: var(--muted);
  margin-bottom: 12px;
}

.stat-card strong {
  font-size: 2rem;
}

.toolbar {
  margin-bottom: 20px;
}

.toolbar__meta p {
  margin: 0 0 6px;
}

.table-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  color: var(--text-dark);
}

.table-wrapper {
  overflow: auto;
  margin-top: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

thead th {
  text-align: left;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #607184;
  padding: 14px 16px;
  border-bottom: 1px solid #dde7ef;
}

tbody td {
  padding: 16px;
  border-bottom: 1px solid #eef3f7;
}

tbody tr:hover {
  background: #f8fbfd;
}

.direction-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 700;
}

.direction-badge.inbound {
  background: rgba(40, 212, 197, 0.14);
  color: #11776d;
}

.direction-badge.internal {
  background: rgba(37, 99, 235, 0.12);
  color: #224ea8;
}

.direction-badge.outbound {
  background: rgba(255, 138, 61, 0.14);
  color: #b45f22;
}

.empty-state {
  text-align: center;
  padding: 34px 20px 14px;
}

.empty-state p {
  color: #607184;
}

code {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.2rem 0.45rem;
  border-radius: 8px;
}

@media (max-width: 1120px) {
  .app-panel {
    width: 100%;
  }
}

@media (max-width: 780px) {
  .dashboard-header,
  .toolbar,
  .table-card__header {
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .page-shell {
    padding: 20px;
  }

  .login-card,
  .dashboard {
    padding: 20px;
    border-radius: 22px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}
