:root {
  --brand: #1a3a5c;
  --brand-dark: #122943;
  --accent: #ff6b35;
  --accent-dark: #e35a26;
  --ok: #1c8c5e;
  --warn: #b8860b;
  --bad: #c9433d;
  --info: #2f6fed;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --border: #e2e6ec;
  --text: #1e2530;
  --text-muted: #6b7684;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 30, 50, 0.08), 0 4px 16px rgba(20, 30, 50, 0.06);
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--info); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 20%, #24507c, var(--brand-dark) 60%);
}
.login-card {
  background: var(--panel);
  border-radius: 16px;
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand h1 { margin: 12px 0 4px; font-size: 26px; color: var(--brand); }
.login-brand p { margin: 0; color: var(--text-muted); font-size: 14px; }
.brand-logo {
  width: 56px; height: 56px; margin: 0 auto;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px; letter-spacing: 0.5px;
}
.brand-logo.small { width: 36px; height: 36px; font-size: 14px; border-radius: 10px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.login-form input {
  padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; color: var(--text);
}
.login-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,107,53,0.15); }
.form-error { background: #fdecea; color: var(--bad); padding: 10px 12px; border-radius: 8px; font-size: 13px; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 9px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
  transition: all .15s ease;
}
.btn:hover { border-color: #c9d2de; background: #f8fafc; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-ok-ghost { color: var(--ok); border-color: #bfe4d3; background: #f0faf5; }
.btn-danger-ghost { color: var(--bad); border-color: #f3c7c4; background: #fdf3f2; }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; background: var(--brand-dark); color: #fff; display: flex; flex-direction: column;
  flex-shrink: 0; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 700; font-size: 17px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: rgba(255,255,255,0.78); font-size: 14px; font-weight: 500; position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-icon { width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700;
  padding: 1px 6px; border-radius: 20px;
}
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,0.1); display: flex; flex-direction: column; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: 13.5px; font-weight: 600; }
.user-role { font-size: 12px; color: rgba(255,255,255,0.6); }
.sidebar-footer .btn-ghost { color: #fff; border-color: rgba(255,255,255,0.25); }
.sidebar-footer .btn-ghost:hover { background: rgba(255,255,255,0.08); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 24px;
  background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-size: 19px; font-weight: 700; color: var(--brand); }
.topbar-right { margin-left: auto; }
.bell { position: relative; font-size: 18px; }
.bell-dot { position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; background: var(--bad); border-radius: 50%; }
.hamburger { display: none; background: none; border: none; font-size: 22px; color: var(--brand); }
.view-container { padding: 24px; flex: 1; }
.sidebar-overlay { display: none; }

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-card {
  background: var(--panel); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  border-left: 4px solid var(--info);
}
.kpi-card.kpi-warn { border-left-color: var(--warn); }
.kpi-label { font-size: 12.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.kpi-value { font-size: 28px; font-weight: 800; color: var(--brand); margin: 6px 0 2px; }
.kpi-sub { font-size: 12.5px; color: var(--text-muted); }

/* ---------- Panels / tables ---------- */
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 16px; }
.panel-narrow { max-width: 560px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.panel-header h3 { margin: 0; font-size: 15.5px; color: var(--brand); }
.panel-body { padding: 16px 18px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; padding: 9px 10px; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.3px; }
.table td { padding: 10px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
.table tfoot td { border-top: 2px solid var(--border); border-bottom: none; font-weight: 700; padding-top: 12px; }
.table tbody tr:hover { background: #fafbfd; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.link-strong { color: var(--text); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.link-strong:hover { color: var(--info); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge-ok { background: #e5f6ee; color: var(--ok); }
.badge-warn { background: #fdf3e0; color: var(--warn); }
.badge-bad { background: #fdecea; color: var(--bad); }
.badge-info { background: #e8f0fe; color: var(--info); }
.badge-neutral { background: #eef0f3; color: #5b6472; }

/* ---------- Text helpers ---------- */
.text-muted { color: var(--text-muted); font-size: 12.5px; }
.text-ok { color: var(--ok); font-weight: 600; }
.text-warn { color: var(--warn); font-weight: 600; }
.text-bad { color: var(--bad); font-weight: 600; }

/* ---------- Toolbar / forms ---------- */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; background: #fff; }
.toolbar .btn-primary { margin-left: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.form-grid input, .form-grid select, .form-grid textarea {
  padding: 10px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; color: var(--text); font-weight: 400;
}
.form-grid textarea { min-height: 70px; resize: vertical; font-family: inherit; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.hours-preview { background: #f1f5fa; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--brand); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 25, 40, 0.5); display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 70px rgba(0,0,0,0.3); }
.modal-wide { max-width: 640px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; color: var(--brand); font-size: 17px; }
.modal-close { background: none; border: none; font-size: 18px; color: var(--text-muted); }
.modal-body { padding: 20px; }

/* ---------- Toast ---------- */
.toast-holder { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: var(--brand-dark); color: #fff; padding: 11px 16px; border-radius: 8px; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25); opacity: 0; transform: translateY(8px); transition: all .25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-bad { background: var(--bad); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-icon { font-size: 34px; margin-bottom: 10px; }

/* ---------- Avatars ---------- */
.avatar { width: 36px; height: 36px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.avatar-sm { width: 26px; height: 26px; font-size: 12px; }
.avatar-lg { width: 64px; height: 64px; font-size: 24px; }

/* ---------- Profile ---------- */
.profile-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.profile-header h2 { margin: 0 0 4px; color: var(--brand); display: flex; align-items: center; gap: 10px; font-size: 21px; }
.def-list { display: grid; grid-template-columns: 160px 1fr; gap: 8px 12px; margin: 0; font-size: 14px; }
.def-list dt { color: var(--text-muted); font-weight: 600; }
.def-list dd { margin: 0; }
.back-link { display: inline-block; margin-bottom: 14px; font-size: 13.5px; font-weight: 600; }

/* ---------- List clean ---------- */
.list-clean { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.list-clean li { display: flex; justify-content: space-between; align-items: center; padding: 9px 4px; border-bottom: 1px solid #f0f2f5; font-size: 13.5px; }
.list-clean li:last-child { border-bottom: none; }

/* ---------- Notifications ---------- */
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-list li { display: flex; gap: 12px; padding: 12px 6px; border-bottom: 1px solid #f0f2f5; font-size: 13.5px; align-items: flex-start; }
.notif-list li.unread { background: #f7faff; border-radius: 8px; }
.notif-list li:last-child { border-bottom: none; }
.notif-icon { font-size: 17px; }

/* ---------- Schedule ---------- */
.schedule-grid-wrap { overflow-x: auto; }
.schedule-table th, .schedule-table td { text-align: center; }
.schedule-table td:first-child, .schedule-table th:first-child { text-align: left; }
.shift-chip { background: #e8f0fe; color: var(--info); padding: 4px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .grid-2col { grid-template-columns: 1fr; }
  .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: block; }
  .sidebar-overlay.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 40; }
  .form-grid { grid-template-columns: 1fr; }
  .view-container { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .kpi-grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .kpi-grid, .kpi-grid-4 { grid-template-columns: 1fr; }
  .toolbar .btn-primary { margin-left: 0; }
  .login-card { padding: 26px 20px; }
}
