:root {
  --ink: #112129;
  --paper: #f4f6f8;
  --surface: #ffffff;
  --line: #d4dbe1;
  --brand: #0f8b8d;
  --accent: #ef6f6c;
  --gold: #f2b134;
  --ok: #2a9d8f;
  --warn: #e76f51;
  --focus: #0d3b66;
  --shadow: 0 18px 30px rgba(17, 33, 41, 0.14);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 15%, rgba(15, 139, 141, 0.15), transparent 36%),
    radial-gradient(circle at 90% 10%, rgba(239, 111, 108, 0.16), transparent 34%),
    linear-gradient(135deg, #f8fbfd 0%, #f1f3f5 100%);
  min-height: 100vh;
}

.app-shell {
  width: min(1200px, 94vw);
  margin: 28px auto;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(460px, 96vw);
}

.auth-card h1 {
  margin-top: 0;
}

.auth-help-row {
  margin-top: 8px;
  display: flex;
  justify-content: center;
}

.auth-help-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #cfd8df;
  background: #f8fafc;
  color: #5a6e7c;
  font-size: 0.9rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.auth-help-btn:hover {
  background: #eef4f8;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

h1,
h2,
h3,
h4 {
  font-family: "Franklin Gothic Medium", "Avenir Next", "Trebuchet MS", sans-serif;
  letter-spacing: 0.02em;
}

h1 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
}

.eyebrow {
  margin: 0 0 6px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--brand);
  font-size: 0.72rem;
}

.topbar-meta {
  display: flex;
  gap: 8px;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.8rem;
  background: var(--surface);
}

.badge-warn {
  border-color: var(--gold);
  background: #fff7dd;
}

.tabs {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab,
.btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 700;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tab.active,
.btn.active {
  background: var(--focus);
  color: white;
  border-color: var(--focus);
}

.btn-primary {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}

.tab:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus), white 40%);
  outline-offset: 2px;
}

main {
  margin-top: 16px;
}

.view {
  display: none;
  animation: reveal 380ms ease;
}

.view.active {
  display: block;
}

.info-strip {
  border: 1px solid #d8e6e8;
  background: #edf8f8;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 16px;
}

.demo-banner {
  margin: 12px 0 0;
  border: 1px solid #f0c36d;
  background: #fff3db;
  border-radius: 12px;
  padding: 10px 12px;
  color: #6f4d00;
  font-weight: 700;
}

.cards {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 14px;
}

.metric {
  animation: up 460ms ease both;
}

.metric-value {
  font-size: 2rem;
  margin: 8px 0 0;
  font-weight: 800;
}

.metric-value.danger {
  color: var(--warn);
}

.muted {
  opacity: 0.72;
}

.timeline {
  margin-top: 14px;
}

.timeline ol {
  margin: 8px 0 0 22px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.field-label {
  font-size: 0.9rem;
  font-weight: 700;
}

.hidden {
  display: none;
}

input,
select {
  width: 100%;
  margin-top: 6px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #e9edf1;
  white-space: nowrap;
}

th {
  font-size: 0.88rem;
  color: #37505e;
}

.pill {
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.78rem;
  font-weight: 700;
}

.pill.ok {
  background: #e5f7f3;
  color: #0d6a5d;
}

.pill.paused {
  background: #f5f0e6;
  color: #8a6630;
}

.pill.error {
  background: #fae7e4;
  color: #8f2f20;
}

.inline-message {
  margin: 0 0 12px;
  border-radius: 10px;
  padding: 9px 11px;
  border: 1px solid #cfe2f5;
  background: #edf6ff;
}

.inline-message.error {
  border-color: #efc2bc;
  background: #fff0ee;
  color: #7d2014;
}

.table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-small {
  font-size: 0.78rem;
  padding: 5px 9px;
}

.btn-danger {
  border-color: #e9b5ac;
  background: #fff3f0;
  color: #8f2f20;
}

.form-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  margin: 8px 0 10px;
}

.form-grid label {
  display: block;
}

.form-grid input {
  margin-bottom: 0;
}

.form-grid input[type="color"] {
  height: 42px;
  padding: 4px;
}

.swatch-inline {
  width: 28px;
  height: 14px;
  border-radius: 999px;
  display: inline-block;
  border: 1px solid #b8c4cf;
}

.calendar-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
}

.roster ul {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.roster li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.roster-select {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--line);
  background: #f8fbfd;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
}

