:root {
  --bg-top: #f7f8fa;
  --bg-bottom: #eff2f6;
  --ink: #1b1f26;
  --muted: #5f6972;
  --surface: #ffffff;
  --surface-muted: #f3f5f8;
  --card: #ffffff;
  --accent: #f5c518;
  --accent-dark: #c79205;
  --accent-ink: #241b00;
  --highlight: #ffe29a;
  --warning: #ffb65c;
  --danger: #d6453d;
  --success: #1f9d61;
  --border: #e3e8ee;
  --shadow: 0 18px 36px rgba(17, 24, 39, 0.08);
  --shadow-tight: 0 10px 20px rgba(17, 24, 39, 0.08);
  --radius: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(700px 420px at 12% 0%, rgba(245, 197, 24, 0.12) 0%, transparent 70%),
    radial-gradient(700px 420px at 88% 0%, rgba(160, 180, 208, 0.16) 0%, transparent 70%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  min-height: 100vh;
  line-height: 1.5;
}

h1,
h2,
h3 {
  margin: 0 0 12px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
}

p {
  margin: 0 0 12px;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-tight);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #ffdd66);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 10px 20px rgba(245, 197, 24, 0.35);
}

.brand-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lang-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

select,
input,
textarea {
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
  min-height: 40px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:focus,
input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(245, 197, 24, 0.8);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.18);
}

.status-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.status-pill.published {
  background: rgba(31, 157, 97, 0.12);
  border-color: rgba(31, 157, 97, 0.3);
  color: var(--success);
}

.status-pill.draft {
  background: rgba(255, 182, 92, 0.18);
  border-color: rgba(255, 182, 92, 0.45);
  color: #8a4f12;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  box-shadow: var(--shadow-tight);
}

.btn.tiny {
  padding: 6px 10px;
  font-size: 11px;
}

.nav {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-tight);
}

.nav-item {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  color: var(--muted);
}

.nav-item.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: rgba(245, 197, 24, 0.6);
  box-shadow: 0 12px 20px rgba(245, 197, 24, 0.35);
}

.content {
  display: block;
}

.view {
  display: none;
  animation: fadeIn 0.4s ease;
}

.view.active {
  display: block;
}

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

.card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 20px;
  animation: rise 0.5s ease;
}

.card > h2,
.card > h3,
.card > h4 {
  margin-top: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.card.hero {
  grid-column: span 2;
  background: linear-gradient(135deg, #ffffff 0%, #fff7d8 60%, #fff0b0 100%);
  border-color: rgba(245, 197, 24, 0.3);
}

.hero h1 {
  font-size: 32px;
  margin: 0 0 8px;
}

.hero p {
  margin: 0 0 20px;
  color: var(--muted);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.hero-stats > div {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-tight);
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.stat-value {
  font-size: 18px;
  font-weight: 600;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}

.checklist li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.checklist li:last-child {
  border-bottom: none;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  color: var(--ink);
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: 0 10px 18px rgba(245, 197, 24, 0.35);
}

.btn.ghost {
  border-color: transparent;
  background: var(--surface-muted);
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 18px rgba(17, 24, 39, 0.12);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.shift-status {
  font-size: 14px;
  margin: 12px 0 16px;
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-weight: 700;
}

.shift-live {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}

.shift-live > div,
.shift-meta > div {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.shift-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.shift-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.shift-summary {
  flex: 1 1 260px;
  min-width: 240px;
}

.shift-actions {
  flex: 0 0 240px;
  min-width: 220px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.shift-actions.button-row {
  margin-top: 0;
}

.shift-actions .btn {
  width: 100%;
  justify-content: center;
}

.shift-live strong,
.shift-meta strong {
  font-size: 15px;
  color: var(--ink);
}

.time-grid {
  grid-template-columns: minmax(320px, 1.1fr) minmax(280px, 0.9fr);
  grid-template-areas:
    "shift entries"
    "shift corrections";
  align-items: start;
}

#time-shift-card {
  grid-area: shift;
}

#time-entries-card {
  grid-area: entries;
}

.time-corrections-card {
  grid-area: corrections;
}

.list {
  display: grid;
  gap: 12px;
}

.list-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-tight);
  display: grid;
  gap: 6px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.list-item:hover {
  border-color: rgba(245, 197, 24, 0.4);
  box-shadow: 0 12px 24px rgba(17, 24, 39, 0.1);
}

.item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.item-title {
  font-weight: 700;
}

.item-meta {
  font-size: 12px;
  color: var(--muted);
}

.item-badges {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--muted);
}

.badge.success {
  background: rgba(31, 157, 97, 0.14);
  border-color: rgba(31, 157, 97, 0.35);
  color: var(--success);
}

.badge.warning {
  background: rgba(255, 182, 92, 0.22);
  border-color: rgba(255, 182, 92, 0.45);
  color: #8a4f12;
}

.badge.danger {
  background: rgba(214, 69, 61, 0.14);
  border-color: rgba(214, 69, 61, 0.35);
  color: var(--danger);
}

.list-item.conflict-item {
  border-left: 4px solid var(--warning);
}

.list-item.conflict-item.danger {
  border-left-color: var(--danger);
}

.summary {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-tight);
}

#dashboard-actions-card,
#time-shift-card,
#rota-editor-card,
#rota-tools-card,
.rota-tools-panel {
  border-color: rgba(245, 197, 24, 0.4);
  background: linear-gradient(180deg, rgba(255, 249, 220, 0.7), rgba(255, 255, 255, 0.9));
}

#rota-availability-card,
#rota-timeoff-card,
#rota-conflicts-card {
  border-color: rgba(160, 180, 208, 0.45);
}

