:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #d9e0e7;
  --text: #17212b;
  --muted: #677381;
  --accent: #176b5b;
  --accent-dark: #0f5447;
  --danger: #b42318;
  --warning: #9a5b13;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app-topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: stretch;
  min-height: 72px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(90deg, #062c35, #073b44);
  color: #d9e6ea;
  box-shadow: 0 2px 10px rgba(16, 24, 40, 0.12);
}

.top-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 190px;
  padding: 0 22px;
  color: #ffffff;
}

.top-brand .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #0ea58c;
  color: #ffffff;
  font-weight: 700;
}

.top-brand strong {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
}

.top-nav {
  display: flex;
  align-items: stretch;
  min-width: 0;
  overflow: visible;
}

.top-nav-group {
  position: relative;
  display: flex;
  flex: 0 0 auto;
}

.top-nav-group > button {
  border: 0;
  background: transparent;
  border-radius: 10px;
  color: #d6e2e8;
  font-size: 15px;
  font-weight: 500;
  padding: 14px 22px;
  margin: 8px 2px;
  cursor: pointer;
}

.top-nav-group > button:hover,
.top-nav-group.active > button {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-weight: 600;
}

.top-nav-menu {
  position: absolute;
  top: 72px;
  left: 0;
  z-index: 30;
  display: none;
  min-width: 230px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 0;
  background: #0b2834;
  box-shadow: 0 16px 30px rgba(16, 24, 40, 0.25);
  padding: 12px;
}

.top-nav-menu-wide {
  min-width: 420px;
  columns: 2;
}

.top-nav-group:hover .top-nav-menu {
  display: grid;
  gap: 4px;
}

body.top-nav-closed .top-nav-menu {
  display: none !important;
}

.top-nav-menu a {
  display: block;
  break-inside: avoid;
  border-radius: 6px;
  color: #b9c8cd;
  padding: 10px 12px;
}

.top-nav-menu a:hover,
.top-nav-menu a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 0 14px;
}

.top-icon-btn {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  cursor: pointer;
}

.top-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  line-height: 1.15;
  padding-left: 10px;
  cursor: pointer;
}

.top-user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 180px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 20;
  display: flex;
  flex-direction: column;
}

.top-user-menu[hidden] {
  display: none;
}

.top-user-menu a,
.top-user-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.top-user-menu a[hidden],
.top-user-menu button[hidden] {
  display: none;
}

.top-user-menu a:hover,
.top-user-menu button:hover {
  background: var(--surface-soft);
}

.top-user-avatar {
  display: inline-grid;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: #0ea58c;
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
}

.top-user-copy {
  display: grid;
}

.top-user-copy strong {
  font-size: 13px;
  font-weight: 650;
  color: #ffffff;
}

.top-user-copy small {
  color: #92a6ad;
  font-size: 12px;
}

.top-user-chevron {
  flex: 0 0 auto;
  color: #92a6ad;
}

@media (max-width: 1180px) {
  .top-brand {
    min-width: auto;
  }

  .top-nav-group > button {
    padding-inline: 10px;
  }

  .top-user {
    display: none;
  }
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 4;
  display: none;
  flex-direction: column;
  width: 260px;
  border-right: 1px solid var(--line);
  background: #13201d;
  color: #f7faf9;
  padding: 18px 14px;
  transition: width 160ms ease;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 0 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 2px 6px;
}

.brand-mark {
  flex: 0 0 auto;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  font-weight: 700;
}

.brand-copy {
  min-width: 0;
}

.brand strong,
.brand small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: #a8bbb6;
}

.sidebar-toggle {
  display: inline-grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-content: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.sidebar-toggle span {
  display: block;
  width: 15px;
  height: 2px;
  border-radius: 999px;
  background: #d7e2df;
}

.sidebar-toggle-floating {
  display: none;
}

.side-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 4px 0 16px;
}

.nav-section {
  display: grid;
  gap: 3px;
}

.nav-section h2 {
  margin: 0 0 4px;
  padding: 0 12px;
  color: #7fa096;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  min-height: 36px;
  border-radius: 8px;
  padding: 8px 12px;
  color: #d7e2df;
  line-height: 1.15;
}

.sidebar nav a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar nav a:hover,
.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

body.sidebar-collapsed .sidebar {
  width: 76px;
  padding-inline: 10px;
}

body.sidebar-collapsed .sidebar-top {
  justify-content: center;
}

