:root {
  --bg: #f4f2ed;
  --surface: #ffffff;
  --surface-alt: #f7f8f4;
  --ink: #1e2522;
  --muted: #65706a;
  --line: #d9ded7;
  --blue: #083df3;
  --blue-soft: #e8edff;
  --green: #1f7a4c;
  --amber: #9d6a04;
  --red: #a43d35;
  --cyan: #147b8c;
  --violet: #6650a4;
  --charcoal: #303640;
  --shadow: 0 18px 48px rgba(32, 40, 34, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.locked .app-shell {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

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

button {
  cursor: pointer;
}

button:disabled,
select:disabled,
input:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 340px minmax(0, 1fr);
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(244, 242, 237, 0.88);
}

.auth-screen.hidden {
  display: none;
}

.auth-card {
  display: grid;
  width: min(100%, 420px);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-brand {
  margin-bottom: 4px;
}

.auth-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

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

.brand-logo {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: cover;
}

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

.session-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}

.session-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.session-card div {
  display: grid;
  gap: 3px;
}

.session-card .sync-label {
  font-size: 11px;
  font-weight: 750;
}

.sync-label[data-status="synced"] {
  color: var(--green);
}

.sync-label[data-status="syncing"] {
  color: var(--amber);
}

.sync-label[data-status="offline"] {
  color: var(--red);
}

.mode-button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.mode-button.active {
  color: #fff;
  background: var(--ink);
}

body[data-mode="admin"] .employee-only,
body[data-mode="employee"] .admin-only,
body[data-mode="employee"] .export-section {
  display: none;
}

.employee-copy {
  display: none;
}

body[data-mode="employee"] .admin-copy {
  display: none;
}

body[data-mode="employee"] .employee-copy {
  display: block;
}

body[data-view="schedule"] [data-view-section]:not([data-view-section="schedule"]),
body[data-view="worklog"] [data-view-section]:not([data-view-section="worklog"]),
body[data-view="balance"] [data-view-section]:not([data-view-section="balance"]),
body[data-view="requests"] [data-view-section]:not([data-view-section="requests"]),
body[data-view="poster"] [data-view-section]:not([data-view-section="poster"]) {
  display: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #1e2522;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.section-head h3,
.section-head p,
.panel h2 {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.1;
}

.brand p,
.section-head p,
.panel-head span,
.topbar p {
  color: var(--muted);
  font-size: 13px;
}

.panel,
.schedule-section,
.requests-section,
.export-section,
.payroll-section,
.poster-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
  box-shadow: none;
}

.panel-head,
.section-head,
.topbar,
.toolbar,
.request-actions,
.status-row {
  display: flex;
  align-items: center;
}

.panel-head,
.section-head {
  justify-content: space-between;
  gap: 12px;
}

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

.panel-toggle,
.month-arrow {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  font-size: 18px;
  line-height: 1;
}

.panel.is-collapsed > :not(.panel-head) {
  display: none;
}

.panel.is-collapsed .panel-toggle {
  transform: rotate(180deg);
}

.panel h2,
.section-head h3 {
  font-size: 15px;
}

.request-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.compact-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.full-width-action {
  width: 100%;
  margin-top: 10px;
}

.settings-form {
  margin-bottom: 14px;
}

.custom-rhythm {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.custom-rhythm.hidden {
  display: none;
}

.rates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.panel-copy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.employee-picker {
  margin-top: 14px;
}

.employee-roster {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.roster-row {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-alt);
}

.position-select {
  width: 100%;
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.generator-choice {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.generator-choice input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.generator-choice:has(input:disabled) {
  color: var(--muted);
  cursor: not-allowed;
}

.roster-row .small-action {
  width: 100%;
}

.roster-row strong,
.roster-row span,
.roster-row em {
  display: block;
}

.roster-row strong {
  font-size: 13px;
}

.roster-row span {
  color: var(--muted);
  font-size: 11px;
}

.roster-row em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  line-height: 1.25;
  margin-top: 2px;
}

.roster-row.inactive {
  background: #fbfaf7;
}

.roster-row.inactive strong {
  color: var(--muted);
}

.role-checks {
  display: grid;
  gap: 8px;
}

.role-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
}

.role-checks input {
  width: 16px;
  height: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

.primary-action,
.secondary-action,
.small-action {
  border: 1px solid transparent;
  border-radius: 6px;
  min-height: 38px;
  padding: 0 13px;
  font-weight: 750;
}

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

.secondary-action {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
}

.small-action {
  min-height: 30px;
  padding: 0 10px;
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
  font-size: 12px;
}

.small-action.approve {
  color: var(--green);
}

.small-action.reject {
  color: var(--red);
}

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

.rules div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.rules div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.rules strong {
  font-size: 13px;
}

.rules span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.month-navigator {
  display: grid;
  grid-template-columns: 34px minmax(160px, 220px) 34px;
  align-items: center;
  gap: 6px;
}

.month-navigator select {
  min-height: 34px;
  padding: 6px 9px;
  color: var(--ink);
  font-weight: 800;
}

.topbar h2 {
  font-size: 28px;
}

.eyebrow {
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
}

.toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.view-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
  background: var(--surface);
}

.view-tab {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  color: var(--muted);
  background: transparent;
  font-weight: 850;
  white-space: nowrap;
}

.view-tab.active {
  color: #fff;
  background: var(--ink);
}

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.poster-section {
  margin-bottom: 16px;
  overflow: hidden;
}

.poster-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 180px)) auto;
  align-items: end;
  gap: 10px;
  padding: 14px 16px;
}

