:root {
  --bg: #f5efe5;
  --surface: #fffdf9;
  --surface-strong: #f0e6d6;
  --line: #dccfb9;
  --text: #1c2e31;
  --muted: #66777a;
  --primary: #1f6d67;
  --primary-strong: #164f4b;
  --accent: #c97d45;
  --success: #2f7c49;
  --danger: #b04f3a;
  --warning: #9d6a00;
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 20px 40px rgba(28, 46, 49, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(201, 125, 69, 0.14), transparent 20%),
    linear-gradient(180deg, #f8f3eb 0%, #efe6d8 100%);
}

button,
input,
select,
textarea {
  font: inherit;
  font-size: 16px;
}

button {
  cursor: pointer;
}

.shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2rem);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  position: relative;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(31, 109, 103, 0.12);
  color: var(--primary-strong);
  font-size: 0.88rem;
  font-weight: 700;
}

.status-badge.warning {
  background: rgba(157, 106, 0, 0.14);
  color: var(--warning);
}

.status-badge.error {
  background: rgba(176, 79, 58, 0.12);
  color: var(--danger);
}

.nav-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.nav-bar.admin-nav {
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 8px;
}

.nav-bar.worker-nav {
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 8px;
}

.nav-bar button {
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--text);
  font-weight: 700;
}

.nav-bar button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.nav-bar.admin-nav button {
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 14px;
  font-size: 0.86rem;
  font-weight: 700;
}

.nav-bar.worker-nav button {
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 14px;
  font-size: 0.84rem;
  font-weight: 700;
}

.app-view {
  display: grid;
  gap: 14px;
}

