/* =========================================================
   Citas DGT — Autoescuela Tajo
   Paleta corporativa alineada con cronograma.tajoformacion.es
   ========================================================= */

* { box-sizing: border-box; }
:root {
  --primary: #1e3a8a;          /* azul corporativo Tajo */
  --primary-dark: #1e40af;
  --accent: #3b82f6;
  --accent-light: #eff6ff;
  --yellow: #fbbf24;           /* amarillo señal del logo */
  --wa: #25d366;
  --wa-dark: #128c7e;
  --bg: #f8fafc;
  --bg-hover: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --muted: #94a3b8;
  --danger: #ef4444;
  --warn: #f59e0b;
  --ok: #10b981;
  --tipoT: #2563eb;
  --tipoD: #7c3aed;
  --tipoC: #db2777;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
}

html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

/* ==================== TOP NAV ==================== */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px;
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
  height: 60px;
  box-shadow: var(--shadow-sm);
}
.brand a { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text-primary); }
.brand .logo-img { height: 36px; }
.brand .app-name { font-weight: 700; color: var(--primary); font-size: 16px; letter-spacing: 0.3px; }
.brand .sub { color: var(--muted); font-size: 12px; }

nav { display: flex; align-items: center; gap: 4px; }
nav a {
  color: var(--text-secondary); text-decoration: none; font-weight: 500;
  padding: 7px 13px; border-radius: 6px; font-size: 13px;
  transition: background 0.15s, color 0.15s;
}
nav a:hover { background: var(--bg-hover); color: var(--text-primary); }