.poster-tools label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.poster-status {
  display: grid;
  gap: 12px;
  min-width: 0;
  border-top: 1px solid var(--line);
  padding: 14px 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

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

.poster-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.poster-summary strong {
  font-size: 20px;
}

.poster-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.poster-detail-grid h4 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 12px;
}

.poster-rows {
  display: grid;
  gap: 6px;
}

.poster-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: var(--surface-alt);
}

.poster-row span {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.poster-row em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.poster-row.ok {
  border-color: #b9dfc8;
}

.poster-row.fail {
  border-color: #f0c4bd;
  background: #fff7f5;
}

.poster-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.poster-debug {
  display: grid;
  gap: 10px;
}

.poster-debug summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.metric strong {
  display: block;
  font-size: 24px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.schedule-section {
  overflow: hidden;
}

.section-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

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

.schedule-scroll:fullscreen {
  width: 100%;
  height: 100%;
  padding: 14px;
  background: var(--surface);
  overflow: auto;
}

.schedule-scroll:fullscreen .schedule-table {
  min-width: max-content;
}

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

.schedule-table th,
.schedule-table td {
  width: 76px;
  min-width: 76px;
  height: 58px;
  border: 1px solid var(--line);
  padding: 7px;
  vertical-align: top;
  text-align: left;
}

.schedule-table th:first-child,
.schedule-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 118px;
  min-width: 118px;
  background: var(--surface-alt);
}

.schedule-table thead th {
  height: 52px;
  background: var(--surface-alt);
  font-size: 12px;
}

.event-day {
  border-top: 4px solid var(--ink) !important;
}

.day-num {
  display: block;
  font-size: 16px;
  font-weight: 850;
}

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

.event-label {
  display: block;
  overflow: hidden;
  max-width: 64px;
  margin-top: 2px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weekend {
  background: #f0f3ea !important;
}

.employee-name {
  font-weight: 850;
  font-size: 13px;
}

.own-row .employee-name,
.own-row .shift-cell {
  background: #fff8dc;
}

.own-row .employee-name {
  box-shadow: inset 4px 0 0 var(--amber);
}

.shift-cell {
  background: #fff;
}

body[data-mode="admin"] .shift-cell {
  cursor: pointer;
}

body[data-mode="admin"] .shift-cell:hover {
  outline: 2px solid var(--amber);
  outline-offset: -2px;
}

.shift-chip {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 24px;
  margin-bottom: 4px;
  border-radius: 5px;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
  font-weight: 850;
}

.shift-chip small {
  display: block;
  font-size: 9px;
  font-weight: 750;
  line-height: 1.1;
  opacity: 0.9;
}

.bonus-row td {
  background: #fffaf0;
}

.bonus-chip {
  display: grid;
  place-items: center;
  min-height: 30px;
  border-radius: 5px;
  color: var(--ink);
  background: #ffe7a6;
  font-size: 11px;
  font-weight: 850;
  text-align: center;
}

.bonus-chip small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.1;
}

.note-mark {
  position: absolute;
  top: 1px;
  right: 4px;
  font-size: 10px;
  line-height: 1;
}

.role-third_bar {
  background: var(--green);
}

.role-summer_bar {
  background: var(--cyan);
}

.role-door {
  background: var(--charcoal);
}

.request-dot {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--amber);
}

.blocked {
  background: repeating-linear-gradient(135deg, #fff5f3, #fff5f3 6px, #ffe2dd 6px, #ffe2dd 12px);
}

.bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 16px;
  margin-top: 16px;
}

