.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  z-index: 9999;
}

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3248;
  --text: #e8eaf0;
  --muted: #8b90a8;
  --primary: #5b6ef5;
  --primary-hover: #4a5de0;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #38bdf8;
  --radius: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
}

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

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

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

/* ─── Header ─────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
nav { display: flex; gap: 4px; }
nav button {
  background: none;
  border: none;
  color: var(--muted);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}
nav button:hover { background: var(--surface2); color: var(--text); }
nav button.active { background: var(--surface2); color: var(--text); font-weight: 600; }

/* ─── Main ───────────────────────────────── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}
section { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
.subtitle { color: var(--muted); margin-bottom: 28px; }

h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }

/* ─── Cards ──────────────────────────────── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 32px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.provider-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
}
.meta-icon { background: #1877f2; color: #fff; }
.google-icon { background: #fff; color: #4285f4; }
.card-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.card-status { font-size: 13px; }
.connected { color: var(--success); }
.disconnected { color: var(--muted); }
.card-actions { display: flex; gap: 8px; }
.token-input-area { margin-bottom: 12px; }
.token-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 6px; }
.token-input { width: 100%; background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); padding: 8px 12px; font-size: 13px; font-family: monospace; }
.token-input:focus { outline: none; border-color: var(--primary); }
.token-hint { font-size: 11px; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title-row h3 { margin: 0; }
.selected-count { font-size: 12px; background: var(--primary); color: #fff; padding: 2px 10px; border-radius: 12px; }
.token-steps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.token-step { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--muted); }
.token-step a { color: var(--primary); }
.step-num { background: var(--surface2); border: 1px solid var(--border); border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; color: var(--text); }

/* ─── Buttons ────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
}
.btn:hover { background: var(--border); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: #166534; border-color: #166534; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: transparent; border-color: #7f1d1d; color: var(--danger); }
.btn-danger:hover { background: #7f1d1d22; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ─── Form Sections ──────────────────────── */
.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
}
.form-group { margin-bottom: 16px; }
.form-group label { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.form-group input[type=text],
.form-group input[type=number],
.form-group input[type=date],
.form-group select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 14px;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─── Account List ───────────────────────── */
.account-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.radio-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.radio-card:hover { border-color: var(--primary); }
.radio-card.selected { border-color: var(--primary); background: #5b6ef510; }
.radio-card input { display: none; }
.acc-name { font-weight: 500; font-size: 14px; }
.acc-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ─── Level Selector ─────────────────────── */
.level-selector { display: flex; gap: 10px; }
.level-selector label {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
}
.level-selector label:hover { border-color: var(--primary); }
.level-selector label.selected { border-color: var(--primary); background: #5b6ef510; color: var(--primary); }
.level-selector input { display: none; }

/* ─── Date Presets ───────────────────────── */
.date-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.preset-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 20px;
  padding: 5px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.preset-btn:hover { border-color: var(--primary); color: var(--text); }
.preset-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.custom-dates { display: flex; gap: 12px; align-items: center; }
.custom-dates input {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: 14px;
}

/* ─── Metrics ────────────────────────────── */
.metrics-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.metrics-groups.compact { gap: 10px; }
.metric-group { }
.metric-group-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 8px; }
.metric-checkboxes { display: flex; flex-direction: column; gap: 6px; }
.metric-checkbox {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 6px;
  transition: background 0.1s;
}
.metric-checkbox:hover { background: var(--surface2); }
.metric-checkbox input[type=checkbox] { accent-color: var(--primary); width: 14px; height: 14px; }

/* ─── Form Actions ───────────────────────── */
.form-actions { display: flex; gap: 12px; margin: 20px 0; }

/* ─── Preview Table ──────────────────────── */
.preview-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.preview-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.preview-header h3 { margin: 0; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 8px 12px;
  background: var(--surface2);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
td { padding: 8px 12px; border-top: 1px solid var(--border); white-space: nowrap; }
tr:hover td { background: var(--surface2); }

/* ─── Schedules ──────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-header h2 { margin: 0; }
.schedules-table-wrap { overflow-x: auto; }
.schedules-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.schedules-table th {
  background: var(--surface);
  padding: 10px 14px;
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.schedules-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.schedules-table tr:hover td { background: var(--surface2); }
.actions-cell { display: flex; gap: 6px; }

/* ─── Badges ─────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: #14532d; color: #86efac; }
.badge-error { background: #7f1d1d; color: #fca5a5; }
.badge-pending { background: #78350f; color: #fde68a; }
.badge-neutral { background: var(--surface2); color: var(--muted); }

/* ─── Modal ──────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-large { max-width: 720px; }
.modal h3 { margin-bottom: 20px; font-size: 17px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.sheets-selector { display: flex; gap: 8px; }
.sheets-selector select { flex: 1; background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); padding: 8px 12px; font-size: 14px; }

/* ─── Toast ──────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  z-index: 300;
  box-shadow: var(--shadow);
  max-width: 360px;
}
.toast.success { background: #14532d; color: #86efac; border: 1px solid #166534; }
.toast.error { background: #7f1d1d; color: #fca5a5; border: 1px solid #991b1b; }
.toast.info { background: #0c4a6e; color: #7dd3fc; border: 1px solid #0369a1; }

/* ─── Alerts ─────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 14px; }
.alert-warning { background: #78350f22; border: 1px solid var(--warning); color: var(--warning); }
.warning { background: #78350f22; border: 1px solid var(--warning); color: var(--warning); padding: 8px 12px; border-radius: 6px; font-size: 12px; margin-bottom: 10px; }
.info { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.hint { color: var(--muted); font-size: 12px; }

/* ─── Empty / Loading ────────────────────── */
.loading { color: var(--muted); padding: 20px 0; }
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

/* ─── Setup Guide ────────────────────────── */
.setup-guide {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-top: 20px;
}
.setup-guide h3 { margin-bottom: 16px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.setup-guide ol { padding-left: 20px; }
.setup-guide li { margin-bottom: 12px; line-height: 1.6; color: var(--muted); }
.setup-guide li strong { color: var(--text); }
code {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
  color: var(--info);
}

/* ─── Scrollbar ──────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ─── Saved Reports Panel (Veri Çek) ────── */
.saved-reports-panel {
  margin-top: 24px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.saved-reports-panel h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 12px; }
.saved-reports-list { display: flex; flex-direction: column; gap: 8px; }
.saved-report-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.saved-report-info { display: flex; flex-direction: column; gap: 2px; }
.saved-report-name { font-weight: 500; font-size: 14px; }
.saved-report-meta { font-size: 12px; color: var(--muted); }
.saved-report-actions { display: flex; gap: 6px; }

/* ─── Section Header ─────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-header h2 { margin: 0; }

/* ─── Secondary Button ───────────────────── */
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface); }

/* ─── Compact account list (in modals) ───── */
.account-list.compact { max-height: 180px; overflow-y: auto; }
