/* ============================================================
   Admin Quinté — style.css v4
   ============================================================ */

:root {
  --bg:       #f4f6f9;
  --panel:    #ffffff;
  --border:   #e2e6eb;
  --line:     #eaecef;
  --text:     #1e2530;
  --muted:    #6b7585;
  --dark:     #2b3444;
  --sidebar-w: 240px;
  --sidebar-bg: #1e2530;
  --sidebar-text: #9aa3b0;
  --sidebar-active: #ffffff;
  --accent:   #3b82f6;
  --accent-dk: #2563eb;
  --green:    #22c55e;
  --green-dk: #16a34a;
  --red:      #ef4444;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 2px 8px rgba(0,0,0,.07);
  --radius:   6px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
body { min-width: 1280px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }

/* ── Login ─────────────────────────────────────────────────── */
.login-body { min-width: 0; display: grid; place-items: center; min-height: 100vh; background: #f0f4f8; }
.login-shell { width: 100%; min-height: 100vh; display: grid; place-items: center; }
.login-card { width: 400px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 32px rgba(0,0,0,.10); padding: 36px 40px; }
.login-logo { margin-bottom: 24px; }
.login-logo strong { display: block; font-size: 20px; font-weight: 700; color: var(--dark); }
.login-logo span   { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-top: 2px; }
.horse-mark, .mini-logo { display: none; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 600; }
.login-form { margin-top: 20px; display: grid; gap: 13px; }
.login-note { margin-top: 14px; padding: 10px 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); font-size: 12px; line-height: 1.5; }
.form-error { color: var(--red); margin: 0; font-weight: 600; font-size: 13px; }

/* ── Inputs ─────────────────────────────────────────────────── */
input[type=text], input[type=password], input[type=date], input[type=number], input[type=email],
select, textarea {
  width: 100%; border: 1px solid #d1d5db; border-radius: 5px;
  padding: 8px 10px; background: #fff; color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.admin-form label, .login-form label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; }

/* ── Sidebar ────────────────────────────────────────────────── */
.admin-body { display: flex; }
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--sidebar-bg); z-index: 20;
  display: flex; flex-direction: column;
}
.sidebar-logo {
  height: 56px; display: flex; flex-direction: column; justify-content: center;
  padding: 0 20px; border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-logo strong { font-size: 12px; font-weight: 800; color: #fff; letter-spacing: .06em; text-transform: uppercase; }
.sidebar-logo span   { font-size: 10px; color: rgba(255,255,255,.32); letter-spacing: .08em; text-transform: uppercase; margin-top: 1px; }
.admin-user { display: none; }
.side-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-section { padding: 14px 20px 4px; font-size: 10px; font-weight: 700; color: rgba(255,255,255,.22); text-transform: uppercase; letter-spacing: .1em; }
.nav-item {
  display: block; width: 100%; border: 0; background: transparent;
  padding: 9px 20px; text-align: left; color: var(--sidebar-text);
  cursor: pointer; font-size: 13px; font-weight: 500;
  transition: background .1s, color .1s; text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(59,130,246,.18); color: var(--sidebar-active); font-weight: 600; border-left: 3px solid var(--accent); padding-left: 17px; }
.sidebar-bottom { padding: 10px 16px 14px; border-top: 1px solid rgba(255,255,255,.07); }
.sidebar-date { font-size: 11px; color: rgba(255,255,255,.24); text-align: center; padding: 4px 0; }

/* ── App shell ──────────────────────────────────────────────── */
.app-shell { margin-left: var(--sidebar-w); width: calc(100% - var(--sidebar-w)); min-height: 100vh; }
.topbar {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: #fff; border-bottom: 1px solid var(--border);
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.content { padding: 20px 24px 48px; }

/* ── Page title ─────────────────────────────────────────────── */
.page-title { margin-bottom: 18px; }
.page-title h1 { margin: 0 0 2px; font-size: 20px; font-weight: 700; color: var(--dark); }
.breadcrumb { font-size: 12px; color: var(--muted); }

/* ── Panels ─────────────────────────────────────────────────── */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 14px; font-weight: 700; color: var(--dark); text-transform: uppercase; letter-spacing: .04em; }
.panel h3 { margin: 18px 20px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.panel > p { margin: 10px 20px; font-size: 13px; }
.welcome-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 14px; padding: 16px 20px; font-size: 13px; }
.warning-box { margin: 14px 20px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; padding: 11px 14px; border-radius: var(--radius); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12px; color: var(--muted); }

/* ── Metric cards ───────────────────────────────────────────── */
.cards-grid { display: grid; gap: 12px; margin-bottom: 14px; }
.cards-grid.four { grid-template-columns: repeat(4, 1fr); }
.metric-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.metric-card span { display: block; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.metric-card strong { font-size: 28px; font-weight: 700; color: var(--dark); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  border: 0; border-radius: 5px; padding: 7px 13px;
  font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: filter .1s; white-space: nowrap;
}
.btn:hover { filter: brightness(.9); text-decoration: none; }
.btn-primary   { background: var(--accent);  color: #fff; }
.btn-secondary { background: #e8f0fe;        color: var(--accent-dk); }
.btn-dark      { background: var(--dark);    color: #fff; }
.btn-light     { background: #f3f4f6;        color: var(--text); border: 1px solid var(--border); }
.btn-danger    { background: var(--red);     color: #fff; }
.btn-compact   { padding: 5px 9px; font-size: 12px; }
.btn-icon      { width: 30px; height: 28px; padding: 0; font-size: 14px; }
.btn-trash     { background: #fff; color: var(--red); border: 1px solid #fecaca; }
.btn-trash:hover { background: #fef2f2; filter: none; }
.full { width: 100%; }

/* ── Tables ─────────────────────────────────────────────────── */
.data-table { width: calc(100% - 40px); margin: 16px 20px; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: #f8f9fb; color: var(--muted);
  text-align: left; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 9px 11px; border-bottom: 2px solid var(--border);
}
.data-table td { padding: 10px 11px; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: #fafbfc; }

/* ── Forms ──────────────────────────────────────────────────── */
.admin-form { padding: 18px 20px; }
.form-grid { display: grid; gap: 12px; margin-bottom: 10px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid.four  { grid-template-columns: repeat(4, 1fr); }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }
.compact-actions { margin-top: 6px; }
.master-grid { display: grid; grid-template-columns: repeat(13, 1fr); gap: 6px; margin: 8px 0 16px; }
.master-grid label { font-size: 11px; font-weight: 600; text-align: center; color: var(--muted); }
.master-grid input { text-align: center; padding: 7px 4px; }
.destination-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.destination-card { border: 1px solid var(--border); border-radius: 5px; padding: 11px 13px; background: #fafbfc; display: flex; flex-direction: column; gap: 8px; }
.destination-card-top { display: flex; align-items: center; gap: 10px; }
.destination-card-top > div { flex: 1; min-width: 0; }
.destination-card select { width: 100%; box-sizing: border-box; }
.destination-card strong { display: block; font-size: 13px; }
.destination-card span { font-size: 11px; color: var(--muted); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge { display: inline-flex; border-radius: 3px; padding: 2px 7px; font-size: 11px; font-weight: 700; background: var(--green); color: #fff; }
.badge-draft { background: #9ca3af; }
.site-status-pill { min-width: 74px; display: inline-flex; align-items: center; justify-content: center; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.site-status-active   { background: #dcfce7; color: #166534; }
.site-status-inactive { background: #fee2e2; color: #991b1b; }
.site-status-checking { background: #f3f4f6; color: #4b5563; }
.site-status-info     { background: #e8f0fe; color: #1a56db; }
.site-status-warn     { background: #fffbeb; color: #b45309; }

/* ── Misc ────────────────────────────────────────────────────── */
code { font-family: "Courier New", monospace; font-size: 12px; background: #f3f4f6; padding: 1px 5px; border-radius: 3px; }
.steps { margin: 0; padding: 14px 18px 18px 34px; line-height: 2; font-size: 13px; }
.preview-box { background: #eff8ff; border-left: 3px solid var(--accent); padding: 9px 12px; border-radius: 4px; font-family: "Courier New", monospace; font-size: 12px; white-space: pre-wrap; margin: 3px 0; }
.grid-input { font-family: "Courier New", monospace; }
.grid-row-error td { background: #fff5f5 !important; }
.grid-row-error .grid-input { border-color: var(--red); box-shadow: 0 0 0 2px rgba(239,68,68,.15); }
.grid-error-text { margin-top: 4px; color: #b91c1c; font-size: 11px; font-weight: 600; }
.actions-cell { display: flex; gap: 6px; align-items: center; }
.url-cell a { color: var(--accent); }
.site-status-pill { min-width: 74px; }
