:root {
  color-scheme: light;
  --bg: #f7f5f1;
  --surface: #ffffff;
  --surface-soft: #f1eadb;
  --surface-strong: #6f171c;
  --text: #26181a;
  --muted: #746b60;
  --border: #e1d8c6;
  --accent: #9b1f24;
  --accent-dark: #74171c;
  --gold: #b5a46d;
  --gold-dark: #8f7f4c;
  --blue: #8f7f4c;
  --red: #b4232a;
  --amber: #a88432;
  --green: #15803d;
  --shadow: 0 14px 34px rgba(91, 34, 28, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(155, 31, 36, 0.05), transparent 210px),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.is-loading:disabled {
  opacity: 1;
}

.login-view {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
  padding: 48px clamp(18px, 6vw, 86px);
  background:
    linear-gradient(176deg, var(--accent) 0 18%, transparent 18.2%),
    linear-gradient(166deg, rgba(181, 164, 109, 0.72) 0 24%, transparent 24.2%),
    var(--bg);
  overflow: hidden;
  isolation: isolate;
}

.login-view::after {
  content: "";
  position: absolute;
  inset: auto -10% -22% 34%;
  height: 42%;
  background: radial-gradient(closest-side, rgba(181, 164, 109, 0.22), transparent 70%);
  z-index: -2;
}

.login-scene {
  position: absolute;
  left: clamp(20px, 5vw, 86px);
  top: 56%;
  width: min(58vw, 840px);
  height: min(92vh, 860px);
  transform: translateY(-50%);
  z-index: -1;
  pointer-events: none;
}

.login-scene canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.login-copy {
  align-self: start;
  max-width: min(42vw, 520px);
  margin-top: clamp(22px, 4vh, 48px);
  color: #fff5d6;
  text-shadow:
    0 2px 0 rgba(104, 21, 26, 0.72),
    0 14px 34px rgba(68, 12, 16, 0.34);
  pointer-events: none;
}

.login-copy span {
  color: #ead28b;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-copy strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.65rem, 3vw, 3.25rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
  -webkit-text-stroke: 0.4px rgba(104, 21, 26, 0.6);
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  justify-self: center;
  grid-column: 2;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(74, 18, 20, 0.18);
  padding: 24px;
  backdrop-filter: blur(12px);
}

.login-card h1 {
  margin: 16px 0 6px;
  font-size: 1.45rem;
}

.login-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  background: linear-gradient(180deg, #8f1d22, #68151a);
  color: #f9fafb;
  transition: padding 180ms ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
}

.sidebar-brand > div {
  min-width: 0;
}

.sidebar-brand strong {
  display: block;
  font-size: 1rem;
}

.sidebar-brand > div span {
  display: block;
  margin-top: 2px;
  color: #eadfbd;
  font-size: 0.84rem;
  font-weight: 700;
}

.brand-logo {
  display: block;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  object-fit: contain;
  border-radius: 8px;
}

.login-logo {
  width: 88px;
  height: 88px;
  margin-bottom: 14px;
}

.sidebar-logo {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
}

.sidebar-toggle {
  width: 34px;
  height: 34px;
  margin-left: auto;
  flex: 0 0 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #f9fafb;
  font-size: 1.35rem;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.side-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  min-height: 40px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: #f2e9cf;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-weight: 750;
}

.nav-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  color: #dfcf9b;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.nav-item:hover .nav-icon,
.nav-item.is-active .nav-icon {
  color: #ffffff;
}

.sidebar-note {
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-note strong,
.sidebar-note span {
  display: block;
}

.sidebar-note span {
  margin-top: 5px;
  color: #f0e6ca;
  font-size: 0.88rem;
  line-height: 1.35;
}

@media (min-width: 1181px) {
  body.sidebar-collapsed .app-shell {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  body.sidebar-collapsed .app-sidebar {
    padding: 18px 12px;
    gap: 14px;
  }

  body.sidebar-collapsed .sidebar-brand {
    min-height: 90px;
    align-items: center;
    flex-direction: column;
    justify-content: flex-start;
    gap: 9px;
  }

  body.sidebar-collapsed .sidebar-brand > div:not(.brand-logo),
  body.sidebar-collapsed .sidebar-note {
    display: none;
  }

  body.sidebar-collapsed .sidebar-toggle {
    width: 42px;
    height: 30px;
    margin-left: 0;
    font-size: 1.05rem;
  }

  body.sidebar-collapsed .side-nav {
    margin-top: 0;
  }

  body.sidebar-collapsed .nav-item {
    min-height: 42px;
    justify-content: center;
    padding: 0;
    white-space: nowrap;
  }

  body.sidebar-collapsed .nav-label {
    display: none;
  }

  body.sidebar-collapsed .nav-icon {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
  }
}

.app-main {
  min-width: 0;
}

.app-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: #fffdf8;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header h1 {
  margin: 0;
  font-size: 1.28rem;
  line-height: 1.2;
}

.app-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.workspace {
  width: min(1520px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.accountant-mobile-nav {
  display: none;
}

.accountant-mobile-header,
.accountant-mobile-pending,
.accountant-mobile-record-filters {
  display: none;
}

.view-stack {
  display: grid;
  gap: 16px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(145px, 1fr));
  gap: 12px;
}

.panel,
.metric-card,
.table-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 102px;
  padding: 16px;
  display: grid;
  align-content: space-between;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.metric-card strong {
  font-size: 1.9rem;
  line-height: 1;
}

.metric-card small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.25;
}

.metric-card.quality strong {
  color: var(--muted);
}

.metric-card.quality.is-strong strong {
  color: var(--green);
}

.metric-card.quality.is-warning strong {
  color: var(--amber);
}

.metric-card.quality.is-critical strong {
  color: var(--red);
}

.metric-card.attention strong {
  color: var(--red);
}

.metric-card.balance strong {
  color: var(--blue);
}

.metric-card.queue strong {
  color: var(--gold-dark);
}

.workbench-grid,
.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.panel {
  padding: 16px;
}

.panel-heading,
.table-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading {
  display: flex;
}

.panel-heading h2,
.table-header h2 {
  margin: 0;
  font-size: 1rem;
}

.panel-heading p,
.table-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.employee-balance-summary {
  margin: 14px 16px 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffaf0;
}

.employee-balance-summary span,
.employee-balance-summary p {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.employee-balance-summary strong {
  display: block;
  margin-top: 3px;
  font-size: 1.55rem;
  line-height: 1;
}

.employee-balance-summary p {
  margin: 0;
  text-align: right;
}

.action-panel {
  min-height: 254px;
}

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

.button-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.button-row button {
  flex: 1 1 180px;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.field span,
.check-field span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fffdf8;
  color: var(--text);
}

.field input[type="time"] {
  display: block;
  max-width: 100%;
  text-align: left;
  text-align-last: left;
}

.field input[type="time"]::-webkit-date-and-time-value {
  min-width: 0;
  text-align: left;
}

.field textarea {
  min-height: 122px;
  resize: vertical;
  line-height: 1.35;
}

.field input[type="file"] {
  padding: 7px;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
}

.compact-check {
  min-height: 38px;
  margin-top: calc(0.78rem + 6px);
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fffdf8;
  white-space: nowrap;
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.holiday-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.holiday-item {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffaf0;
}

.holiday-info {
  min-width: 0;
}

.holiday-info strong,
.holiday-info span {
  display: block;
}

.holiday-info strong {
  font-size: 0.9rem;
}

.holiday-info span,
.holiday-empty {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.holiday-empty {
  margin: 0;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #fffaf0;
}

.holiday-toggle {
  flex: 0 0 auto;
  margin-top: 0;
  white-space: nowrap;
}

.status-line {
  min-height: 34px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.status-line.is-error {
  color: var(--red);
}

.user-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 11px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.primary-action,
.secondary-action,
.ghost-action {
  margin-top: 10px;
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-action,
.secondary-action {
  border: 0;
}

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

.secondary-action {
  background: var(--gold);
  color: #fff;
}

.ghost-action {
  border: 1px solid var(--border);
  background: #fffdf8;
  color: var(--text);
}

.header-button {
  width: auto;
  margin-bottom: 10px;
}

.primary-action:hover:not(:disabled),
.secondary-action:hover:not(:disabled),
.ghost-action:hover:not(:disabled) {
  filter: brightness(0.97);
}

.primary-action.is-loading::before,
.secondary-action.is-loading::before,
.ghost-action.is-loading::before,
.status-line.is-loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 760ms linear infinite;
}

.status-line.is-loading::before {
  width: 13px;
  height: 13px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.table-panel {
  overflow: hidden;
}

.table-header {
  min-height: 64px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.table-header span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
  white-space: nowrap;
}

.table-tools {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: max-content;
}

.table-tools > span {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding-bottom: 1px;
  margin: 0 0 0;
  flex: 0 0 auto;
}

.table-tools .header-button {
  min-height: 38px;
  margin: 0;
  flex: 0 0 auto;
}

.search-field {
  display: grid;
  gap: 6px;
  flex: 0 0 auto;
}

.search-field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.search-field input,
.search-field select {
  min-height: 38px;
  width: 280px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fffdf8;
  color: var(--text);
}

.daily-balance-dashboard {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: #fffaf0;
}

.daily-balance-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.daily-balance-header h3 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 1rem;
}

.daily-balance-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.daily-balance-chart {
  min-height: 330px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffdf8;
}

.empty-chart-message {
  margin: auto;
  color: var(--muted);
  font-weight: 750;
  text-align: center;
}

.daily-balance-plot {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 6px;
  padding: 24px 10px 12px 6px;
}

.daily-balance-axis {
  height: 240px;
  position: relative;
  padding-top: 0;
  border-right: 1px solid rgba(120, 96, 55, 0.18);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  text-align: right;
  flex-shrink: 0;
}

.daily-balance-axis span {
  position: absolute;
  right: 7px;
  transform: translateY(-50%);
}

.daily-balance-plot-area {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-rows: 240px auto;
  overflow-x: auto;
  overflow-y: hidden;
}

.daily-balance-grid {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 240px;
  width: max(100%, calc(var(--chart-days, 1) * 52px));
  pointer-events: none;
}

.daily-balance-grid span {
  position: absolute;
  right: 0;
  left: 0;
  height: 1px;
  transform: translateY(-50%);
  background: rgba(120, 96, 55, 0.22);
}

.daily-balance-grid span.is-zero {
  height: 2px;
  background: rgba(120, 96, 55, 0.62);
}

.daily-balance-bars {
  position: relative;
  z-index: 1;
  min-width: max(100%, calc(var(--chart-days, 1) * 52px));
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: 12px;
  grid-row: 1 / 3;
  padding: 0 8px;
}

.daily-balance-item {
  width: 40px;
  display: grid;
  grid-template-rows: 120px 120px 18px 20px;
  justify-items: center;
  align-items: stretch;
  color: var(--muted);
}

.daily-balance-slot {
  width: 100%;
  height: 100%;
  align-self: stretch;
  display: flex;
  justify-content: center;
}

.daily-balance-slot.is-top {
  align-items: flex-end;
  border-bottom: 1px solid transparent;
}

.daily-balance-slot.is-bottom {
  align-items: flex-start;
  border-top: 1px solid transparent;
}

.daily-balance-bar {
  width: 100%;
  display: block;
  border-radius: 1px 1px 0 0;
  background: #9aa0a6;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

.daily-balance-item.is-positive .daily-balance-bar {
  background: #1f9d55;
}

.daily-balance-item.is-negative .daily-balance-bar {
  border-radius: 0 0 1px 1px;
  background: #b3262d;
}

.daily-balance-day {
  align-self: end;
  padding-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.daily-balance-value {
  align-self: start;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.1;
}

.daily-balance-item.is-positive .daily-balance-value {
  color: #157347;
}

.daily-balance-item.is-negative .daily-balance-value {
  color: #a32026;
}

.table-scroll {
  width: 100%;
  overflow: auto;
  max-height: calc(100vh - 190px);
}

.pagination-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.pagination-row[hidden] {
  display: none;
}

.pagination-row .header-button {
  min-height: 36px;
}

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

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8f1df;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #fff8eb;
}

tbody tr.non-working-record {
  background: #e5e7eb;
  color: #64748b;
}

tbody tr.non-working-record td {
  background: #e5e7eb;
  border-bottom-color: #cbd5e1;
  border-top: 1px solid #cbd5e1;
}

tbody tr.non-working-record:hover {
  background: #dfe3e8;
}

tbody tr.non-working-record:hover td {
  background: #dfe3e8;
}

.numeric {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amount-positive,
.amount-negative,
.amount-neutral {
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amount-positive {
  color: var(--green);
}

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

.amount-neutral {
  color: var(--muted);
}

.balance-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.balance-indicator.positive {
  color: var(--green);
}

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

.balance-indicator.neutral {
  color: var(--muted);
}

.balance-icon {
  position: relative;
  display: inline-block;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 999px;
}

.balance-icon::before,
.balance-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 3px;
  border-radius: 999px;
  background: #ffffff;
  transform: translate(-50%, -50%);
}

.balance-indicator.positive .balance-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.balance-indicator.negative .balance-icon::after {
  display: none;
}

.balance-indicator.positive .balance-icon {
  background: var(--green);
}

.balance-indicator.negative .balance-icon {
  background: var(--red);
}

.original-punches {
  color: var(--red) !important;
  font-weight: 850;
  white-space: nowrap;
}

td.original-punches-cell,
td .original-punches {
  color: var(--red) !important;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.badge.ok {
  color: #166534;
  background: #dcfce7;
}

.badge.day-off {
  color: #0f766e;
  background: #ccfbf1;
}

.badge.extra {
  color: #047857;
  background: #d1fae5;
}

.badge.negative {
  color: #b45309;
  background: #fef3c7;
}

.badge.off-schedule {
  color: #7c2d12;
  background: #ffedd5;
}

.badge.incomplete {
  color: #92400e;
  background: #fde68a;
}

.badge.missing {
  color: #7f1d1d;
  background: #fee2e2;
}

.badge.adjusted {
  color: #1d4ed8;
  background: #dbeafe;
}

.badge.agreed-day-off {
  color: #6d28d9;
  background: #ede9fe;
}

.badge.excused {
  color: #0369a1;
  background: #e0f2fe;
}

.badge.absence {
  color: #991b1b;
  background: #fecaca;
}

.badge.vacation {
  color: #0f766e;
  background: #cffafe;
}

.badge.approved {
  color: #15803d;
  background: #bbf7d0;
}

.badge.rejected {
  color: #be123c;
  background: #ffe4e6;
}

.badge.pending {
  color: #a16207;
  background: #fef9c3;
}

.badge.warning {
  color: #475569;
  background: #e2e8f0;
}

.table-action {
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--accent-dark);
  font-weight: 850;
  padding: 0 9px;
  white-space: nowrap;
}

.table-action.danger {
  color: var(--red);
}

.action-row {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.empty-row td {
  color: var(--muted);
  text-align: center;
  padding: 34px 12px;
}

.adjust-dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: calc(100dvh - 24px);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0;
  overflow: auto;
}

.adjust-dialog::backdrop {
  background: rgba(15, 23, 42, 0.38);
}

.dialog-body {
  padding: 16px;
}

.adjust-grid {
  margin-top: -8px;
}

.adjust-dialog form,
.adjust-dialog .dialog-body,
.adjust-dialog .field,
.adjust-dialog .time-grid,
.adjust-dialog .inline-fields {
  min-width: 0;
}

.adjust-dialog input[type="time"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  appearance: none;
  -webkit-appearance: none;
}

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

  .app-sidebar {
    position: static;
    height: auto;
  }

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

  body.sidebar-collapsed .app-sidebar {
    gap: 10px;
    padding: 12px;
  }

  body.sidebar-collapsed .sidebar-brand > div:not(.brand-logo),
  body.sidebar-collapsed .sidebar-note {
    display: none;
  }

  body.sidebar-collapsed .sidebar-brand {
    min-height: 42px;
  }

  body.sidebar-collapsed .side-nav {
    grid-template-columns: repeat(6, minmax(42px, 1fr));
  }

  body.sidebar-collapsed .nav-item {
    min-height: 40px;
    justify-content: center;
    padding: 0;
  }

  body.sidebar-collapsed .nav-label {
    display: none;
  }

  body.sidebar-collapsed .nav-icon {
    width: 30px;
    height: 30px;
  }

  .metrics {
    grid-template-columns: repeat(3, minmax(145px, 1fr));
  }
}

@media (max-width: 820px) {
  .login-view {
    grid-template-columns: 1fr;
    padding: 24px 14px;
  }

  .login-copy {
    display: none;
  }

  .login-scene {
    inset: 0;
    width: auto;
    height: auto;
    transform: none;
    opacity: 0.42;
  }

  .login-card {
    justify-self: center;
    grid-column: auto;
  }

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

  .header-actions,
  .header-actions button,
  .header-actions .user-pill,
  .primary-action {
    width: 100%;
  }

  .workspace {
    padding: 12px;
  }

  body[data-role="accountant"] .app-sidebar,
  body[data-role="accountant"] .app-header {
    display: none;
  }

  body[data-role="accountant"] .app-main {
    background: #f6f3ee;
  }

  body[data-role="accountant"] .workspace {
    width: min(440px, 100%);
    padding: 8px 10px 28px;
  }

  body[data-role="accountant"] .accountant-mobile-header {
    width: min(440px, calc(100% - 20px));
    min-height: 44px;
    margin: 8px auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
  }

  body[data-role="accountant"] .accountant-mobile-header strong {
    color: var(--text);
    font-size: 1rem;
    font-weight: 850;
  }

  body[data-role="accountant"] .accountant-mobile-header .mobile-back-button {
    position: absolute;
    left: 0;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font-size: 1.9rem;
    line-height: 1;
  }

  body[data-role="accountant"][data-accountant-mobile-mode="home"] .accountant-mobile-header .mobile-back-button {
    display: none;
  }

  body[data-role="accountant"] .accountant-mobile-header #mobileTopLogoutBtn {
    position: absolute;
    right: 0;
    min-height: 34px;
    padding: 7px 12px;
    border-color: var(--accent);
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 6px 14px rgba(155, 31, 36, 0.18);
  }

  body[data-role="accountant"] .accountant-mobile-nav {
    width: 100%;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body[data-role="accountant"] .accountant-mobile-nav button {
    min-height: 52px;
    border: 1px solid rgba(155, 31, 36, 0.24);
    border-radius: 8px;
    background: #fff4ec;
    color: var(--accent-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 10px;
    box-shadow: 0 6px 16px rgba(74, 18, 20, 0.08);
    font-size: 0.82rem;
    font-weight: 900;
    text-align: center;
  }

  body[data-role="accountant"] .accountant-mobile-nav #mobileLogoutBtn {
    display: none;
  }

  body[data-role="accountant"] .accountant-mobile-nav button span {
    color: var(--accent);
    font-size: 1rem;
    line-height: 1;
  }

  body[data-role="accountant"] .accountant-mobile-nav button.is-active {
    border-color: rgba(155, 31, 36, 0.24);
    background: #fff4ec;
    color: var(--accent-dark);
  }

  .workbench-grid,
  .settings-grid,
  .inline-fields,
  .time-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    padding: 12px;
    gap: 12px;
  }

  .sidebar-brand {
    min-height: 46px;
  }

  .sidebar-note {
    display: none;
  }

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

  .nav-item {
    min-height: 44px;
    justify-content: center;
    padding: 0 8px;
    text-align: center;
  }

  .nav-icon {
    width: 22px;
    height: 22px;
  }

  .table-header {
    display: flex;
    flex-direction: column;
    padding: 14px;
  }

  .table-header span {
    white-space: normal;
  }

  .table-tools {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    justify-content: stretch;
  }

  .table-tools .header-button,
  .table-tools .search-field,
  .table-tools .compact-check,
  .table-tools .search-field input,
  .table-tools .search-field select,
  .table-tools > span {
    width: 100%;
  }

  .table-tools .header-button {
    margin-top: 0;
    align-self: stretch;
  }

  .table-tools .compact-check {
    margin-top: 0;
  }

  .table-tools > span {
    margin: 0 !important;
    align-self: stretch;
  }

  body[data-role="accountant"] #recordsView {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body[data-role="accountant"] #recordsView[hidden] {
    display: none !important;
  }

  body[data-role="accountant"] #requestsView {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body[data-role="accountant"] #requestsView[hidden] {
    display: none !important;
  }

  body[data-role="accountant"] #requestsView .table-header,
  body[data-role="accountant"] #requestsView .table-scroll {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fffdf8;
  }

  body[data-role="accountant"] #requestsView .table-scroll {
    overflow: hidden;
  }

  body[data-role="accountant"] #recordsView .employee-balance-summary {
    order: 1;
  }

  body[data-role="accountant"] #recordsView .accountant-mobile-nav {
    order: 2;
  }

  body[data-role="accountant"] #recordsView .accountant-mobile-pending {
    order: 3;
  }

  body[data-role="accountant"] #recordsView .table-header {
    order: 4;
  }

  body[data-role="accountant"] #recordsView .accountant-mobile-record-filters {
    order: 5;
  }

  body[data-role="accountant"] #recordsView .table-scroll {
    order: 6;
  }

  body[data-role="accountant"] #recordsView .pagination-row {
    order: 7;
  }

  body[data-role="accountant"] .employee-balance-summary {
    margin: 0;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    border-radius: 8px;
    background: #fffdf8;
    box-shadow: 0 7px 18px rgba(74, 18, 20, 0.08);
  }

  body[data-role="accountant"] .employee-balance-summary div {
    min-height: 42px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 10px;
  }

  body[data-role="accountant"] .employee-balance-summary div::before {
    content: "◷";
    width: 32px;
    height: 32px;
    grid-row: 1 / 3;
    display: grid;
    place-items: center;
    border: 2px solid var(--muted);
    border-radius: 50%;
    color: var(--muted);
    font-size: 1.18rem;
    line-height: 1;
  }

  body[data-role="accountant"] .employee-balance-summary span {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 900;
  }

  body[data-role="accountant"] .employee-balance-summary p {
    margin: 2px 0 0;
    color: #a69a8d;
    font-size: 0.78rem;
    font-weight: 750;
    text-align: left;
  }

  body[data-role="accountant"] .employee-balance-summary strong {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 900;
    white-space: nowrap;
  }

  body[data-role="accountant"] .accountant-mobile-pending {
    display: grid;
    gap: 10px;
  }

  body[data-role="accountant"] .accountant-mobile-pending h3 {
    margin: 2px 0 0;
    color: var(--text);
    font-size: 0.96rem;
  }

  body[data-role="accountant"] .accountant-mobile-card-button {
    min-height: 54px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    background: #fffdf8;
    color: var(--text);
    box-shadow: 0 7px 18px rgba(74, 18, 20, 0.08);
    font-weight: 850;
    text-align: left;
  }

  body[data-role="accountant"] .accountant-mobile-card-button strong {
    min-width: 32px;
    min-height: 24px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: #fff06a;
    color: #6f171c;
    font-size: 0.82rem;
  }

  body[data-role="accountant"] .accountant-mobile-record-filters {
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fffdf8;
    box-shadow: 0 7px 18px rgba(74, 18, 20, 0.08);
  }

  body[data-role="accountant"] .accountant-mobile-record-filters .search-field,
  body[data-role="accountant"] .accountant-mobile-record-filters .search-field input,
  body[data-role="accountant"] .accountant-mobile-record-filters button {
    width: 100%;
  }

  body[data-role="accountant"] #recordsView .table-header {
    margin-top: 2px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fffdf8;
  }

  body[data-role="accountant"] #recordsView .table-tools {
    display: none;
  }

  body[data-role="accountant"][data-accountant-mobile-mode="home"] #recordsView .table-header,
  body[data-role="accountant"][data-accountant-mobile-mode="home"] #recordsView .accountant-mobile-record-filters,
  body[data-role="accountant"][data-accountant-mobile-mode="home"] #recordsView .table-scroll,
  body[data-role="accountant"][data-accountant-mobile-mode="home"] #recordsView .pagination-row {
    display: none;
  }

  body[data-role="accountant"][data-accountant-mobile-mode="records"] #recordsView .employee-balance-summary,
  body[data-role="accountant"][data-accountant-mobile-mode="records"] #recordsView .accountant-mobile-pending,
  body[data-role="accountant"][data-accountant-mobile-mode="issues"] #recordsView .employee-balance-summary,
  body[data-role="accountant"][data-accountant-mobile-mode="issues"] #recordsView .accountant-mobile-pending {
    display: none;
  }

  body[data-role="accountant"][data-accountant-mobile-mode="records"] #recordsView .accountant-mobile-record-filters,
  body[data-role="accountant"][data-accountant-mobile-mode="issues"] #recordsView .accountant-mobile-record-filters {
    display: grid;
  }

  .daily-balance-dashboard {
    padding: 12px;
  }

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

  .daily-balance-header .search-field,
  .daily-balance-header .search-field select {
    width: 100%;
  }

  .daily-balance-chart {
    justify-content: flex-start;
  }

  .daily-balance-item {
    width: 38px;
  }

  .pagination-row {
    justify-content: stretch;
    flex-wrap: wrap;
    padding-inline: 0;
  }

  .pagination-row span {
    flex: 1 0 100%;
    order: -1;
    text-align: center;
  }

  .pagination-row .header-button {
    flex: 1 1 0;
  }

  .table-panel {
    overflow: visible;
  }

  .table-scroll {
    overflow: visible;
    max-height: none;
  }

  table {
    display: block;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  tbody tr:not(.empty-row) {
    display: grid;
    gap: 9px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fffdf8;
  }

  tbody tr:not(.empty-row):hover {
    background: #fff8eb;
  }

  tbody tr.non-working-record:not(.empty-row) {
    background: #e5e7eb;
    border-color: #cbd5e1;
  }

  tbody tr.non-working-record:not(.empty-row):hover {
    background: #dfe3e8;
  }

  tbody tr:not(.empty-row) td {
    display: grid;
    grid-template-columns: minmax(94px, 38%) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 0;
    border: 0;
    text-align: right;
    word-break: break-word;
  }

  tbody tr.non-working-record:not(.empty-row) td {
    background: transparent;
  }

  tbody tr:not(.empty-row) td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 850;
    text-align: left;
    text-transform: uppercase;
  }

  tbody tr:not(.empty-row) td > * {
    justify-self: end;
  }

  .empty-row td {
    display: block;
    border: 0;
  }

  .action-row {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .table-action {
    min-height: 36px;
  }

  .employee-balance-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .employee-balance-summary p {
    text-align: left;
  }

  body.sidebar-collapsed .side-nav {
    grid-template-columns: repeat(6, minmax(38px, 1fr));
  }

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

@media (max-width: 520px) {
  .adjust-dialog {
    width: calc(100dvw - 12px);
    max-width: calc(100dvw - 12px);
    max-height: calc(100dvh - 12px);
  }

  .adjust-dialog .dialog-body {
    padding: 12px;
    overflow-x: hidden;
  }

  .adjust-dialog .inline-fields,
  .adjust-dialog .time-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .adjust-dialog input,
  .adjust-dialog select,
  .adjust-dialog textarea {
    font-size: 16px;
  }

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

  .nav-item {
    justify-content: flex-start;
    text-align: left;
  }
}