body.sidebar-collapsed .brand {
  padding-inline: 0;
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .nav-section h2,
body.sidebar-collapsed .sidebar nav a span {
  display: none;
}

body.sidebar-collapsed .sidebar-toggle {
  position: fixed;
  left: 21px;
  bottom: 18px;
}

body.sidebar-collapsed .side-nav {
  align-items: center;
  padding-top: 12px;
}

body.sidebar-collapsed .nav-section {
  gap: 7px;
}

body.sidebar-collapsed .sidebar nav a {
  width: 42px;
  height: 42px;
  justify-content: center;
  padding: 0;
}

body.sidebar-collapsed .sidebar nav a::before {
  content: attr(data-short);
  font-size: 12px;
  font-weight: 750;
}

.app-shell {
  margin-left: 0;
  min-height: 100vh;
  padding: 100px clamp(16px, 3vw, 40px) 28px;
  transition: margin-left 160ms ease;
}

body.sidebar-collapsed .app-shell {
  margin-left: 0;
}

.page {
  width: 100%;
  margin: 0;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.page-title h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.page-title p {
  margin: 6px 0 0;
  color: var(--muted);
}

.toolbar,
.card,
.summary-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
  gap: 10px;
  padding: 14px;
  margin-bottom: 16px;
}

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

.card-body {
  min-width: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.card-header h2,
.card-header h3 {
  margin: 0;
  font-size: 16px;
}

.card-body {
  padding: 16px;
}

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

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

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.summary-card {
  padding: 16px;
}

.summary-card > span {
  color: var(--muted);
  display: block;
  margin-bottom: 10px;
}

.summary-card strong {
  display: block;
  min-width: 0;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.workflow-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.workflow-actions {
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.action-menu {
  position: relative;
}

.action-menu summary {
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 650;
}

.action-menu summary::-webkit-details-marker {
  display: none;
}

.action-menu[open] div {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 4;
  display: grid;
  min-width: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.action-menu button {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
}

.action-menu button:hover {
  background: var(--surface-soft);
}

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

.workflow-status-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
}

.workflow-status-card span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
}

.workflow-status-card strong {
  display: block;
}

.workflow-warning {
  display: grid;
  gap: 8px;
  border: 1px solid #f2c48d;
  border-radius: 8px;
  background: #fff8ed;
  color: #7a4308;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.workflow-warning ul {
  margin: 0;
  padding-left: 18px;
}

.next-action-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #bedbd4;
  border-radius: 8px;
  background: #effaf7;
  color: #133d35;
  padding: 16px;
  margin-bottom: 16px;
}

.next-action-panel.done {
  background: #f5f7fa;
  color: var(--text);
}

.next-action-panel span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-weight: 650;
}

.next-action-panel strong {
  font-size: 20px;
}

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

.attention-card {
  display: grid;
  gap: 8px;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 16px;
  text-align: left;
  cursor: pointer;
}

.attention-card:hover {
  border-color: var(--accent);
  background: #ffffff;
}

.attention-card span {
  color: var(--muted);
  font-weight: 650;
}

.attention-card strong {
  font-size: 22px;
}

.action-form-box {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  padding: 12px;
}

.action-form-box summary {
  cursor: pointer;
  font-weight: 750;
}

.action-form-box form {
  margin-top: 14px;
}

.workflow-stepper {
  display: grid;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.workflow-step {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  color: var(--muted);
  font-weight: 650;
}

.workflow-dot {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.workflow-step.completed {
  color: var(--accent);
}

.workflow-step.completed .workflow-dot,
.workflow-step.current .workflow-dot {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.workflow-step.current {
  color: var(--text);
}

.workflow-tabs {
  margin-top: 6px;
}

.helper-text {
  margin: 0 0 14px;
  color: var(--muted);
}

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

.workflow-timeline {
  display: grid;
  gap: 0;
}

.timeline-row {
  display: grid;
  grid-template-columns: 18px minmax(160px, 1fr) 2fr;
  gap: 12px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.timeline-row span {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-row em {
  color: var(--muted);
  font-style: normal;
}

.batch-wizard-page {
  max-width: none;
}

.batch-wizard-page,
.batch-wizard-page form,
.batch-wizard-page .card,
.batch-wizard-page .card-body,
.batch-wizard-page .table-scroll {
  width: 100%;
}

.contract-wizard-page {
  container-type: inline-size;
}

.batch-wizard-stepper {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.batch-wizard-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 12px;
  color: var(--muted);
}

.batch-wizard-step span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  font-weight: 750;
}

.batch-wizard-step strong {
  color: inherit;
}

.batch-wizard-step.completed,
.batch-wizard-step.current {
  border-color: #bedbd4;
  color: var(--accent);
}

.batch-wizard-step.completed span,
.batch-wizard-step.current span {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.batch-wizard-step.current {
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.12);
}

.erp-stepper {
  display: grid;
  grid-template-columns: repeat(var(--step-count, 5), minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.erp-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 12px;
  color: var(--muted);
}

.erp-step span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  font-weight: 750;
}

.erp-step.completed,
.erp-step.current {
  border-color: #bedbd4;
  color: var(--accent);
}

.erp-step.completed span,
.erp-step.current span {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.erp-step.current {
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.12);
}

.erp-warning-panel {
  border: 1px solid #f0c98d;
  border-radius: 10px;
  background: #fff7ed;
  color: #7c3f0a;
  padding: 12px 14px;
}

.erp-warning-panel ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.batch-wizard-page .card-body {
  display: grid;
  gap: 16px;
}

.batch-wizard-page table input {
  min-width: 0;
}

.contract-wizard-page th:nth-child(1),
.contract-wizard-page td:nth-child(1) {
  min-width: 150px;
}

.contract-wizard-page th:nth-child(2),
.contract-wizard-page td:nth-child(2),
.contract-wizard-page th:nth-child(3),
.contract-wizard-page td:nth-child(3),
.contract-wizard-page th:nth-child(4),
.contract-wizard-page td:nth-child(4),
.contract-wizard-page th:nth-child(5),
.contract-wizard-page td:nth-child(5),
.contract-wizard-page th:nth-child(6),
.contract-wizard-page td:nth-child(6) {
  min-width: 116px;
}

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

.confirm-grid .card {
  margin-bottom: 0;
}

.empty.compact {
  padding: 14px;
  text-align: left;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(10, 22, 20, 0.46);
  padding: 24px;
}

.modal-panel {
  width: min(1040px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(16, 24, 40, 0.28);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.modal-close {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.modal-body {
  display: grid;
  gap: 16px;
  padding: 16px;
}

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

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

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

.form-field {
  position: relative;
}

.field-label-text {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  color: var(--muted);
}

.required-mark {
  color: var(--danger);
  font-weight: 800;
}

.field-helper,
.field-error {
  font-size: 11px;
  line-height: 1.35;
}

.field-helper {
  color: var(--muted);
}

.field-error {
  color: var(--danger);
}

.form-field.has-error input,
.form-field.has-error select,
.form-field.has-error textarea {
  border-color: var(--danger);
}

input[readonly],
textarea[readonly] {
  background: #f4f7f9;
  color: #41505f;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #eef2f5;
  color: #7b8794;
  cursor: not-allowed;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.14);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--text);
}

.check-row input {
  width: 16px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.field-group .field-label-text {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.field-group .check-row {
  min-height: 30px;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.auth-card {
  width: 360px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  padding: 32px 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  font-size: 16px;
}

.auth-brand .brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.auth-card h1 {
  margin: 0 0 18px;
  font-size: 19px;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.btn.sm {
  min-height: 28px;
  padding: 5px 10px;
  font-size: 12.5px;
}

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.btn.primary:hover {
  background: var(--accent-dark);
}

.btn.danger {
  border-color: #f0b8b2;
  color: var(--danger);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll table {
  min-width: 960px;
}

.contract-wizard-page .table-scroll table {
  min-width: 1180px;
}

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

td input,
td select {
  width: 100%;
  min-width: 0;
}

.number-cell {
  text-align: right;
  white-space: nowrap;
}

.action-cell {
  min-width: 112px;
  white-space: nowrap;
}

th {
  background: var(--surface-soft);
  color: #465563;
  font-size: 12px;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--surface-soft);
  color: #465563;
  font-size: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: #eef4ff;
  color: #264b87;
  font-size: 12px;
  font-weight: 700;
}

.status-badge.success,
.status-badge.matched {
  background: #e8f7ef;
  color: #176b45;
}

.status-badge.warning,
.status-badge.waiting_acceptance,
.status-badge.difference {
  background: #fff4df;
  color: #8a4f00;
}

.status-badge.muted,
.status-badge.waiting,
.status-badge.partial {
  background: #eef2f7;
  color: #556274;
}

.ops-page {
  max-width: none;
  margin: -14px -12px 0;
}

.ops-titlebar {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
}

.ops-title-left {
  display: flex;
  align-items: center;
  gap: 7px;
}

.ops-title-left h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 750;
}

.ops-menu-btn,
.ops-icon-btn,
.ops-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: #4d5968;
  padding: 6px 10px;
  cursor: pointer;
}

.ops-menu-btn {
  min-width: 28px;
  border-color: transparent;
  background: transparent;
  font-weight: 800;
}

.ops-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-height: 46px;
}

.ops-tabs button {
  border: 0;
  border-left: 1px solid transparent;
  background: transparent;
  color: #8a94a6;
  padding: 0 18px;
  cursor: pointer;
}

.ops-tabs button.active {
  color: var(--text);
  font-weight: 700;
}

.ops-quick-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.ops-icon-btn {
  min-width: 42px;
  background: #e9eef6;
  color: #6d788b;
  font-size: 12px;
}

.ops-commandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  padding: 7px 0;
}

.ops-command-left,
.ops-search,
.ops-footer,
.ops-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ops-command-left .btn.primary {
  min-height: 34px;
  border-color: #1db9b1;
  background: #22c7bf;
  text-transform: uppercase;
}

.ops-counter {
  color: var(--muted);
  font-size: 13px;
}

.ops-search {
  margin-left: auto;
}

.ops-search input {
  width: min(360px, 28vw);
}

.ops-search input,
.ops-search select {
  min-height: 34px;
  border-radius: 4px;
  background: #ffffff;
}

.ops-tool-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.ops-table-card {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08);
}

.ops-table {
  min-width: 1420px;
  font-size: 13px;
}

.ops-table th,
.ops-table td {
  padding: 10px 12px;
  color: #667085;
}

.ops-table th {
  height: 48px;
  background: #ffffff;
  color: #525d6c;
  font-size: 13px;
  white-space: nowrap;
}

.ops-table tbody tr:nth-child(even) td {
  background: #f6f6f7;
}

.ops-table tbody tr:hover td {
  background: #eef6f4;
}

.ops-table th:last-child,
.ops-table td:last-child {
  position: sticky;
  right: 0;
  background: #ffffff;
  box-shadow: -8px 0 8px -8px rgba(16, 24, 40, 0.12);
}

.ops-table tbody tr:nth-child(even) td:last-child {
  background: #f6f6f7;
}

.ops-table tbody tr:hover td:last-child {
  background: #eef6f4;
}

.ops-check {
  width: 44px;
  text-align: center;
}

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

.ops-code {
  width: 72px;
  color: #7a8493;
}

.ops-primary-link {
  border: 0;
  background: transparent;
  color: #485469;
  cursor: pointer;
  padding: 0;
  font-weight: 750;
  text-align: left;
}

.ops-primary-link:hover,
.ops-row-actions .link-btn:hover {
  color: var(--accent);
  text-decoration: underline;
}

.ops-money {
  white-space: nowrap;
  color: #445066;
  font-weight: 650;
}

.ops-warning {
  color: #8a4b0f;
}

.ops-row-actions {
  display: flex;
  gap: 10px;
  white-space: nowrap;
}

.ops-footer {
  justify-content: space-between;
  padding: 12px 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.ops-page-btn {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.ops-page-btn.active {
  background: #00a99d;
  border-color: #00a99d;
  color: #ffffff;
}

.ops-page-btn.ellipsis {
  border: 0;
  background: transparent;
  cursor: default;
  color: #94a3b8;
}

.ops-page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.orders-ops-page .ops-table {
  min-width: 1520px;
}

.orders-ops-page #order-search-form input:first-child {
  width: min(320px, 22vw);
}

.orders-ops-page #order-search-form input {
  width: min(210px, 15vw);
}

.orders-ops-page #order-search-form select {
  width: min(180px, 13vw);
}

.status-badge.active,
.status-badge.signed {
  background: #e8f6f1;
  color: #176b5b;
}

.status-badge.completed {
  background: #eef2f6;
  color: #465563;
}

.status-badge.cancelled {
  background: #fff1f0;
  color: var(--danger);
}

.status-badge.done {
  background: #e8f7ef;
  color: #176b45;
}

.status-badge.in_progress {
  background: #fff4df;
  color: #8a4f00;
}

.status-badge.priority-low {
  background: #eef2f7;
  color: #556274;
}

.status-badge.priority-medium {
  background: #fff4df;
  color: #8a4f00;
}

.status-badge.priority-high {
  background: #fff1f0;
  color: var(--danger);
}

.tasks-ops-page .ops-commandbar {
  flex-wrap: wrap;
  min-height: auto;
  gap: 10px 18px;
}

.tasks-ops-page .ops-search {
  flex-wrap: wrap;
  row-gap: 8px;
}

.tasks-ops-page .ops-search input {
  width: min(220px, 18vw);
}

.tasks-ops-page .ops-search select {
  width: min(170px, 15vw);
}

.tasks-ops-page .ops-search .inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
}

.tasks-ops-page .ops-search .inline-check input {
  width: auto;
}

.tasks-summary-cards {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 4px 0 20px;
}

.tasks-summary-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 220px;
  height: 86px;
  padding: 0 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.tasks-summary-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
}

.tasks-summary-icon.teal {
  background: #ddf8f3;
  color: #00a99d;
}

.tasks-summary-icon.red {
  background: #fff1f0;
  color: var(--danger);
}

.tasks-summary-icon.amber {
  background: #fff4df;
  color: #8a4f00;
}

.tasks-summary-icon.green {
  background: #e8f7ef;
  color: #176b45;
}

.tasks-summary-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.tasks-summary-copy span {
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tasks-summary-copy strong {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
}

.tasks-ops-page .ops-table tr.task-priority-high {
  border-left: 3px solid var(--danger);
}

.tasks-ops-page .ops-table tr.task-priority-medium {
  border-left: 3px solid #d99a1f;
}

.tasks-ops-page .ops-table tr.task-priority-low {
  border-left: 3px solid transparent;
}

.tasks-view-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  margin-left: 4px;
}

.tasks-view-toggle button {
  border: 0;
  background: #ffffff;
  color: #556274;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.tasks-view-toggle button + button {
  border-left: 1px solid var(--line);
}

.tasks-view-toggle button.active {
  background: var(--accent);
  color: #ffffff;
}

.task-board {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 8px;
}

.task-board-column {
  flex: 1 1 260px;
  min-width: 260px;
  max-width: 320px;
  background: #f4f6f9;
  border-radius: 12px;
  padding: 10px;
}

.task-board-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 10px;
  font-weight: 700;
  color: #33404f;
}

.task-board-count {
  display: inline-flex;
  min-width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e2e8f0;
  color: #556274;
  font-size: 12px;
  font-weight: 700;
  padding: 0 6px;
}

.task-board-column-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 80px;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.task-board-column-body.drag-over {
  background: rgba(23, 107, 91, 0.08);
  outline: 2px dashed var(--accent);
}

.task-board-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 14px 6px;
  text-align: center;
}