#view-admin .form-card {
  border-left: 3px solid rgba(245, 197, 24, 0.45);
}

.filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-row label {
  display: grid;
  gap: 6px;
  min-width: 180px;
  font-size: 12px;
  color: var(--muted);
}

.filter-row label span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  color: var(--muted);
}

.checkbox-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
}

.policy-preview pre {
  white-space: pre-wrap;
  font-size: 12px;
  background: var(--surface);
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  min-height: 220px;
}

.form-card h3 {
  margin-top: 0;
}

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

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.form-grid label span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.missing {
  font-size: 12px;
  color: var(--danger);
}

.reset-card {
  max-width: 440px;
  margin: 40px auto;
  display: grid;
  gap: 12px;
}

.reset-card label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.reset-message {
  font-size: 12px;
}

.reset-message.success {
  color: var(--success);
}

.reset-message.error {
  color: var(--danger);
}

.reset-link {
  font-size: 12px;
  color: var(--accent-dark);
  text-decoration: none;
}

.footer {
  margin-top: 32px;
  font-size: 12px;
  color: var(--muted);
}

.rota-board {
  margin-top: 0;
  overflow-x: auto;
  padding-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-tight);
}

.rota-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(260px, 1fr));
  gap: 14px;
  min-width: 980px;
}

.rota-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  align-items: start;
}

.rota-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.rota-side {
  display: grid;
  gap: 16px;
  align-content: start;
}

.rota-side-card {
  background: var(--surface);
}

.rota-hero {
  display: grid;
  gap: 12px;
}

.rota-toolbar {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.rota-cta {
  margin-top: 4px;
}

.rota-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.rota-week-nav .btn {
  min-width: 96px;
}

.rota-week-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.rota-filters {
  align-items: flex-end;
}

.rota-filters input,
.rota-filters select {
  min-width: 180px;
}

.rota-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rota-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  box-shadow: var(--shadow-tight);
}

.rota-chip strong {
  font-size: 13px;
}

.rota-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 220px;
  display: grid;
  gap: 10px;
  box-shadow: var(--shadow-tight);
}

.rota-day-header {
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rota-day.drag-over {
  outline: 2px dashed var(--accent);
}

.rota-day h4 {
  margin: 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rota-time-scale {
  display: grid;
  gap: 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.rota-time-scale span {
  text-align: center;
}

.rota-timeline {
  display: grid;
  gap: 10px;
}

.rota-lane {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 10px;
  align-items: center;
}

.rota-lane-label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.rota-lane-title {
  font-weight: 600;
  color: var(--ink);
}

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

.rota-lane-actions .btn {
  padding: 4px 8px;
  font-size: 10px;
}

.rota-track {
  position: relative;
  height: 36px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px dashed var(--border);
  overflow: hidden;
}

.rota-track-grid {
  position: absolute;
  inset: 0;
  display: grid;
  pointer-events: none;
}

.rota-track-grid span {
  border-right: 1px dashed rgba(120, 136, 126, 0.35);
}

.rota-track-grid span:last-child {
  border-right: none;
}

.rota-bar {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  padding: 2px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 6px 12px rgba(245, 197, 24, 0.35);
  cursor: pointer;
  font-weight: 600;
}

.rota-bar.unassigned {
  background: #e2e8f0;
  color: #243041;
  box-shadow: 0 6px 12px rgba(148, 163, 184, 0.35);
}

.rota-bar.clipped {
  opacity: 0.85;
}

.rota-bar.editing {
  outline: 2px solid var(--highlight);
}

.rota-bar.warning {
  background: var(--warning);
  color: #2f1d00;
}

.rota-bar.danger {
  background: var(--danger);
  color: #fff;
}

.rota-lane-label .warning-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #7a4a1a;
}

.rota-track.drag-over,
.rota-bar.drag-over {
  outline: 2px dashed var(--accent);
}

.rota-shift {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: grid;
  gap: 6px;
  box-shadow: var(--shadow-tight);
}

.rota-shift.unassigned {
  border-left: 3px solid var(--accent);
  background: #fff8dd;
}

.rota-shift.editing {
  outline: 2px solid var(--highlight);
}

.rota-shift.drag-over {
  outline: 2px dashed var(--accent);
}

.rota-assign {
  font-size: 12px;
  color: var(--muted);
}

.rota-staff-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  cursor: grab;
}

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

#rota-update,
#rota-cancel {
  display: none;
}

.geo-map {
  height: 360px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-tight);
}

.signature-wrap {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 10px;
}

.signature-wrap canvas {
  width: 100%;
  height: 200px;
  display: block;
}

.selfie-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  display: grid;
  place-items: center;
  min-height: 200px;
  box-shadow: var(--shadow-tight);
}

.selfie-preview img {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 10px;
}

.selfie-preview img:not([src]),
.selfie-preview img[src=""] {
  display: none;
}

#invite-link {
  word-break: break-all;
}

select {
  min-height: 40px;
}

.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(13, 17, 23, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.auth-modal.active {
  display: flex;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(13, 17, 23, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 60;
}

.modal.active {
  display: flex;
}

.modal-card {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(460px, 100%);
  display: grid;
  gap: 12px;
}

.auth-card {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
}

.auth-card label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.auth-error {
  color: var(--danger);
  font-size: 12px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@media (max-width: 900px) {
  .card.hero {
    grid-column: span 1;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .nav {
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .time-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "shift"
      "entries"
      "corrections";
  }
  .shift-actions {
    width: 100%;
  }
  .rota-layout {
    grid-template-columns: 1fr;
  }
  .rota-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    min-width: 100%;
  }
  .rota-lane {
    grid-template-columns: 1fr;
  }
  .rota-lane-actions {
    justify-content: flex-start;
  }
}
