:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1c2530;
  --text-muted: #6b7688;
  --border: #e1e5eb;
  --primary: #2f6fed;
  --primary-dark: #244fb0;
  --danger: #c62828;
  --success: #2e7d32;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* topbar */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.topbar nav { display: flex; gap: 16px; flex: 1; flex-wrap: wrap; }
.topbar-user { display: flex; align-items: center; gap: 10px; color: var(--text-muted); }

.link-button {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

/* forms */
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 12px; }
input, select {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
}
button {
  padding: 9px 16px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}
button:hover { background: var(--primary-dark); }
button.secondary { background: var(--border); color: var(--text); }
button.secondary:hover { background: #cfd6e0; }
button.secondary.danger { color: var(--danger); }
button.secondary.danger:hover { background: #f5c6c6; }

.error { color: var(--danger); font-weight: 600; }
.success { color: var(--success); font-weight: 600; }

/* login */
body.login-page {
  min-height: 100vh;
  background: linear-gradient(rgba(20, 24, 30, 0.55), rgba(20, 24, 30, 0.55)), url('/images/login-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}
body.login-page .container { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box {
  max-width: 360px;
  width: 100%;
  margin: 0;
  background: rgba(255, 255, 255, 0.96);
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

/* page header */
.page-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.month-nav { display: flex; align-items: center; gap: 14px; }
.month-nav a { font-size: 1.2rem; padding: 4px 10px; border-radius: 6px; }
.month-nav a:hover { background: var(--border); text-decoration: none; }
.button-link { display: inline-block; padding: 8px 14px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 0.9rem; font-weight: 600; }
.button-link:hover { background: var(--primary-dark); text-decoration: none; }

/* legend */
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; font-size: 0.85rem; color: var(--text-muted); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.summary { margin-bottom: 20px; color: var(--text-muted); }

/* day grid */
.day-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}
.day-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: box-shadow 0.1s ease;
}
.day-card:hover { box-shadow: 0 0 0 2px var(--primary) inset; }
.day-card.weekend { background: #f0f2f5; }
.day-card-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.day-num { font-weight: 700; font-size: 1.1rem; }
.day-weekday { font-size: 0.75rem; color: var(--text-muted); }
.day-card-status {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  padding: 3px 8px;
  border-radius: 999px;
  text-shadow: 0 1px 1px rgba(0,0,0,0.15);
}
.day-card-status.muted { color: var(--text-muted); font-weight: 400; background: none; padding: 0; }

/* modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 380px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* overview table */
.scroll-hint { font-size: 0.82rem; color: var(--text-muted); margin: 0 0 8px; }
.overview-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.overview-table { border-collapse: collapse; width: 100%; font-size: 0.78rem; }
.overview-table th, .overview-table td { border: 1px solid var(--border); padding: 3px 2px; text-align: center; min-width: 26px; }
.overview-table th.weekend, .overview-table td.weekend { background: #f0f2f5; }
.overview-table .weekday-label { color: var(--text-muted); font-weight: 400; font-size: 0.7rem; }
.sticky-col { position: sticky; left: 0; background: var(--surface); text-align: left !important; min-width: 140px !important; padding: 6px 8px !important; z-index: 1; }
.group-row .group-label { font-weight: 700; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.04em; color: var(--text-muted); background: var(--bg); }
.group-row td { background: var(--bg); border-top: 2px solid var(--border); }
.overview-table td.special-shift { background: #ffe08a55; color: #8a6100; font-weight: 600; }
.overview-table .today-col { box-shadow: inset 0 0 0 2px var(--danger); }
.overview-table td.editable-cell { cursor: pointer; }
.overview-table td.editable-cell:hover { outline: 2px solid var(--primary); outline-offset: -2px; }

/* admin users */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; }
.inline-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.inline-form label { margin-bottom: 0; }
.users-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.users-table th, .users-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.users-table tr.inactive-row { opacity: 0.5; }
.actions-cell { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form-small { display: flex; gap: 6px; }
.inline-form-small input { padding: 6px 8px; width: 130px; }
.secondary-link { color: var(--text-muted); font-size: 0.9rem; align-self: center; }
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 0.9rem; }

/* home */
.today-date { font-weight: 600; color: var(--text-muted); }
.shift-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.shift-card h2 { margin-top: 0; }
.shift-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.shift-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--border); }
.shift-list li:last-child { border-bottom: none; }
.tag { font-size: 0.8rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.shift-list .note { font-size: 0.8rem; color: var(--text-muted); }
.senior-card { border: 2px solid #8e24aa; background: #8e24aa0d; }
.senior-item .senior-tag { background: #8e24aa22; color: #8e24aa; }
.tag.senior-tag { background: #8e24aa22; color: #8e24aa; margin-left: 6px; }
.tag.conflict-tag { background: #c6282822; color: var(--danger); margin-left: 6px; }
.muted { color: var(--text-muted); }
.home-link { margin-top: 20px; }

@media (max-width: 600px) {
  .topbar-inner { flex-direction: column; align-items: flex-start; }
}