.task-board-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.05);
  cursor: grab;
}

.task-board-card.dragging {
  opacity: 0.4;
}

.task-board-card.task-priority-high {
  border-left: 3px solid var(--danger);
}

.task-board-card.task-priority-medium {
  border-left: 3px solid #d99a1f;
}

.task-board-card-title {
  font-weight: 650;
  color: #0f172a;
  margin-bottom: 4px;
}

.task-board-card-meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.task-board-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 6px;
}

.task-board-card-deadline {
  color: var(--muted);
}

.task-board-card-actions {
  display: flex;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid #eef2f7;
}

.item-row {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 0.7fr 0.8fr 1fr 0.7fr auto;
  gap: 10px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.item-row:first-child {
  padding-top: 0;
}

.item-row:last-child {
  border-bottom: 0;
}

.totals-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.total-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.total-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.total-box strong {
  font-size: 16px;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  overflow-x: auto;
}

.tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 12px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.tab.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

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

.detail-item {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.detail-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

/* ---- Shared "detail page" design system ---- */

.detail-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.detail-breadcrumb-sep {
  color: #c7d0d8;
}

.detail-breadcrumb-current {
  color: var(--text);
  font-weight: 600;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

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

.detail-title-row h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 750;
}

.detail-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 999px;
  padding: 4px 10px 4px 8px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.detail-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.detail-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  background: #eef2f7;
  color: #556274;
}

.detail-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.detail-status-pill.success {
  background: #e8f7ef;
  color: #176b45;
}

.detail-status-pill.warning {
  background: #fff4df;
  color: #8a4f00;
}

.detail-status-pill.danger {
  background: #fff1f0;
  color: var(--danger);
}

.detail-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-subtitle-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12px;
  color: var(--text);
}

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

