:root {
  color-scheme: light;
  --bg: #f7eeea;
  --panel: #fff8f4;
  --muted: #8a7f7a;
  --text: #2b1f1a;
  --accent: #f1873a;
  --accent-2: #ffb385;
  --border: #ecdcd4;
  --success: #2f9b5c;
  --warning: #e6892e;
  --danger: #d4553c;
  --chip: #f1e6df;
  --shadow: 0 18px 40px rgba(30, 14, 3, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: #fbf3ef;
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #f9b07a);
  display: grid;
  place-items: center;
  color: #fff;
}

.brand-text {
  font-size: 18px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-item {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  cursor: pointer;
}

.nav-item.active {
  background: #f0e1d7;
  font-weight: 600;
}

.nav-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-pill {
  background: var(--panel);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.nav-user {
  font-weight: 600;
  font-size: 13px;
}

.main {
  flex: 1;
  padding: 28px 32px 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.topbar h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

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

.tag-links {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.tag-links a {
  color: var(--accent);
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--border);
  padding: 4px 8px;
  border-radius: 999px;
}

.segmented {
  display: flex;
  background: #f4e8e2;
  border-radius: 999px;
  padding: 4px;
}

.segmented-button {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}

.segmented-button.active {
  background: #fff;
  box-shadow: 0 8px 18px rgba(33, 16, 5, 0.1);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 16px;
  align-items: center;
}

.toolbar.hidden {
  display: none;
}

.filter-panel.hidden {
  display: none;
}

.main.candidate-mode .toolbar {
  display: none;
}

.main.candidate-mode > .filter-panel {
  display: none;
}

body[data-view="candidate"] .toolbar,
body[data-view="candidate"] #filterPanel {
  display: none !important;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-panel {
  display: none;
  grid-template-columns: repeat(2, minmax(160px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.filter-panel.active {
  display: grid;
}

.filter-field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.filter-field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  font-size: 13px;
  background: #fff;
}
.week-selector,
.search {
  background: var(--panel);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.week-selector label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.week-selector select,
.search input {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: 14px;
  outline: none;
}

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

.chip {
  border: 0;
  background: var(--chip);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}

.chip.active {
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 10px 18px rgba(29, 14, 4, 0.08);
}

.bulk-bar {
  display: none;
  align-items: center;
  gap: 16px;
  background: #fff;
  border-radius: var(--radius);
  padding: 12px 16px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.bulk-bar.active {
  display: flex;
}

.bulk-feedback {
  color: var(--success);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.table {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.table-header,
.row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  column-gap: 12px;
  min-width: 1180px;
  flex-wrap: nowrap;
}

.table-header > .checkbox,
.row > .checkbox {
  flex: 0 0 36px;
}

.table-header > .worker,
.row > .worker {
  flex: 0 0 240px;
}

.table-header > .placement,
.row > .placement {
  flex: 0 0 240px;
}

.table-header > .week,
.row > .week {
  flex: 0 0 90px;
}

.table-header > .hours,
.row > .hours {
  flex: 0 0 90px;
}

.table-header > .variance,
.row > .variance {
  flex: 0 0 90px;
}

.table-header > .flags,
.row > .flags {
  flex: 0 0 140px;
}

.table-header > .actions,
.row > .actions {
  flex: 0 0 240px;
}

.table-header {
  background: #f8f1ed;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.th {
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.row .cell,
.table-header .th {
  display: flex;
  align-items: center;
}

.row .cell {
  white-space: nowrap;
}

.row {
  border-top: 1px solid var(--border);
  background: #fff;
}

.row.expanded {
  background: #fff9f5;
}

.row-details {
  padding: 12px 16px 16px 52px;
  border-top: 1px solid var(--border);
  background: #fff;
}

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

.worker-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1d7c7;
  display: grid;
  place-items: center;
  font-weight: 600;
}

.placement-title {
  font-weight: 600;
  font-size: 14px;
}

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

.cell.placement {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.status-chip {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.status-chip.suggested {
  background: #f3efe9;
}

.status-chip.awaiting {
  background: #fff2d9;
  color: #a35f13;
}

.status-chip.disputed {
  background: #ffe0da;
  color: #a13e2e;
}

.status-chip.approved {
  background: #dff4e7;
  color: #1b6c3b;
}

.flag {
  background: #f9ebe3;
  color: #7a4e33;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 8px;
  display: inline-block;
  margin-right: 6px;
}

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

button {
  font-family: inherit;
}

.primary,
.secondary {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

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

.primary.small {
  padding: 8px 12px;
  font-size: 13px;
}

.secondary {
  background: #fff;
  border: 1px solid var(--border);
}

.icon-button {
  border: 0;
  background: #f6e9e3;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
}

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

.strip-day {
  background: #f7efe9;
  border-radius: 10px;
  padding: 8px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.strip-day strong {
  display: block;
  margin-bottom: 2px;
}

.strip-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 8px;
  background: #f2e7df;
  font-size: 11px;
}

.strip-line.current {
  background: #ffe7d6;
  color: #a35f13;
}

.strip-line.correction {
  background: #e7f0ff;
  color: #1d4c9e;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 0;
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.drawer.open {
  width: 100%;
  opacity: 1;
  pointer-events: all;
}

.drawer-content {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 420px;
  background: #fff;
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-size: 18px;
  font-weight: 600;
}

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

.drawer-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  background: #f8f1ed;
  padding: 12px;
  border-radius: 12px;
}

.label {
  font-size: 11px;
  color: var(--muted);
}

.value {
  font-weight: 600;
}

.drawer-body {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}

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

.day-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.day-title {
  font-weight: 600;
  font-size: 14px;
}

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

.day-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.text-button {
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 11px;
  white-space: nowrap;
  transition: all 0.2s;
}

.text-button:hover {
  background: var(--bg-light);
  border-color: var(--primary);
  color: var(--primary);
}

.icon-button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  transition: all 0.2s;
}

.icon-button:hover {
  background: var(--bg-light);
  border-color: var(--primary);
  color: var(--primary);
}

.block {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 6px;
}

.block input {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 12px;
}

.block .remove {
  border: 0;
  background: #ffe7df;
  color: var(--danger);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}

.block-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.drawer-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #fff;
  padding: 20px;
  border-radius: 16px;
  width: 360px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-body label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
  display: block;
}

.modal-body select,
.modal-body textarea {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-top: 6px;
  font-family: inherit;
  font-size: 13px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.phone-frame {
  display: flex;
  justify-content: center;
}

.candidate-view-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.candidate-list {
  width: 360px;
  background: #fff8f4;
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.candidate-list #candidateListItems {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.candidate-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.candidate-title {
  font-weight: 700;
  font-size: 16px;
}

.candidate-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.candidate-filter-bar {
  display: flex;
  justify-content: flex-start;
}

.candidate-list .filter-panel {
  display: none;
  margin-top: 4px;
  grid-template-columns: 1fr;
  align-items: stretch;
}

.candidate-list .filter-panel.active {
  display: grid;
}

.candidate-list .filter-panel button {
  width: 100%;
}

.candidate-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.candidate-card.active {
  border-color: #f4b38c;
  box-shadow: 0 12px 24px rgba(30, 14, 3, 0.12);
}

.candidate-card:hover {
  box-shadow: var(--shadow);
}

.candidate-detail.hidden {
  display: none;
}

.candidate-detail {
  width: 360px;
}

.candidate-detail .phone {
  width: 100%;
}

.candidate-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.candidate-card-title {
  font-weight: 600;
}

.candidate-card-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.candidate-card-flags {
  margin-top: 8px;
}

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

.phone-header .text-button {
  font-size: 12px;
  padding: 4px 10px;
}

.phone {
  width: 360px;
  background: #fff8f4;
  border-radius: 28px;
  padding: 20px 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.phone-header {
  text-align: center;
  margin-bottom: 16px;
}

.phone-title {
  font-weight: 700;
  font-size: 18px;
}

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

.phone-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.day-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-item {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
}

.day-item.changed {
  border: 1px solid #f4b38c;
  background: #fff1e8;
}

.day-item .day-name {
  font-weight: 600;
  font-size: 14px;
}

.day-item .day-detail {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.candidate-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.candidate-confirm {
  text-align: center;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

.candidate-payslip {
  margin-top: -4px;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--muted);
}

.candidate-payslip a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f2e7df;
  font-size: 11px;
  color: #7a4e33;
  margin-left: 6px;
}

.correction-pill {
  background: #e7f0ff;
  color: #1d4c9e;
}

.candidate-note {
  text-align: center;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
}

@media (max-width: 1024px) {
  .sidebar {
    display: none;
  }

  .main {
    padding: 20px;
  }

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

  .candidate-view-layout {
    grid-template-columns: 1fr;
  }
}