.card,
.hero-card,
.list-card {
  background: var(--surface);
  border: 1px solid rgba(28, 46, 49, 0.06);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.card,
.list-card {
  padding: 18px;
}

.hero-card {
  padding: 20px;
  background: linear-gradient(140deg, #1f6d67 0%, #154246 100%);
  color: #fffdf8;
}

.hero-card p {
  margin: 8px 0 0;
  color: rgba(255, 253, 248, 0.8);
}

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

.section-head h2,
.section-head h3,
.section-head h4,
.card h2,
.card h3,
.card h4 {
  margin: 0;
}

.subtitle,
.meta,
.helper,
.empty-state,
.hint {
  color: var(--muted);
}

.empty-state {
  padding: 16px;
  border-radius: 16px;
  background: var(--surface-strong);
}

.schedule-head {
  display: grid;
  gap: 10px;
}

.schedule-inline-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.range-switch.compact {
  gap: 6px;
}

.range-switch.compact button,
.compact-button {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 12px;
  font-size: 0.84rem;
}

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

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

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

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

.row.between {
  justify-content: space-between;
}

.row.end {
  justify-content: flex-end;
}

.chips,
.tag-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
}

.user-chip {
  background: rgba(31, 109, 103, 0.12);
  color: var(--primary-strong);
}

.tag.success {
  background: rgba(47, 124, 73, 0.12);
  color: var(--success);
}

.tag.warning {
  background: rgba(157, 106, 0, 0.12);
  color: var(--warning);
}

.tag.danger {
  background: rgba(176, 79, 58, 0.12);
  color: var(--danger);
}

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

.list-item {
  padding: 14px;
  border: 1px solid rgba(28, 46, 49, 0.08);
  border-radius: 16px;
  background: #fff;
}

.list-item.resolved {
  background: #f4fbf5;
}

.metric {
  padding: 14px;
  border-radius: 18px;
  background: var(--surface-strong);
}

.metric strong {
  display: block;
  font-size: 1.45rem;
  margin-top: 4px;
}

.login-screen {
  min-height: 70vh;
  display: grid;
  place-items: center;
}

.login-card {
  width: min(100%, 440px);
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.login-card h2 {
  margin: 0 0 8px;
}

.login-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.pin-input {
  width: 100%;
  height: 58px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: center;
  font-size: 1.7rem;
  letter-spacing: 8px;
}

.field,
.field-group {
  display: grid;
  gap: 8px;
}

.field label,
.field-group label {
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
}

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

.primary-button,
.secondary-button,
.danger-button,
.ghost-button {
  min-height: 48px;
  padding: 11px 16px;
  border-radius: 14px;
  border: 0;
  font-weight: 700;
}

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

.secondary-button {
  background: var(--surface-strong);
  color: var(--text);
}

.danger-button {
  background: rgba(176, 79, 58, 0.12);
  color: var(--danger);
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

.hidden {
  display: none !important;
}

.menu-wrap {
  position: relative;
}

.icon-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
}

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: 220px;
  padding: 8px;
  border: 1px solid rgba(28, 46, 49, 0.08);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: grid;
  gap: 6px;
}

.menu-panel button {
  min-height: 42px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 700;
}

.menu-panel button.active {
  background: var(--surface-strong);
}

.split-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.schedule-strip {
  display: grid;
  gap: 10px;
}

.hours-entry-card {
  display: inline-grid;
  grid-template-columns: 44px minmax(70px, auto) 44px 48px;
  gap: 8px;
  align-items: center;
}

.hours-entry-card.compact {
  grid-template-columns: 44px minmax(90px, auto) 44px 52px;
}

.hours-step,
.hours-confirm,
.icon-only {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.hours-confirm {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.hours-value {
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 14px;
  background: var(--surface-strong);
  font-weight: 700;
}

.material-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 10px;
  align-items: center;
}

.reminder-card {
  border-color: rgba(157, 106, 0, 0.2);
  background: linear-gradient(180deg, rgba(255, 247, 230, 0.9), var(--surface));
}

.schedule-toolbar {
  display: grid;
  gap: 10px;
}

.filter-grid {
  display: grid;
  gap: 10px;
}

.arrow-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
}

.range-switch {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.range-switch button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.range-switch button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.date-cluster {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toggle-chip {
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  text-align: left;
}

.toggle-chip.active {
  background: rgba(31, 109, 103, 0.12);
  border-color: rgba(31, 109, 103, 0.24);
  color: var(--primary-strong);
}

.month-mode-switch {
  margin-top: 4px;
}

.schedule-group {
  display: grid;
  gap: 10px;
}

.today-grid-card {
  display: grid;
  gap: 12px;
}

.today-grid-columns {
  display: grid;
  gap: 10px;
}

.today-location-column {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: var(--surface-strong);
}

.today-location-header {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(31, 109, 103, 0.12);
  color: var(--primary-strong);
  font-weight: 700;
  text-align: center;
}

.today-shift-block {
  padding: 10px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(28, 46, 49, 0.08);
  display: grid;
  gap: 8px;
}

.today-shift-head {
  display: grid;
  gap: 2px;
}

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

.today-grid-table {
  display: grid;
  grid-template-columns: minmax(110px, 0.9fr) repeat(3, minmax(160px, 1fr));
  overflow-x: auto;
  border: 1px solid rgba(28, 46, 49, 0.08);
  border-radius: 18px;
}

.today-grid-cell {
  min-height: 74px;
  padding: 12px;
  border-right: 1px solid rgba(28, 46, 49, 0.08);
  border-bottom: 1px solid rgba(28, 46, 49, 0.08);
  background: #fff;
  display: grid;
  align-content: center;
  gap: 6px;
}

.today-grid-header,
.today-grid-corner {
  background: var(--surface-strong);
  font-weight: 700;
}

.today-grid-shift {
  background: rgba(31, 109, 103, 0.08);
}

.today-grid-shift span {
  color: var(--muted);
  font-size: 0.82rem;
}

.today-grid-entry {
  align-content: flex-start;
}

.schedule-status-strip,
.change-log {
  display: grid;
  gap: 8px;
}

.schedule-status-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface-strong);
}

.schedule-worker-tag,
.status-picker-button {
  border: 0;
}

.schedule-worker-tag {
  cursor: pointer;
  text-align: left;
}

.status-picker-button {
  min-height: 34px;
}

.quick-action-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(28, 46, 49, 0.08);
  background: rgba(255, 255, 255, 0.82);
}

.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.assignment-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(28, 46, 49, 0.08);
  background: rgba(255, 255, 255, 0.76);
}

.compact-grid .metric {
  padding: 12px;
}

.worker-summary-card {
  width: 100%;
  border: 1px solid rgba(28, 46, 49, 0.08);
  text-align: left;
}

.worker-summary-card.selected {
  border-color: rgba(31, 109, 103, 0.3);
  background: rgba(31, 109, 103, 0.08);
}

.schedule-location-list {
  display: grid;
  gap: 8px;
}

.schedule-worker-list,
.summary-list {
  display: grid;
  gap: 8px;
}

.schedule-line {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-strong);
}

.schedule-line-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(31, 109, 103, 0.12);
  color: var(--primary-strong);
  font-size: 0.84rem;
  font-weight: 700;
}