.detail-summary-cards {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.detail-summary-card {
  flex: 1 1 220px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.detail-summary-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.detail-summary-card strong {
  display: block;
  font-size: 26px;
  font-weight: 750;
  color: #0f172a;
}

.detail-summary-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.detail-card {
  background: #ffffff;
  border: 1px solid #e9edf2;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.detail-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid #eef1f5;
  cursor: pointer;
  user-select: none;
}

.detail-card-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  flex: 1 1 auto;
}

.detail-card-count {
  background: #eef2f7;
  color: #556274;
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12px;
  font-weight: 700;
}

.detail-card-header-actions {
  display: flex;
  gap: 8px;
}

.detail-chevron {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  padding: 2px;
  transition: transform 0.15s ease;
}

.detail-card.collapsed .detail-chevron {
  transform: rotate(-90deg);
}

.detail-card.collapsed .detail-card-body {
  display: none;
}

.detail-card-body {
  padding: 18px;
}

.detail-card-body h3 {
  margin: 0 0 12px;
  padding-top: 18px;
  border-top: 1px solid #eef1f5;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.detail-card-body h3:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.detail-icon-badge {
  display: inline-grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  background: #ddf8f3;
  color: #00a99d;
}

.detail-icon-badge.sm {
  width: 22px;
  height: 22px;
  border-radius: 7px;
}

.detail-icon-badge.blue {
  background: #e5f0ff;
  color: #2563eb;
}

.detail-icon-badge.purple {
  background: #f1e8fd;
  color: #7c3aed;
}

.detail-icon-badge.amber {
  background: #fff4df;
  color: #8a4f00;
}

.detail-icon-badge.green {
  background: #e8f7ef;
  color: #176b45;
}

.detail-icon-badge.red {
  background: #fff1f0;
  color: var(--danger);
}

.detail-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f1f4f8;
}

