:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --ok: #059669;
  --warn: #d97706;
  --error: #dc2626;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: "DM Sans", system-ui, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.85rem 1.5rem; background: #fff; border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 0.75rem;
}
.brand { font-weight: 700; color: var(--text); }
.brand span { color: var(--primary); }
.topbar nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.user-chip { font-size: 0.85rem; color: var(--muted); }

.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #eef2ff, #f8fafc); }
.login-card { background: #fff; padding: 2rem; border-radius: 16px; width: min(420px, 92vw); box-shadow: 0 20px 50px rgba(15,23,42,.08); }
.login-brand h1 { margin: 0 0 0.25rem; }
.login-brand p { margin: 0 0 1.5rem; color: var(--muted); }
.login-note { font-size: 0.8rem; color: var(--muted); margin-top: 1rem; }
.login-note a { font-weight: 600; }

.panel, .card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.25rem; margin-bottom: 1rem;
}
.panel.highlight { border-color: #c7d2fe; background: #fafaff; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.card h3 { margin: 0 0 0.35rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 1rem; }
.kpi span { display: block; color: var(--muted); font-size: 0.8rem; }
.kpi strong { font-size: 1.4rem; }

.form label { display: block; margin-bottom: 0.75rem; font-size: 0.9rem; font-weight: 500; }
.form input, .form select, .form textarea {
  width: 100%; margin-top: 0.25rem; padding: 0.55rem 0.65rem;
  border: 1px solid var(--border); border-radius: 8px; font: inherit;
}
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; align-items: end; }
.inline-form { display: flex; gap: 1rem; flex-wrap: wrap; align-items: end; }

.btn {
  display: inline-block; padding: 0.55rem 1rem; border-radius: 8px; border: none;
  background: #e2e8f0; color: var(--text); font: inherit; cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-block { width: 100%; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.85rem; }
.btn-link { background: none; border: none; color: var(--error); cursor: pointer; padding: 0; }

.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
.data-table th, .data-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.88rem; }
.data-table th { background: #f8fafc; color: var(--muted); font-weight: 600; }
.table-scroll { overflow-x: auto; }
.schedule-grid .shift-cell { text-align: center; min-width: 36px; }
.name-col { min-width: 140px; font-weight: 600; white-space: nowrap; }

.alert { padding: 0.75rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-error { background: #fef2f2; color: var(--error); border: 1px solid #fecaca; }
.status-ok { color: var(--ok); font-weight: 600; }
.status-warn { color: var(--warn); font-weight: 600; }
.muted, .hint { color: var(--muted); font-size: 0.85rem; }
.topbar nav a.active { color: var(--primary); font-weight: 600; border-bottom: 2px solid var(--primary); padding-bottom: 2px; }
.alert-success { background: #ecfdf5; color: var(--ok); border: 1px solid #a7f3d0; }

.schedule-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.month-nav { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.publish-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.schedule-tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.schedule-tabs a {
  padding: 0.55rem 0.85rem; border-radius: 999px; background: #fff; border: 1px solid var(--border); color: var(--text);
}
.schedule-tabs a.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.draft-cell { background: #fffbeb; }
.csv-sample {
  margin-top: 1rem; padding: 0.75rem; background: #f8fafc; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.82rem; overflow-x: auto;
}
.shift-assign-grid .cell-select {
  width: 100%; min-width: 72px; padding: 0.25rem; font-size: 0.75rem; border: 1px solid var(--border); border-radius: 6px;
}

@media (max-width: 768px) {
  .topbar { flex-direction: column; align-items: flex-start; }
}
