@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500&display=swap');

/* ─── Variables ─────────────────────────────────────────────────────────── */

:root {
  --bg-base:     #0a0a0a;
  --bg-surface:  #111111;
  --bg-elevated: #1a1a1a;
  --bg-glass:    rgba(255, 255, 255, 0.04);

  --border:        rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 255, 255, 0.2);

  --text-primary:   #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.5);
  --text-muted:     rgba(255, 255, 255, 0.25);

  --accent:  #ffffff;
  --danger:  #ff3b3b;
  --success: #00ff88;

  --radius: 2px;
  --font: 'Space Grotesk', sans-serif;
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: var(--font);
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  overflow-y: auto;
}

.main-content {
  flex: 1;
  padding: 40px 48px;
  overflow-y: auto;
  min-width: 0;
}

/* ─── Logo ───────────────────────────────────────────────────────────────── */

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  text-decoration: none;
}

.logo-mark {
  width: 28px;
  height: 28px;
  border: 1.5px solid #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-mark::after {
  content: '';
  width: 8px;
  height: 8px;
  background: #ffffff;
  border-radius: 50%;
}

.logo-text {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--text-primary);
  text-transform: uppercase;
}

/* ─── Navigation ─────────────────────────────────────────────────────────── */

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
  margin-top: 24px;
}

.nav-label:first-child {
  margin-top: 0;
}

.nav a {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: var(--radius);
  border-left: 2px solid transparent;
  font-size: 14px;
  transition: color 0.15s, background 0.15s;
}

.nav a:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.nav a.active {
  color: var(--text-primary);
  border-left: 2px solid #ffffff;
  background: var(--bg-elevated);
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

/* ─── Stats Grid ─────────────────────────────────────────────────────────── */

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

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.stat-value {
  font-size: 32px;
  font-weight: 300;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ─── Tables ─────────────────────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  text-align: left;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--bg-elevated);
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 16px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--border-active);
  background: var(--bg-elevated);
}

.btn-primary {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

.btn-primary:hover {
  background: #ffffff;
  opacity: 0.9;
  border-color: #ffffff;
}

.btn-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: rgba(255, 59, 59, 0.08);
}

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* ─── Form Inputs ────────────────────────────────────────────────────────── */

input,
textarea,
select {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 14px;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--border-active);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group {
  margin-bottom: 20px;
}

/* ─── Badges ─────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: var(--radius);
  font-weight: 500;
}

.badge-active {
  color: var(--success);
  background: rgba(0, 255, 136, 0.1);
}

.badge-pending {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
}

.badge-replied {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}

.badge-sent {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
}

.badge-error {
  color: var(--danger);
  background: rgba(255, 59, 59, 0.1);
}

.badge-completed {
  color: var(--success);
  background: rgba(0, 255, 136, 0.06);
}

.badge-cancelled {
  color: var(--text-muted);
  background: transparent;
}

/* ─── Page Header ────────────────────────────────────────────────────────── */

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.page-header .subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ─── Utilities ──────────────────────────────────────────────────────────── */

.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

.flex         { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

.gap-8  { gap: 8px; }
.gap-16 { gap: 16px; }

.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success   { color: var(--success); }
.text-danger    { color: var(--danger); }

.w-full { width: 100%; }

/* ─── Modal ──────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 400;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s;
}

.modal-close:hover {
  color: var(--text-primary);
}

.hidden { display: none !important; }