.detail-field span {
  color: var(--muted);
  font-size: 12px;
}

.detail-field strong {
  font-size: 14px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.detail-two-col.with-arrow {
  grid-template-columns: 1fr auto 1fr;
}

.detail-address-arrow {
  display: flex;
  align-items: center;
  color: var(--muted);
}

.detail-tone-panel {
  border-radius: 12px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #eef1f5;
}

.detail-tone-panel.success {
  background: #f0faf6;
  border-color: #d7f0e4;
}

.detail-tone-panel-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.detail-tone-panel.success .detail-tone-panel-header {
  color: #176b45;
}

.detail-mini-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.detail-mini-field:not(:last-child) {
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.detail-mini-field span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.detail-mini-field strong {
  display: block;
  font-size: 13px;
  font-weight: 650;
}

.detail-warning-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fff8e1;
  color: #8a5b00;
  border: 1px solid #f4e3ab;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  margin-top: 14px;
}

.detail-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: 32px 16px;
  border: 1.5px dashed #dde3ea;
  border-radius: 12px;
  background: #fafbfc;
}

.detail-empty-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #eef2f7;
  color: var(--muted);
  margin-bottom: 4px;
}

.detail-empty-state strong {
  font-size: 14px;
}

.detail-empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  max-width: 360px;
}