body[data-mode="employee"] .bottom-grid {
  grid-template-columns: minmax(0, 1fr);
}

.requests-list {
  display: grid;
  gap: 10px;
  max-height: 430px;
  overflow: auto;
  padding: 14px;
}

.request-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-alt);
}

.request-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.request-main strong {
  font-size: 14px;
}

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

.request-note {
  margin-top: 6px;
}

.request-actions {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.status {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 850;
}

.status.pending {
  color: var(--amber);
  background: #fff3d8;
}

.status.approved {
  color: var(--green);
  background: #e5f6ed;
}

.status.rejected {
  color: var(--red);
  background: #ffe8e5;
}

.export-section textarea {
  display: block;
  width: calc(100% - 28px);
  margin: 14px;
  min-height: 348px;
  color: #26302b;
  background: #fbfcf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.payroll-section {
  margin-top: 16px;
  overflow: hidden;
}


.payroll-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}

.payroll-section-toggle::-webkit-details-marker {
  display: none;
}

.payroll-section-toggle h3 {
  margin: 0;
  font-size: 15px;
}

.payroll-section-toggle::after {
  content: "Розгорнути ▾";
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
}

.payroll-section[open] > .payroll-section-toggle::after {
  content: "Згорнути ▴";
}

.payroll-section-toggle:hover {
  background: var(--surface-alt);
}

.payroll-section-toggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -3px;
}

.payroll-section-toggle + .section-head {
  padding-top: 0;
}

.payroll-summary {
  padding: 14px;
}

.payroll-import-panel,
.payroll-adjustments-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.payroll-period-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.payroll-period-inputs label {
  display: grid;
  gap: 5px;
  min-width: 160px;
}

.payroll-paste-field {
  display: grid;
  gap: 5px;
}

.payroll-paste-field textarea {
  min-height: 120px;
  resize: vertical;
}

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

.bridge-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #afc8b7;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  padding: 14px;
  background: #f2f8f2;
}

.bridge-card div {
  display: grid;
  gap: 4px;
}

.bridge-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.manual-import-details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.manual-import-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.manual-import-details[open] {
  display: grid;
  gap: 10px;
}

.adjustment-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) minmax(120px, 0.65fr) minmax(220px, 1.6fr) auto;
  align-items: end;
  gap: 10px;
}

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

.adjustment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-alt);
}

.adjustment-row.deduction {
  border-left-color: var(--red);
}

.payout-row {
  border-left-color: #42536a;
}

.payout-row:has(.muted-cell) {
  opacity: 0.55;
}

.adjustment-row strong,
.adjustment-row span {
  display: block;
}

.adjustment-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.adjustment-row b {
  white-space: nowrap;
}

.payroll-fact-note {
  margin-bottom: 12px;
  border-left: 4px solid var(--green);
  padding: 9px 12px;
  color: #245038;
  background: #edf8f1;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
}

.negative-money {
  color: var(--red);
}

.royalty-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.royalty-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(120px, 0.7fr) minmax(220px, 1.2fr) minmax(140px, 0.8fr);
  align-items: end;
  gap: 10px;
}

.royalty-form .wide-field {
  min-width: 0;
}

.royalty-form button {
  min-height: 42px;
  align-self: end;
  font-size: 13px;
  line-height: 1.15;
  white-space: normal;
}

.royalty-form label:nth-of-type(5),
.royalty-form label:nth-of-type(6) {
  max-width: 180px;
}

.royalty-rules-list {
  display: grid;
  gap: 8px;
}

.royalty-rule {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-alt);
}

.royalty-rule strong,
.royalty-rule span,
.royalty-rule em {
  display: block;
}

.royalty-rule strong {
  font-size: 14px;
}

.royalty-rule span,
.royalty-rule em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.royalty-rule.inactive {
  opacity: 0.65;
}

.payroll-warning {
  border: 1px solid #f1d39a;
  border-radius: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  color: #5f430b;
  background: #fff7df;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.muted-cell {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.balance-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
  padding: 14px;
  background: var(--surface-alt);
}

.balance-card strong {
  color: var(--ink);
  font-size: 26px;
}

.available-card {
  border-color: #b8dfc5;
  background: #edf8f1;
}

.available-card > span:first-child {
  color: #245038;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.negative-balance-card {
  border-color: #e3b4af;
  background: #fff2f0;
}

.negative-balance-card > span:first-child {
  color: var(--red);
}

.available-money {
  color: var(--green);
  font-weight: 850;
}