.user-chip {
  margin-left: 10px; padding: 6px 12px;
  background: var(--accent-light); border-radius: 16px;
  font-size: 12px; color: var(--primary); font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.user-chip .icon-link { text-decoration: none; opacity: 0.7; }
.user-chip .icon-link:hover { opacity: 1; }

main { max-width: 1280px; margin: 0 auto; padding: 24px; }
footer {
  text-align: center; color: var(--muted); padding: 24px; font-size: 12px;
  border-top: 1px solid var(--border); margin-top: 40px;
}

h2 { margin: 0 0 16px; color: var(--text-primary); font-size: 22px; }
h3 { margin-top: 28px; color: var(--text-primary); font-size: 16px; }
code {
  background: var(--bg-hover); padding: 2px 6px; border-radius: 4px;
  font-size: 12px; color: var(--primary); font-family: Consolas, Monaco, monospace;
}

/* ==================== FLASH ==================== */
.flash-wrap { max-width: 1280px; margin: 12px auto 0; padding: 0 24px; }
.flash {
  padding: 11px 16px; border-radius: var(--radius); margin-bottom: 6px;
  font-size: 13px; border: 1px solid transparent;
}
.flash.ok { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.flash.error { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

/* ==================== HERO + STATS ==================== */
.hero {
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 60%, #3b82f6 100%);
  color: white; padding: 28px 32px; border-radius: 12px; margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}
.stats { display: flex; gap: 32px; }
.stat { display: flex; flex-direction: column; }
.stat .val { font-size: 30px; font-weight: 700; line-height: 1; }
.stat .lbl { font-size: 11px; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.6px; margin-top: 4px; }
.stat.small .val { font-size: 22px; color: var(--primary); }
.stat.small .lbl { color: var(--muted); }
.row { display: flex; gap: 24px; margin-bottom: 16px; flex-wrap: wrap; }

.cta { display: flex; gap: 10px; }

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 6px; border: 0;
  cursor: pointer; font-weight: 600; text-decoration: none; font-size: 13px;
  background: #e5e7eb; color: var(--text-primary);
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: #d1d5db; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: white; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
main .btn.ghost { color: var(--primary); border-color: var(--primary); background: white; }
.hero .btn.ghost { color: white; border: 1px solid rgba(255,255,255,0.7); }
.hero .btn.ghost:hover { background: rgba(255,255,255,0.1); }
.btn.wa { background: var(--wa); color: white; }
.btn.wa:hover { background: var(--wa-dark); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==================== CARD + FORM ==================== */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
}
.form input[type=file] { display: block; margin: 12px 0; }
.form input[type=text], .form input[type=email], .form input[type=password], .form select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px;
  width: 100%; box-sizing: border-box; font-family: inherit;
}
.form input[type=text]:focus, .form input[type=password]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ==================== TABLE ==================== */
.tbl {
  width: 100%; border-collapse: collapse; background: white;
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.tbl th, .tbl td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 13px; }
.tbl th { background: var(--bg-hover); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); font-weight: 600; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover { background: var(--bg-hover); }

/* ==================== TAGS / BADGES ==================== */
.tag {
  display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 11px;
  background: #e5e7eb; color: var(--text-secondary); font-weight: 600; letter-spacing: 0.3px;
}
.tag.tipo-T { background: #dbeafe; color: var(--tipoT); }
.tag.tipo-D { background: #ede9fe; color: var(--tipoD); }
.tag.tipo-C { background: #fce7f3; color: var(--tipoC); }
.tag.mov { background: #d1fae5; color: var(--ok); }
.tag.fijo { background: #fef3c7; color: var(--warn); }

.warn { color: var(--warn); font-size: 11px; margin-left: 6px; font-weight: 600; }
.ok { color: var(--ok); font-size: 11px; margin-left: 6px; font-weight: 600; }
.muted { color: var(--muted); }

.bar { background: #e2e8f0; height: 6px; border-radius: 4px; overflow: hidden; width: 120px; display: inline-block; }
.bar span { display: block; height: 100%; background: var(--primary); transition: width 0.3s; }

.empty {
  background: white; padding: 36px; border-radius: var(--radius);
  text-align: center; color: var(--muted); border: 1px dashed var(--border);
}

/* ==================== CITACION VIEW ==================== */
.header-cita { margin-bottom: 18px; }
.header-cita .meta { color: var(--muted); margin-top: -8px; font-size: 12px; }
.row-alumno.enviado { background: #f0fdf4; }
.row-alumno.sin-tel { background: #fffbeb; }
.tel-cell select, .tel-manual { width: 100%; padding: 5px 7px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; }
.msg-cell { min-width: 340px; }
.msg-area {
  width: 100%; padding: 8px; font-family: inherit; font-size: 12px;
  border: 1px solid var(--border); border-radius: 4px; resize: vertical;
}
.msg-area:focus { outline: 1px solid var(--accent); }

.lnk { background: none; border: 0; color: var(--primary); cursor: pointer; text-decoration: underline; padding: 0; font-size: 13px; font-family: inherit; }
.lnk.danger { color: var(--danger); }

/* ==================== FILTERS ==================== */
.filters { display: flex; gap: 10px; margin-bottom: 18px; align-items: center; flex-wrap: wrap; }
.filters input, .filters select {
  padding: 7px 11px; border: 1px solid var(--border); border-radius: 5px; font-size: 13px; font-family: inherit;
}
.filters .count { color: var(--muted); margin-left: auto; font-size: 13px; }

/* ==================== ESTADO ==================== */
.estado {
  padding: 3px 9px; border-radius: 4px; font-size: 10px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
}
.estado.enviado { background: #d1fae5; color: var(--ok); }
.estado.pendiente { background: #fef3c7; color: var(--warn); }
.estado.cancelado, .estado.no_enviado { background: #fee2e2; color: var(--danger); }

/* ==================== DIALOG ==================== */
dialog {
  border: 0; border-radius: 12px; padding: 24px; max-width: 560px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}
dialog::backdrop { background: rgba(0,0,0,0.4); }
dialog h3 { margin-top: 0; color: var(--primary); }
dialog pre { white-space: pre-wrap; background: var(--bg); padding: 14px; border-radius: 6px; font-family: inherit; font-size: 13px; line-height: 1.6; }
.dlg-actions { margin-top: 16px; display: flex; gap: 8px; justify-content: flex-end; }

#dlg-masivo { max-width: 640px; width: 90%; }
#dlg-masivo h3 small { color: var(--muted); font-weight: normal; font-size: 13px; margin-left: 6px; }
#dlg-body > div { margin: 8px 0; font-size: 13px; }
#dlg-masivo textarea { width: 100%; margin-top: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; font-size: 13px; }
#dlg-masivo select, #dlg-masivo input[type=text] { padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-family: inherit; }

/* ==================== TELS ==================== */
ul.tels { list-style: none; padding: 0; }
ul.tels li { padding: 8px 0; border-bottom: 1px solid var(--border); }
ul.tels li:last-child { border-bottom: 0; }
ul.tels li code { font-size: 14px; margin-right: 8px; }

/* ==================== AUTH ==================== */
.auth-body {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 60%, #1e40af 100%);
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  margin: 0; padding: 20px;
}
.auth-card {
  background: white; padding: 40px 44px; border-radius: 12px;
  width: 380px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);
}
.auth-card .logo-block { text-align: center; margin-bottom: 24px; }
.auth-card .logo-block img { height: 56px; }
.auth-card h1 {
  margin: 16px 0 4px; color: var(--primary); font-size: 20px;
  text-align: center; font-weight: 700; letter-spacing: 0.4px;
}
.auth-card .subtitle {
  margin: 0 0 24px; font-size: 12px; color: var(--muted); text-align: center;
  text-transform: uppercase; letter-spacing: 1px;
}
.auth-card label { display: block; margin-top: 14px; font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.auth-card input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; box-sizing: border-box; margin-top: 4px; font-family: inherit;
}
.auth-card input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.auth-card button { width: 100%; margin-top: 20px; padding: 12px; font-size: 14px; }
.auth-card .flash { margin-bottom: 14px; }

/* ==================== CONFIG ==================== */
.full { width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; font-size: 13px; }
.mono { font-family: Consolas, Monaco, monospace; font-size: 12px; }
.card label { display: block; margin-top: 12px; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