.detail-timeline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
}

.detail-timeline-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c7cdd5;
}

.detail-timeline-item.done {
  color: #22c7bf;
}

.detail-timeline-item div {
  display: flex;
  flex-direction: column;
}

.detail-timeline-item span {
  color: var(--muted);
  font-size: 11px;
}

.detail-timeline-item strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.detail-progress {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eef1f5;
}

.detail-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
}

.detail-progress-top strong {
  color: var(--accent);
}

.detail-progress-track {
  height: 8px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.detail-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c7bf, #176b5b);
}

.detail-progress-caption {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 860px) {
  .detail-field-grid,
  .detail-timeline-grid,
  .detail-two-col {
    grid-template-columns: 1fr;
  }

  .detail-two-col.with-arrow {
    grid-template-columns: 1fr;
  }

  .detail-address-arrow {
    transform: rotate(90deg);
    justify-content: center;
    padding: 4px 0;
  }
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 24px;
  top: 88px;
  z-index: 50;
  max-width: 360px;
  border: 1px solid #bedbd4;
  border-radius: 8px;
  background: #effaf7;
  color: #164e43;
  box-shadow: var(--shadow);
  padding: 12px 14px;
}

.error {
  border-color: #f0b8b2;
  background: #fff5f4;
  color: var(--danger);
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.inline-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 360px;
  margin: 4px 0;
}

.inline-edit input {
  width: 100px;
}

.negative {
  color: var(--danger);
}

body.public-layout {
  background: #f3f6f9;
}

body.public-layout .app-topbar,
body.public-layout .sidebar,
body.public-layout .sidebar-toggle-floating {
  display: none !important;
}

body.public-layout .app-shell,
body.public-layout.sidebar-collapsed .app-shell {
  margin-left: 0;
  padding: 0;
}

.public-request-page {
  min-height: 100vh;
  background: #f3f6f9;
  color: #17212b;
}

.public-request-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid #d8e1ea;
  background: #ffffff;
  padding: 18px clamp(18px, 4vw, 48px);
}

.public-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #0e3554;
}

.public-request-header h1 {
  margin: 0;
  color: #102a43;
  font-size: 24px;
}

.public-request-header p {
  margin: 4px 0 0;
  color: #526171;
}

.public-request-container {
  width: min(1100px, calc(100% - 32px));
  margin: 28px auto;
}

.public-stepper {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.public-stepper button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid #cfd9e3;
  border-radius: 8px;
  background: #ffffff;
  color: #526171;
  padding: 10px;
  text-align: left;
  cursor: pointer;
}

.public-stepper button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.public-stepper span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  border: 1px solid #bfd0df;
  background: #f6f9fc;
  color: #31566f;
  font-weight: 700;
}