.status-tag.success {
  background: rgba(47, 124, 73, 0.12);
  color: var(--success);
}

.status-tag.warning {
  background: rgba(157, 106, 0, 0.12);
  color: var(--warning);
}

.status-tag.danger {
  background: rgba(176, 79, 58, 0.12);
  color: var(--danger);
}

.status-tag.info {
  background: rgba(31, 109, 103, 0.12);
  color: var(--primary-strong);
}

.compact-tags .tag {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 0.78rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-strong);
}

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

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

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

.calendar-spacer {
  min-height: 1px;
}

.calendar-cell {
  min-height: 150px;
  border-radius: 18px;
  background: var(--surface-strong);
  border: 1px solid rgba(28, 46, 49, 0.08);
}

.calendar-cell.today {
  background: linear-gradient(135deg, rgba(31, 109, 103, 0.16), rgba(201, 125, 69, 0.14));
}

.calendar-cell.ghost {
  opacity: 0.24;
}

.calendar-cell-button {
  width: 100%;
  height: 100%;
  min-height: 150px;
  padding: 12px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.calendar-cell-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.calendar-cell-head strong {
  font-size: 1rem;
}

.calendar-cell-head span,
.calendar-cell-meta,
.calendar-cell-status {
  font-size: 0.78rem;
  color: var(--muted);
}

.calendar-cell-status {
  margin-top: 6px;
  font-weight: 700;
}

.calendar-cell.empty .calendar-cell-button {
  justify-content: flex-start;
}

.user-grid {
  display: grid;
  gap: 12px;
}

.user-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 120px 110px 110px;
  align-items: end;
}

.field-note {
  font-size: 0.86rem;
  color: var(--warning);
}

.schedule-day {
  padding: 14px;
  border-radius: 16px;
  background: var(--surface-strong);
}

.schedule-day.today {
  background: linear-gradient(135deg, rgba(31, 109, 103, 0.14), rgba(201, 125, 69, 0.16));
}

.schedule-day h4 {
  margin: 0 0 6px;
}

.checklist {
  display: grid;
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-strong);
}

.check-item input {
  width: auto;
  min-height: 0;
}

.image-preview {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(28, 46, 49, 0.08);
  object-fit: cover;
}

@media (max-width: 720px) {
  .schedule-inline-controls {
    align-items: stretch;
  }

  .schedule-inline-controls .date-cluster,
  .schedule-inline-controls .range-switch,
  .schedule-inline-controls .compact-button {
    width: 100%;
    justify-content: center;
  }
}

.table {
  display: grid;
  gap: 10px;
}

.table-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(28, 46, 49, 0.08);
}

.request-status.pending {
  color: var(--warning);
}

.request-status.approved {
  color: var(--success);
}

.request-status.rejected {
  color: var(--danger);
}

.inline-note {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(157, 106, 0, 0.08);
  color: var(--warning);
}

@media (max-width: 640px) {
  .shell {
    padding: 14px 12px 32px;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-status {
    justify-content: stretch;
  }

  .header-status > * {
    flex: 1 1 auto;
  }

  .grid.two,
  .grid.three,
  .split-actions {
    grid-template-columns: 1fr;
  }

  .nav-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-row {
    grid-template-columns: 1fr;
  }

  .summary-row,
  .schedule-line-status {
    align-items: flex-start;
    flex-direction: column;
  }

  .hours-entry-card,
  .hours-entry-card.compact {
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .material-line {
    grid-template-columns: 1fr 44px;
  }

  .today-grid-table {
    grid-template-columns: minmax(96px, 0.9fr) repeat(3, minmax(128px, 1fr));
    font-size: 0.92rem;
  }

  .today-grid-cell {
    min-height: 68px;
    padding: 10px;
  }

  .today-grid-columns {
    gap: 6px;
  }

  .today-location-column {
    padding: 8px;
    gap: 8px;
  }

  .today-location-header,
  .today-shift-block {
    padding: 8px;
  }

  .today-location-header {
    font-size: 0.82rem;
  }

  .today-shift-head strong,
  .today-shift-head span,
  .today-shift-block .tag,
  .today-shift-block .meta {
    font-size: 0.74rem;
  }

  .calendar-weekdays {
    display: none;
  }

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

  .calendar-spacer {
    display: none;
  }

  .calendar-cell,
  .calendar-cell-button {
    min-height: 132px;
  }

  .menu-panel {
    width: 190px;
  }
}
