:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d7dee8;
  --surface: #ffffff;
  --page: #f6f3ee;
  --accent: #0f766e;
  --accent-strong: #0b5d57;
  --accent-soft: #fff1df;
  --warm: #f59e0b;
  --ok: #16865a;
  --warn: #b7791f;
  --bad: #b83232;
  --shadow: 0 18px 42px rgba(31, 41, 51, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(245, 158, 11, 0.1)),
    var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.account-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-bar span {
  color: var(--muted);
  font-weight: 700;
}

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

.compact {
  min-height: 38px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.55rem, 4vw, 2.2rem);
}

h2 {
  font-size: 1.25rem;
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mode-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.mode-button.is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.mode-button.availability-open {
  background: #e5f6ee;
  color: var(--ok);
  font-weight: 800;
}

.mode-button.availability-open.is-active {
  background: var(--ok);
  color: #fff;
}

.mode-button.availability-warning {
  background: #fff4d6;
  color: var(--warn);
  font-weight: 800;
}

.mode-button.availability-warning.is-active {
  background: var(--warn);
  color: #fff;
}

.mode-button.availability-danger {
  background: #fbe9e9;
  color: var(--bad);
  font-weight: 800;
  animation: deadlinePulse 1.4s ease-in-out infinite;
}

.mode-button.availability-danger.is-active {
  background: var(--bad);
  color: #fff;
}

.mode-button.has-market-alert {
  background: #fbe9e9;
  color: var(--bad);
  font-weight: 900;
  animation: marketPulse 1.1s ease-in-out infinite;
}

.mode-button.has-market-alert.is-active {
  background: var(--bad);
  color: #fff;
}

.mode-button.availability-closed,
.mode-button:disabled {
  background: #e5e7eb;
  color: #8a94a6;
  cursor: not-allowed;
  opacity: 1;
}

@keyframes deadlinePulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(184, 50, 50, 0.2);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(184, 50, 50, 0.16);
  }
}

@keyframes marketPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(184, 50, 50, 0.22);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(184, 50, 50, 0.18);
  }
}

.notice,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.notice {
  margin-bottom: 18px;
  padding: 12px 14px;
  color: var(--muted);
  line-height: 1.45;
}