.public-stepper strong {
  min-width: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.public-stepper .active {
  border-color: #2d6f9f;
  box-shadow: 0 0 0 2px rgba(45, 111, 159, 0.12);
}

.public-stepper .active span,
.public-stepper .done span {
  border-color: #2d6f9f;
  background: #2d6f9f;
  color: #ffffff;
}

.public-card {
  border: 1px solid #d8e1ea;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  padding: clamp(18px, 3vw, 28px);
}

.public-card-header {
  margin-bottom: 18px;
}

.public-card-header h2,
.public-success-card h2 {
  margin: 0;
  color: #102a43;
  font-size: 26px;
}

.public-card-header p,
.public-success-card p,
.public-request-footer {
  color: #5e6b78;
}

.public-choice-grid,
.public-form-grid,
.public-confirm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.public-choice {
  border: 1px solid #cfd9e3;
  border-radius: 10px;
  background: #ffffff;
  padding: 18px;
  text-align: left;
  cursor: pointer;
}

.public-choice strong {
  display: block;
  color: #102a43;
  font-size: 17px;
  margin-bottom: 8px;
}

.public-choice span {
  color: #5e6b78;
}

.public-choice.selected {
  border-color: #2d6f9f;
  background: #f1f7fc;
  box-shadow: 0 0 0 2px rgba(45, 111, 159, 0.12);
}

.public-form-grid label,
.public-lookup-row label {
  display: grid;
  gap: 7px;
  color: #415365;
  font-weight: 650;
}

.public-form-grid input,
.public-form-grid select,
.public-form-grid textarea,
.public-lookup-row input,
.public-schedule-table input,
.public-schedule-table select {
  width: 100%;
  border: 1px solid #cbd7e3;
  border-radius: 8px;
  background: #ffffff;
  color: #17212b;
  padding: 11px 12px;
}

.public-form-grid textarea {
  min-height: 94px;
  resize: vertical;
}

.public-form-grid input:focus,
.public-form-grid select:focus,
.public-form-grid textarea:focus,
.public-lookup-row input:focus,
.public-schedule-table input:focus,
.public-schedule-table select:focus,
.public-stepper button:focus,
.public-choice:focus,
.public-actions button:focus {
  outline: 3px solid rgba(45, 111, 159, 0.22);
  outline-offset: 2px;
}

.public-lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.public-error,
.public-warning {
  border: 1px solid #f0b8b2;
  border-radius: 8px;
  background: #fff5f4;
  color: #b42318;
  padding: 10px 12px;
  margin: 12px 0 0;
}

.public-warning {
  border-color: #f2d49b;
  background: #fff8e8;
  color: #7a4a10;
}

.public-summary-card,
.public-summary-section {
  border: 1px solid #d8e1ea;
  border-radius: 9px;
  background: #f8fafc;
  padding: 14px;
  margin-top: 14px;
}

.public-summary-card dl,
.public-summary-section dl {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
}

.public-summary-card dl div,
.public-summary-section dl div {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
  border-top: 1px solid #d8e1ea;
  padding-top: 8px;
}

.public-summary-section h3 {
  margin: 0;
  color: #102a43;
}

.public-summary-section dt {
  color: #647385;
}

.public-summary-section dd,
.public-summary-card dd {
  margin: 0;
  color: #17212b;
  font-weight: 650;
}

.public-table-wrap {
  overflow-x: auto;
  border: 1px solid #d8e1ea;
  border-radius: 9px;
  margin-bottom: 12px;
}

.public-schedule-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.public-schedule-table th,
.public-schedule-table td {
  border-bottom: 1px solid #d8e1ea;
  padding: 10px;
  text-align: left;
}

.public-schedule-table th {
  background: #f6f9fc;
  color: #415365;
}

.public-total-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.public-total-grid div {
  border: 1px solid #d8e1ea;
  border-radius: 9px;
  background: #f8fafc;
  padding: 14px;
}

.public-total-grid span {
  display: block;
  color: #647385;
  margin-bottom: 6px;
}

.public-total-grid strong {
  color: #102a43;
  font-size: 18px;
}

.public-confirm-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  color: #17212b;
  font-weight: 650;
}

.public-confirm-check input {
  margin-top: 3px;
}

.public-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #d8e1ea;
  margin-top: 24px;
  padding-top: 18px;
}

.public-actions.only {
  justify-content: center;
}

.public-request-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 0;
  padding: 0 4px;
}

.public-success-card {
  text-align: center;
}

.public-success-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 50%;
  background: #e8f6ef;
  color: #176b5b;
  font-size: 28px;
  font-weight: 800;
  margin: 0 auto 14px;
}