.balance-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.balance-subtitle {
  margin: 14px 0 8px;
  font-size: 13px;
}

.payroll-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.payroll-table th,
.payroll-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
}

.payroll-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.payroll-table td:last-child,
.payroll-table th:last-child {
  text-align: right;
}

.payroll-table tfoot td {
  border-bottom: 0;
  font-weight: 850;
}

.work-session-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.worklog-total-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.worklog-total-grid section {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-alt);
}

.worklog-total-grid .worklog-fund {
  border-color: #b7dfc7;
  background: #effaf3;
}

.worklog-total-grid span,
.worklog-total-grid small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.worklog-total-grid strong {
  color: var(--ink);
  font-size: 25px;
  line-height: 1;
}

.work-session-overview section {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--surface-alt);
}

.work-session-overview strong {
  font-size: 12px;
  text-transform: uppercase;
}

.work-session-overview span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.work-session-overview .needs-review {
  border-color: #f1d39a;
  background: #fff7df;
}

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

.workday-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.workday-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
}

.workday-card > header div {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.workday-card > header strong {
  font-size: 16px;
}

.workday-card > header span,
.workday-card > header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.workday-people {
  display: grid;
}

.workday-person {
  display: grid;
  grid-template-columns: minmax(175px, 1.45fr) repeat(3, minmax(92px, 0.8fr)) minmax(110px, 0.85fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.workday-person:last-child {
  border-bottom: 0;
}

.workday-person > strong {
  display: grid;
  gap: 3px;
  font-size: 14px;
}

.workday-person > span {
  display: grid;
  gap: 2px;
  font-size: 13px;
  font-weight: 750;
}

.workday-person small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.workday-person > b {
  color: var(--green);
  font-size: 14px;
  text-align: right;
  white-space: nowrap;
}

.workday-person.is-current {
  background: #f3fbf5;
}

.workday-footnote {
  margin: 0;
  border-top: 1px solid #f1d39a;
  padding: 9px 12px;
  color: #805a0b;
  background: #fff9e9;
  font-size: 12px;
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: none;
  max-width: 320px;
  border-radius: 8px;
  padding: 12px 14px;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast.show {
  display: block;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .workspace {
    order: 1;
  }

  .sidebar {
    order: 2;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  body[data-view="schedule"] .sidebar [data-control-section]:not([data-control-section~="schedule"]),
  body[data-view="balance"] .sidebar [data-control-section]:not([data-control-section~="balance"]),
  body[data-view="requests"] .sidebar [data-control-section]:not([data-control-section~="requests"]),
  body[data-view="poster"] .sidebar [data-control-section] {
    display: none;
  }

  .metrics-strip,
  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .poster-detail-grid {
    grid-template-columns: 1fr;
  }

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

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

  .royalty-form label:nth-of-type(5),
  .royalty-form label:nth-of-type(6) {
    max-width: none;
  }

  .royalty-rule {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .view-tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    overflow-x: auto;
    margin-inline: -16px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    padding-inline: 16px;
  }

  .toolbar {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .sidebar,
  .workspace {
    padding: 16px;
  }

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

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

  .poster-tools {
    grid-template-columns: 1fr;
  }

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

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

  .payroll-period-inputs,
  .payroll-import-actions,
  .adjustment-row {
    align-items: stretch;
    flex-direction: column;
  }

  .payroll-period-inputs label {
    min-width: 0;
  }

  .payroll-table {
    min-width: 760px;
  }

  .payroll-summary {
    overflow-x: auto;
  }

  .work-session-overview {
    grid-template-columns: 1fr;
  }

  .worklog-total-grid {
    grid-template-columns: 1fr;
  }

  .workday-card > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .workday-person {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .workday-person > strong {
    grid-column: 1 / -1;
  }

  .workday-person > b {
    grid-column: 1 / -1;
    text-align: left;
    font-size: 16px;
  }

  .poster-tools button {
    width: 100%;
  }

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

  .topbar h2 {
    font-size: 24px;
  }

  .toolbar {
    width: 100%;
  }

  .month-navigator {
    width: 100%;
    grid-template-columns: 38px minmax(0, 1fr) 38px;
  }

  .month-arrow {
    width: 38px;
    height: 38px;
  }

  .toolbar button {
    flex: 1 1 100%;
  }
}

.payroll-warning {
  margin: 12px 0;
  padding: 12px;
  border-left: 4px solid var(--amber);
  background: #fff6df;
  color: #654604;
  font-size: 13px;
  line-height: 1.5;
}
