:root {
  color-scheme: light;
  --om-bg: #f4f7fb;
  --om-panel: #ffffff;
  --om-panel-soft: #f8fbff;
  --om-ink: #102033;
  --om-muted: #66758a;
  --om-soft: #e7eef8;
  --om-line: #d7e2ef;
  --om-blue: #2563eb;
  --om-blue-dark: #1d4ed8;
  --om-blue-soft: #eff6ff;
  --om-navy: #12233c;
  --om-navy-2: #1d3557;
  --om-green: #059669;
  --om-green-soft: #ecfdf5;
  --om-amber: #d97706;
  --om-amber-soft: #fff7ed;
  --om-red: #dc2626;
  --om-red-soft: #fef2f2;
  --om-shadow: 0 14px 34px rgba(15, 35, 65, 0.07);
  --om-shadow-soft: 0 8px 22px rgba(15, 35, 65, 0.055);
  --om-radius: 12px;
  --om-control-height: 42px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 34rem),
    linear-gradient(180deg, #f8fbff 0%, var(--om-bg) 42%, #edf3fb 100%);
  color: var(--om-ink);
  font-size: 16px;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 100vh;
  padding: 20px 14px;
  background: linear-gradient(180deg, var(--om-navy) 0%, #162a46 100%);
  color: #dbeafe;
}

.brand {
  display: grid;
  gap: 8px;
  padding: 2px 2px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.24);
}

.brand h1 {
  margin: 0;
  color: #ffffff;
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.brand p {
  margin: 0;
  color: #b8c7dc;
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.45;
}

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

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #c8d7ea;
  font-weight: 850;
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.nav button:hover,
.nav button:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav button.active {
  border-color: rgba(147, 197, 253, 0.32);
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
  box-shadow: inset 3px 0 0 #60a5fa;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.10);
  font-size: 0;
}

.nav button:first-child .nav-icon::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 3px;
  box-shadow: inset 0 -5px 0 rgba(255, 255, 255, 0.22);
}

.nav button:nth-child(2) .nav-icon::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: inset -4px 0 0 rgba(255, 255, 255, 0.22);
}

.sidebar-stats {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
}

.mini-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}

.mini-stat span {
  color: #b8c7dc;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mini-stat strong {
  color: #ffffff;
  font-size: 0.95rem;
}

main {
  min-width: 0;
  padding: 24px clamp(18px, 2.2vw, 32px) 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1560px;
  margin: 0 auto 16px;
  padding: 2px 0;
}

.topbar h2 {
  margin: 0;
  color: #102033;
  font-size: clamp(1.65rem, 2vw, 2.12rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--om-muted);
  font-size: 0.96rem;
  font-weight: 700;
}