@media (max-width: 980px) {
  .app-topbar {
    display: none;
  }

  .sidebar {
    display: flex;
    width: 260px;
    box-shadow: 16px 0 30px rgba(16, 24, 40, 0.18);
  }

  .app-shell {
    margin-left: 0;
    padding: 68px 18px 18px;
  }

  body.sidebar-collapsed .sidebar {
    width: 260px;
    transform: translateX(-100%);
  }

  body.sidebar-collapsed .app-shell {
    margin-left: 0;
  }

  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .nav-section h2,
  body.sidebar-collapsed .sidebar nav a span {
    display: block;
  }

  body.sidebar-collapsed .side-nav {
    align-items: stretch;
  }

  body.sidebar-collapsed .sidebar nav a {
    width: auto;
    height: auto;
    justify-content: flex-start;
    padding: 8px 12px;
  }

  body.sidebar-collapsed .sidebar nav a::before {
    content: none;
  }

  body.sidebar-collapsed .sidebar-toggle,
  .sidebar-toggle {
    position: fixed;
    top: 18px;
    left: 18px;
    bottom: auto;
    background: #13201d;
    box-shadow: var(--shadow);
  }

  .sidebar .sidebar-toggle {
    display: none;
  }

  .sidebar-toggle-floating {
    display: inline-grid;
    z-index: 6;
  }

  .toolbar,
  .grid,
  .grid.three,
  .item-row,
  .totals-bar,
  .summary-grid,
  .workflow-status-grid,
  .erp-stepper,
  .batch-wizard-stepper,
  .confirm-grid,
  .detail-list {
    grid-template-columns: 1fr;
  }

  .page-header,
  .workflow-header,
  .next-action-panel,
  .timeline-row {
    display: block;
  }

  .page-header .actions,
  .workflow-actions {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .action-menu[open] div {
    left: 0;
    right: auto;
  }

  table {
    min-width: 900px;
  }

  .card {
    overflow-x: auto;
  }

  .public-request-header,
  .public-choice-grid,
  .public-form-grid,
  .public-confirm-grid,
  .public-total-grid {
    grid-template-columns: 1fr;
  }

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

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

  .public-actions,
  .public-request-footer {
    display: grid;
  }

  .public-actions .btn {
    width: 100%;
  }
}

/* ---- Attendance (Davomat) ---- */

.attendance-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.attendance-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.attendance-toolbar select,
.attendance-toolbar input {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.attendance-toolbar-spacer {
  flex: 1 1 auto;
}

.attendance-table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.attendance-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
  white-space: nowrap;
}

.attendance-table th,
.attendance-table td {
  border: 1px solid var(--line);
  padding: 5px 7px;
  text-align: center;
}

.attendance-table th.attendance-col-name,
.attendance-table td.attendance-col-name {
  text-align: left;
  white-space: normal;
  min-width: 160px;
}

.attendance-table th.attendance-col-position,
.attendance-table td.attendance-col-position {
  text-align: left;
  white-space: normal;
  min-width: 130px;
}

.attendance-table thead th {
  background: var(--surface-soft);
  font-weight: 700;
  color: #465563;
}

.attendance-dept-row td {
  background: #eaf1ff;
  color: #1f3a63;
  font-weight: 700;
  text-align: left;
}

.attendance-day-cell {
  cursor: pointer;
  min-width: 42px;
}

.attendance-day-cell:hover {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.attendance-day-cell.on_time {
  background: #e8f7ef;
  color: #176b45;
}

.attendance-day-cell.minor {
  background: #fff8e1;
  color: #8a6d00;
}

.attendance-day-cell.moderate {
  background: #ffe9d1;
  color: #9a4b00;
}

.attendance-day-cell.major,
.attendance-day-cell.absent {
  background: #fdeceb;
  color: #b42318;
}

.attendance-day-cell.no_data {
  background: var(--surface-soft);
  color: var(--muted);
}

.attendance-grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  border-radius: 6px;
  padding: 2px 6px;
  font-weight: 700;
}

.attendance-grade.grade-A {
  background: #e8f7ef;
  color: #176b45;
}

.attendance-grade.grade-B {
  background: #eaf3ff;
  color: #1f5fae;
}

.attendance-grade.grade-C {
  background: #fff8e1;
  color: #8a6d00;
}

.attendance-grade.grade-D {
  background: #ffe9d1;
  color: #9a4b00;
}

.attendance-grade.grade-E {
  background: #fdeceb;
  color: #b42318;
}

.attendance-panels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.attendance-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.attendance-panel h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--accent-dark);
}

.attendance-panel ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.6;
}

.attendance-panel table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.attendance-panel table th,
.attendance-panel table td {
  border: 1px solid var(--line);
  padding: 4px 6px;
  text-align: left;
}

.attendance-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 6px;
}

@media (max-width: 1100px) {
  .attendance-panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .attendance-panels {
    grid-template-columns: 1fr;
  }
}