.roster-select.active {
  border-color: var(--focus);
  background: #eaf2ff;
  color: var(--focus);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot-a,
.swatch-a {
  background: #0f8b8d;
}

.dot-b,
.swatch-b {
  background: #ef6f6c;
}

.dot-c,
.swatch-c {
  background: #f2b134;
}

.dot-d {
  background: #0d3b66;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(140px, 1fr));
  gap: 8px;
}

.day {
  min-height: 130px;
  border: 1px dashed #ccd8e0;
  border-radius: 10px;
  padding: 8px;
  background: linear-gradient(180deg, #fff 0%, #fafcfd 100%);
}

.day.outside {
  background: #f6f8fa;
  opacity: 0.72;
}

.day h4 {
  margin: 0 0 8px;
}

.shift {
  margin: 0 0 7px;
  padding: 5px 7px;
  border-radius: 7px;
  font-size: 0.83rem;
}

.morning {
  background: #e0f6f6;
}

.evening {
  background: #ffe8e8;
}

.night {
  background: #fff3d9;
}

.conflict {
  background: #ffd8d1;
  color: #7d2014;
  font-weight: 700;
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.day-label {
  margin: 0;
  font-size: 0.95rem;
}

.day-date {
  margin: 0;
  font-size: 0.72rem;
  opacity: 0.7;
}

.schedule-empty {
  margin: 8px 0 0;
  opacity: 0.65;
  font-size: 0.82rem;
}

.schedule-add {
  margin-top: 8px;
  width: 100%;
}

.schedule-month-separator {
  grid-column: 1 / -1;
  border: 1px solid #d7e1ea;
  border-radius: 8px;
  padding: 7px 9px;
  background: #eef3f7;
  font-size: 0.84rem;
  font-weight: 700;
}

.shift-entry {
  margin: 0 0 7px;
  border-radius: 8px;
  padding: 7px;
  background: #f3f8fb;
  border-left: 5px solid #0f8b8d;
}

.shift-entry.conflict {
  background: #ffe8e2;
  border-left-color: #c3371f;
}

.shift-entry.vacation {
  background: #fff7df;
  border-left-color: #cf8c00;
}

.shift-entry-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.shift-entry-meta {
  margin: 3px 0 6px;
  font-size: 0.77rem;
  opacity: 0.82;
}

.shift-entry-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.schedule-readonly .schedule-action-control,
.schedule-readonly .shift-entry-actions,
.schedule-readonly .schedule-add,
.schedule-readonly .day button[data-action="addVacation"] {
  display: none !important;
}

.employee-calendar-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.workload-calendar-shell {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: stretch;
}

.nav-arrow {
  min-width: 44px;
  padding: 0 12px;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.month-calendar-grid {
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  gap: 8px;
}

.month-day {
  border: 1px solid #dbe3ea;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  min-height: 128px;
}

.month-day.outside {
  background: #f6f8fa;
  opacity: 0.6;
}

.month-day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.month-day-name {
  font-size: 0.72rem;
  opacity: 0.75;
}

.month-day-num {
  font-weight: 700;
  font-size: 0.86rem;
}

.month-item {
  margin: 0 0 5px;
  font-size: 0.73rem;
  border-radius: 6px;
  padding: 4px 5px;
  background: #eef5fb;
  border-left: 4px solid #0f8b8d;
}

.month-item.vacation {
  background: #fff7df;
  border-left-color: #cf8c00;
}

.month-empty {
  font-size: 0.74rem;
  opacity: 0.58;
}

.load-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.75rem;
  font-weight: 700;
}

.load-badge.low {
  background: #e8f6ed;
  color: #1e6f44;
}

.load-badge.medium {
  background: #fff3d9;
  color: #8a6200;
}

.load-badge.high {
  background: #fde8e3;
  color: #8f2f20;
}

.load-bar {
  width: 100%;
  max-width: 150px;
  height: 8px;
  border-radius: 999px;
  background: #e8edf2;
  overflow: hidden;
  margin-top: 6px;
}

.load-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0f8b8d, #ef6f6c);
}

.upload-zone {
  border-style: dashed;
  background: #fcfcff;
}

code {
  display: inline-block;
  margin-top: 5px;
  border: 1px solid #dce4ec;
  background: #f3f7fb;
  border-radius: 6px;
  padding: 4px 6px;
}

.shift-type {
  position: relative;
}

.swatch {
  width: 44px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.print-sheet {
  margin-top: 12px;
  border: 1px solid #d5dee7;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  overflow-x: auto;
}

#printWeekStart {
  min-width: 160px;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.print-table th,
.print-table td {
  border: 1px solid #c7d3de;
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
}

.print-table th {
  background: #eef3f7;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.print-status-conflict {
  color: #8f2f20;
  font-weight: 700;
}

.print-status-vacation {
  color: #8a5f00;
  font-weight: 700;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  width: min(420px, 90vw);
}

dialog::backdrop {
  background: rgba(12, 23, 31, 0.56);
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .calendar-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 640px) {
  .tab,
  .btn {
    width: 100%;
    text-align: center;
  }

  .calendar-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .workload-calendar-shell .btn {
    width: auto;
  }

  .workload-calendar-shell {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .tabs,
  .section-head,
  #mockModal {
    display: none !important;
  }

  .view {
    display: none !important;
  }

  #print.view {
    display: block !important;
  }

  .card {
    box-shadow: none;
    border-color: #bbb;
  }

  .print-table {
    font-size: 10pt;
  }
}