.topbar-actions,
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.primary,
.secondary,
.danger,
.button-link,
.view-toggle button,
.calendar-nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--om-control-height);
  padding: 0 17px;
  border-radius: 12px;
  border: 1px solid var(--om-line);
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.primary {
  border-color: var(--om-blue);
  background: linear-gradient(180deg, #2f6df1, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.18);
}

.primary:hover,
.primary:focus-visible {
  background: linear-gradient(180deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
}

.secondary,
.button-link {
  background: #ffffff;
  color: #1d4ed8;
}

.secondary:hover,
.button-link:hover,
.secondary:focus-visible,
.button-link:focus-visible {
  border-color: rgba(37, 99, 235, 0.45);
  background: var(--om-blue-soft);
}

.danger {
  border-color: #fecaca;
  background: #fff7f7;
  color: #b91c1c;
}

.danger:hover,
.danger:focus-visible {
  background: #fee2e2;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  min-height: var(--om-control-height);
  padding: 4px;
  border: 1px solid var(--om-line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: var(--om-shadow-soft);
}

.view-toggle button {
  min-height: 36px;
  border-color: transparent;
  background: transparent;
  color: #516174;
  box-shadow: none;
}

.view-toggle button.active {
  background: var(--om-blue);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.20);
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  max-width: 1560px;
  margin: 0 auto 10px;
}

.summary-card {
  position: relative;
  display: flex;
  min-height: 94px;
  flex-direction: column;
  padding: 14px 46px 13px 16px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: var(--om-shadow-soft);
  appearance: none;
  color: inherit;
  font: inherit;
  text-align: left;
  overflow: hidden;
}

button.summary-card {
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

button.summary-card:hover,
button.summary-card:focus-visible {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 15px 34px rgba(37, 99, 235, 0.12);
  outline: none;
  transform: translateY(-1px);
}

button.summary-card.active {
  border-color: rgba(37, 99, 235, 0.62);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12), var(--om-shadow-soft);
}

button.summary-card.active .kpi-icon {
  background: #2563eb;
  color: #ffffff;
}

.summary-card > span:not(.kpi-icon) {
  display: block;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kpi-icon {
  position: absolute;
  top: 13px;
  right: 13px;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.82rem;
  font-weight: 950;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  color: #0f1f35;
  font-size: clamp(1.65rem, 2.1vw, 2.1rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.summary-card:nth-child(4) strong,
.summary-card:nth-child(5) strong {
  font-size: clamp(1.42rem, 1.75vw, 1.78rem);
}

.summary-card small {
  display: block;
  margin-top: auto;
  padding-top: 8px;
  color: #66758a;
  font-size: 0.8rem;
  font-weight: 750;
}

.workflow-summary {
  max-width: 1560px;
  margin: 0 auto 10px;
  padding: 8px 10px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 22px rgba(15, 35, 65, 0.04);
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 13px;
  border: 1px solid #d7e2ef;
  border-radius: 999px;
  background: #ffffff;
  color: #334155;
  font-size: 0.86rem;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(15, 35, 65, 0.04);
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.status-pill:hover,
.status-pill:focus-visible {
  border-color: #93c5fd;
  background: #f8fbff;
  color: #1d4ed8;
  transform: translateY(-1px);
}

.status-pill strong {
  display: inline-grid;
  min-width: 24px;
  min-height: 20px;
  place-items: center;
  padding: 0 7px;
  border-radius: 999px;
  background: #eef4fb;
  color: #1d4ed8;
  font-size: 0.78rem;
}

.status-pill.active {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.12);
}

.status-pill.active strong {
  background: #2563eb;
  color: #ffffff;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  max-width: 1560px;
  margin: 0 auto;
}

.card,
.dashboard-panel {
  border: 1px solid rgba(37, 99, 235, 0.13);
  border-radius: 14px;
  background: var(--om-panel);
  box-shadow: var(--om-shadow);
}

.dashboard-panel {
  min-height: 0;
  padding: 0;
  overflow: visible;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 9px;
  border-bottom: 0;
  background: #ffffff;
}

.panel-head h3 {
  margin: 0;
  color: #102033;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
}

.panel-head p {
  margin: 4px 0 0;
  color: #66758a;
  font-size: 0.88rem;
  font-weight: 750;
}

.order-toolbar {
  display: grid;
  grid-template-columns: minmax(250px, 1.1fr) minmax(150px, 0.55fr) minmax(0, 2.2fr);
  gap: 10px;
  align-items: end;
  padding: 0 18px 14px;
  border-bottom: 1px solid var(--om-soft);
  background: #ffffff;
}

.order-toolbar > .actions {
  justify-content: flex-end;
}

.search-control {
  display: grid;
  gap: 5px;
  color: #617089;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sort-controls {
  display: grid;
  gap: 5px;
  color: #617089;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sort-controls select,
.search-control input,
label input,
label select,
label textarea {
  width: 100%;
  border: 1px solid #cbd7e6;
  border-radius: 12px;
  background: #ffffff;
  color: #102033;
  font-weight: 750;
}

.sort-controls select,
.search-control input,
label input,
label select {
  min-height: 40px;
  padding: 0 12px;
}

label textarea {
  min-height: 104px;
  padding: 12px;
  resize: vertical;
}

.table-wrap {
  width: 100%;
  min-height: 210px;
  overflow: auto;
  background: #ffffff;
  border-top: 1px solid #edf2f8;
  border-radius: 0 0 14px 14px;
}

.table-wrap,
.table-wrap table,
.table-wrap button,
.table-wrap .button-link {
  font-family: "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

table {
  width: 100%;
  min-width: 1080px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  color: #102033;
}

thead th:nth-child(1) { width: 20%; }
thead th:nth-child(2) { width: 12%; }
thead th:nth-child(3) { width: 13%; }
thead th:nth-child(4) { width: 12%; }
thead th:nth-child(5) { width: 15%; }
thead th:nth-child(6) { width: 10%; }
thead th:nth-child(7) { width: 8%; }
thead th:nth-child(8) { width: 10%; }

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 13px;
  border-bottom: 1px solid var(--om-soft);
  background: #f8fbff;
  color: #607089;
  font-size: 0.86rem;
  font-weight: 950;
  letter-spacing: 0.045em;
  text-align: left;
  text-transform: uppercase;
}

.table-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
  cursor: pointer;
}

.table-sort-button span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-sort-button span:last-child {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 3px 6px;
  border-radius: 999px;
  background: #eaf1ff;
  color: #2563eb;
  font-size: 0.63rem;
  font-weight: 950;
  letter-spacing: 0.03em;
  text-align: center;
}

.table-sort-button:not(.active) span:last-child {
  background: #eef4f8;
  color: #64748b;
}

.table-sort-button:hover,
.table-sort-button:focus-visible {
  color: #1d4ed8;
  outline: none;
}

.table-sort-button:focus-visible span:first-child {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 1080px;
  padding: 13px 14px;
  border-top: 1px solid #edf2f8;
  background: #fbfdff;
  color: #526278;
  font-size: 0.9rem;
  font-weight: 850;
}

.table-pagination div {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.table-pagination button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid #cbdcf2;
  border-radius: 10px;
  background: #ffffff;
  color: #1d4ed8;
  font-size: 0.84rem;
  font-weight: 950;
  cursor: pointer;
}

.table-pagination button:hover:not(:disabled),
.table-pagination button:focus-visible:not(:disabled) {
  border-color: #93b7ed;
  background: #eff6ff;
  outline: none;
}

.table-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

tbody td {
  padding: 12px 13px;
  border-bottom: 1px solid #edf2f8;
  background: #ffffff;
  vertical-align: middle;
  font-size: 0.91rem;
  line-height: 1.3;
  overflow: visible;
}

tbody tr {
  position: relative;
  height: 76px;
  transition: background 140ms ease, box-shadow 140ms ease;
}

tbody tr:hover td {
  background: #fbfdff;
}

tbody tr.overdue td {
  background: #ffffff;
}

tbody tr.overdue {
  box-shadow: inset 5px 0 0 var(--om-red);
}

tbody tr.urgent {
  box-shadow: inset 5px 0 0 var(--om-amber);
}

td.file-cell,
td.timeline-cell,
td.financial-cell,
td.client-cell,
td.workflow-cell {
  vertical-align: middle;
}

.file-cell strong,
.client-cell strong,
.financial-cell strong,
.timeline-cell strong,
.workflow-cell strong {
  display: block;
  color: #102033;
  font-weight: 950;
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-cell span,
.timeline-cell span,
.appointment-cell span,
.financial-cell span,
.workflow-cell span,
.muted {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 0.84rem;
  font-weight: 700;
}

.truncate-line {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-cell {
  display: inline-grid;
  gap: 4px;
  color: #0f3b63;
  font-weight: 900;
  max-width: 100%;
}

.appointment-cell.empty {
  display: inline;
  min-height: 0;
  padding: 0;
  color: #64748b;
  text-align: left;
  font-size: 0.98rem;
  font-weight: 800;
}

.appointment-cell strong {
  color: #0f3b63;
  font-weight: 900;
}

.financial-cell .commission-line {
  color: #2563eb;
}

.is-overdue {
  color: var(--om-red) !important;
  font-weight: 950;
}

.is-urgent {
  color: var(--om-amber) !important;
  font-weight: 950;
}

.overdue-badge,
.urgent-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 950;
}

.overdue-badge {
  background: var(--om-red-soft);
  color: #b91c1c;
}

.urgent-badge {
  background: var(--om-amber-soft);
  color: #9a3412;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 950;
}

.status-received {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.status-appointment,
.status-scheduled {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}

.status-inspecting {
  background: #ecfeff;
  border-color: #a5f3fc;
  color: #0e7490;
}

.status-writing,
.status-in-progress {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}

.status-overdue {
  background: #fef2f2;
  border-color: #fecaca;
  color: #dc2626;
}

.status-complete,
.status-completed,
.status-paid {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #047857;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 96px;
}

.row-actions button,
.row-actions .button-link,
.row-menu summary {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid #d7e2ef;
  background: #ffffff;
  color: #1d4ed8;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.row-actions .row-primary {
  border-color: var(--om-blue);
  background: var(--om-blue);
  color: #ffffff;
}

.row-menu {
  position: relative;
}

.row-menu summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  padding: 0;
  list-style: none;
  overflow: hidden;
  color: transparent;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.04);
}

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

.row-menu summary::after {
  content: "...";
  margin-left: 0;
  letter-spacing: 0.08em;
  color: #1d4ed8;
}

.row-menu[open] summary {
  border-color: #93c5fd;
  background: #eff6ff;
}

.row-menu > div {
  position: absolute;
  right: 0;
  z-index: 20;
  display: grid;
  min-width: 134px;
  gap: 6px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid #d7e2ef;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(15, 35, 65, 0.14);
}

.row-menu > div button,
.row-menu > div .button-link {
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  color: #334155;
  text-decoration: none;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 34px;
  border: 1px dashed #cbd7e6;
  border-radius: 14px;
  margin: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: #64748b;
  text-align: center;
  font-weight: 750;
}

.empty strong {
  display: block;
  margin-bottom: 6px;
  color: #102033;
  font-size: 1.2rem;
}

.form-card {
  padding: 18px;
}

.card-title {
  margin: 0 0 14px;
  color: #102033;
  font-size: 1.3rem;
}

form,
label {
  display: grid;
  gap: 8px;
}

form {
  gap: 14px;
}

label {
  color: #243348;
  font-size: 0.86rem;
  font-weight: 900;
}

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

.file-number-controls {
  display: grid;
  grid-template-columns: minmax(78px, 0.55fr) minmax(130px, 0.9fr) minmax(180px, 1.3fr);
  gap: 8px;
}

.file-number-subfield {
  display: grid;
  gap: 5px;
}

.file-number-subfield-label {
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 850;
}

.inline-check input {
  width: 18px;
  height: 18px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(6px);
}

.modal-backdrop[hidden],
[hidden] {
  display: none !important;
}

.modal {
  width: min(760px, 100%);
  max-height: min(900px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
}

.order-form-modal {
  width: min(760px, 100%);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--om-soft);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.modal-head h3 {
  margin: 0;
  color: #102033;
  font-size: 1.25rem;
}

.close {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--om-line);
  border-radius: 12px;
  background: #f8fbff;
  color: #334155;
  font-size: 1.05rem;
  font-weight: 950;
}

.close:hover,
.close:focus-visible {
  background: var(--om-blue-soft);
  color: var(--om-blue);
}

.modal-body {
  padding: 18px;
}

.job-detail {
  display: grid;
  gap: 12px;
}

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

.detail-item {
  padding: 12px;
  border: 1px solid var(--om-soft);
  border-radius: 12px;
  background: #f8fbff;
}

.detail-item span {
  display: block;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.detail-item strong {
  display: block;
  margin-top: 5px;
  color: #102033;
}

.calendar {
  padding: 18px;
}

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

.calendar-head h3 {
  margin: 0;
  color: #102033;
  font-size: 1.25rem;
}

.calendar-nav {
  display: flex;
  gap: 8px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(132px, 1fr));
  min-width: 960px;
  border: 1px solid var(--om-soft);
  border-radius: 14px;
  overflow: hidden;
}

.weekday,
.day,
.calendar-day-name,
.calendar-cell {
  border-right: 1px solid var(--om-soft);
  border-bottom: 1px solid var(--om-soft);
}

.weekday,
.calendar-day-name {
  padding: 11px;
  background: #f8fbff;
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.day,
.calendar-cell {
  min-height: 128px;
  padding: 10px;
  background: #ffffff;
}

.day.outside,
.calendar-cell.other-month {
  background: #f8fafc;
  color: #94a3b8;
}

.day-number,
.calendar-date {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #102033;
  font-weight: 950;
}

.day-number span:last-child {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 950;
}

.badge-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.event-badge,
.calendar-event {
  display: block;
  margin-top: 8px;
  padding: 7px 8px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 0.78rem;
  font-weight: 850;
  text-align: left;
}

.event-badge {
  width: 100%;
  margin-top: 0;
}

.event-badge.urgent {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.event-badge.completed {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #047857;
}

.event-badge.overdue,
.calendar-event.overdue {
  border-color: #fecaca;
  background: #fff7f7;
  color: #b91c1c;
}

.calendar-scroll {
  overflow: auto;
}

.modal-body .summary-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 0 16px;
}

.modal-body .summary-card {
  min-height: 94px;
  padding: 15px;
}

.modal-body .summary-card strong {
  font-size: 1.35rem;
  line-height: 1.1;
}

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

  .sidebar {
    position: relative;
    min-height: auto;
  }

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

@media (max-width: 760px) {
  body {
    font-size: 15px;
  }

  .sidebar {
    gap: 12px;
    padding: 14px 12px;
  }

  .brand {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 3px 10px;
    align-items: center;
    padding-bottom: 10px;
  }

  .brand-mark {
    grid-row: 1 / span 2;
  }

  .brand p {
    line-height: 1.35;
  }

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

  .nav button {
    justify-content: center;
    min-height: 42px;
  }

  .sidebar-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 0;
  }

  .mini-stat {
    display: grid;
    gap: 3px;
    align-content: center;
    min-height: 56px;
    padding: 8px;
  }

  .mini-stat span {
    font-size: 0.6rem;
  }

  .mini-stat strong {
    font-size: 0.88rem;
  }

  main {
    padding: 18px 12px 28px;
  }

  .topbar,
  .panel-head,
  .calendar-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .actions {
    width: 100%;
  }

  .topbar h2 {
    font-size: 1.55rem;
  }

  .primary,
  .secondary,
  .danger,
  .button-link,
  .view-toggle,
  .view-toggle button {
    width: 100%;
  }

  .summary-cards,
  .form-row,
  .detail-grid,
  .file-number-controls {
    grid-template-columns: 1fr;
  }

  .summary-card {
    min-height: 98px;
    padding-right: 44px;
  }

  main > .summary-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  main > .summary-cards .receivable-card {
    grid-column: 1 / -1;
  }

  main > .summary-cards .summary-card > span:not(.kpi-icon) {
    font-size: 0.68rem;
    line-height: 1.25;
  }

  main > .summary-cards .summary-card strong {
    font-size: 1.55rem;
  }

  .dashboard-panel {
    min-height: 0;
  }

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

  .table-wrap {
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
    padding: 12px;
    background: #f4f7fb;
  }

  tbody tr {
    height: auto;
    border: 1px solid #d7e2ef;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 35, 65, 0.06);
    overflow: hidden;
  }

  tbody tr.overdue {
    box-shadow: inset 4px 0 0 var(--om-red), 0 10px 24px rgba(15, 35, 65, 0.06);
  }

  tbody td {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 12px;
    padding: 9px 12px;
    border-bottom: 1px solid #edf2f8;
  }

  tbody td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 950;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

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

  .row-actions {
    justify-content: flex-start;
  }

  .row-actions button,
  .row-actions .button-link,
  .row-menu summary {
    width: auto;
  }

  .row-menu > div {
    left: 0;
    right: auto;
  }
}
