:root {
  --bg: #edf2f7;
  --panel: #ffffff;
  --ink: #172336;
  --muted: #5b6b80;
  --primary: #8b5cf6;
  --teal: #0d9488;
  --critical: #dc2626;
  --border: #d6e0ef;
  --shadow: 0 10px 30px rgba(23, 35, 54, 0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(139, 92, 246, 0.16), transparent 20%),
    radial-gradient(circle at 92% 10%, rgba(13, 148, 136, 0.12), transparent 24%),
    var(--bg);
}

h1, h2, h3, strong { font-family: "Space Grotesk", sans-serif; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
}

.topbar h1 { margin: 0; }
.topbar p { margin: 0.2rem 0 0; color: var(--muted); }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
}

.tabs a {
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  transition: all 150ms ease;
}

.tabs a[href="index.html"]::before { content: "[D] "; }
.tabs a[href="calendar.html"]::before { content: "[C] "; }
.tabs a[href="tasks.html"]::before { content: "[T] "; }
.tabs a[href="notes.html"]::before { content: "[N] "; }
.tabs a[href="shifts.html"]::before { content: "[S] "; }
.tabs a[href="settings.html"]::before { content: "[G] "; }

.tabs a:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.focus-bar {
  margin: 0 1rem;
  border: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.12), rgba(13,148,136,0.08));
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.55rem 0.75rem;
}

.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  grid-column: span 12;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.card.full { grid-column: span 12; }

@media (min-width: 1000px) {
  .layout .card { grid-column: span 6; }
  .layout .card.full { grid-column: span 12; }
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.65rem;
}

.summary-grid article {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem;
  background: #fff;
}

.summary-grid strong { font-size: 1.2rem; display: block; }
.summary-grid small { color: var(--muted); }

.dashboard-left-stack {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.9rem;
}

.dashboard-subsection h3 {
  margin: 0 0 0.5rem;
}

.day-calendar {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.6rem;
  background: #f6f7fb;
}

.dash-cal-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.dash-cal-controls button {
  background: var(--primary);
  border-radius: 12px;
}

.dash-cal-wrap {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 0.4rem;
}

