/* ─── Reset & base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #f7f7f5;
  --surface:  #ffffff;
  --border:   #e4e4e0;
  --text:     #1a1a18;
  --muted:    #888780;
  --accent:   #2a5cff;
  --accent-h: #1e4be0;
  --success:  #0f6e56;
  --success-bg: #e1f5ee;
  --danger:   #a32d2d;
  --danger-bg:#fcebeb;
  --warn:     #854f0b;
  --warn-bg:  #faeeda;
  --sidebar-w: 220px;
  --radius:   10px;
  --shadow:   0 1px 3px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Auth ──────────────────────────────────────────────── */
.auth-body { display: flex; align-items: center; justify-content: center; background: var(--bg); }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}

.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }

.auth-logo-icon {
  width: 40px; height: 40px;
  background: var(--text); color: #fff;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; letter-spacing: 0.5px;
}

.auth-logo h1 { font-size: 18px; font-weight: 600; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }

/* ─── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh; z-index: 10;
}

.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  width: 32px; height: 32px;
  background: var(--text); color: #fff;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 11px;
}

.sidebar-title { font-weight: 600; font-size: 14px; }
.sidebar-nav { flex: 1; padding: 12px 8px; }
.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--border); }

.nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 7px;
  color: var(--muted); font-size: 13px;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.nav-item:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--bg); color: var(--text); font-weight: 500; }
.logout-link:hover { color: var(--danger); }

/* ─── Main ──────────────────────────────────────────────── */
.main { margin-left: var(--sidebar-w); flex: 1; padding: 32px 40px; max-width: 1100px; }

/* ─── Page header ───────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px; flex-wrap: wrap;
}
.page-header h1 { font-size: 22px; font-weight: 600; }

.back-link { color: var(--muted); font-size: 13px; text-decoration: none; }
.back-link:hover { color: var(--text); }

.stats-row { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

/* ─── Badges ────────────────────────────────────────────── */
.badge, .stat-badge {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
}
.badge-processing, .stat-badge.processing { background: #e6f1fb; color: #185fa5; }
.badge-pending_review, .stat-badge.pending { background: var(--warn-bg); color: var(--warn); }
.badge-validated, .stat-badge.validated { background: var(--success-bg); color: var(--success); }
.badge-rejected, .stat-badge.rejected { background: #f1efe8; color: #5f5e5a; }
.badge-error, .stat-badge.error { background: var(--danger-bg); color: var(--danger); }

/* ─── Table ─────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}

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

.speakers-table thead th {
  background: var(--bg); padding: 10px 16px;
  text-align: left; font-weight: 500; font-size: 12px;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.speakers-table tbody tr {
  border-bottom: 1px solid var(--border); transition: background 0.1s;
}
.speakers-table tbody tr:last-child { border-bottom: none; }
.speakers-table tbody tr:hover { background: var(--bg); }
.speakers-table td { padding: 12px 16px; vertical-align: middle; }

.td-name { font-weight: 500; }
.td-job, .td-email, .td-date { color: var(--muted); }
.td-date { font-size: 12px; white-space: nowrap; }

.empty-state { text-align: center; color: var(--muted); padding: 48px !important; }

/* ─── Info card ─────────────────────────────────────────── */
.info-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 24px;
}

.info-row {
  display: flex; gap: 12px; align-items: baseline;
  padding: 8px 0; width: 100%;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }

.info-label {
  font-weight: 500; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.4px; min-width: 110px;
}

/* ─── Actions ───────────────────────────────────────────── */
.actions-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 500; border: 1px solid transparent;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
  white-space: nowrap; background: none;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: #f0aeae; }
.btn-danger:hover { background: #f7c1c1; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-full { width: 100%; }

.btn-delete {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border-radius: 6px; font-size: 12px;
  color: var(--muted); border: 1px solid transparent; background: none; cursor: pointer;
  opacity: 0.5; transition: opacity .15s, color .15s, background .15s;
}
.btn-delete:hover { opacity: 1; color: var(--danger); background: var(--danger-bg); border-color: #f0aeae; }

/* ─── Forms ─────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text); }
.field-hint { color: var(--muted); font-weight: 400; }
.field input, .field select, .field textarea {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--surface); color: var(--text);
  outline: none; transition: border-color 0.15s; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 80px; }

/* ─── Alerts ────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 20px; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }

/* ─── Filters ───────────────────────────────────────────── */
.filter-bar { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }

.filter-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 500;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; transition: background .15s, color .15s; white-space: nowrap;
}
.filter-tab:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.filter-tab.active { background: var(--text); color: #fff; border-color: var(--text); }

.filter-count {
  background: rgba(0,0,0,0.10); border-radius: 20px;
  padding: 1px 7px; font-size: 11px; font-weight: 700;
}
.filter-tab.active .filter-count { background: rgba(255,255,255,0.22); color: #fff; }

.type-select {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--surface); color: var(--text);
  cursor: pointer; outline: none;
}
.type-select:focus { border-color: var(--accent); }

.muted { color: var(--muted); }

/* ─── Table actions ─────────────────────────────────────── */
.td-actions {
  display: flex; align-items: center; gap: 8px;
  justify-content: flex-end; white-space: nowrap;
}

/* ─── Generate form ─────────────────────────────────────── */
.generate-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; max-width: 680px;
}

.form-section { margin-bottom: 28px; }

.form-section-title {
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--muted); margin-bottom: 14px;
}

.form-grid { display: flex; flex-direction: column; gap: 14px; }
.field-wide { width: 100%; }

.type-selector { display: flex; gap: 10px; flex-wrap: wrap; }

.type-option { cursor: pointer; }
.type-option input[type="radio"] { display: none; }

.type-option-box {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 20px; border-radius: 10px;
  border: 2px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 500; color: var(--muted);
  transition: border-color .15s, color .15s, background .15s;
  min-width: 130px; text-align: center;
  cursor: pointer;
}
.type-option-box:hover { border-color: var(--accent); color: var(--text); }
.type-option input:checked + .type-option-box {
  border-color: var(--accent); color: var(--accent);
  background: #f0f4ff;
}

.form-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.generate-hint { color: var(--muted); font-size: 12px; }

/* ─── Spinner ───────────────────────────────────────────── */
.spinner-inline {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-right: 6px; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Content block ─────────────────────────────────────── */
.content-block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}

.content-block-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.content-block-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }

.content-textarea {
  width: 100%; min-height: 340px; padding: 18px;
  font-size: 13px; font-family: "SF Mono", "Fira Code", "Fira Mono", monospace;
  line-height: 1.65; border: none; outline: none; resize: vertical;
  background: var(--surface); color: var(--text);
}

.content-preview {
  padding: 24px 28px; min-height: 200px;
  font-size: 15px; line-height: 1.7; color: var(--text);
}
.content-preview h1 { font-size: 22px; margin-bottom: 16px; }
.content-preview h2 { font-size: 18px; margin: 20px 0 10px; }
.content-preview h3 { font-size: 16px; margin: 16px 0 8px; }
.content-preview p { margin-bottom: 12px; }
.content-preview ul, .content-preview ol { margin: 10px 0 12px 20px; }
.content-preview li { margin-bottom: 4px; }
.content-preview strong { font-weight: 600; }

/* ─── View toggle ───────────────────────────────────────── */
.view-toggle {
  display: flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden;
}
.view-btn {
  padding: 5px 12px; font-size: 12px; font-weight: 500; background: var(--surface);
  color: var(--muted); border: none; cursor: pointer; transition: background .15s, color .15s;
}
.view-btn.active { background: var(--text); color: #fff; }
.view-btn:hover:not(.active) { background: var(--bg); color: var(--text); }

/* ─── Search input ──────────────────────────────────────── */
.search-input {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--surface); color: var(--text);
  outline: none; transition: border-color .15s;
}
.search-input:focus { border-color: var(--accent); }

/* ─── Usage bars ────────────────────────────────────────── */
.tenant-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
  margin-bottom: 16px;
}
.tenant-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.usage-grid { display: flex; flex-direction: column; gap: 10px; }
.usage-item { display: flex; flex-direction: column; gap: 4px; }
.usage-label {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted); font-weight: 500;
}
.usage-ok   { color: var(--success); }
.usage-warn { color: var(--warn); font-weight: 600; }
.usage-over { color: var(--danger); font-weight: 600; }

.usage-bar-bg {
  height: 6px; background: var(--bg); border-radius: 4px; overflow: hidden;
  border: 1px solid var(--border);
}
.usage-bar {
  height: 100%; background: var(--accent); border-radius: 4px;
  transition: width .3s;
}
.usage-bar-warn { background: var(--warn); }
.usage-bar-over { background: var(--danger); }

.limits-panel {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ─── Usage widget (cliente) ────────────────────────────── */
.usage-widget {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px;
  margin-bottom: 20px; display: flex; gap: 24px; flex-wrap: wrap;
}
.usage-widget-item { flex: 1; min-width: 160px; }
.usage-widget-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }
.usage-widget-value { font-size: 13px; font-weight: 500; margin-bottom: 6px; }

/* ─── Blocked state ─────────────────────────────────────── */
.alert-blocked {
  background: var(--danger-bg); color: var(--danger);
  border: 1px solid #f0aeae; border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 24px;
}
.alert-blocked strong { display: block; margin-bottom: 4px; font-size: 15px; }
.alert-blocked p { font-size: 13px; margin-top: 4px; opacity: 0.85; }