.notice strong {
  color: var(--ink);
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.form-panel {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.home-panel {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.home-action {
  display: grid;
  min-height: 112px;
  align-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.home-action:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.home-action strong {
  font-size: 1.05rem;
}

.home-action span {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
}

.home-action.is-alert {
  border-color: #f1b7b7;
  background: #fff6f6;
}

.home-action.is-alert strong {
  color: var(--bad);
}

.home-action.is-muted {
  background: #f3f4f6;
}

.login-panel {
  width: min(520px, 100%);
  margin: 0 auto 18px;
  padding: 20px;
}

.panel-heading {
  margin-bottom: 18px;
}

form {
  display: grid;
  gap: 14px;
}

label,
fieldset {
  display: grid;
  gap: 7px;
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
}

fieldset {
  border: 0;
  padding: 0;
}

legend {
  margin-bottom: 7px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.calendar-section {
  position: relative;
  display: grid;
  gap: 10px;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
}

.calendar-toolbar strong {
  text-align: center;
  font-size: 1.05rem;
}

.icon-button {
  width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-strong);
  font-size: 1.35rem;
  font-weight: 700;
  cursor: pointer;
}

.weekdays,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekdays span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.day-cell {
  position: relative;
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.day-cell.is-empty {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.5);
  cursor: default;
}

.day-cell.is-selected {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.08);
}

.day-number {
  display: block;
  font-weight: 700;
}

.day-shift {
  display: inline-flex;
  margin-top: 12px;
  border-radius: 999px;
  padding: 4px 7px;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}

.hours-counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
}

.hours-counter span {
  color: var(--muted);
  font-weight: 700;
}

.hours-counter strong {
  color: var(--accent-strong);
  font-size: 1.05rem;
}

.shift-popover {
  position: absolute;
  z-index: 5;
  width: min(230px, calc(100vw - 34px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(31, 41, 51, 0.18);
}

.shift-popover p {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 700;
}

#shift-options {
  display: grid;
  gap: 6px;
}

.shift-option,
#clear-day {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.shift-option:hover,
.shift-option.is-active {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.08);
}

#clear-day {
  width: 100%;
  margin-top: 8px;
  color: var(--bad);
}

.primary-action,
.secondary-action,
.danger-action {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
}

.primary-action {
  background: var(--accent);
  color: #fff;
}

.primary-action:hover,
.mode-button.is-active:hover {
  background: var(--accent-strong);
}

.secondary-action {
  background: #e7f3f1;
  color: var(--accent-strong);
}

.danger-action {
  background: #fbe9e9;
  color: var(--bad);
}

.success-message {
  min-height: 22px;
  margin: 0;
  color: var(--ok);
  font-weight: 700;
}

.lock-message {
  min-height: 22px;
  margin: 0;
  color: var(--warn);
  font-weight: 700;
}

.admin-settings {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.add-user-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

body.is-locked .day-cell:not(.is-empty),
body.is-locked .primary-action {
  opacity: 0.58;
}

.dashboard {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
}

.filters,
.table-panel {
  padding: 18px;
}

.filters {
  align-self: start;
  display: grid;
  gap: 14px;
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.compact-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.stat strong {
  display: block;
  margin-top: 2px;
  font-size: 1.25rem;
}

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

#dispatch-view .table-wrap {
  display: none;
}

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

.dispatch-day-card {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.dispatch-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  background: #f8fafc;
  font-weight: 700;
}

.dispatch-day-head span {
  color: var(--muted);
  font-size: 0.78rem;
}

.dispatch-day-body {
  display: grid;
  gap: 6px;
  padding: 9px;
}

.dispatch-entry {
  border-radius: 8px;
  padding: 7px 8px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
}

.dispatch-entry strong {
  font-weight: 800;
}

.dispatch-empty {
  color: var(--muted);
  font-size: 0.84rem;
}

table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
}

.schedule-panel {
  position: relative;
  padding: 18px;
}

.reports-panel,
.market-panel,
.months-panel,
.mydays-panel {
  padding: 18px;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.market-want-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(140px, 180px) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.market-grid h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.market-list {
  display: grid;
  gap: 10px;
}

.market-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.market-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.market-card p {
  margin: 0;
  color: var(--muted);
}

.market-card.is-taken {
  border-color: #b7dfca;
  background: #f1fbf6;
}

.market-card.is-stale {
  border-color: #f1c2c2;
  background: #fff6f6;
}

.mydays-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.myday-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.myday-card.is-near {
  border-color: #f3c56f;
  background: #fff9ea;
}

.myday-date {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.myday-date strong {
  font-size: 1.6rem;
}

.myday-date span,
.myday-shift span {
  color: var(--muted);
  font-weight: 800;
}

.myday-shift {
  display: flex;
  align-items: center;
  gap: 10px;
}

.myday-shift strong {
  font-size: 1.15rem;
}

.myday-actions {
  display: flex;
  justify-content: flex-end;
}

.market-note,
.empty-inline {
  color: var(--muted);
  font-weight: 700;
}

.month-control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.month-library {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.month-card {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.month-card > div:first-child > strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.month-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.month-stats {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.schedule-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.schedule-head label {
  width: min(220px, 100%);
}

.report-actions {
  align-items: end;
}

.report-actions label {
  width: min(220px, 100%);
}

.report-output {
  display: grid;
  gap: 18px;
}

.reports-panel .compact-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.report-picker {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.report-picker:empty {
  display: none;
}

.report-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.report-picker-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.report-check {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8fafc;
  font-size: 0.92rem;
}

.report-check input {
  width: 18px;
  min-height: 18px;
}

.report-check span {
  font-weight: 700;
}

.attendance-report {
  width: min(520px, 100%);
  margin: 0 auto;
  border: 1px solid #111827;
  padding: 18px;
  background: #fff;
  color: #111827;
}

.report-sheet-head {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: start;
  margin-bottom: 18px;
}

.report-sheet-head h3 {
  margin: 0;
  text-align: center;
  font-size: 1.05rem;
}

.report-month-label {
  display: grid;
  justify-items: end;
  gap: 6px;
  font-size: 1.1rem;
  font-weight: 700;
}

.report-month-label span {
  font-size: 0.82rem;
  font-weight: 700;
}

.attendance-table {
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  background: #fff;
}

.attendance-table th,
.attendance-table td {
  height: 20px;
  border: 1px solid #111827;
  padding: 2px 5px;
  color: #111827;
  font-size: 0.75rem;
  line-height: 1.05;
  text-align: left;
  text-transform: none;
}

.attendance-table thead th {
  font-weight: 700;
}

.attendance-table .report-empty-head {
  width: 52px;
}

.attendance-table .employee-head {
  height: 24px;
  vertical-align: top;
}

.attendance-table .employee-name {
  height: 74px;
  font-size: 1rem;
  font-weight: 700;
  vertical-align: top;
}

.attendance-table .report-day {
  width: 42px;
  text-align: center;
  vertical-align: middle;
}

.attendance-table .report-kind {
  width: 56px;
  font-weight: 700;
}

.attendance-table .report-time {
  width: 86px;
  text-align: center;
  font-weight: 700;
}

.attendance-table .report-signature {
  min-width: 80px;
}

.attendance-table .report-total {
  height: 48px;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  vertical-align: middle;
}

.attendance-table .is-outside-month td {
  background: #f3f4f6;
  color: #9ca3af;
}

.attendance-report.is-report-hidden {
  display: none;
}

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

.schedule-editor {
  display: grid;
  position: absolute;
  z-index: 12;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(31, 41, 51, 0.18);
}

.schedule-editor p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.schedule-editor input {
  min-height: 38px;
}

.schedule-assistant {
  display: grid;
  position: absolute;
  z-index: 11;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(31, 41, 51, 0.18);
}

.schedule-assistant h3 {
  margin: 0;
  font-size: 1.05rem;
}

.assistant-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.assistant-driver {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--ok);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.assistant-driver.is-balanced {
  border-left-color: var(--warn);
}

.assistant-driver.is-heavy {
  border-left-color: var(--bad);
}

.assistant-driver.is-used {
  opacity: 0.45;
  filter: grayscale(0.4);
}

.assistant-driver strong,
.assistant-driver span {
  display: block;
}

.assistant-driver span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.schedule-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  background: #fff;
  table-layout: fixed;
}

.weekly-schedule-table + .weekly-schedule-table {
  margin-top: 18px;
}

.schedule-table th,
.schedule-table td {
  width: 46px;
  min-width: 46px;
  height: 31px;
  border: 1px solid #111827;
  padding: 3px;
  text-align: center;
  vertical-align: middle;
  font-size: 0.86rem;
}

.schedule-table .week-title,
.schedule-table .month-title {
  min-width: 118px;
  font-weight: 700;
}

.schedule-table .week-title {
  font-size: 0.86rem;
}

.schedule-table .month-title {
  font-size: 0.82rem;
}

.schedule-table .shift-label {
  min-width: 82px;
  font-size: 1.05rem;
  font-weight: 700;
}

.schedule-table .day-head {
  font-weight: 700;
}

.schedule-table .weekend {
  background: #f3f4f6;
}

.schedule-table .spacer-row td {
  height: 7px;
  padding: 0;
  border-left-color: transparent;
  border-right-color: transparent;
  background: #fff;
}

.schedule-table .driver-cell {
  font-weight: 700;
}

.schedule-table .my-schedule-slot {
  background: #fff4a8 !important;
  box-shadow: inset 0 0 0 3px #b7791f;
  color: #111827;
  font-size: 1rem;
}

.schedule-table .market-offer-slot:not(.my-schedule-slot) {
  background: #fbe9e9;
  box-shadow: inset 0 0 0 2px #b83232;
  color: #7f1d1d;
}

.schedule-table .my-schedule-slot.market-offer-slot {
  background: #fbe9e9 !important;
  box-shadow: inset 0 0 0 3px #b83232;
  color: #7f1d1d;
}

.offer-shift-button {
  display: block;
  width: 100%;
  min-height: 20px;
  margin-top: 2px;
  border: 0;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 700;
}

.offer-shift-label {
  display: block;
  margin-top: 2px;
  border-radius: 5px;
  padding: 2px 3px;
  background: #b83232;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}

.schedule-table .toggleable-slot {
  cursor: pointer;
}

.schedule-table .toggleable-slot:hover {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.schedule-table .disabled-slot {
  background: #9ca3af !important;
  color: transparent;
  cursor: pointer;
}

.schedule-table .disabled-slot::after {
  color: #374151;
  content: "wyl.";
  font-size: 0.72rem;
  font-weight: 700;
}

.schedule-table .empty-cell {
  color: transparent;
}

.schedule-table .blank-schedule-cell {
  background: repeating-linear-gradient(
    -45deg,
    #eef1f4 0,
    #eef1f4 6px,
    #e1e5ea 6px,
    #e1e5ea 12px
  );
  color: transparent;
  cursor: default;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.person {
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef2f6;
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.badge.ok {
  background: #e5f6ee;
  color: var(--ok);
}

.badge.warn {
  background: #fff4d6;
  color: var(--warn);
}

.badge.bad {
  background: #fbe9e9;
  color: var(--bad);
}

.pin-code {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 8px;
  padding: 0 10px;
  background: #fff4d6;
  color: var(--warn);
  font-weight: 700;
}

.name-edit {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.name-edit input {
  min-height: 38px;
}

.icon-danger {
  display: inline-flex;
  width: 38px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: #fbe9e9;
  color: var(--bad);
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 700;
}

.icon-danger:hover {
  background: #f7d1d1;
}

.empty-state {
  display: none;
  margin: 18px 0 0;
  color: var(--muted);
}

.empty-state.is-visible {
  display: block;
}

@media (max-width: 800px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .mode-switch,
  .dashboard,
  .market-grid,
  .market-want-form,
  .home-actions,
  .summary-row,
  .month-control-grid,
  .month-card {
    grid-template-columns: 1fr;
  }

  .mode-switch {
    width: 100%;
  }

  .form-panel,
  .filters,
  .table-panel {
    padding: 16px;
  }

  table {
    min-width: 840px;
  }

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

  .hours-counter {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .weekdays,
  .month-grid {
    gap: 4px;
  }

  .day-cell {
    min-height: 58px;
    padding: 5px;
  }

  .day-shift {
    margin-top: 6px;
    padding: 3px 5px;
    font-size: 0.68rem;
  }

  .schedule-head {
    align-items: stretch;
    flex-direction: column;
  }

  .schedule-head label {
    width: 100%;
  }

  .schedule-editor {
    position: static;
    grid-template-columns: 1fr;
    width: auto !important;
    box-shadow: none;
  }

  .schedule-assistant {
    position: static;
    width: auto !important;
    transform: none;
    box-shadow: none;
  }

  .actions-row,
  .add-user-form {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .myday-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .myday-actions {
    justify-content: stretch;
  }

  .myday-actions .compact {
    width: 100%;
  }

  .name-edit {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    margin: 10mm;
    size: A4 portrait;
  }

  body {
    background: #fff;
  }

  .topbar,
  .notice,
  .reports-panel > .schedule-head,
  .reports-panel > .summary-row,
  .reports-panel > .report-picker,
  .reports-panel > .empty-state,
  .view:not(#reports-view) {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  #reports-view,
  #reports-view.is-visible {
    display: block !important;
  }

  .reports-panel {
    border: 0;
    padding: 0;
    box-shadow: none;
  }

  .report-output {
    display: block;
  }

  .attendance-report {
    width: 105mm;
    min-height: 277mm;
    margin: 0 auto;
    border: 0;
    padding: 0;
    break-after: page;
    page-break-after: always;
  }

  .attendance-report:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .attendance-report.is-report-hidden {
    display: none !important;
  }

  .attendance-table th,
  .attendance-table td {
    height: 17px;
    padding: 1px 4px;
    font-size: 9px;
  }

  .attendance-table .employee-name {
    height: 60px;
    font-size: 12px;
  }

  .attendance-table .report-total {
    height: 38px;
    font-size: 18px;
  }
}