.dash-time-col {
  display: grid;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.dash-time-col div {
  min-height: 23px;
  padding: 0 0.35rem;
  border-bottom: 1px solid #edf2f7;
  color: #475569;
  font-size: 0.85rem;
}

.dash-time-spacer {
  padding: 0;
}

.dash-time-head {
  min-height: 34px;
}

.dash-time-untimed {
  min-height: 23px;
}

.dash-day-col {
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.dash-day-head {
  background: linear-gradient(90deg, #a855f7, #8b5cf6);
  color: #fff;
  text-align: center;
  padding: 0.45rem;
  font-weight: 700;
}

.dash-day-body { display: grid; }
.dash-slot {
  min-height: 23px;
  padding: 0.1rem 0.25rem;
  border-bottom: 1px solid #edf2f7;
  display: flex;
  gap: 0.2rem;
  align-items: center;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 0.14rem 0.45rem;
  margin-right: 0.2rem;
  background: #dbeafe;
}

.tag.shift { background: #ccfbf1; }
.tag.low { background: #dcfce7; }
.tag.medium { background: #fef9c3; }
.tag.high { background: #fed7aa; }
.tag.critical { background: #fee2e2; }
.tag.done {
  background: #dcfce7;
  color: #166534;
  text-decoration: line-through;
}

.mini-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
}

.mini-day-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  padding: 0.4rem;
  display: grid;
}
.mini-day-title {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.list { display: grid; gap: 0.55rem; }

.item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem;
  background: #fff;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.item.done {
  opacity: 1;
  border-color: #86efac;
  background: #f0fdf4;
}
.item.done label,
.item.done strong,
.item.done small {
  color: #166534;
  text-decoration: line-through;
}
.item small { display: block; color: var(--muted); }

.form-grid, .inline-grid { display: grid; gap: 0.55rem; }
.inline-grid { grid-template-columns: 1fr auto; }

.inline-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

input, select, textarea, button {
  font: inherit;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 10px;
}

textarea { min-height: 90px; resize: vertical; }

button {
  background: #2563eb;
  color: #fff;
  border: none;
  cursor: pointer;
}

button:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

.badge { display: inline-block; border-radius: 999px; padding: 0.15rem 0.5rem; font-size: 0.75rem; font-weight: 700; }
.badge.Low { background: #dcfce7; color: #166534; }
.badge.Medium { background: #fef3c7; color: #92400e; }
.badge.High { background: #fed7aa; color: #9a3412; }
.badge.Critical { background: #fecaca; color: #991b1b; }
.badge.gray { background: #e2e8f0; color: #334155; }

.stack-actions { display: grid; gap: 0.35rem; align-content: start; }
.section-head { display: flex; justify-content: space-between; gap: 0.6rem; align-items: center; }

.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.4rem; }
.cal-head { font-weight: 700; text-align: center; color: var(--muted); }
.cal-cell {
  min-height: 90px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  display: grid;
}
.cal-cell.empty { background: #f8fafc; }
.urgent-dot { color: var(--critical); font-weight: 700; }
.cal-task-list {
  margin: 0.2rem 0 0;
  padding-left: 1rem;
  font-size: 0.68rem;
  line-height: 1.2;
}
.cal-task-list li {
  margin: 0;
}
.cal-task-list li.done {
  color: #166534;
  text-decoration: line-through;
}
.cal-cell.today {
  border: 2px solid #0f766e;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.2);
}
.cal-cell.today strong { color: #0f766e; }
.cal-cell.has-task-low {
  border-color: #15803d;
  background: #f0fdf4;
}
.cal-cell.has-task-low strong,
.cal-cell.has-task-low small,
.cal-cell.has-task-low .cal-task-list {
  color: #166534;
  font-weight: 700;
}
.cal-cell.has-task-medium {
  border-color: #ca8a04;
  background: #fefce8;
}
.cal-cell.has-task-medium strong,
.cal-cell.has-task-medium small,
.cal-cell.has-task-medium .cal-task-list {
  color: #854d0e;
  font-weight: 700;
}
.cal-cell.has-task-high {
  border-color: #ea580c;
  background: #fff7ed;
}
.cal-cell.has-task-high strong,
.cal-cell.has-task-high small,
.cal-cell.has-task-high .cal-task-list {
  color: #9a3412;
  font-weight: 700;
}
.cal-cell.has-task-critical {
  border-color: #b91c1c;
  background: #fff1f2;
}
.cal-cell.has-task-critical strong,
.cal-cell.has-task-critical small,
.cal-cell.has-task-critical .cal-task-list {
  color: #b91c1c;
  font-weight: 700;
}

.notes-board {
  min-height: 62vh;
  border: 1px dashed #b8c8e3;
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #f8fbff, #eef5ff);
}

.notes-controls { display: flex; gap: 0.45rem; margin-bottom: 0.6rem; }

.sticky-note {
  position: absolute;
  border: 1px solid #d8c57a;
  border-radius: 10px;
  box-shadow: 0 12px 26px rgba(98, 87, 40, 0.2);
  display: grid;
  grid-template-rows: 40px 1fr;
  resize: both;
  overflow: hidden;
  z-index: 6;
}

.sticky-note header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem;
  border-bottom: 1px solid rgba(0,0,0,0.12);
  cursor: grab;
  min-height: 40px;
}

.sticky-note .content { padding: 0.45rem; white-space: pre-wrap; overflow: auto; }

.screen-notes-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 70;
}

.screen-notes-layer .sticky-note { pointer-events: auto; }

.quick-add-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 1.6rem;
  z-index: 80;
  background: linear-gradient(160deg, #2563eb, #8b5cf6);
}

.quick-add-menu {
  position: fixed;
  right: 20px;
  bottom: 78px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 80;
  display: grid;
}

.quick-add-menu a { padding: 0.5rem 0.7rem; text-decoration: none; color: var(--ink); }
.quick-add-menu a:hover { background: #f1f5f9; }

.hidden { display: none !important; }

.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 12px; }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { border: 1px solid var(--border); padding: 0.45rem; text-align: left; }
.shift-table th, .shift-table td { border-color: rgba(15, 23, 42, 0.2); }
.shift-table { border-color: rgba(15, 23, 42, 0.2); }

.shift-table tbody tr:nth-child(even) th { background: #f8fafc; }
.shift-table tbody td:nth-child(2n) { background: #f4f8ff; }
.shift-table tbody td:nth-child(2n+1) { background: #eefaf4; }
.shift-role-row.has-role-color th,
.shift-role-row.has-role-color td { background: var(--role-row-soft) !important; }

.shift-table select { min-width: 120px; }
.shift-table thead th {
  vertical-align: top;
  min-width: 190px;
}
.shift-day-title strong {
  display: block;
}
.shift-day-title small {
  color: var(--muted);
}
.shift-day-meta {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.shift-holiday-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
  margin-top: 0.8rem;
}
.shift-holiday-day {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem;
  background: #fff;
  display: grid;
  gap: 0.45rem;
}
.shift-holiday-head {
  display: grid;
  gap: 0.15rem;
}
.shift-day-controls {
  align-items: stretch;
}
.shift-day-controls select {
  min-width: 0;
  width: 100%;
}
.shift-day-controls button {
  white-space: nowrap;
}
.shift-day-chips {
  min-height: 1.8rem;
}
.shift-role-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  position: relative;
}
.shift-role-name-hotspot {
  border: none;
  background: transparent;
  color: inherit;
  border-radius: 0;
  padding: 0.15rem 0.35rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-block;
}
.shift-role-lock-all {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-size: 0.76rem;
  white-space: nowrap;
}
.shift-role-palette {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 20;
  width: 172px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 0.45rem;
  display: none;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
}
.shift-role-palette.open {
  display: grid;
}
.shift-role-swatch {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  border: 2px solid rgba(15, 23, 42, 0.08);
  padding: 0;
  background: var(--swatch);
}
.shift-role-swatch.active {
  border-color: #0f172a;
  box-shadow: 0 0 0 2px #fff inset;
}
.shift-role-clear {
  grid-column: 1 / -1;
  padding: 0.3rem 0.45rem;
  border-radius: 8px;
  font-size: 0.78rem;
  background: #e2e8f0;
  color: #0f172a;
}
.shift-lock {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.shift-lock input {
  width: auto;
  height: auto;
  padding: 0;
}
.shift-preview-value {
  display: inline-block;
  min-height: 1.5rem;
  font-weight: 600;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chip { background: #dbeafe; color: #1e3a8a; border: none; border-radius: 999px; padding: 0.2rem 0.55rem; }
.chip.on { background: #93c5fd; }

.hint { color: var(--muted); }
.dual { display: grid; gap: 0.75rem; }
@media (min-width: 900px) { .dual { grid-template-columns: 1fr 1fr; } }

body.dark {
  --bg: #0b1220;
  --panel: #131c2f;
  --ink: #f8fafc;
  --muted: #c7d2e3;
  --border: #475569;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

body.dark .topbar {
  background: rgba(15, 23, 42, 0.88);
}

body.dark .tabs a,
body.dark .summary-grid article,
body.dark .day-calendar,
body.dark .dash-time-col,
body.dark .dash-day-col,
body.dark .mini-day-card,
body.dark .item,
body.dark .cal-cell,
body.dark .quick-add-menu,
body.dark table,
body.dark input,
body.dark select,
body.dark textarea {
  background: #0f172a;
  color: #f8fafc;
  border-color: #475569;
}

body.dark .cal-cell.empty,
body.dark .notes-board {
  background: #111b31;
}

body.dark .shift-holiday-day {
  background: #0f172a;
  border-color: #475569;
}
body.dark .shift-role-palette {
  background: #0f172a;
  border-color: #475569;
}
body.dark .shift-role-swatch.active {
  border-color: #e2e8f0;
  box-shadow: 0 0 0 2px #0f172a inset;
}
body.dark .shift-role-clear {
  background: #1e293b;
  color: #f8fafc;
}

body.dark .dash-time-col div,
body.dark .dash-slot,
body.dark .quick-add-menu a:hover {
  border-color: #334155;
}

body.dark .dash-time-col div,
body.dark .hint,
body.dark small {
  color: #dbe7ff;
}


