:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e2e5ea;
  --text: #1c2230;
  --text-muted: #6b7280;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eaf0fe;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

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

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

.sidebar {
  width: 220px;
  background: #12172b;
  color: #e6e9f2;
  padding: 20px 14px;
  flex-shrink: 0;
}
.sidebar .brand { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.sidebar .brand-sub { font-size: 12px; color: #8f97ad; margin-bottom: 24px; }
.sidebar nav a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: #cdd3e3;
  margin-bottom: 2px;
  font-weight: 500;
}
.sidebar nav a:hover { background: #1d2440; text-decoration: none; }
.sidebar nav a.active { background: var(--accent); color: white; }
.sidebar .user-box {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid #262c47;
  font-size: 12px;
  color: #9aa2ba;
}
.sidebar .user-box strong { color: #e6e9f2; display: block; font-size: 13px; }
.sidebar button.logout {
  margin-top: 10px;
  background: none;
  border: 1px solid #333a5c;
  color: #cdd3e3;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
  width: 100%;
}
.sidebar button.logout:hover { background: #1d2440; }

.main { flex: 1; padding: 28px 32px; max-width: 1200px; }
.main h1 { margin: 0 0 4px; font-size: 22px; }
.page-sub { color: var(--text-muted); margin: 0 0 22px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.stat-row { display: flex; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.stat-tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-width: 160px;
  flex: 1;
}
.stat-tile .stat-value { font-size: 26px; font-weight: 700; }
.stat-tile .stat-label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: #fafbfc; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-programado { background: var(--accent-soft); color: var(--accent-dark); }
.badge-en_curso { background: #fff4e0; color: var(--warning); }
.badge-completado { background: #e5f7ea; color: var(--success); }
.badge-cancelado { background: #fde8e8; color: var(--danger); }

.btn {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: var(--panel); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: #f0f1f4; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

input, select, textarea {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.field.span-2 { grid-column: span 2; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 18, 30, .45);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px;
  overflow-y: auto; z-index: 50;
}
.modal { background: white; border-radius: var(--radius); padding: 24px; width: 100%; max-width: 640px; }
.modal h2 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.hidden { display: none !important; }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alert-error { background: #fde8e8; color: var(--danger); }
.alert-info { background: var(--accent-soft); color: var(--accent-dark); }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tabs button {
  background: none; border: none; padding: 10px 16px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent;
}
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

.bols-list { display: flex; gap: 6px; flex-wrap: wrap; }
.bol-tag { background: #eef0f4; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-family: monospace; }

.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg);
}
.login-card { background: white; padding: 36px; border-radius: 14px; width: 100%; max-width: 380px; border: 1px solid var(--border); }
.login-card h1 { margin: 0 0 4px; }
.login-card p { color: var(--text-muted); margin-top: 0; margin-bottom: 22px; }
.login-card .field { margin-bottom: 14px; }
.login-card button { width: 100%; padding: 10px; margin-top: 6px; }
.demo-hint { margin-top: 18px; font-size: 12px; color: var(--text-muted); background: #f7f8fa; padding: 10px 12px; border-radius: 8px; }
