:root {
  color-scheme: light;
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #687382;
  --line: #d9dee5;
  --accent: #1f6f63;
  --accent-dark: #15544b;
  --file-link-color: #15544b;
  --sidebar-bg: #15202b;
  --sidebar-active: #09141f;
  --sidebar-widget: #0d1823;
  --warn: #a15b17;
  --danger: #a12d2d;
  --soft: #f6f8fa;
  --shadow: 0 18px 45px rgba(28, 37, 47, 0.12);
  font-family: "Segoe UI", Arial, sans-serif;
}

/* Compact, information-first tender card. */
.tender-main-form {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.tender-main-form > .tender-main-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px 10px;
}

.tender-main-grid > .tender-main-overview {
  display: grid;
  grid-column: 1 / -1;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 4%, var(--panel));
}

.tender-main-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.tender-main-title span,
.tender-main-overview dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.tender-main-title strong {
  color: var(--text);
  font-size: 19px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.tender-main-overview dl {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, minmax(130px, 1fr));
  gap: 8px;
  margin: 0;
}

.tender-main-overview dl > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--background) 74%, transparent);
}

.tender-main-overview dd {
  overflow: hidden;
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.3;
  text-overflow: ellipsis;
}

.tender-main-grid > .tender-main-field {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.tender-main-grid > .tender-main-info {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 48px;
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-left: 3px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--background) 68%, var(--panel));
}

.tender-main-info > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.tender-main-info > strong {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.tender-main-grid > .tender-main-field > input,
.tender-main-grid > .tender-main-field > select,
.tender-main-grid > .tender-main-field > textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 35px;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.2;
}

.tender-main-grid > [data-field="customer"],
.tender-main-grid > [data-field="organizer"],
.tender-main-grid > [data-field="sourceLink"],
.tender-main-grid > [data-field="filesLink"] {
  grid-column: span 2;
}

.tender-main-form > .form-actions {
  margin-top: 12px;
}

@media (max-width: 1180px) {
  .tender-main-form > .tender-main-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tender-main-overview dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .tender-main-form > .tender-main-grid,
  .tender-main-overview dl {
    grid-template-columns: 1fr;
  }

  .tender-main-grid > [data-field] {
    grid-column: auto;
  }
}

html[data-theme="dark"] { color-scheme:dark; --bg:#0f141a; --panel:#1b242e; --ink:#e8edf2; --muted:#9caab7; --line:#303d49; --soft:#222d38; --accent:#3b82f6; --accent-dark:#60a5fa; --file-link-color:#60a5fa; --sidebar-bg:#151c24; --sidebar-active:#222d38; --sidebar-widget:#1b242e; --warn:#d6a84b; --danger:#d45d67; --success:#3fae76; --info:#4c91e8; --neutral:#84919d; --bg-page:#0f141a; --bg-sidebar:#151c24; --bg-header:#151c24; --bg-card:#1b242e; --bg-input:#222d38; --bg-hover:#26323e; --border:#303d49; --border-focus:#3b82f6; --text-main:#e8edf2; --text-secondary:#9caab7; --text-muted:#71808e; --accent-hover:#60a5fa; --shadow:0 8px 24px rgb(0 0 0 / 24%); }
html[data-theme="dark"] body,html[data-theme="dark"] .workspace,html[data-theme="dark"] .auth-screen{background-color:var(--bg);color:var(--ink)}
html[data-theme="dark"] .topbar,html[data-theme="dark"] .sidebar{background:#151c24}html[data-theme="dark"] .topbar{border-color:var(--line)}
html[data-theme="dark"] .content-panel,html[data-theme="dark"] .metric-card,html[data-theme="dark"] .data-card,html[data-theme="dark"] .contract-card,html[data-theme="dark"] .role-card,html[data-theme="dark"] .manager-metric,html[data-theme="dark"] .settings-form,html[data-theme="dark"] .contract-form,html[data-theme="dark"] table,html[data-theme="dark"] th,html[data-theme="dark"] td{background-color:var(--panel);color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] thead th,html[data-theme="dark"] tfoot th,html[data-theme="dark"] .table-pagination,html[data-theme="dark"] .toolbar,html[data-theme="dark"] .audit-filters,html[data-theme="dark"] .form-head,html[data-theme="dark"] .form-actions,html[data-theme="dark"] .settings-tabs,html[data-theme="dark"] .sales-deal-tabs{background:var(--soft);color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] tbody tr:hover,html[data-theme="dark"] .manager-metric:hover,html[data-theme="dark"] .notification-item:hover{background-color:#222d38}
html[data-theme="dark"] input,html[data-theme="dark"] select,html[data-theme="dark"] textarea,html[data-theme="dark"] .portal-filter-dropdown summary,html[data-theme="dark"] .portal-filter-dropdown-options,html[data-theme="dark"] .object-chief-filter summary,html[data-theme="dark"] .object-chief-options{background:#222d38;color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] input::placeholder,html[data-theme="dark"] textarea::placeholder{color:#81909e}
html[data-theme="dark"] .secondary-button,html[data-theme="dark"] .small-button,html[data-theme="dark"] .icon-button,html[data-theme="dark"] .tab-button{background:#222d38;color:var(--ink);border-color:var(--line)}
html[data-theme="dark"] .secondary-button:hover,html[data-theme="dark"] .small-button:hover,html[data-theme="dark"] .icon-button:hover,html[data-theme="dark"] .tab-button:hover{background:#2a3744;color:#fff}
html[data-theme="dark"] .primary-button,html[data-theme="dark"] button[type="submit"]{background:#3b82f6;color:#fff;border-color:#3b82f6}html[data-theme="dark"] .primary-button:hover,html[data-theme="dark"] button[type="submit"]:hover{background:#60a5fa;border-color:#60a5fa}
html[data-theme="dark"] .muted,html[data-theme="dark"] small,html[data-theme="dark"] .section-head p,html[data-theme="dark"] .form-head p{color:var(--muted)}
html[data-theme="dark"] .status{border-color:#42515f;background:#26333f;color:#d9e2ea}html[data-theme="dark"] .status.warn{background:#49381f;color:#ffd58a;border-color:#73592e}html[data-theme="dark"] .status.danger,html[data-theme="dark"] .task-overdue{background:#4b2528;color:#ffb4b4;border-color:#783b40}html[data-theme="dark"] .status.success,html[data-theme="dark"] .status-active,html[data-theme="dark"] .contract-status-active{background:#173f37;color:#8de1ca;border-color:#286959}
html[data-theme="dark"] .modal-layer{background:rgb(5 9 13 / 76%)}html[data-theme="dark"] .account-menu-panel,html[data-theme="dark"] .notification-panel{background:var(--panel);color:var(--ink);border-color:var(--line);box-shadow:var(--shadow)}
html[data-theme="dark"] .account-profile-form>.form-head,html[data-theme="dark"] .account-profile-form>.form-actions,html[data-theme="dark"] .account-profile-photo{background:var(--soft)}html[data-theme="dark"] .account-profile-avatar{border-color:var(--line);background:#263646}
html[data-theme="dark"] .brand-mark.has-custom-logo img,html[data-theme="dark"] .brand-mini.has-custom-logo img{filter:drop-shadow(0 0 1px rgb(255 255 255 / 35%))}
html[data-theme="dark"] .nav-item{position:relative;color:#bdc8d2;border-left:3px solid transparent;border-radius:0 7px 7px 0}html[data-theme="dark"] .nav-item:hover{background:rgb(96 165 250 / 8%);color:#fff}html[data-theme="dark"] .nav-item.active{background:rgb(59 130 246 / 14%);color:#fff;border-left-color:#3b82f6}
html[data-theme="dark"] .quick-theme-button{color:#9caab7}html[data-theme="dark"] .quick-theme-button:hover{color:#60a5fa;background:rgb(59 130 246 / 12%)}
html[data-theme="dark"] .table-wrap{border-color:#303d49;background:#1b242e}html[data-theme="dark"] table{border-collapse:separate;border-spacing:0}html[data-theme="dark"] thead th{position:sticky;z-index:3;top:0;background:#222d38;box-shadow:inset 0 -1px #303d49}html[data-theme="dark"] tbody tr:nth-child(even){background:rgb(255 255 255 / 1.2%)}html[data-theme="dark"] tbody tr:hover td{background:#26323e}
html[data-theme="dark"] .status{display:inline-flex;align-items:center;gap:6px;padding:2px 7px;border:0;background:transparent!important;color:#9caab7}html[data-theme="dark"] .status::before{content:"";width:7px;height:7px;flex:0 0 7px;border-radius:50%;background:var(--neutral)}html[data-theme="dark"] .status.warn::before{background:var(--warning)}html[data-theme="dark"] .status.danger::before,html[data-theme="dark"] .task-overdue::before{background:var(--danger)}html[data-theme="dark"] .status.success::before,html[data-theme="dark"] .status-active::before,html[data-theme="dark"] .contract-status-active::before{background:var(--success)}html[data-theme="dark"] .status.info::before{background:var(--info)}
html[data-theme="dark"] input:focus,html[data-theme="dark"] select:focus,html[data-theme="dark"] textarea:focus{border-color:#3b82f6!important;outline:0;box-shadow:0 0 0 3px rgb(59 130 246 / 18%)}html[data-theme="dark"] button:disabled,html[data-theme="dark"] input:disabled,html[data-theme="dark"] select:disabled{opacity:.48;cursor:not-allowed;filter:saturate(.5)}html[data-theme="dark"] .danger-button{background:#45252b;color:#f2a8af;border-color:#6b353d}html[data-theme="dark"] .danger-button:hover{background:#583039;color:#ffd5d9;border-color:#8a4650}
html[data-theme="dark"] .manager-metric{position:relative}html[data-theme="dark"] .manager-metric::after{content:"";position:absolute;inset:auto 16px 0;height:2px;border-radius:2px;background:#3b82f6;opacity:.7}html[data-theme="dark"] .manager-metric strong{color:#e8edf2}

.account-theme-settings{display:grid;gap:5px;margin:2px 0;padding:12px;border:1px solid var(--line);border-radius:9px}.account-theme-settings legend{padding:0 6px;color:var(--ink);font-size:13px;font-weight:700}.account-theme-settings label{display:flex!important;grid-template-columns:none!important;align-items:center;gap:10px;min-height:44px;padding:7px 9px;border-radius:7px;cursor:pointer}.account-theme-settings label:hover{background:var(--soft)}.account-theme-settings input{flex:0 0 17px;width:17px;height:17px;min-height:17px;margin:0;accent-color:var(--accent)}.account-theme-settings label span{display:grid;gap:1px}.account-theme-settings label strong{font-size:13px}.account-theme-settings label small{color:var(--muted);font-size:11px}

/* Dark theme: targeted fixes for module surfaces that define hard-coded light backgrounds. */
html[data-theme="dark"] .projects-date-pill {
  border-color: #3a5268;
  background: #223345;
  color: #a9d3f4;
}

html[data-theme="dark"] .projects-date-pill.is-overdue {
  border-color: #70444a;
  background: #35262b;
  color: #e7a4aa;
}

html[data-theme="dark"] .projects-date-pill.is-done {
  border-color: #3b4854;
  background: #252f39;
  color: #aab5bf;
}

html[data-theme="dark"] .projects-table-summary,
html[data-theme="dark"] .project-task-overdue {
  border-color: #303d49;
  background: #1b242e;
  color: #9caab7;
}

html[data-theme="dark"] .debtor-kpis article {
  border: 1px solid #303d49;
  background: #1b242e;
}

html[data-theme="dark"] .debtor-kpis span,
html[data-theme="dark"] .debtor-kpis small { color: #9caab7; }
html[data-theme="dark"] .debtor-kpis strong { color: #e8edf2; }

html[data-theme="dark"] .timesheet-object-filter summary,
html[data-theme="dark"] .timesheet-chief-filter summary,
html[data-theme="dark"] .payroll-employee-filter summary,
html[data-theme="dark"] .payroll-period-filter.payroll-auto-period-filter > .check-row {
  border-color: #303d49;
  background: #222d38;
  color: #e8edf2;
}

html[data-theme="dark"] .payroll-period-filter.payroll-auto-period-filter > .check-row:hover {
  border-color: #3b82f6;
  background: #26323e;
}

html[data-theme="dark"] #timesheetPayrollResults > .payroll-totals,
html[data-theme="dark"] #directPayrollResults > .payroll-totals,
html[data-theme="dark"] .payroll-saved-report > .payroll-totals {
  background: #1b242e;
}

html[data-theme="dark"] .gbr-state-row {
  border-color: #303d49;
  background: #1b242e;
  color: #e8edf2;
}

html[data-theme="dark"] #weaponModal .weapon-entry-form {
  border: 1px solid #303d49;
  background: #1b242e;
  color: #e8edf2;
}

html[data-theme="dark"] #weaponModal .weapon-entry-form > .form-head {
  border-color: #303d49;
  background: #222d38;
}

html[data-theme="dark"] #weaponModal .weapon-entry-form > .form-head h3 { color: #e8edf2; }
html[data-theme="dark"] #weaponModal .weapon-entry-form > .form-head p { color: #9caab7; }

html[data-theme="dark"] #weaponModal .weapon-entry-form > .form-actions {
  border-color: #303d49;
  background: rgb(27 36 46 / 96%);
}

html[data-theme="dark"] .envelope-format-hint,
html[data-theme="dark"] .envelope-address-preview {
  border-color: #303d49;
  background: #222d38;
  color: #e8edf2;
}

html[data-theme="dark"] .system-color-field {
  border-color: #303d49;
  background: #222d38;
  color: #e8edf2;
}

html[data-theme="dark"] .system-color-field input[type="color"] {
  border-color: #465563;
  background: #1b242e;
}

html[data-theme="dark"] .notification-panel,
html[data-theme="dark"] .notification-panel-head,
html[data-theme="dark"] .notification-list,
html[data-theme="dark"] .notification-empty {
  border-color: #303d49;
  background: #1b242e;
  color: #e8edf2;
}

html[data-theme="dark"] .notification-item {
  border-color: #303d49;
  background: #1b242e;
  color: #e8edf2;
}

html[data-theme="dark"] .notification-item.unread {
  border-left-color: #3b82f6;
  background: #202f3e;
}

html[data-theme="dark"] .notification-item:hover,
html[data-theme="dark"] .notification-item.unread:hover { background: #26323e; }

html[data-theme="dark"] .notification-item span,
html[data-theme="dark"] .notification-item time,
html[data-theme="dark"] .notification-empty { color: #9caab7; }

/* Dark theme module corrections: keep every screen dark and low-noise. */
html[data-theme="dark"] .topbar .primary-button,
html[data-theme="dark"] .topbar .secondary-button,
html[data-theme="dark"] .topbar .account-menu-panel button,
html[data-theme="dark"] .account-menu-panel button {
  border-color: #303d49;
  background: #1b242e;
  color: #d9e2ea;
}
html[data-theme="dark"] .topbar .primary-button:hover,
html[data-theme="dark"] .topbar .secondary-button:hover,
html[data-theme="dark"] .account-menu-panel button:hover { background: #26323e; color: #fff; }

html[data-theme="dark"] .system-settings-card,
html[data-theme="dark"] .debtor-task-groups section,
html[data-theme="dark"] .payroll-adjustment-panel,
html[data-theme="dark"] .payroll-type-catalog-panel,
html[data-theme="dark"] .payroll-print-picker > section,
html[data-theme="dark"] .payroll-adjustments-section,
html[data-theme="dark"] .envelope-address-preview,
html[data-theme="dark"] .settings-note,
html[data-theme="dark"] .sales-card,
html[data-theme="dark"] .tender-card,
html[data-theme="dark"] .debtor-kanban-card,
html[data-theme="dark"] .task-card,
html[data-theme="dark"] .project-card {
  border-color: #303d49;
  background: #1b242e;
  color: #e8edf2;
  box-shadow: 0 4px 12px rgb(0 0 0 / 14%);
}
html[data-theme="dark"] .system-settings-card h3,
html[data-theme="dark"] .system-settings-card label,
html[data-theme="dark"] .debtor-task-groups h3,
html[data-theme="dark"] .debtor-kanban-card > strong,
html[data-theme="dark"] .debtor-kanban-card > b { color: #e8edf2; }

html[data-theme="dark"] .projects-kanban .kanban-column,
html[data-theme="dark"] .sales-lane,
html[data-theme="dark"] .tender-lane,
html[data-theme="dark"] .debtor-kanban-lane {
  border-color: #303d49;
  background: #18212a;
  box-shadow: inset 0 0 0 1px #303d49;
}
html[data-theme="dark"] .projects-kanban .kanban-todo,
html[data-theme="dark"] .projects-kanban .kanban-progress,
html[data-theme="dark"] .projects-kanban .kanban-review,
html[data-theme="dark"] .projects-kanban .kanban-done { background: #18212a; }
html[data-theme="dark"] .projects-kanban .kanban-head,
html[data-theme="dark"] .sales-lane > header,
html[data-theme="dark"] .tender-lane > header,
html[data-theme="dark"] .debtor-kanban-lane > header {
  border-color: #303d49;
  background: #222d38;
  color: #e8edf2;
}
html[data-theme="dark"] .projects-kanban .kanban-head span,
html[data-theme="dark"] .sales-lane > header span,
html[data-theme="dark"] .tender-lane > header span,
html[data-theme="dark"] .debtor-kanban-lane > header span {
  background: #303d49;
  color: #d9e2ea;
}
html[data-theme="dark"] .projects-kanban .task-card-head strong,
html[data-theme="dark"] .projects-kanban .project-meta .task-meta-project,
html[data-theme="dark"] .projects-kanban .task-card > p,
html[data-theme="dark"] .projects-kanban .project-meta,
html[data-theme="dark"] .sales-card strong,
html[data-theme="dark"] .tender-card strong { color: #dce4eb; }
html[data-theme="dark"] .projects-kanban .project-meta .task-meta-badge { background: #26323e; color: #9caab7; }
html[data-theme="dark"] .sales-quick-deal { border-color:#3a4855; background:#1b242e; color:#b8c4ce; }
html[data-theme="dark"] .sales-quick-deal:hover { background:#26323e; }

html[data-theme="dark"] .employee-grade-badge {
  border: 1px solid #4b5d6c;
  background: #26323e;
  color: #e8edf2;
  box-shadow: none;
}

html[data-theme="dark"] .timesheet-calendar-wrap { border-color:#303d49; background:#151c24; }
html[data-theme="dark"] .timesheet-calendar thead th,
html[data-theme="dark"] .timesheet-calendar th:first-child,
html[data-theme="dark"] .timesheet-calendar thead th:first-child { background:#222d38; color:#e8edf2; }
html[data-theme="dark"] .timesheet-calendar td,
html[data-theme="dark"] .timesheet-calendar th { border-color:#303d49; }
html[data-theme="dark"] .timesheet-calendar input { border-color:#3b4a58; background:#1b242e; color:#e8edf2; }
html[data-theme="dark"] .timesheet-calendar .timesheet-day-off { background:#2c2428; color:#dba0a6; }
html[data-theme="dark"] .timesheet-calendar .timesheet-day-off input { border-color:#684049; background:#35272c; color:#f0b6bc; }
html[data-theme="dark"] .timesheet-entry-hint,
html[data-theme="dark"] .timesheet-totals > div,
html[data-theme="dark"] .payroll-totals > div,
html[data-theme="dark"] .payroll-summary-period,
html[data-theme="dark"] .payroll-period-filter,
html[data-theme="dark"] .saved-payroll-toolbar,
html[data-theme="dark"] .payroll-employee-options { border-color:#303d49; background:#222d38; color:#e8edf2; }
html[data-theme="dark"] .timesheet-totals strong,
html[data-theme="dark"] .payroll-totals strong { color:#e8edf2; }
html[data-theme="dark"] .payroll-employee-total th,
html[data-theme="dark"] .timesheet-payroll-table .payroll-object-title > th { background:#26323e; color:#e8edf2; }

html[data-theme="dark"] .primary-button:not(:hover) { background:#2f6fd0; border-color:#2f6fd0; }
html[data-theme="dark"] .small-button:not(.danger-button),
html[data-theme="dark"] .secondary-button { background:#222d38; color:#d6dee6; border-color:#3a4855; }
html[data-theme="dark"] .file-button,
html[data-theme="dark"] .file-link { color:#80b4f8; }

.portal-filter-native-select { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; opacity: 0 !important; pointer-events: none !important; }
.portal-filter-dropdown { position: relative; min-width: 0; }
.table-action-menu { position: relative; display: inline-block; min-width: 112px; text-align: left; }
.table-action-menu[open] { z-index: 2300; }
.table-wrap:has(.table-action-menu[open]) { overflow: visible; position: relative; z-index: 50; }
.table-action-menu > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 112px; list-style: none; cursor: pointer; user-select: none; }
.table-action-menu > summary::-webkit-details-marker { display: none; }
.table-action-menu > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .16s ease; }
.table-action-menu[open] > summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.table-action-menu-list { position: absolute; z-index: 2300; top: calc(100% + 6px); right: 0; display: grid; gap: 3px; min-width: 190px; padding: 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 16px 42px rgb(15 31 43 / 20%); }
.table-action-menu-list button,.table-action-menu-list a { width: 100%; min-height: 36px; border: 0; border-radius: 7px; padding: 8px 10px; color: var(--ink); background: transparent; font: inherit; font-size: 13px; font-weight: 600; text-align: left; text-decoration: none; cursor: pointer; }
.table-action-menu-list button:hover,.table-action-menu-list a:hover { color: var(--accent); background: var(--soft); }
.table-action-menu-list .danger-button,.table-action-menu-list .is-danger { color: #a53636; }
.employees-table tr:has(.table-action-menu[open]),.contracts-table tr:has(.table-action-menu[open]) { position: relative; z-index: 25; }
.contract-card:has(> .table-action-menu[open]) { position: relative; z-index: 25; }
html[data-theme="dark"] .table-action-menu-list { border-color: var(--line); background: var(--panel); }
.portal-filter-dropdown[open] { z-index: 2200; }
.portal-filter-dropdown summary { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; min-height: 46px; padding: 7px 34px 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; list-style: none; position: relative; }
.portal-filter-dropdown summary::after { content: ""; position: absolute; right: 14px; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform .18s ease; }
.portal-filter-dropdown[open] summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.portal-filter-dropdown summary::-webkit-details-marker { display: none; }
.portal-filter-dropdown summary span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.portal-filter-dropdown summary strong { overflow: hidden; max-width: 180px; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.portal-filter-dropdown[open] summary { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.portal-filter-dropdown-options { position: absolute; z-index: 1900; top: calc(100% + 6px); left: 0; display: grid; gap: 3px; width: max(100%, 230px); max-height: 310px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 18px 45px rgb(28 37 47 / 18%); }
.portal-filter-option { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 36px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.portal-filter-option:hover, .portal-filter-option.is-active { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); color: var(--accent-dark); }
.portal-filter-option input { width: 16px !important; height: 16px !important; min-height: 16px !important; margin: 0; accent-color: var(--accent); }
.portal-filter-dropdown-search { position: sticky; top: 0; z-index: 1; min-height: 38px !important; margin-bottom: 4px; background: var(--panel) !important; }

.portal-seasonal-event { position: fixed; inset: 0; z-index: 1490; pointer-events: none; overflow: hidden; }
.seasonal-walker, .seasonal-march { position: absolute; bottom: 0; left: 0; display: flex; align-items: flex-end; gap: 10px; animation: seasonal-cross 10s linear forwards; }
.seasonal-santa { font-size: 58px; filter: drop-shadow(0 5px 4px rgb(0 0 0 / 20%)); }
.seasonal-sack { font-size: 35px; animation: seasonal-bob .35s ease-in-out infinite alternate; }
.seasonal-caption, .seasonal-march strong { align-self: center; white-space: nowrap; padding: 7px 12px; border-radius: 18px; background: rgb(255 255 255 / 92%); color: #9d1c24; font-weight: 800; box-shadow: var(--shadow); }
.seasonal-snow { position: absolute; top: 8%; width: 100%; color: #8dcbe8; font-size: 30px; text-align: center; word-spacing: 11vw; animation: seasonal-snow 5s linear infinite; }
.seasonal-march { gap: 4px; animation-duration: 10s; }
.seasonal-soldier { display: inline-block; font-size: 43px; animation: seasonal-march-step .32s ease-in-out infinite alternate; }
.seasonal-soldier:nth-child(even) { animation-direction: alternate-reverse; }
.seasonal-fireworks { position: absolute; inset: 8% 5% auto; display: flex; justify-content: space-between; color: #d04a2f; font-size: 55px; }
.seasonal-fireworks i { font-style: normal; animation: seasonal-burst 1.2s ease-out infinite; }
.seasonal-fireworks i:nth-child(2) { color: #e0a52b; animation-delay: .35s; }
.seasonal-fireworks i:nth-child(3) { animation-delay: .7s; }
.seasonal-ribbon { position: absolute; left: 50%; bottom: 28px; translate: -50% 0; display: grid; justify-items: center; gap: 8px; animation: seasonal-card-in 10s ease forwards; }
.seasonal-ribbon span { width: 260px; height: 26px; border-radius: 50%; background: repeating-linear-gradient(135deg, #ee7925 0 13px, #191919 13px 26px); transform: rotate(-3deg); box-shadow: 0 5px 12px rgb(0 0 0 / 20%); }
.seasonal-ribbon strong, .seasonal-guard-card { padding: 12px 20px; border-radius: 16px; background: rgb(255 255 255 / 94%); box-shadow: var(--shadow); }
.seasonal-guard-card { position: absolute; top: 92px; left: 50%; translate: -50% 0; display: flex; align-items: center; gap: 15px; min-width: min(440px, calc(100vw - 28px)); animation: seasonal-card-in 9s ease forwards; }
.seasonal-medal { font-size: 52px; }.seasonal-guard-card div { display: grid; gap: 4px; }.seasonal-guard-card strong { font-size: 20px; }.seasonal-guard-card small { color: var(--muted); }
@keyframes seasonal-cross { from { transform: translateX(calc(-100% - 30px)); } to { transform: translateX(calc(100vw + 30px)); } }
@keyframes seasonal-bob { to { transform: translateY(-5px) rotate(4deg); } }
@keyframes seasonal-march-step { to { transform: translateY(-4px) rotate(2deg); } }
@keyframes seasonal-snow { to { transform: translateY(70vh) rotate(25deg); } }
@keyframes seasonal-burst { 0% { opacity: 0; transform: scale(.2); } 45% { opacity: 1; } 100% { opacity: 0; transform: scale(1.5); } }
@keyframes seasonal-card-in { 0%, 100% { opacity: 0; transform: translateY(-12px); } 10%, 90% { opacity: 1; transform: none; } }


* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 72%, #ffffff) var(--soft);
}

*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

*::-webkit-scrollbar-track {
  background: var(--soft);
  border-radius: 8px;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid var(--soft);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 72%, #ffffff);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.sidebar,
.sidebar * {
  scrollbar-color: color-mix(in srgb, var(--accent) 75%, #ffffff) var(--sidebar-bg);
}

.sidebar *::-webkit-scrollbar-track { background: var(--sidebar-bg); }
.sidebar *::-webkit-scrollbar-thumb { border-color: var(--sidebar-bg); }

.status-tooltip {
  position: relative;
  cursor: help;
}

.status-tooltip::after {
  position: absolute;
  z-index: 80;
  left: 50%;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: 300px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #172033;
  color: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
  content: attr(data-tooltip);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  white-space: normal;
}

.status-tooltip:hover::after,
.status-tooltip:focus::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.status-tooltip-left::after {
  right: 0;
  left: auto;
  transform: translate(0, 4px);
}

.status-tooltip-left:hover::after,
.status-tooltip-left:focus::after {
  transform: translate(0, 0);
}

.employees-table .status-tooltip::after { display: none; }
.floating-status-tooltip {
  position: fixed;
  z-index: 10000;
  width: max-content;
  max-width: min(260px, calc(100vw - 16px));
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: #172033;
  color: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.24);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  pointer-events: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

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

/* Денежные поля вводятся вручную: без браузерных кнопок увеличения и уменьшения. */
input[type="number"]:is(
  [name*="amount" i],
  [name*="price" i],
  [name*="cost" i],
  [name*="rate" i],
  [name="payroll"],
  [name="taxes"],
  [name="operations"],
  [name="guarantee"],
  [name="reserve"],
  [name="principal"],
  [name="sanctions"],
  [name="expenses"],
  [name="paidBeforeTransfer"],
  [placeholder*="сумма" i],
  [aria-label*="сумма" i]
) {
  appearance: textfield;
  -moz-appearance: textfield;
}
input[type="number"]:is(
  [name*="amount" i],
  [name*="price" i],
  [name*="cost" i],
  [name*="rate" i],
  [name="payroll"],
  [name="taxes"],
  [name="operations"],
  [name="guarantee"],
  [name="reserve"],
  [name="principal"],
  [name="sanctions"],
  [name="expenses"],
  [name="paidBeforeTransfer"],
  [placeholder*="сумма" i],
  [aria-label*="сумма" i]
)::-webkit-inner-spin-button,
input[type="number"]:is(
  [name*="amount" i],
  [name*="price" i],
  [name*="cost" i],
  [name*="rate" i],
  [name="payroll"],
  [name="taxes"],
  [name="operations"],
  [name="guarantee"],
  [name="reserve"],
  [name="principal"],
  [name="sanctions"],
  [name="expenses"],
  [name="paidBeforeTransfer"],
  [placeholder*="сумма" i],
  [aria-label*="сумма" i]
)::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

button {
  cursor: pointer;
  letter-spacing: 0;
}

button:focus-visible {
  outline: 3px solid rgba(31, 111, 99, 0.2);
  outline-offset: 2px;
}

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

.is-hidden {
  display: none !important;
}

.section-loading-state {
  min-height: 240px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
}

.section-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: portalBootSpin .8s linear infinite;
}

body.app-booting {
  background: var(--bg);
}

body.app-booting .auth-screen,
body.app-booting .app-shell {
  visibility: hidden;
}

body.app-booting::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: var(--bg);
}

body.app-booting::after {
  content: "";
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 9999;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 3px solid rgba(31, 111, 99, 0.16);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: portalBootSpin 0.8s linear infinite;
}

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

.auth-screen {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 800px);
  justify-content: center;
  align-items: center;
  gap: 42px;
  padding: 40px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--bg) 97%, transparent), color-mix(in srgb, var(--bg) 82%, transparent)),
    url("data:image/svg+xml,%3Csvg width='1200' height='800' viewBox='0 0 1200 800' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='1200' height='800' fill='%23d9dee5'/%3E%3Cg fill='none' stroke='%238a96a3' stroke-width='2' opacity='.34'%3E%3Cpath d='M0 650h1200M0 520h1200M0 390h1200M0 260h1200M0 130h1200M160 0v800M320 0v800M480 0v800M640 0v800M800 0v800M960 0v800M1120 0v800'/%3E%3C/g%3E%3Cg fill='%231f6f63' opacity='.18'%3E%3Crect x='130' y='120' width='170' height='90' rx='8'/%3E%3Crect x='830' y='210' width='220' height='120' rx='8'/%3E%3Crect x='455' y='485' width='250' height='110' rx='8'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
}

.auth-particles {
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
}

.auth-particles canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.auth-panel,
.auth-aside {
  position: relative;
  z-index: 1;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(280px, 1.1fr);
  align-items: center;
  gap: 34px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(217, 222, 229, 0.88);
  border-radius: 8px;
  padding: 34px;
  box-shadow: var(--shadow);
  width: 100%;
}

.auth-brand-copy {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.auth-brand-copy h1 {
  margin: 0;
}

.auth-brand-copy p {
  grid-column: 1 / -1;
}

.brand-mark,
.brand-mini {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
}

.brand-mark.has-custom-logo,
.brand-mini.has-custom-logo {
  background: transparent;
}

.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 8px;
}

.brand-mini {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  flex: 0 0 auto;
}

svg {
  width: 24px;
  height: 24px;
}

svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark svg {
  width: 38px;
  height: 38px;
}

.auth-panel h1 {
  margin: 24px 0 10px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.05;
  letter-spacing: 0;
}

.auth-panel p {
  margin: 0 0 26px;
  color: var(--muted);
  line-height: 1.55;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: #354151;
  font-weight: 600;
}

.login-form input,
.toolbar input,
.toolbar select,
.toolbar textarea,
.contract-form input,
.contract-form select,
.contract-form textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.login-form button,
.primary-button,
.user-pill button,
.secondary-button,
.small-button,
.danger-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(23, 32, 42, 0.1);
  font-weight: 600;
  line-height: 1.2;
  padding: 0 14px;
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.login-form button:hover,
.primary-button:hover,
.user-pill button:hover {
  background: var(--accent-dark);
  box-shadow: 0 3px 8px rgba(21, 84, 75, 0.18);
  transform: translateY(-1px);
}

.secondary-button,
.small-button {
  border-color: #d4dbe2;
  background: #fff;
  color: #263241;
  box-shadow: 0 1px 2px rgba(23, 32, 42, 0.06);
}

.secondary-button:hover,
.small-button:hover {
  border-color: #aebbc5;
  background: #f6f8fa;
  box-shadow: 0 2px 6px rgba(23, 32, 42, 0.08);
  transform: translateY(-1px);
}

.toolbar > .primary-button,
.toolbar > .secondary-button {
  align-self: end;
  height: 38px;
  min-height: 38px;
}

.danger-button {
  border-color: #efcaca;
  background: #fff7f7;
  color: var(--danger);
  box-shadow: none;
}

.danger-button:hover {
  border-color: #d99b9b;
  background: #ffeded;
}

button.action-print:not(.danger-button) {
  border-color: #c9dce8;
  background: #f2f8fb;
  color: #315f78;
}

button.action-print:not(.danger-button):hover {
  border-color: #9fc3d8;
  background: #e8f3f8;
}

button.action-open:not(.danger-button) {
  border-color: #c8dfd1;
  background: #f1f8f3;
  color: #35684a;
}

button.action-open:not(.danger-button):hover {
  border-color: #9fc6ae;
  background: #e8f4ec;
}

button.action-edit:not(.danger-button) {
  border-color: #ead9aa;
  background: #fff9e9;
  color: #725d25;
}

button.action-edit:not(.danger-button):hover {
  border-color: #d8bd70;
  background: #fff3d2;
}

.primary-button:active,
.secondary-button:active,
.small-button:active,
.danger-button:active,
.login-form button:active,
.user-pill button:active {
  box-shadow: none;
  transform: translateY(0);
}

.form-error {
  min-height: 20px;
  color: var(--danger);
  font-weight: 600;
}

.license-error-code {
  display: block;
  margin-top: 6px;
  max-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
}

.license-error-code code {
  white-space: nowrap;
}

.install-app-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.install-app-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.demo-access {
  margin-top: 18px;
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 14px;
}

.auth-aside {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 16px;
  align-self: end;
  margin-bottom: 7vh;
}

.summary-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 130px;
  border-radius: 8px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(217, 222, 229, 0.78);
  box-shadow: 0 12px 30px rgba(28, 37, 47, 0.08);
}

.summary-tile span {
  color: var(--muted);
}

.summary-tile strong {
  display: block;
  margin-top: 12px;
  font-size: 34px;
  line-height: 1;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 20;
  background: var(--sidebar-bg);
  color: #fff;
  padding: 20px 14px;
}

.sidebar-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 6px 22px;
}

.sidebar-head span {
  display: block;
  margin-top: 4px;
  color: #aeb8c5;
  font-size: 13px;
}

.nav-list {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
}

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

.nav-item:hover,
.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.nav-item.action-print { background: transparent; color: #dfe6ee; }
.nav-item.action-print:hover,
.nav-item.action-print.active { background: var(--sidebar-active); color: #fff; }

.workspace {
  min-width: 0;
  max-width: calc(100vw - 280px);
  overflow-x: hidden;
  margin-left: 280px;
  padding: 22px;
}

.portal-assistant {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 18;
}

.assistant-launcher {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(15, 31, 43, 0.24);
  cursor: pointer;
  animation: assistant-float 3.2s ease-in-out infinite;
}

.assistant-launcher::after {
  content: "";
  position: absolute;
  inset: -4px;
  z-index: -1;
  border: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 50%;
  opacity: 0;
  animation: assistant-pulse 3.2s ease-out infinite;
}

.assistant-bot-icon {
  display: grid;
  place-items: center;
  transition: transform 180ms ease;
}

.assistant-launcher:hover .assistant-bot-icon { transform: scale(1.08) rotate(-3deg); }
.assistant-launcher svg { width: 25px; height: 25px; }

.assistant-panel {
  position: absolute;
  right: 0;
  bottom: 62px;
  width: min(390px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 110px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 55px rgba(15, 31, 43, 0.28);
  transform-origin: right bottom;
  animation: assistant-panel-in 180ms ease-out both;
}

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

.assistant-panel > header > div:first-child { display: grid; gap: 2px; }
.assistant-panel > header strong { color: var(--ink); }
.assistant-panel > header span,
.assistant-context { color: var(--muted); font-size: 12px; }
.assistant-panel .icon-button { width: 32px; height: 32px; }

.assistant-context {
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assistant-messages {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: #f8fafb;
}

.assistant-message {
  max-width: 88%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.45;
  background: #fff;
  animation: assistant-message-in 180ms ease-out both;
}

.assistant-message.user {
  align-self: flex-end;
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.assistant-message.assistant { align-self: flex-start; }
.assistant-message footer { display: flex; justify-content: space-between; gap: 8px; margin-top: 9px; padding-top: 7px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.assistant-message footer button { border: 0; padding: 1px 4px; color: var(--accent); background: transparent; cursor: pointer; }
.assistant-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.assistant-actions button { border: 1px solid #b8c7d1; border-radius: 6px; padding: 6px 8px; color: var(--ink); background: #edf2f4; cursor: pointer; }
.assistant-welcome { margin: auto 0; padding: 18px; text-align: center; color: var(--muted); }
.assistant-welcome strong { color: var(--ink); font-size: 17px; }
.assistant-welcome p { margin: 7px 0 0; line-height: 1.5; }

.assistant-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 52px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  animation: assistant-message-in 180ms ease-out both;
}

.assistant-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: assistant-dot 1s ease-in-out infinite;
}

.assistant-typing span:nth-child(2) { animation-delay: 120ms; }
.assistant-typing span:nth-child(3) { animation-delay: 240ms; }

@keyframes assistant-panel-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes assistant-message-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes assistant-dot {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

@keyframes assistant-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes assistant-pulse {
  0%, 55% { opacity: 0; transform: scale(0.9); }
  70% { opacity: 0.45; }
  100% { opacity: 0; transform: scale(1.2); }
}

@media (prefers-reduced-motion: reduce) {
  .assistant-launcher,
  .assistant-launcher::after,
  .assistant-panel,
  .assistant-message,
  .assistant-typing,
  .assistant-typing span {
    animation: none !important;
  }
}

.assistant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.assistant-form textarea {
  width: 100%;
  min-height: 42px;
  max-height: 100px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
}

@media (max-width: 700px) {
  .portal-assistant { right: 12px; bottom: 12px; }
  .assistant-panel { position: fixed; inset: 8px; width: auto; height: auto; max-height: none; }
  .assistant-form { grid-template-columns: 1fr; }
  .assistant-form button { width: 100%; }
}

.brand-mark img,
.brand-mini img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.desktop-widgets {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 8px;
  margin-top: auto;
  padding: 14px 4px 0;
  overflow: hidden;
}

.clock-widget,
.weather-widget {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: var(--sidebar-widget);
  padding: 12px 14px;
  text-align: left;
}

.clock-widget strong,
.clock-widget span,
.weather-widget strong,
.weather-widget span {
  display: block;
}

.clock-widget strong,
.weather-widget strong {
  color: #fff;
}

.clock-widget strong {
  font-size: 32px;
  line-height: 1;
}

.clock-widget span {
  margin-top: 7px;
  color: #d8e0e8;
  font-size: 16px;
  text-transform: capitalize;
}

.weather-widget strong {
  font-size: 25px;
}

.weather-current {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 3px;
}

.weather-current-icon {
  display: grid !important;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #dbe7f1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 3px 8px rgba(0, 0, 0, 0.14);
}

.weather-current-icon svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18));
}

.weather-current-icon.sun { background: rgba(245, 196, 81, 0.13); color: #ffd66b; }
.weather-current-icon.sun svg { fill: rgba(255, 214, 107, 0.12); }
.weather-current-icon.cloud { background: rgba(190, 210, 226, 0.11); color: #d7e4ee; }
.weather-current-icon.cloud svg { fill: rgba(215, 228, 238, 0.12); }
.weather-current-icon.cloud-rain { background: rgba(84, 169, 232, 0.13); color: #80c8f7; }
.weather-current-icon.snowflake { background: rgba(179, 226, 248, 0.13); color: #d0f1ff; }
.weather-current-icon.cloud-fog { background: rgba(174, 184, 197, 0.12); color: #c3ccd6; }
.weather-current-icon.cloud-lightning { background: rgba(245, 196, 81, 0.13); color: #ffd269; }

.weather-widget span {
  color: #aeb8c5;
  font-size: 13px;
}

.weather-widget button {
  display: block;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
  border: 0;
  padding: 0;
  background: transparent;
  color: #c7d1dc;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 1181px) and (max-height: 820px) {
  .desktop-widgets {
    gap: 6px;
    padding-top: 8px;
  }

  .clock-widget,
  .weather-widget {
    padding: 8px 10px;
  }

  .clock-widget strong {
    font-size: 27px;
  }

  .clock-widget span {
    margin-top: 4px;
    font-size: 13px;
  }

  .weather-current-icon {
    width: 32px;
    height: 32px;
  }

  .weather-current-icon svg {
    width: 24px;
    height: 24px;
  }

}

@media (max-width: 1180px), (max-height: 700px) {
  .desktop-widgets {
    display: none;
  }
}

.system-logo-preview { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.system-logo-preview img { max-width: 220px; max-height: 100px; object-fit: contain; }
.system-favicon-preview { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.system-favicon-preview img { width: 32px; height: 32px; object-fit: contain; }
.system-color-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 10px; }
.system-color-field { display: flex !important; align-items: center; justify-content: space-between; gap: 12px !important; min-height: 54px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: #fff; }
.system-color-field input[type="color"] { width: 42px; height: 34px; min-height: 34px; flex: 0 0 42px; border: 1px solid var(--line); border-radius: 5px; padding: 2px; background: #fff; cursor: pointer; }
.system-settings-form { padding: 14px; }
.backup-settings-layout { display:grid; gap:14px; }
.backup-summary-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.backup-summary-grid article { display:grid; gap:5px; }
.backup-summary-grid article small,.backup-summary-grid article span { color:var(--muted); }
.backup-summary-grid article strong { font-size:18px; }
@media (max-width:900px) { .backup-summary-grid { grid-template-columns:1fr; } }
.system-settings-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.system-settings-column { display: grid; gap: 14px; align-content: start; min-width: 0; }
.system-settings-card { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 1px 2px rgba(23, 32, 42, .04); }
.tenderland-settings-card { width: min(920px, 100%); }
.system-settings-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.system-settings-card-head h3 { margin: 0; font-size: 15px; }
.system-settings-card-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.system-settings-card-head > svg { width: 19px; height: 19px; flex: 0 0 auto; color: var(--accent); }
.system-settings-fields { display: grid; gap: 12px; }
.settings-list-field { display: grid; gap: 8px; min-width: 0; }
.settings-list-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.settings-list-label > strong { font-size: 13px; color: var(--text); }
.settings-list-rows { display: grid; gap: 6px; max-height: 250px; overflow: auto; padding: 2px; scrollbar-width: thin; }
.settings-list-row { display: grid; grid-template-columns: minmax(0, 1fr) 34px; align-items: center; gap: 6px; }
.settings-list-row input { min-width: 0; height: 36px; }
.settings-list-row .icon-button { width: 34px; height: 34px; min-height: 34px; padding: 7px; }
.settings-list-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.settings-list-add input { min-width: 0; }
.settings-list-add .secondary-button { white-space: nowrap; }
.settings-list-field input.is-invalid { border-color: #dc2626; box-shadow: 0 0 0 2px rgba(220, 38, 38, .1); }
@media (max-width: 620px) {
  .settings-list-add { grid-template-columns: 1fr; }
}
.system-settings-form .system-color-grid { grid-template-columns: 1fr; }
.system-settings-form .system-logo-preview img { max-width: 160px; max-height: 72px; }
.system-settings-form .form-actions { margin-top: 14px; }
@media (max-width: 900px) { .system-settings-layout { grid-template-columns: 1fr; } }
.polished-select { min-height: 44px; border-color: #bfc9d5; background: #fff; }
.employee-organization-select {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.employee-organization-options {
  display: grid;
  gap: 6px;
  max-height: 156px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #fff;
}

.employee-organization-options label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 6px;
  border-radius: 5px;
  font-weight: 500;
}

.employee-organization-options label:hover {
  background: var(--soft);
}

.employee-organization-options input {
  width: 16px;
  min-height: 16px;
  margin: 2px 0 0;
}

.employee-organization-options span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.settings-note { margin-bottom: 12px; color: var(--muted); }

.audit-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 8px;
  align-items: end;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9fa;
}

.audit-filters > *,
.audit-filters label {
  min-width: 0;
  max-width: 100%;
}

.audit-filters input,
.audit-filters select {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--ink);
  background: #fff;
}

.audit-filters label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
}

.audit-filters .secondary-button { width: 100%; min-height: 36px; }

.audit-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  margin: 8px 0;
}

.audit-table {
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
  font-size: 12px;
}

.audit-table th,
.audit-table td {
  padding: 7px 8px;
  line-height: 1.3;
  vertical-align: top;
}

.audit-table th:nth-child(1) { width: 132px; }
.audit-table th:nth-child(2) { width: 160px; }
.audit-table th:nth-child(3) { width: 140px; }
.audit-table th:nth-child(4) { width: 190px; }
.audit-table td { overflow-wrap: anywhere; }
.audit-table td > .muted { display: block; margin-top: 2px; font-size: 11px; }
.audit-date { white-space: nowrap; color: var(--muted); }

.audit-pagination {
  display: flex;
  width: 100%;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: flex-start;
  margin: 8px 0;
}

.audit-pagination label {
  display: flex;
  flex: 1 1 230px;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  gap: 6px;
}

.audit-pagination select { min-height: 32px; }

.audit-pagination .pagination-info { flex: 1 1 170px; min-width: 0; }
.audit-pagination .secondary-button { flex: 0 1 100px; min-width: 82px; }

#settingsPanel,
#auditTableWorkspace {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 700px) {
  .audit-table { min-width: 850px; }
}

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

.topbar h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

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

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.notification-center {
  position: relative;
}

.icon-button.notification-button {
  position: relative;
  width: 54px;
  height: 54px;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  border-radius: 999px;
  padding: 0 4px;
  background: var(--danger);
  color: #fff !important;
  font-size: 10px;
  font-weight: 700;
}

.notification-panel {
  position: absolute;
  z-index: 70;
  top: calc(100% + 10px);
  right: 0;
  width: min(380px, calc(100vw - 28px));
  max-height: min(520px, 70vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(28, 37, 47, 0.18);
}

.notification-panel-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  background: #fff;
}

.notification-panel-head strong {
  font-size: 15px;
}

.notification-panel-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.notification-clear-button { color: var(--danger) !important; }

.notification-list {
  display: grid;
}

.notification-item {
  width: 100%;
  display: grid;
  gap: 4px;
  border: 0;
  border-bottom: 1px solid #edf0f3;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.notification-item:hover {
  background: #f6f8fa;
}

.notification-item.unread {
  border-left: 3px solid var(--accent);
  background: #f3f8f6;
  padding-left: 11px;
}

.notification-item strong {
  font-size: 14px;
  font-weight: 600;
}

.notification-item span,
.notification-item time,
.notification-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.notification-empty {
  display: block;
  padding: 22px 14px;
  text-align: center;
}

.user-pill {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.user-pill .account-menu-button {
  display: none;
}

.account-menu-panel {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-pill span {
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.user-pill button {
  min-height: 36px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.dashboard-grid:empty {
  margin-bottom: 0;
}

.metric-card,
.content-panel,
.data-card,
.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-card {
  min-height: 104px;
  padding: 18px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: 30px;
}

.content-panel {
  padding: 18px;
}

.manager-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: -18px -18px 22px;
  border-bottom: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: var(--line);
  overflow: hidden;
}

.manager-metric {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 16px 18px;
  border: 0;
  border-radius: 0;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.manager-metric:hover {
  background: #f5f8fa;
}

.manager-metric-static {
  cursor: default;
}

.manager-metric-static:hover {
  background: var(--panel);
}

.manager-metric span,
.manager-metric small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manager-metric strong {
  font-size: 28px;
}

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

.manager-panel {
  min-width: 0;
  padding-top: 14px;
  border-top: 2px solid var(--line);
}

.manager-panel-wide {
  grid-column: 1 / -1;
}

.manager-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.manager-panel-head h3 {
  margin: 0;
  font-size: 17px;
}

.manager-list {
  display: grid;
}

.manager-list > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.manager-list > button:hover strong {
  color: var(--accent);
}

.manager-list > button span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.manager-list > button span:not(.status) {
  color: var(--muted);
}

.manager-list > button strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manager-list > button b {
  flex: 0 0 auto;
  white-space: nowrap;
}

.manager-list > .muted {
  margin: 10px 0;
}

.equipment-tabs {
  overflow-x: auto;
  margin-bottom: 14px;
}

.equipment-toolbar {
  grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(170px, 220px));
}

.equipment-movement-toolbar {
  grid-template-columns: minmax(240px, 1fr) minmax(190px, 240px);
}

@media (max-width: 900px) {
  .manager-metrics,
  .manager-dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 680px) {
  .manager-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: -14px -14px 14px;
  }

  .manager-metric {
    gap: 2px;
    min-height: 76px;
    padding: 10px 12px;
  }

  .manager-metric span {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.25;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .manager-metric strong { font-size: 22px; }
  .manager-metric small { display: none; }

  .manager-dashboard-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .manager-panel-wide {
    grid-column: auto;
  }

  .manager-panel {
    padding-top: 10px;
  }

  .manager-panel-head {
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
  }

  .manager-panel-head h3 {
    font-size: 15px;
    line-height: 1.25;
  }

  .manager-panel-head .small-button {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .manager-list > button {
    gap: 8px;
    padding: 8px 0;
    font-size: 13px;
  }

  .manager-list > button:nth-of-type(n + 4) {
    display: none;
  }

  .manager-list > button span {
    gap: 1px;
  }

  .manager-list .status {
    padding: 4px 6px;
    font-size: 11px;
  }

  .manager-duty-table {
    overflow: visible;
    border: 0;
  }

  .manager-duty-table table,
  .manager-duty-table tbody {
    display: grid;
    gap: 8px;
    min-width: 0;
  }

  .manager-duty-table thead { display: none; }

  .manager-duty-table tr {
    display: grid;
    gap: 4px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafb;
  }

  .manager-duty-table td {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 8px;
    padding: 0;
    border: 0;
    font-size: 12px;
    overflow-wrap: anywhere;
  }

  .manager-duty-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 600;
  }
}

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

.section-head h3 {
  margin: 0 0 6px;
  font-size: 22px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 210px auto;
  gap: 10px;
  padding: 12px;
  margin-bottom: 16px;
  background: var(--soft);
}

.toolbar > *,
.toolbar label {
  min-width: 0;
  max-width: 100%;
}

.toolbar button {
  width: 100%;
}

.contract-toolbar {
  grid-template-columns: minmax(220px, 1.5fr) repeat(5, minmax(140px, 1fr)) auto;
}

.objects-toolbar {
  grid-template-columns: minmax(300px, 0.9fr) minmax(250px, 0.34fr) minmax(320px, 0.8fr);
  align-items: stretch;
}

.objects-toolbar > input[type="search"],
.objects-toolbar > .portal-filter-dropdown,
.objects-toolbar > .object-chief-filter,
.objects-toolbar .portal-filter-dropdown summary,
.objects-toolbar .object-chief-filter summary {
  min-height: 48px;
  height: 48px;
}

.objects-toolbar .portal-filter-dropdown summary,
.objects-toolbar .object-chief-filter summary {
  align-content: center;
  padding-top: 5px;
  padding-bottom: 5px;
}

.objects-toolbar > input[type="search"],
.objects-toolbar .portal-filter-dropdown summary,
.objects-toolbar .object-chief-filter summary {
  border-radius: 8px;
}

.object-chief-filter {
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.object-chief-filter summary {
  display: grid;
  gap: 2px;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  list-style: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.object-chief-filter summary::-webkit-details-marker { display: none; }
.object-chief-filter summary span { color: var(--muted); font-size: 11px; }
.object-chief-filter summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.object-chief-filter[open] summary {
  border-color: var(--accent);
  background: #fbfefd;
  box-shadow: 0 0 0 3px rgba(31, 111, 99, 0.12);
}

.object-chief-filter-options {
  position: absolute;
  z-index: 8;
  top: calc(100% + 4px);
  left: 0;
  display: grid;
  gap: 3px;
  box-sizing: border-box;
  width: min(360px, calc(100vw - 48px));
  max-height: 280px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.object-chief-option {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.object-chief-option:hover { background: #edf5f3; }
.object-chief-option input { width: 16px; min-height: 16px; }
.object-chief-filter-options .secondary-button { margin-top: 5px; }

.timesheet-toolbar {
  grid-template-columns: minmax(180px, 1.2fr) minmax(150px, 0.7fr) minmax(280px, 1.5fr) auto;
}

.timesheet-object-filter,
.timesheet-chief-filter {
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.timesheet-object-filter summary,
.timesheet-chief-filter summary {
  display: grid;
  gap: 2px;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  list-style: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.timesheet-object-filter summary::-webkit-details-marker,
.timesheet-chief-filter summary::-webkit-details-marker { display: none; }
.timesheet-object-filter summary span,
.timesheet-chief-filter summary span { color: var(--muted); font-size: 11px; }
.timesheet-object-filter summary strong,
.timesheet-chief-filter summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.timesheet-object-filter[open] summary,
.timesheet-chief-filter[open] summary {
  border-color: var(--accent);
  background: #fbfefd;
  box-shadow: 0 0 0 3px rgba(31, 111, 99, 0.12);
}

.timesheet-object-filter-options,
.timesheet-chief-filter-options {
  position: absolute;
  z-index: 7;
  top: calc(100% + 4px);
  left: 0;
  display: grid;
  box-sizing: border-box;
  width: min(420px, calc(100vw - 48px));
  max-height: 280px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.timesheet-chief-filter-options { width: min(380px, calc(100vw - 48px)); }

.timesheet-object-filter-search,
.timesheet-chief-filter-search {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  margin-bottom: 6px;
  border-radius: 6px;
  background: #f8fafb;
}

.timesheet-object-filter-options label,
.timesheet-chief-option {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}

.timesheet-object-filter-options label:hover,
.timesheet-chief-option:hover {
  background: #edf5f3;
}

.timesheet-object-filter-options label.timesheet-object-option-hidden { display: none; }
.timesheet-chief-option.timesheet-chief-option-hidden { display: none; }
.timesheet-chief-option.is-active {
  background: #e4f0ed;
  color: var(--accent);
  font-weight: 700;
}
.timesheet-object-filter-all {
  border-bottom: 1px solid var(--line);
  margin-bottom: 5px;
  padding-bottom: 9px !important;
  font-weight: 700 !important;
}
.timesheet-chief-filter-all {
  border-bottom: 1px solid var(--line);
  margin-bottom: 5px;
  padding-bottom: 9px !important;
  font-weight: 700 !important;
}
.timesheet-object-filter-options label input { width: 16px; min-height: 16px; }

.content-panel:has(.timesheet-object-filter),
.content-panel:has(.timesheet-chief-filter),
.content-panel:has(.object-chief-filter),
.content-panel:has(.portal-filter-dropdown) {
  min-height: 430px;
  overflow: visible;
}

.content-panel:has(.portal-filter-dropdown) .toolbar,
.content-panel:has(.portal-filter-dropdown) .audit-filters {
  overflow: visible;
}

/*
 * Animated content blocks create independent stacking contexts. Keep the
 * currently opened filter and its toolbar above table wrappers rendered later
 * in the DOM, otherwise the options panel is painted behind the table.
 */
.content-panel:has(.portal-filter-dropdown[open]) > :has(.portal-filter-dropdown[open]) {
  position: relative;
  z-index: 2100;
  overflow: visible;
}

.content-panel:has(.portal-filter-dropdown) .table-wrap,
.content-panel:has(.portal-filter-dropdown) .audit-table-wrap {
  position: relative;
  z-index: 1;
}

.object-chief-filter[open],
.timesheet-object-filter[open],
.timesheet-chief-filter[open],
.payroll-employee-filter[open] {
  position: relative;
  z-index: 2200;
}

.content-panel > :not(.modal-layer):has(.object-chief-filter[open]),
.content-panel > :not(.modal-layer):has(.timesheet-object-filter[open]),
.content-panel > :not(.modal-layer):has(.timesheet-chief-filter[open]),
.content-panel > :not(.modal-layer):has(.payroll-employee-filter[open]) {
  position: relative;
  z-index: 2100;
  overflow: visible;
}

.object-chief-filter-options,
.timesheet-object-filter-options,
.timesheet-chief-filter-options,
.payroll-employee-options {
  z-index: 2300;
}

/* The pinned navigation must cover workspace dropdowns, while dialogs cover both. */
.sidebar { z-index: 2500; }
.modal-layer { z-index: 3000; }
.session-expired-layer {
  z-index: 10000;
  display: grid;
  place-items: center;
}
.session-expired-dialog {
  width: min(520px, calc(100vw - 32px));
}
.session-expired-dialog .settings-note {
  margin: 0;
}
body:has(.modal-layer:not(.is-hidden), .rp-modal-layer) .sidebar { z-index: 10; }

@media (max-width: 980px) {
  .sidebar.open + .sidebar-backdrop { z-index: 2490; }
}

.content-panel:has(.portal-filter-dropdown) .table-wrap:has(tbody:empty),
.content-panel:has(.portal-filter-dropdown) .audit-table-wrap:has(tbody:empty) {
  overflow: visible;
}

.timesheet-totals {
  display: flex;
  gap: 12px;
  margin: 14px 0;
}

.timesheet-totals > div {
  display: grid;
  gap: 3px;
  min-width: 190px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafb;
}

.timesheet-totals span { color: var(--muted); font-size: 13px; }
.timesheet-totals strong { font-size: 18px; }

.payroll-totals {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}
.payroll-totals > .payroll-summary-period { display:grid; align-items:initial; justify-content:initial; gap:3px; margin:0; padding:9px 10px; border:1px solid var(--border); border-left:4px solid var(--accent); border-radius:8px; background:#f4f8f7; }

.payroll-totals > div {
  min-width: 0;
  padding: 9px 10px;
}

.payroll-totals span {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.payroll-totals strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.timesheet-list-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin: 10px 0;
}

.timesheet-list-bar .timesheet-totals { flex: 1 1 auto; margin: 0; gap: 8px; }
.timesheet-list-bar .timesheet-totals > div { min-width: 120px; padding: 8px 10px; }
.timesheet-list-bar .timesheet-totals strong { font-size: 15px; }
.timesheet-list-bar #timesheetTopPagination { flex: 0 1 auto; min-width: 0; }
.timesheet-list-bar .table-pagination { flex-wrap: nowrap; padding: 0; white-space: nowrap; }

.timesheet-payroll-form { width: min(1180px, 100%); }
.payroll-period-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 145px)) minmax(140px, 155px) minmax(180px, 1fr) repeat(4, auto);
  gap: 8px;
  align-items: end;
  margin-bottom: 14px;
}
.payroll-period-filter label { display: grid; min-width: 0; gap: 5px; font-size: 13px; font-weight: 700; }
.payroll-period-filter input,
.payroll-period-filter select,
.payroll-period-filter button { min-width: 0; }
.payroll-period-filter.payroll-settlement-filter {
  grid-template-columns: repeat(2, minmax(130px, 145px)) minmax(220px, 1fr) repeat(4, auto);
}
.payroll-period-filter.payroll-auto-period-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f6f8f9;
}
.payroll-period-filter.payroll-auto-period-filter > label:not(.check-row) { flex: 0 1 155px; }
.payroll-period-filter.payroll-auto-period-filter > .payroll-employee-filter { flex: 1 1 175px; max-width: 260px; }
.payroll-period-filter.payroll-auto-period-filter > button {
  min-height: 38px;
  padding: 7px 10px;
  white-space: nowrap;
}
.payroll-period-filter.payroll-auto-period-filter > .check-row {
  display: flex;
  flex: 0 0 auto;
  grid-template-columns: none;
  align-items: center;
  align-self: end;
  gap: 7px;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.payroll-period-filter.payroll-auto-period-filter > .check-row:hover { border-color: var(--accent); background: #f3f8f8; }
.payroll-period-filter.payroll-auto-period-filter > .check-row input { width: 16px; min-height: 16px; margin: 0; }
.payroll-period-filter.payroll-auto-period-filter .payroll-employee-filter summary {
  min-height: 38px;
  padding: 5px 9px;
}
.payroll-period-filter.payroll-auto-period-filter.payroll-settlement-filter {
  grid-template-columns: minmax(220px, 1fr) repeat(4, auto);
}
.direct-payroll-toolbar,
.direct-payroll-add-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
}
.direct-payroll-toolbar > label,
.direct-payroll-add-row > label,
.direct-payroll-add-row > .direct-employee-filter { flex: 1 1 300px; min-width: 260px; max-width: none; }
.direct-employee-picker { display: grid; gap: 5px; font-size: 13px; font-weight: 700; }
.direct-employee-picker .payroll-employee-filter { width: 100%; }
.direct-payroll-actions { display: flex; flex: 0 0 auto; gap: 8px; align-items: center; }
.direct-payroll-toolbar button,
.direct-payroll-add-row button { width: auto; min-width: max-content; flex: 0 0 auto; }
#directPayrollResults .table-wrap { margin-top: 6px; }
#timesheetPayrollContent.direct-payroll-empty {
  min-height: min(560px, calc(100vh - 16px));
}
#timesheetPayrollContent.direct-payroll-empty .direct-employee-picker .payroll-employee-options {
  max-height: min(260px, calc(100vh - 190px));
}
@media (max-height: 620px) {
  #timesheetPayrollContent.direct-payroll-empty .direct-employee-picker .payroll-employee-options {
    top: auto;
    bottom: calc(100% + 4px);
  }
}
#directPayrollResults .timesheet-payroll-table th,
#directPayrollResults .timesheet-payroll-table td {
  padding: 3px 5px;
  line-height: 1.15;
  font-size: 12px;
}
#directPayrollResults .payroll-employee-total th { padding-block: 4px; }
#directPayrollResults .payroll-negative-payment > td {
  background: color-mix(in srgb, var(--danger) 8%, var(--panel));
}
#directPayrollResults .payroll-negative-payment > td:first-child {
  box-shadow: inset 3px 0 0 var(--danger);
}
#directPayrollResults .payroll-negative-payment > td:nth-child(5) strong {
  color: var(--danger);
}
#directPayrollResults .payroll-operation-item {
  min-height: 18px;
  margin: 0;
  gap: 3px;
  line-height: 1.1;
}
#directPayrollResults .payroll-operation-item button {
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
}
#directPayrollResults .payroll-operation-editor {
  grid-template-columns: minmax(68px, 82px) minmax(105px, 145px) 24px;
  gap: 3px;
  margin-top: 2px;
}
#directPayrollResults .payroll-operation-editor input,
#directPayrollResults .payroll-operation-editor select {
  height: 27px;
  min-height: 27px;
  padding: 2px 5px;
  font-size: 11px;
}
#directPayrollResults .payroll-operation-editor button {
  width: 24px;
  height: 27px;
  min-height: 27px;
  padding: 0;
}
.direct-payroll-toolbar,
.direct-payroll-add-row { margin-bottom: 8px; }
.compact-label { display: none; }
.payroll-employee-filter { position: relative; min-width: 0; }
.payroll-employee-filter summary {
  display: grid;
  gap: 2px;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  list-style: none;
}
.payroll-employee-filter summary::-webkit-details-marker { display: none; }
.payroll-employee-filter summary span { color: var(--muted); font-size: 11px; }
.payroll-employee-filter summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.payroll-employee-options {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: grid;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow);
}
.payroll-employee-search {
  width: 100%;
  margin-bottom: 4px;
}
.payroll-employee-options label { display: flex; grid-template-columns: none; align-items: center; gap: 8px; padding: 7px; font-weight: 500; }
.payroll-employee-options label.payroll-employee-option-hidden { display: none; }
.payroll-employee-all {
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.payroll-employee-options input { width: 16px; min-height: 16px; }
.payroll-employee-options .payroll-employee-search {
  width: 100%;
  min-height: 34px;
}
.payroll-employee-empty { padding: 7px; }
.payroll-employee-total th { background: #eef3f5; text-align: left; }
.payroll-screen-employee-name { font-size: 14px; }
.timesheet-payroll-table .payroll-employee-total > th,
.timesheet-payroll-table .payroll-editable-detail > td { padding-top: 6px; padding-bottom: 6px; }
.timesheet-payroll-table tr[data-payroll-job] > :nth-child(2) { border-left: 4px solid #d89b2b; }
.payroll-side-job-label { display: grid; gap: 2px; padding-left: 7px; color: #8a5a08; font-size: 8px !important; font-weight: 700; }
.payroll-side-job-label small { color: var(--muted); font-size: 11px; }
.timesheet-payroll-table .payroll-object-title > th {
  border: 1px solid #c6cdd2;
  padding: 5px 8px;
  background: #edf0f2;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
}
.timesheet-payroll-table .payroll-object-gap > td {
  height: 5px;
  padding: 0;
  border: 0;
  background: #fff;
}
.timesheet-payroll-table .payroll-grand-total-gap > td {
  height: 6px;
  padding: 0;
  border: 0;
  background: #fff;
}
.timesheet-payroll-table .payroll-grand-total > th,
.timesheet-payroll-table .payroll-grand-total > td {
  font-weight: 700;
}
.timesheet-payroll-table.payroll-main-object-table > :not(caption) > tr:not(.payroll-object-title) > :nth-child(2),
.timesheet-payroll-table.payroll-object-group-table > :not(caption) > tr:not(.payroll-object-title) > :nth-child(2) {
  width: 28%;
  min-width: 265px;
  white-space: nowrap;
}
.timesheet-payroll-table > :not(caption) > tr:not(.payroll-object-title) > :nth-child(6),
.timesheet-payroll-table > :not(caption) > tr:not(.payroll-object-title) > :nth-child(7) {
  width: 14%;
  min-width: 170px;
}
.timesheet-payroll-table > :not(caption) > tr:not(.payroll-object-title) > :nth-child(8) {
  width: 8%;
  min-width: 88px;
}
.timesheet-payroll-table td:nth-child(n + 3),
.timesheet-payroll-table th:nth-child(n + 3) { white-space: nowrap; text-align: right; }
.timesheet-payroll-table .payroll-editable-total th:nth-child(6),
.timesheet-payroll-table .payroll-editable-total th:nth-child(7),
.timesheet-payroll-table .payroll-editable-detail td:nth-child(6),
.timesheet-payroll-table .payroll-editable-detail td:nth-child(7) { white-space: normal; vertical-align: top; }
.payroll-operation-cell { display: grid; gap: 5px; }
.payroll-operation-item { display: flex; align-items: center; justify-content: flex-end; gap: 5px; font-weight: 500; }
.payroll-operation-item button { width: 22px; min-width: 22px; height: 22px; padding: 0; border: 0; background: transparent; color: var(--danger); font-size: 18px; cursor: pointer; }
.payroll-operation-editor { display: grid; grid-template-columns: minmax(62px, 76px) minmax(90px, 108px) 28px; justify-content: end; gap: 3px; }
.payroll-operation-editor input,
.payroll-operation-editor select { width: 100%; min-width: 0; min-height: 30px; padding: 4px 6px; font-size: 12px; }
.payroll-operation-editor button { min-width: 30px; min-height: 30px; padding: 2px; border: 1px solid var(--accent); border-radius: 5px; background: var(--accent); color: #fff; cursor: pointer; }
.payroll-adjustments-section {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid #d9e0e4;
  border-top: 3px solid #aebbc2;
  border-radius: 10px;
  background: #f4f7f8;
}
.payroll-adjustments-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.payroll-adjustment-panel {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  display: grid;
  gap: 8px;
  background: #fff;
}
.payroll-adjustment-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}
.payroll-adjustment-head > div { min-width: 0; }
.payroll-adjustment-head .small-button {
  flex: 0 0 auto;
  padding: 5px 9px;
}
.payroll-adjustment-head h3 {
  margin: 0;
  font-size: 16px;
}
.payroll-adjustment-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.payroll-adjustment-toolbar {
  position: relative;
  min-width: 0;
  max-width: 100%;
}
.payroll-adjustment-toolbar::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  border: 2px solid #8a96a3;
  border-radius: 50%;
  pointer-events: none;
}
.payroll-adjustment-toolbar::after {
  content: "";
  position: absolute;
  left: 24px;
  top: calc(50% + 5px);
  width: 7px;
  height: 2px;
  transform: rotate(45deg);
  background: #8a96a3;
  border-radius: 2px;
  pointer-events: none;
}
.payroll-adjustment-toolbar input {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 38px;
  padding: 8px 12px 8px 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  font-size: 13px;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.payroll-adjustment-toolbar input::placeholder {
  color: #8a96a3;
}
.payroll-adjustment-toolbar input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 111, 99, 0.12);
  outline: none;
}
.payroll-adjustment-table {
  width: 100%;
  min-width: 0;
  max-height: 360px;
  box-sizing: border-box;
}
.payroll-adjustment-table table {
  min-width: 0;
  table-layout: fixed;
  font-size: 12px;
}
.payroll-adjustment-table th,
.payroll-adjustment-table td {
  padding: 3px 6px;
  vertical-align: middle;
  line-height: 1.15;
}
.payroll-adjustment-table th:nth-child(1),
.payroll-adjustment-table td:nth-child(1) {
  width: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.payroll-adjustment-table th:nth-child(2),
.payroll-adjustment-table td:nth-child(2) {
  width: 92px;
  white-space: nowrap;
  text-align: right;
}
.payroll-adjustment-table th:nth-child(3),
.payroll-adjustment-table td:nth-child(3) {
  width: 96px;
}
.payroll-adjustment-table .action-row {
  flex-wrap: nowrap;
  gap: 3px;
  justify-content: flex-end;
}
.payroll-adjustment-table .small-button {
  min-height: 22px;
  padding: 1px 6px;
  font-size: 10.5px;
  line-height: 1;
}

.payroll-deduction-form {
  width: min(920px, 100%);
  padding: 14px;
}
.payroll-deduction-form .form-head {
  margin-bottom: 12px;
}
.payroll-deduction-form .form-head p {
  margin-top: 3px;
  font-size: 13px;
}
.payroll-deduction-grid {
  grid-template-columns: minmax(260px, 1.5fr) minmax(120px, .65fr) minmax(220px, 1fr);
  gap: 8px;
  align-items: start;
}
.payroll-deduction-grid label {
  gap: 4px;
  font-size: 12px;
}
.payroll-deduction-grid input,
.payroll-deduction-grid select {
  min-height: 36px;
}
.payroll-deduction-grid textarea {
  min-height: 58px;
  resize: vertical;
}
.payroll-deduction-grid .deduction-employee-field {
  grid-column: auto;
}
.payroll-deduction-grid .deduction-reason-field {
  grid-column: auto;
}
.payroll-deduction-grid > .wide { grid-column: auto; }
.payroll-addition-form > .form-grid {
  grid-template-columns: minmax(240px, 1.4fr) minmax(120px, .65fr) minmax(220px, 1fr);
  gap: 8px;
  align-items: start;
}
.payroll-addition-form > .form-grid > .wide { grid-column: auto; }
.payroll-addition-form > .form-grid:has(select[name="objectId"]) { grid-template-columns: minmax(210px, 1.25fr) minmax(190px, 1fr) minmax(110px, .55fr) minmax(190px, 1fr); }
.payroll-addition-form > .form-grid label { gap: 4px; font-size: 12px; }
.payroll-addition-form > .form-grid input,
.payroll-addition-form > .form-grid select { min-height: 36px; }
.payroll-type-catalog-form { width: min(820px, 100%); }
.payroll-type-catalog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.payroll-type-catalog-panel {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}
.payroll-type-catalog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.payroll-type-sortable { display: grid; gap: 5px; min-height: 42px; max-height: 390px; overflow-y: auto; }
.payroll-type-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: grab;
}
.payroll-type-row:active { cursor: grabbing; }
.payroll-type-row.is-dragging { opacity: .42; border-color: var(--accent); }
.payroll-type-row input { min-width: 0; min-height: 34px; padding: 5px 8px; }
.payroll-type-drag {
  width: 28px;
  min-width: 28px;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  letter-spacing: -4px;
  cursor: grab;
}
.payroll-type-remove { width: 30px; min-width: 30px; min-height: 30px; }
.payroll-deduction-form .form-actions {
  margin-top: 12px;
}

#deductionForm.payroll-deduction-form,
#additionForm.payroll-deduction-form:not(.payroll-addition-form) {
  width: min(920px, calc(100vw - 32px));
}
#deductionForm > .payroll-deduction-grid,
#additionForm:not(.payroll-addition-form) > .payroll-deduction-grid {
  grid-template-columns: minmax(260px, 1.45fr) minmax(140px, .7fr) minmax(220px, 1.1fr);
  gap: 8px;
}
#deductionForm > .payroll-deduction-grid > label,
#additionForm:not(.payroll-addition-form) > .payroll-deduction-grid > label {
  grid-column: auto;
  min-width: 0;
}
#deductionForm > .payroll-deduction-grid input,
#deductionForm > .payroll-deduction-grid select,
#additionForm:not(.payroll-addition-form) > .payroll-deduction-grid input,
#additionForm:not(.payroll-addition-form) > .payroll-deduction-grid select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
}
.payroll-type-native-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0;
  pointer-events: none;
}
.payroll-type-dropdown { position: relative; min-width: 0; }
.payroll-type-dropdown-trigger {
  position: relative;
  width: 100%;
  min-height: 36px;
  padding: 6px 34px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.payroll-type-dropdown-trigger::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-65%) rotate(45deg);
}
.payroll-type-dropdown-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  display: grid;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(32, 45, 52, .2);
}
.payroll-type-dropdown-menu.is-portal-overlay {
  position: fixed;
  z-index: 1000;
  right: auto;
  bottom: auto;
}
.payroll-type-dropdown-menu.is-hidden { display: none; }
.payroll-type-dropdown-menu button {
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.payroll-type-dropdown-menu button:hover,
.payroll-type-dropdown-menu button.is-selected { background: var(--soft); color: var(--accent); }

.settings-rate-block {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--soft);
}
.settings-rate-head { display: grid; gap: 3px; }
.settings-rate-head span { color: var(--muted); font-size: 12px; font-weight: 500; }
.settings-rate-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.settings-tech-rate-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.settings-rate-table { display: grid; gap: 8px; }
.settings-rate-row { display: grid; grid-template-columns: 140px repeat(2, minmax(130px, 1fr)); gap: 10px; align-items: center; }
.settings-rate-labels { color: var(--muted); font-size: 12px; }

@media (max-width: 1100px) {
  .payroll-adjustments-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .payroll-deduction-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .payroll-deduction-grid .deduction-employee-field {
    grid-column: 1 / -1;
  }
  .payroll-addition-form > .form-grid,
  .payroll-addition-form > .form-grid:has(select[name="objectId"]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .payroll-period-filter,
  .payroll-period-filter.payroll-auto-period-filter {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }
  .payroll-period-filter label,
  .payroll-period-filter .payroll-employee-filter {
    grid-column: 1 / -1;
  }
  .payroll-period-filter button {
    width: 100%;
    min-height: 36px;
    padding-inline: 6px;
    font-size: 12px;
  }
  .direct-payroll-toolbar button,
  .direct-payroll-add-row button { width: auto; padding-inline: 12px; }
  .direct-payroll-actions { width: 100%; }
.payroll-period-filter .payroll-print-button { display: none; }
.payroll-summary-period { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:0 0 8px; padding:8px 12px; border:1px solid var(--line); border-left:4px solid var(--accent); border-radius:7px; background:#f5f8f8; }
.payroll-summary-period span { color:var(--muted); font-size:12px; }
.payroll-summary-period strong { color:var(--ink); font-size:14px; }
  .payroll-period-filter .wide-label { display: none; }
  .payroll-period-filter .compact-label { display: inline; }
  .payroll-adjustments-grid { grid-template-columns: 1fr; }
  .payroll-deduction-form {
    width: min(100%, calc(100vw - 24px));
    padding: 14px;
  }
  .payroll-deduction-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .payroll-deduction-grid .deduction-employee-field,
  .payroll-deduction-grid .deduction-reason-field {
    grid-column: auto;
  }
  .payroll-addition-form > .form-grid,
  .payroll-addition-form > .form-grid:has(select[name="objectId"]),
  .payroll-type-catalog-grid { grid-template-columns: 1fr; }
  .payroll-adjustment-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }
  .payroll-adjustment-head .small-button {
    width: auto;
    justify-content: center;
    min-height: 32px;
    padding: 5px 10px;
    white-space: nowrap;
  }
  .payroll-adjustment-head p { display: none; }
  .payroll-adjustment-toolbar input {
    min-width: 0;
    max-width: 100%;
  }
  .payroll-adjustment-table {
    max-height: none;
    overflow: hidden;
  }
  .payroll-adjustment-table table,
  .payroll-adjustment-table thead,
  .payroll-adjustment-table tbody,
  .payroll-adjustment-table tr,
  .payroll-adjustment-table th,
  .payroll-adjustment-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .payroll-adjustment-table thead {
    display: none;
  }
  .payroll-adjustment-table tbody {
    display: grid;
    gap: 6px;
  }
  .payroll-adjustment-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 86px 96px;
    gap: 4px 7px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }
  .payroll-adjustment-table td {
    padding: 0;
    border: 0;
  }
  .payroll-adjustment-table td:nth-child(1) {
    grid-column: 1;
    white-space: nowrap;
    color: inherit;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .payroll-adjustment-table td:nth-child(2) {
    grid-column: 2;
    min-width: 0;
    text-align: right;
    white-space: nowrap;
    font-weight: 700;
  }
  .payroll-adjustment-table td:nth-child(3) {
    grid-column: 3;
  }
  .payroll-adjustment-table .action-row {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
  }
  .payroll-adjustment-table .small-button {
    width: auto;
    padding-inline: 5px;
  }
  .settings-rate-grid { grid-template-columns: 1fr; }
  .settings-rate-row { grid-template-columns: 1fr 1fr; }
  .settings-rate-row strong { grid-column: span 2; }
}

@media (max-width: 420px) {
  .payroll-adjustment-head h3 {
    font-size: 15px;
  }
  .payroll-adjustment-head .small-button {
    padding-inline: 8px;
    font-size: 11px;
  }
  .payroll-adjustment-toolbar::before {
    left: 10px;
    width: 12px;
    height: 12px;
  }
  .payroll-adjustment-toolbar::after {
    left: 21px;
  }
  .payroll-adjustment-toolbar input {
    min-height: 36px;
    padding-left: 33px;
  }
  .payroll-adjustment-table tr {
    grid-template-columns: minmax(0, 1fr) 72px 86px;
    padding: 6px;
  }
}

.contract-form.timesheet-document-form {
  width: calc(100vw - 48px);
  max-width: none;
  max-height: calc(100vh - 32px);
}

@media (max-width: 700px) {
  .contract-form.timesheet-document-form {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }
}

.timesheet-calendar-wrap {
  overflow: auto;
  max-height: 62vh;
  border: 1px solid var(--border);
}

.timesheet-calendar {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.timesheet-calendar th,
.timesheet-calendar td {
  min-width: 48px;
  padding: 5px;
  text-align: center;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.timesheet-calendar thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef2f5;
}

.timesheet-calendar th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 210px;
  text-align: left;
  background: #fff;
}

.timesheet-calendar thead th:first-child { z-index: 3; background: #eef2f5; }
.timesheet-calendar th small { display: block; color: var(--muted); font-weight: 500; }
.timesheet-calendar .timesheet-day-off { background: #fde8e8; color: #a52323; }
.timesheet-calendar .timesheet-day-off input { background: #fff3f3; color: #a52323; }
.timesheet-calendar input { width: 48px; min-width: 48px; padding: 6px 3px; text-align: center; }
.timesheet-entry-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
}
.timesheet-entry-hint strong,
.timesheet-entry-hint b { color: var(--ink); }
.timesheet-new-employee-action {
  display: flex;
  justify-content: flex-start;
  margin-top: 10px;
}
.timesheet-new-employee-button {
  min-width: 220px;
  justify-content: center;
}
.timesheet-calendar tfoot th,
.timesheet-calendar tfoot td { background: #f4f7f8; font-weight: 700; }
.correction-reason { display: grid; gap: 6px; margin-top: 16px; }
.correction-history { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.correction-history-entry { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-top: 10px; }
.correction-history-entry p { min-width: 0; margin: 0; }
.correction-history-delete { flex: 0 0 auto; color: var(--danger); }

@media (max-width: 860px) {
  .timesheet-toolbar { grid-template-columns: 1fr; }
  .timesheet-totals { display: grid; grid-template-columns: 1fr 1fr; }
  .timesheet-totals > div { min-width: 0; }
  .payroll-totals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.tech-toolbar {
  grid-template-columns: minmax(260px, 1fr) 180px 150px 150px auto;
  align-items: end;
}

.employees-toolbar {
  grid-template-columns: minmax(240px, 1.25fr) repeat(5, minmax(145px, 1fr));
}

.projects-toolbar {
  grid-template-columns: minmax(220px, 1fr) 180px 220px auto;
}

.purchase-toolbar {
  grid-template-columns: minmax(240px, 1fr) 220px auto;
}

.document-toolbar {
  grid-template-columns: minmax(240px, 1fr) repeat(3, minmax(170px, 1fr)) auto;
}

.instruments-toolbar {
  grid-template-columns: minmax(260px, 1fr) repeat(2, minmax(180px, 1fr)) auto;
}

.fleet-toolbar {
  grid-template-columns: minmax(260px, 1fr) 220px auto;
}

.fleet-section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:16px}.fleet-section-head h2{margin:0;color:var(--ink);font-size:24px}.fleet-section-head p{margin:5px 0 0;color:var(--muted);font-size:13px}.fleet-add-button{display:inline-flex;align-items:center;gap:7px}.fleet-add-button svg{width:16px;height:16px}.fleet-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:14px}.fleet-metric{display:flex;align-items:flex-start;gap:12px;min-width:0;padding:16px;border:1px solid var(--line);border-radius:11px;background:var(--bg-card,#fff);box-shadow:0 2px 7px rgb(31 48 68 / 5%)}.fleet-metric>span{display:grid;flex:0 0 38px;width:38px;height:38px;place-items:center;border-radius:9px;color:#2168d8;background:#eaf2ff}.fleet-metric>span svg{width:21px;height:21px}.fleet-metric>div{display:grid;min-width:0;gap:3px}.fleet-metric small{color:var(--muted);font-size:11px;font-weight:700}.fleet-metric strong{color:var(--ink);font-size:25px;line-height:1.1}.fleet-metric em{overflow:hidden;color:var(--muted);font-size:10px;font-style:normal;text-overflow:ellipsis;white-space:nowrap}.fleet-metric-active>span{color:#218655;background:#e6f7ed}.fleet-metric-service>span{color:#c77b12;background:#fff3dc}.fleet-metric-repair>span{color:#d3444d;background:#ffebed}.fleet-workspace{overflow:hidden;border:1px solid var(--line);border-radius:10px;background:var(--bg-card,#fff)}

.duty-toolbar {
  grid-template-columns: minmax(220px, 1fr) 38px 140px 140px 38px minmax(190px, 230px);
  align-items: end;
}

.duty-toolbar label {
  font-size: 13px;
}

.duty-toolbar input,
.duty-toolbar select {
  min-height: 38px;
  padding: 8px 10px;
}

.duty-toolbar .primary-button,
.duty-toolbar .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  height: 38px;
  padding: 8px 10px;
  white-space: normal;
  line-height: 1.15;
}

#resetDutyFilters {
  min-width: 190px;
  padding: 8px 18px;
  border-color: #5f8eac;
  background: linear-gradient(135deg, #eef7fc, #dceef8);
  color: #244f69;
  font-weight: 800;
  box-shadow: 0 3px 9px rgba(55, 104, 134, 0.14);
}

#resetDutyFilters:hover {
  border-color: #397697;
  background: linear-gradient(135deg, #e5f4fc, #cfe8f5);
}

.duty-toolbar .duty-date-nav-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  align-self: end;
  border: 1px solid #86a9bd;
  background: #eef7fc;
  color: #315f78;
}

.duty-toolbar .duty-date-nav-button:hover {
  border-color: #397697;
  background: #dceef8;
}

.duty-page-size-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.duty-page-size-control select {
  width: 70px;
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

/* The fixed desktop sidebar leaves tablet viewports with a narrow content area. */
@media (max-width: 1280px) {
  .contract-toolbar,
  .objects-toolbar,
  .timesheet-toolbar,
  .tech-toolbar,
  .employees-toolbar,
  .projects-toolbar,
  .purchase-toolbar,
  .document-toolbar,
  .instruments-toolbar,
  .fleet-toolbar,
  .duty-toolbar,
  .equipment-toolbar,
  .equipment-movement-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

.duty-subsections {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.duty-subsection {
  display: grid;
  gap: 10px;
}

.subsection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.subsection-head h3 {
  margin: 0;
  font-size: 18px;
}

.pagination-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.table-pagination {
  padding: 7px 0;
  flex-wrap: wrap;
  font-size: 12px;
}

.table-pagination label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.table-pagination select {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 7px;
  background: #fff;
}

.pagination-controls span {
  min-width: 52px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.pagination-controls .pagination-info {
  min-width: 128px;
  text-align: center;
}

.table-pagination .secondary-button {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.tab-button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 12px;
  background: transparent;
  color: #354151;
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

.tab-button:hover {
  background: rgba(255, 255, 255, 0.72);
  border-color: #d4dbe2;
}

.tab-button.active {
  border-color: #c9ddd8;
  background: #fff;
  color: var(--accent-dark);
  box-shadow: 0 1px 3px rgba(23, 32, 42, 0.08);
}

.settings-panel {
  display: grid;
  gap: 16px;
}

.settings-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--soft);
}
.settings-object-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.settings-object-create { display: grid; gap: 14px; background: #fff; }
.settings-object-create .primary-button { width: 100%; }
.settings-object-list { min-width: 0; background: #fff; }
.settings-object-list .settings-table-wrap { margin-top: 0; }
@media (max-width: 900px) { .settings-object-layout { grid-template-columns: 1fr; } }
.virtual-objects-card { padding: 12px; }
.virtual-objects-card .system-settings-card-head { margin-bottom: 8px; }
.virtual-objects-card .system-settings-card-head p { margin-top: 2px; }
.virtual-object-list { display: grid; gap: 5px; }
.virtual-object-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto 34px; gap: 6px; align-items: center; transition: opacity .15s, transform .15s; }
.virtual-object-row.is-dragging { opacity: .45; transform: scale(.99); }
.virtual-object-drag { display: grid; place-items: center; height: 30px; color: var(--muted); cursor: grab; font-weight: 800; letter-spacing: -3px; user-select: none; }
.virtual-object-drag:active { cursor: grabbing; }
.virtual-object-row input { min-height: 32px; padding: 4px 8px; font-size: 13px; }
.virtual-object-row .status { min-width: 92px; text-align: center; }
.virtual-object-row .icon-button { width: 32px; height: 32px; min-height: 32px; }
.virtual-object-add { display: grid; grid-template-columns: minmax(120px, 1fr) auto auto; gap: 6px; margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); }
.virtual-object-add input, .virtual-object-add button { min-height: 32px; padding-block: 4px; }
@media (max-width: 700px) { .virtual-object-add { grid-template-columns: 1fr; } .virtual-object-row { grid-template-columns: 20px minmax(0, 1fr) 34px; } .virtual-object-row .status { display: none; } }

.settings-table-wrap {
  margin-top: 16px;
}

.settings-users-table {
  min-width: 1120px;
  table-layout: fixed;
}

.settings-users-table th:nth-child(1) { width: 16%; }
.settings-users-table th:nth-child(2) { width: 12%; }
.settings-users-table th:nth-child(3) { width: 18%; }
.settings-users-table th:nth-child(4) { width: 20%; }
.settings-users-table th:nth-child(5) { width: 130px; }
.settings-users-table th:nth-child(6) { width: 340px; }

.settings-users-table td {
  overflow-wrap: anywhere;
  vertical-align: middle;
}

.settings-users-table td:last-child .action-row {
  flex-wrap: nowrap;
}

.settings-users-table [data-user-edit] { width: 112px; }
.settings-users-table [data-user-block] { width: 126px; }
.settings-users-table [data-user-delete] { width: 76px; }

.user-role-field { display: grid; gap: 6px; color: #354151; font-size: 14px; font-weight: 700; }
.user-role-picker { position: relative; min-width: 0; }
.user-role-picker summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  list-style: none;
}
.user-role-picker summary::-webkit-details-marker { display: none; }
.user-role-picker summary::after { content: "⌄"; margin-left: auto; color: var(--muted); font-size: 16px; }
.user-role-picker summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.user-role-options {
  position: absolute;
  z-index: 8;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 280px;
  overflow: auto;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow);
}
.settings-form .user-role-options label { display:flex; grid-template-columns:none; flex-direction:row; align-items:center; gap:8px; min-width:0; margin:0; padding:7px; font-weight:500; cursor:pointer; }
.settings-form .user-role-options label span { min-width:0; line-height:1.25; }
.settings-form .user-role-options input { width:16px; min-width:16px; height:16px; min-height:16px; margin:0; padding:0; flex:0 0 16px; }

@media (max-width: 680px) {
  .user-role-options { grid-template-columns: 1fr; }
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
}

.contracts-table {
  min-width: 1570px;
}

.contracts-table th,
.contracts-table td {
  padding: 8px 10px;
  line-height: 1.25;
}

.contracts-table th {
  font-size: 12px;
}

.contracts-table td {
  font-size: 13px;
}

.contracts-table th:nth-child(6),
.contracts-table td:nth-child(6) {
  width: 135px;
  max-width: 135px;
}

.contracts-table th:nth-child(7),
.contracts-table td:nth-child(7) {
  width: 175px;
  min-width: 175px;
  white-space: nowrap;
}

.contracts-table th:nth-child(4),
.contracts-table td:nth-child(4) {
  width: 160px;
  min-width: 160px;
}

.contract-object-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; max-width: 190px; }
.contract-object-tags button, .contract-object-tags b { display: block; max-width: 150px; overflow: hidden; padding: 3px 7px; border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line)); border-radius: 6px; background: color-mix(in srgb, var(--accent) 8%, var(--panel)); color: var(--accent-dark); font: inherit; font-size: 10.5px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.contract-object-tags button { cursor: pointer; text-align: left; }
.contract-object-tags button:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 15%, var(--panel)); text-decoration: underline; }
.contract-object-tags b { flex: 0 0 auto; color: var(--muted); background: var(--soft); font-weight: 700; }

.contracts-table .muted {
  font-size: 12px;
}

.contracts-table .status {
  min-height: 22px;
  padding: 2px 8px;
  font-size: 11px;
}

.contracts-table .contract-prolonged-status {
  margin-top: 4px;
  border-color: #85b8a9;
  background: #e7f5ef;
  color: #17614f;
  white-space: nowrap;
}

.contracts-table .action-row {
  gap: 5px;
}

.contracts-table .small-button {
  min-height: 26px;
  padding: 0 8px;
  font-size: 11.5px;
}

.documents-table {
  min-width: 1120px;
}

.tools-table {
  min-width: 1180px;
}

.fleet-table {
  min-width: 1040px;
  margin: 0;
  border: 0;
}

.fleet-table th{padding-top:12px;padding-bottom:12px;color:var(--muted);background:var(--soft);font-size:11px;font-weight:700;text-transform:none}.fleet-table td{height:67px;padding-top:9px;padding-bottom:9px;vertical-align:middle}.fleet-table tbody tr{transition:background .15s ease,box-shadow .15s ease}.fleet-table tbody tr:hover{background:color-mix(in srgb,var(--accent) 4%,transparent);box-shadow:inset 3px 0 0 var(--accent)}.fleet-vehicle-cell{display:flex;align-items:center;gap:11px;min-width:230px}.fleet-vehicle-cell>div:last-child{display:grid;min-width:0;gap:3px}.fleet-vehicle-cell .link-button{overflow:hidden;max-width:190px;padding:0;font-weight:750;text-align:left;text-overflow:ellipsis;white-space:nowrap}.fleet-vehicle-cell span,.fleet-cell-note{display:block;margin-top:3px;color:var(--muted);font-size:10px;font-weight:400}.fleet-thumb{display:grid;flex:0 0 58px;width:58px;height:42px;overflow:hidden;place-items:center;border:1px solid var(--line);border-radius:8px;color:var(--muted);background:linear-gradient(145deg,#f7f9fc,#eef2f6)}.fleet-thumb img,.fleet-view-photo img,.fleet-photo-preview img{width:100%;height:100%;object-fit:cover}.fleet-thumb svg{width:25px;height:25px}.fleet-row-actions{flex-wrap:nowrap;max-width:260px;overflow-x:auto;padding-bottom:2px}.fleet-row-actions .small-button{flex:0 0 auto;min-height:26px;font-size:10px}.fleet-photo-editor{display:flex;align-items:center;gap:16px;padding:14px;border:1px dashed var(--line);border-radius:10px;background:var(--soft)}.fleet-photo-editor>div:last-child{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.fleet-photo-editor strong,.fleet-photo-editor p{flex:0 0 100%;margin:0}.fleet-photo-editor p{color:var(--muted);font-size:11px}.fleet-photo-preview{display:grid;flex:0 0 150px;width:150px;height:96px;overflow:hidden;place-items:center;border:1px solid var(--line);border-radius:9px;color:var(--muted);background:#fff}.fleet-photo-preview svg{width:45px;height:45px}.fleet-view-title{display:flex;align-items:center;gap:14px}.fleet-view-title>div:last-child{display:grid;justify-items:start;gap:4px}.fleet-view-title h3,.fleet-view-title p{margin:0}.fleet-view-photo{display:grid;flex:0 0 132px;width:132px;height:86px;overflow:hidden;place-items:center;border:1px solid var(--line);border-radius:10px;color:var(--muted);background:var(--soft)}.fleet-view-photo svg{width:44px;height:44px}

@media(max-width:1020px){.fleet-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:680px){.fleet-section-head{align-items:stretch;flex-direction:column}.fleet-add-button{justify-content:center}.fleet-metrics{grid-template-columns:1fr}.fleet-photo-editor,.fleet-view-title{align-items:stretch;flex-direction:column}.fleet-photo-preview,.fleet-view-photo{width:100%}}
.fleet-row-actions{position:relative;display:flex;justify-content:center;max-width:none;overflow:visible;padding:0}.fleet-row-menu{position:relative}.fleet-row-menu[open]{z-index:25}.fleet-row-menu summary{display:grid;width:32px;height:30px;place-items:center;border:1px solid var(--line);border-radius:7px;color:var(--ink);background:var(--panel);font-size:13px;font-weight:800;letter-spacing:1px;cursor:pointer;list-style:none}.fleet-row-menu summary::-webkit-details-marker{display:none}.fleet-row-menu summary:hover,.fleet-row-menu[open] summary{border-color:var(--accent);color:var(--accent);background:color-mix(in srgb,var(--accent) 7%,var(--panel))}.fleet-row-menu-panel{position:absolute;z-index:30;top:calc(100% + 5px);right:0;display:grid;width:205px;padding:6px;border:1px solid var(--line);border-radius:9px;background:var(--panel);box-shadow:0 14px 36px rgb(26 39 53 / 18%)}.fleet-row-menu-panel .small-button{display:flex;align-items:center;width:100%;min-height:32px;padding:7px 9px;border:0;border-radius:6px;color:var(--ink);background:transparent;font-size:11px;text-align:left;box-shadow:none}.fleet-row-menu-panel .small-button:hover{background:var(--soft)}.fleet-row-menu-panel .danger-button{color:var(--danger)}.fleet-row-menu-panel .danger-button:hover{background:color-mix(in srgb,var(--danger) 9%,var(--panel))}
.fleet-waybill-form{width:min(900px,calc(100vw - 28px));max-height:calc(100vh - 28px);overflow:auto}.fleet-waybill-grid{grid-template-columns:repeat(2,minmax(0,1fr))}@media(max-width:680px){.fleet-waybill-grid{grid-template-columns:1fr}.fleet-waybill-grid .wide{grid-column:auto}.fleet-row-menu-panel{right:-4px;width:190px}}
.fleet-workspace,.fleet-workspace .table-wrap{overflow:visible}.fleet-table td:last-child{position:relative;width:58px}.fleet-table tbody tr:nth-last-child(-n+3) .fleet-row-menu-panel{top:auto;bottom:calc(100% + 5px)}

.duty-table {
  min-width: 860px;
}

.duty-transport-table {
  min-width: 820px;
}

.duty-transport-history-table {
  min-width: 980px;
}

.form-static-value {
  display: grid;
  gap: 6px;
  align-content: start;
}

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

.duty-group-table {
  min-width: 1480px;
}

.duty-crew-cell {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: start;
  gap: 2px 5px;
  font-size: 15px;
  line-height: 1.18;
}

.duty-crew-cell strong,
.duty-crew-cell span {
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

.duty-group-history-table {
  min-width: 1520px;
}

.duty-group-members {
  display: grid;
  gap: 6px;
}

.duty-group-members > span {
  font-weight: 800;
}

.weapon-tabs {
  overflow-x: auto;
}

.weapon-org-filter {
  display: grid;
  gap: 6px;
  max-width: 360px;
  margin-bottom: 14px;
  font-weight: 700;
}

.weapon-filterbar {
  grid-template-columns: minmax(220px, 320px) minmax(280px, 1fr);
  align-items: end;
}

.weapon-filterbar .weapon-org-filter,
.weapon-search-filter {
  display: grid;
  gap: 6px;
  max-width: none;
  margin: 0;
  font-weight: 700;
}

.weapon-alerts {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #e5b84f;
  border-radius: 6px;
  background: #fff8e5;
  color: #5f4611;
}

.weapon-document-group + .weapon-document-group {
  margin-top: 12px;
}

.weapon-document-group h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.weapon-documents-table {
  table-layout: fixed;
  min-width: 820px;
}

.weapon-documents-table th,
.weapon-documents-table td {
  padding: 6px 8px;
  line-height: 1.2;
  vertical-align: middle;
}

.weapon-documents-table th {
  font-size: 11px;
  white-space: nowrap;
}

.weapon-documents-table td {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.weapon-documents-table .muted { font-size: 10px; }
.weapon-documents-table .status { min-height: 19px; padding: 1px 6px; font-size: 10px; }
.weapon-documents-table .action-row { gap: 4px; flex-wrap: nowrap; }
.weapon-documents-table .small-button { min-height: 25px; padding: 3px 7px; font-size: 10px; }

.weapon-documents-table-rsla { min-width: 980px; }
.weapon-documents-table-rsla th:nth-child(1) { width: 9%; }
.weapon-documents-table-rsla th:nth-child(2) { width: 13%; }
.weapon-documents-table-rsla th:nth-child(3) { width: 16%; }
.weapon-documents-table-rsla th:nth-child(4) { width: 20%; }
.weapon-documents-table-rsla th:nth-child(5) { width: 9%; }
.weapon-documents-table-rsla th:nth-child(6) { width: 10%; }
.weapon-documents-table-rsla th:nth-child(7) { width: 8%; }
.weapon-documents-table-rsla th:nth-child(8) { width: 15%; }

.weapon-documents-table-rhi { min-width: 720px; }
.weapon-documents-table-rhi th:nth-child(1) { width: 15%; }
.weapon-documents-table-rhi th:nth-child(2) { width: 23%; }
.weapon-documents-table-rhi th:nth-child(3),
.weapon-documents-table-rhi th:nth-child(4) { width: 14%; }
.weapon-documents-table-rhi th:nth-child(5) { width: 16%; }
.weapon-documents-table-rhi th:nth-child(6) { width: 18%; }

.weapon-documents-table-other th:nth-child(1) { width: 12%; }
.weapon-documents-table-other th:nth-child(2),
.weapon-documents-table-other th:nth-child(3) { width: 18%; }
.weapon-documents-table-other th:nth-child(4),
.weapon-documents-table-other th:nth-child(5) { width: 12%; }
.weapon-documents-table-other th:nth-child(6) { width: 13%; }
.weapon-documents-table-other th:nth-child(7) { width: 15%; }

.weapon-compact-table {
  table-layout: fixed;
  min-width: 860px;
}

.weapon-compact-table th,
.weapon-compact-table td {
  padding: 6px 8px;
  line-height: 1.2;
  vertical-align: middle;
}

.weapon-compact-table th {
  font-size: 11px;
  white-space: nowrap;
}

.weapon-compact-table td {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.weapon-compact-table .muted { font-size: 10px; }
.weapon-compact-table .status { min-height: 19px; padding: 1px 6px; font-size: 10px; }
.weapon-compact-table .action-row { gap: 4px; flex-wrap: nowrap; }
.weapon-compact-table .small-button { min-height: 25px; padding: 3px 7px; font-size: 10px; }

.weapon-registry-table th:nth-child(1) { width: 16%; }
.weapon-registry-table th:nth-child(2) { width: 13%; }
.weapon-registry-table th:nth-child(3) { width: 16%; }
.weapon-registry-table th:nth-child(4) { width: 15%; }
.weapon-registry-table th:nth-child(5) { width: 10%; }
.weapon-registry-table th:nth-child(6) { width: 15%; }
.weapon-registry-table th:nth-child(7) { width: 15%; }

.weapon-ammunition-table { min-width: 820px; }
.weapon-ammunition-table th:nth-child(1) { width: 13%; }
.weapon-ammunition-table th:nth-child(2) { width: 11%; }
.weapon-ammunition-table th:nth-child(3) { width: 14%; }
.weapon-ammunition-table th:nth-child(4) { width: 14%; }
.weapon-ammunition-table th:nth-child(5) { width: 12%; }
.weapon-ammunition-table th:nth-child(6) { width: 10%; }
.weapon-ammunition-table th:nth-child(7) { width: 9%; }
.weapon-ammunition-table th:nth-child(8) { width: 17%; }

.weapon-document-group tbody tr:has(.status.warning) > td {
  background: #fff4d6;
}

.weapon-document-group tbody tr:has(.status.warning) > td:first-child {
  box-shadow: inset 4px 0 #e2a400;
}

.weapon-document-group tbody tr:has(.status.danger) > td {
  background: #fff0f0;
}

.weapon-document-group tbody tr:has(.status.danger) > td:first-child {
  box-shadow: inset 4px 0 #c83b3b;
}

.weapon-report-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.weapon-report-grid .role-card {
  display: grid;
  gap: 8px;
}

.weapon-report-grid .role-card span {
  font-size: 28px;
  font-weight: 800;
}

#weaponModal .weapon-entry-form {
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: #f7f9fb;
  box-shadow: 0 22px 65px rgb(16 32 48 / 28%);
}

#weaponModal .weapon-entry-form-document {
  width: min(980px, calc(100vw - 32px));
}

#weaponModal .weapon-entry-form > .form-head {
  position: sticky;
  z-index: 2;
  top: 0;
  align-items: center;
  margin: 0;
  padding: 15px 19px;
  border-bottom: 1px solid #dce4ea;
  background: linear-gradient(135deg, #edf7f4, #f7fafc);
}

#weaponModal .weapon-entry-form > .form-head h3 {
  color: #1d2b37;
  font-size: 19px;
}

#weaponModal .weapon-entry-form > .form-head p {
  margin-top: 3px;
  font-size: 12px;
}

#weaponModal .weapon-entry-form > .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px 10px;
  padding: 16px 19px;
}

#weaponModal .weapon-entry-form .form-grid label {
  gap: 4px;
  font-size: 12px;
}

#weaponModal .weapon-entry-form input,
#weaponModal .weapon-entry-form select,
#weaponModal .weapon-entry-form textarea {
  min-height: 36px;
  padding: 6px 9px;
  border-radius: 7px;
  font-size: 13px;
}

#weaponModal .weapon-entry-form textarea {
  min-height: 58px;
}

#weaponModal .weapon-entry-form .check-row {
  min-height: 36px;
  padding: 0 2px;
}

#weaponModal .weapon-entry-form .check-row input {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

#weaponModal .weapon-entry-form > .form-actions {
  position: sticky;
  bottom: 0;
  margin: 0;
  padding: 11px 19px;
  border-top: 1px solid #dce4ea;
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(8px);
}

#weaponModal .weapon-entry-form > .form-actions button {
  min-height: 34px;
  padding: 6px 13px;
}

.rp-weapon-modal-card {
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: #f7f9fb;
  box-shadow: 0 22px 65px rgb(16 32 48 / 28%);
}

.rp-weapon-modal-card.rp-weapon-modal-document { width: min(980px, calc(100vw - 32px)); }
.rp-weapon-modal-card > .form-head { position: sticky; z-index: 2; top: 0; align-items: center; margin: 0; padding: 12px 19px; border-bottom: 1px solid #dce4ea; background: linear-gradient(135deg, #edf7f4, #f7fafc); }
.rp-weapon-modal-card > .form-head h3 { color: #1d2b37; font-size: 19px; }
.rp-weapon-modal-card > .form-head p { margin-top: 3px; font-size: 12px; }
.rp-weapon-modal-card > form > .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px 10px; padding: 16px 19px; }
.rp-weapon-modal-card .form-grid label { gap: 4px; font-size: 12px; }
.rp-weapon-modal-card input,
.rp-weapon-modal-card select,
.rp-weapon-modal-card textarea { min-height: 36px; padding: 6px 9px; border-radius: 7px; font-size: 13px; }
.rp-weapon-modal-card textarea { min-height: 58px; }
.rp-weapon-modal-card .check-row { min-height: 36px; padding: 0 2px; }
.rp-weapon-modal-card .check-row input { width: 16px; min-height: 16px; padding: 0; }
.rp-weapon-modal-card > form > .form-actions { position: sticky; bottom: 0; margin: 0; padding: 11px 19px; border-top: 1px solid #dce4ea; background: rgb(255 255 255 / 96%); backdrop-filter: blur(8px); }
.rp-weapon-documents > .primary-button { margin-bottom: 14px; }
.rp-weapon-documents .weapon-document-group + .weapon-document-group { margin-top: 14px; }

html[data-theme="dark"] .rp-weapon-modal-card { background: #202a33; }
html[data-theme="dark"] .rp-weapon-modal-card > .form-head { border-color: #34424e; background: linear-gradient(135deg, #22352f, #26313b); }
html[data-theme="dark"] .rp-weapon-modal-card > .form-head h3 { color: #e8edf2; }
html[data-theme="dark"] .rp-weapon-modal-card > .form-head p { color: #9caab7; }
html[data-theme="dark"] .rp-weapon-modal-card > form > .form-actions { border-color: #34424e; background: rgb(32 42 51 / 96%); }

@media (max-width: 760px) {
  #weaponModal .weapon-entry-form,
  #weaponModal .weapon-entry-form-document {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
  }
  #weaponModal .weapon-entry-form > .form-grid { grid-template-columns: 1fr; padding: 12px; }
  #weaponModal .weapon-entry-form .form-grid .wide { grid-column: auto; }
  #weaponModal .weapon-entry-form > .form-head,
  #weaponModal .weapon-entry-form > .form-actions { padding-left: 13px; padding-right: 13px; }
  .rp-weapon-modal-card,
  .rp-weapon-modal-card.rp-weapon-modal-document { width: calc(100vw - 12px); max-height: calc(100vh - 12px); }
  .rp-weapon-modal-card > form > .form-grid { grid-template-columns: 1fr; padding: 12px; }
  .rp-weapon-modal-card .form-grid .wide { grid-column: auto; }
  .rp-weapon-modal-card > .form-head,
  .rp-weapon-modal-card > form > .form-actions { padding-left: 13px; padding-right: 13px; }
}

.gbr-weapon-assignments {
  display: grid;
  gap: 8px;
}

.gbr-shift-form {
  width: min(1080px, 100%);
  padding: 16px;
}

.gbr-shift-form .form-head {
  margin-bottom: 12px;
}

.gbr-shift-form .form-grid {
  gap: 10px;
}

.gbr-shift-form .form-grid > label,
.gbr-shift-form .duty-group-members {
  gap: 4px;
  font-size: 13px;
}

.gbr-shift-form input,
.gbr-shift-form select {
  min-height: 36px;
  padding: 6px 9px;
}

.gbr-shift-form textarea {
  min-height: 58px;
  padding: 7px 9px;
}

.gbr-shift-form .gbr-weapon-assignments {
  gap: 5px;
  width: 100%;
  min-width: 0;
}

.gbr-shift-form .gbr-weapon-row {
  grid-template-columns: minmax(140px, 1.1fr) repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 6px 8px;
  width: 100%;
  min-width: 0;
}

.gbr-shift-form .gbr-weapon-row > * {
  min-width: 0;
}

.gbr-shift-form .gbr-weapon-row select,
.gbr-shift-form .gbr-weapon-row input {
  min-width: 0;
}

#dutyGroupCompleteForm .gbr-weapon-assignments,
#dutyGroupCompleteForm .gbr-weapon-row {
  width: 100%;
  min-width: 0;
}

#dutyGroupCompleteForm .gbr-weapon-row {
  grid-template-columns: minmax(110px, 0.9fr) minmax(125px, 1.1fr) repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 7px;
}

#dutyGroupCompleteForm .gbr-weapon-row > *,
#dutyGroupCompleteForm .gbr-weapon-row input,
#dutyGroupCompleteForm .gbr-weapon-row select {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 720px) {
  #dutyGroupCompleteForm .gbr-weapon-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 980px) {
  .sidebar.open + .sidebar-backdrop {
    position: fixed;
    z-index: 9;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    background: rgb(8 14 20 / 46%);
    cursor: default;
  }
}

.gbr-shift-form .duty-group-members + label.wide {
  margin-top: 2px;
}

.gbr-weapon-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.2fr) repeat(3, minmax(130px, 1fr));
  gap: 8px;
  align-items: end;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
}

.gbr-weapon-row > strong,
.gbr-weapon-row > div {
  align-self: center;
}

.gbr-composition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
}

.gbr-composition-grid label {
  gap: 4px;
  font-size: 13px;
}

.gbr-composition-grid select {
  min-height: 36px;
  padding: 6px 9px;
  font-size: 13px;
}

.gbr-member-states {
  display: grid;
  gap: 5px;
}

.gbr-state-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(110px, auto) minmax(150px, auto);
  align-items: center;
  gap: 12px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
}

.gbr-state-column {
  display: grid;
  gap: 5px;
  align-content: center;
}

.form-warning {
  margin: 0;
  padding: 9px 11px;
  border-left: 3px solid #c58a16;
  background: #fff7df;
  color: #72500d;
  font-size: 13px;
}

.compact-check {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  white-space: nowrap;
}

.compact-check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  min-height: 0;
  margin: 0;
  padding: 0;
}

.portal-toast-stack {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 3000;
  display: grid;
  gap: 10px;
  width: min(390px, calc(100vw - 28px));
  transform: translateX(-50%);
  pointer-events: none;
}

.portal-toast {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid #e2b95f;
  border-left: 4px solid #c58a16;
  border-radius: 7px;
  background: #fffaf0;
  box-shadow: 0 14px 34px rgba(28, 35, 43, 0.18);
  animation: portal-toast-in 180ms ease-out;
  pointer-events: auto;
}

.portal-toast-error {
  border-color: #e5a1a1;
  border-left-color: #b93333;
  background: #fff5f5;
}

.portal-toast-success {
  border-color: #8bc7a2;
  border-left-color: #27834b;
  background: #f2fbf5;
}

.portal-toast strong,
.portal-toast p {
  margin: 0;
}

.portal-toast p {
  margin-top: 3px;
  color: #4d5967;
  line-height: 1.35;
}

.portal-toast button {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 0;
  padding: 5px;
  background: transparent;
  color: #596574;
}

.portal-toast button svg,
.portal-dialog-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.portal-toast.is-leaving {
  opacity: 0;
  transform: translateY(10px);
  transition: 180ms ease;
}

.portal-dialog-layer {
  position: fixed;
  inset: 0;
  z-index: 3100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 25, 33, 0.58);
}

.portal-dialog {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(12, 20, 28, 0.3);
}

.portal-dialog-head {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 13px;
  align-items: start;
}

.portal-dialog-head h3,
.portal-dialog-head p {
  margin: 0;
}

.portal-dialog-head h3 {
  font-size: 18px;
}

.portal-dialog-head p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
  white-space: pre-line;
  max-height: 50vh;
  overflow-y: auto;
}

.portal-dialog-icon {
  width: 42px;
  height: 42px;
  border-radius: 7px;
  padding: 9px;
  background: #eef4f8;
  color: #345c72;
}

.portal-dialog-icon.danger {
  background: #fff0f0;
  color: #b52d2d;
}

.sales-view-switch,
.sales-deal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sales-kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(225px, 260px);
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  align-items: start;
}

.sales-lane {
  min-height: 380px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 82%, var(--background));
}

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

.sales-lane > header span {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--panel);
  text-align: center;
  font-weight: 700;
}

.sales-lane > div {
  display: grid;
  gap: 6px;
}

.sales-lane > div > p {
  margin: 18px 5px;
  color: var(--muted);
  text-align: center;
}

.sales-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 9px;
  background: var(--panel);
  box-shadow: 0 3px 9px rgb(15 23 42 / 6%);
}

.sales-card.is-overdue {
  border-left-color: var(--danger);
}

.sales-card > button {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 8px 9px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.sales-card b {
  font-size: 14px;
}

.sales-card small,
.sales-card span {
  color: var(--muted);
  font-size: 12px;
}

.sales-card em {
  justify-self: end;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-style: normal;
  font-weight: 700;
}

.sales-deal-dialog {
  width: min(1120px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
}

.sales-deal-tabs {
  position: sticky;
  top: -1px;
  z-index: 4;
  margin: 0 0 14px;
  padding: 8px 0;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.sales-deal-tabs button {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}

.sales-deal-tabs button.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.sales-tab-panel {
  display: grid;
  gap: 10px;
  min-height: 260px;
}

.sales-tab-panel .contract-card {
  margin: 0;
}

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

.sales-task-list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
}

.sales-task-list article div {
  display: grid;
  gap: 4px;
}

.sales-task-list article span {
  color: var(--muted);
}

.sales-task-list article.is-overdue {
  border-left: 4px solid var(--danger);
}

.sales-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.sales-metrics article {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

.sales-metrics span {
  color: var(--muted);
}

.sales-metrics strong {
  font-size: 20px;
}

@media (max-width: 720px) {
  .sales-view-switch {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .sales-view-switch button {
    white-space: nowrap;
  }
  .sales-metrics {
    grid-template-columns: 1fr 1fr;
  }
  .sales-deal-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .sales-deal-tabs button {
    flex: 0 0 auto;
  }
}

.content-panel:has(.sales-crm-head) {
  overflow: hidden;
  padding: 0;
  border: 0;
  background:
    radial-gradient(circle at 90% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 38%),
    var(--background);
}

.sales-crm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 94%, var(--accent));
}

.sales-crm-head h3,
.sales-activity-head h4 {
  margin: 2px 0 3px;
}

.sales-crm-head h3 {
  font-size: 26px;
}

.sales-crm-head p,
.sales-activity-head p {
  margin: 0;
  color: var(--muted);
}

.sales-eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.sales-crm-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sales-create-button {
  min-height: 42px;
  padding-inline: 18px;
  border-radius: 10px;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 22%, transparent);
}

.sales-search {
  display: flex;
  align-items: center;
  width: min(350px, 32vw);
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--muted);
}

.sales-search input {
  min-height: 40px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.sales-crm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.sales-view-switch {
  padding: 3px;
  border-radius: 10px;
  background: var(--background);
}

.sales-view-switch button {
  min-height: 34px;
  padding: 6px 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sales-view-switch button.is-active {
  background: var(--panel);
  color: var(--accent);
  box-shadow: 0 2px 8px rgb(15 23 42 / 8%);
}

.sales-toolbar-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.sales-toolbar-summary strong {
  color: var(--ink);
  font-size: 14px;
}

#salesView {
  padding: 16px 20px 22px;
}

.sales-kanban {
  grid-auto-columns: minmax(250px, 280px);
  gap: 12px;
  padding: 0 2px 12px;
}

.sales-lane {
  min-height: 520px;
  padding: 0 8px 12px;
  border: 0;
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 62%, var(--background));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 65%, transparent);
}

.sales-lane > header {
  display: grid;
  gap: 6px;
  margin: 0 -8px 10px;
  padding: 11px 12px 9px;
  border-radius: 12px 12px 5px 5px;
  background: var(--sales-stage-color);
  color: #10212a;
}

.sales-lane > header div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sales-lane > header span {
  min-width: 22px;
  padding: 1px 6px;
  background: rgb(255 255 255 / 35%);
}

.sales-lane > header small {
  font-weight: 800;
  opacity: .72;
}

.sales-quick-deal {
  width: 100%;
  min-height: 34px;
  margin-bottom: 9px;
  border: 1px dashed color-mix(in srgb, var(--sales-stage-color) 70%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--sales-stage-color) 10%, var(--panel));
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sales-quick-deal:hover {
  background: color-mix(in srgb, var(--sales-stage-color) 18%, var(--panel));
}

.sales-lane-stack {
  display: grid;
  gap: 8px;
}

.sales-card {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  border-left: 0;
  border-radius: 10px;
  box-shadow: 0 5px 16px rgb(15 23 42 / 7%);
}

.sales-card.is-overdue {
  border-left: 4px solid var(--danger);
}

.sales-card > button {
  gap: 5px;
  padding: 11px 12px;
}

.sales-card > button:hover {
  background: color-mix(in srgb, var(--accent) 4%, var(--panel));
}

.sales-card-number {
  font-size: 10px !important;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.sales-card-service {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-card b {
  margin: 3px 0;
  font-size: 16px;
}

.sales-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sales-card em {
  justify-self: auto;
  flex: 0 0 auto;
}

.sales-card-deadline {
  color: var(--danger) !important;
  font-weight: 700;
}

.sales-modal-layer {
  align-items: stretch;
  justify-content: flex-end;
  padding: 8px;
  background: rgb(15 23 42 / 58%);
  backdrop-filter: blur(3px);
}

.sales-deal-dialog {
  width: min(1500px, calc(100vw - 36px));
  max-width: none;
  max-height: calc(100vh - 36px);
  padding: 0;
  border-radius: 16px;
  background: var(--background);
  box-shadow: 0 28px 80px rgb(2 6 23 / 35%);
}

.sales-deal-head {
  margin: 0;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.sales-deal-head h3 {
  margin: 2px 0;
  font-size: 24px;
}

.sales-stage-ribbon {
  display: flex;
  overflow-x: auto;
  gap: 3px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.sales-stage-ribbon button {
  display: flex;
  align-items: center;
  flex: 1 0 145px;
  gap: 7px;
  min-height: 38px;
  padding: 7px 10px;
  border: 0;
  background: color-mix(in srgb, var(--muted) 13%, transparent);
  color: var(--muted);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.sales-stage-ribbon button:first-child {
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
}

.sales-stage-ribbon button.is-passed {
  background: color-mix(in srgb, var(--accent) 28%, var(--panel));
  color: var(--accent);
}

.sales-stage-ribbon button.is-current {
  background: var(--accent);
  color: white;
}

.sales-stage-ribbon button span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgb(255 255 255 / 42%);
}

.sales-deal-tabs {
  top: 0;
  margin: 0;
  padding: 9px 20px;
  background: var(--panel);
}

.sales-deal-tabs button {
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.sales-deal-tabs button.is-active {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  color: var(--accent);
}

.sales-deal-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr);
  min-height: 520px;
}

.sales-tab-panel {
  align-content: start;
  min-height: 520px;
  padding: 20px;
  overflow: auto;
  border-right: 1px solid var(--border);
}

.sales-tab-panel > form,
.sales-tab-panel > .contract-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 5px 16px rgb(15 23 42 / 5%);
}

.sales-activity-rail {
  min-width: 0;
  padding: 20px;
  overflow: auto;
  background: color-mix(in srgb, var(--panel) 70%, var(--background));
}

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

.sales-activity-feed {
  position: relative;
  display: grid;
  gap: 12px;
  padding-left: 18px;
}

.sales-activity-feed::before {
  position: absolute;
  inset: 3px auto 3px 4px;
  width: 2px;
  background: color-mix(in srgb, var(--accent) 25%, var(--border));
  content: "";
}

.sales-activity-feed article {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}

.sales-activity-feed article::before {
  position: absolute;
  top: 17px;
  left: -19px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.sales-activity-feed article > span {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.sales-activity-feed article p,
.sales-activity-feed article small {
  margin: 0;
  color: var(--muted);
}

.sales-empty-feed {
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .sales-crm-head,
  .sales-crm-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .sales-search {
    width: 100%;
  }
  .sales-deal-workspace {
    grid-template-columns: 1fr;
  }
  .sales-tab-panel {
    border-right: 0;
  }
  .sales-activity-rail {
    border-top: 1px solid var(--border);
  }
}

.portal-dialog-input {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  font-weight: 700;
}

.portal-dialog-input input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.portal-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
}

@keyframes portal-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 700px) {
  .portal-toast-stack {
    bottom: 72px;
  }
}

@media (max-width: 720px) {
  .gbr-composition-grid {
    grid-template-columns: 1fr;
  }

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

  .gbr-state-row strong {
    grid-column: 1 / -1;
  }

  .gbr-state-row .compact-check {
    white-space: normal;
    font-size: 12px;
  }
}

.objects-table {
  min-width: 1160px;
}

.employees-table {
  min-width: 980px;
  table-layout: fixed;
}

.employees-table .employees-col-name { width: 255px; }
.employees-table .employees-col-qualifications { width: 285px; }
.employees-table .employees-col-phone { width: 145px; }
.employees-table .employees-col-status { width: 120px; }
.employees-table .employees-col-actions { width: 265px; }

.employees-table th,
.employees-table td {
  overflow-wrap: anywhere;
}

.employees-table td:nth-child(3),
.employees-table td:nth-child(4) {
  overflow-wrap: normal;
}

.employees-table td:last-child .action-row {
  align-items: flex-start;
}

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

th {
  background: #f2f5f7;
  font-size: 13px;
  color: #4a5664;
}

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

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 700;
  font-size: 12px;
  background: #e8f3ef;
  color: var(--accent-dark);
  white-space: nowrap;
}

.status.warn {
  background: #fff1dd;
  color: var(--warn);
}

.status.danger {
  background: #ffe8e8;
  color: var(--danger);
}
.status.contract-status-active {
  background: #e3f5ea;
  color: #18704b;
}
.status.contract-status-payment {
  background: #e4efff;
  color: #225fa8;
}
.status.contract-status-approval {
  background: #fff1cc;
  color: #8a5a08;
}
.status.contract-status-archive {
  background: #e9edf1;
  color: #596673;
}
.status.contract-status-terminated {
  background: #ffe3e3;
  color: #a52626;
}
.status.contract-status-draft {
  background: #eee8ff;
  color: #6046a8;
}
.status.contract-status-neutral {
  background: #edf1f4;
  color: #4f5d69;
}
.status.task-todo {
  background: #e5f3ff;
  color: #2675a8;
}
.status.task-progress {
  background: #e3f5ea;
  color: #18704b;
}
.status.task-review {
  background: #fff1cc;
  color: #946514;
}
.status.task-done {
  background: #e7e9ec;
  color: #59636d;
}
.status.task-overdue {
  background: #ffe4e4;
  color: #bd3030;
  box-shadow: inset 0 0 0 1px rgb(189 48 48 / 10%);
}

.status.timesheet-closed {
  background: #e5e7eb;
  color: #4b5563;
}

.status.employee-working {
  background: #e3f4ec;
  color: #16704f;
}

.status.employee-vacation {
  background: #e5f0fb;
  color: #27689b;
}

.status.employee-candidate {
  background: #eee8fa;
  color: #6b4c9a;
}

.status.employee-control {
  background: #fff1d8;
  color: #9a6200;
}

.status.employee-fired {
  background: #dfe3e7;
  color: #626b74;
}

.employees-table tr.employee-row-fired > td {
  background: #eef0f2;
  color: #737b84;
}

.employees-table tr.employee-row-fired .muted,
.employees-table tr.employee-row-fired .file-link {
  color: #737b84;
}

.payroll-settlement {
  margin-top: 18px;
}

.payroll-settlement h4 {
  margin: 0 0 10px;
}

.payroll-settlement-table tfoot th {
  background: #e8edf1;
  font-weight: 800;
}

.status.fleet-retired {
  background: #e8ecef;
  color: #5f6b76;
}

.status.fleet-reserve {
  background: #e5f0fb;
  color: #28679a;
}

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

.file-link {
  color: var(--file-link-color);
  font-weight: 600;
  text-decoration: none;
}

.file-link:hover {
  text-decoration: underline;
}

.file-button {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

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

.small-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  font-weight: 600;
}

.card-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 14px;
}

.data-card {
  padding: 16px;
  min-height: 150px;
}

.data-card strong {
  display: block;
  font-size: 18px;
  margin-bottom: 8px;
}

.data-card span,
.data-card p {
  color: var(--muted);
}

.data-card p {
  margin: 10px 0 0;
  line-height: 1.45;
}

.contract-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.contract-detail-grid > div {
  display: grid;
  gap: 8px;
  align-content: start;
}

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

.contract-detail-grid strong {
  line-height: 1.35;
}

.contract-view-form { width: min(1080px, 100%); }
.contract-view-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: var(--soft);
}
.contract-view-summary > div { display: grid; gap: 6px; padding: 13px 15px; border-right: 1px solid var(--line); }
.contract-view-summary > div:last-child { border-right: 0; }
.contract-view-summary span,
.contract-view-document span { color: var(--muted); font-size: 12px; font-weight: 700; }
.contract-view-summary strong { font-size: 15px; }
.contract-view-sections { display: grid; }
.contract-view-section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.contract-view-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.contract-view-section-head h4 { margin: 0; font-size: 16px; }
.contract-view-section-head span { color: var(--muted); font-size: 12px; text-align: right; }
.contract-view-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px 18px; margin: 0; }
.contract-view-fields > div { min-width: 0; }
.contract-view-fields .wide { grid-column: 1 / -1; }
.contract-view-fields dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.contract-view-fields dd { margin: 4px 0 0; overflow-wrap: anywhere; line-height: 1.4; }
.contract-view-document { display: grid; grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.8fr); gap: 18px; }
.contract-view-document > div { display: grid; align-content: start; gap: 6px; }
.contract-view-document small { color: var(--muted); }

.contract-entry-form { width: min(1100px, 100%); }
.contract-entry-body { display: grid; }
.contract-entry-section { padding: 10px 0 12px; border-bottom: 1px solid var(--line); }
.contract-entry-section:first-child { padding-top: 2px; }
.contract-counterparty-section { order: -1; }
.contract-expiry-warning { background: #fff4d6; box-shadow: inset 4px 0 #e2a400; }
.contract-entry-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px 10px; }
.contract-entry-grid label { display: grid; gap: 4px; color: #354151; font-size: 13px; font-weight: 700; }
.contract-entry-grid .span-2 { grid-column: span 2; }
.contract-entry-grid .span-3 { grid-column: span 3; }
.contract-entry-grid textarea { resize: vertical; }
.contract-end-date-field { display: grid; grid-template-columns: minmax(135px, 1fr) max-content; align-items: end; gap: 5px; min-width: 0; }
.contract-end-date-field > label:first-child { min-width: 0; }
.contract-end-date-field input[type="date"] { width: 100%; min-width: 0; }
.contract-entry-grid .contract-auto-prolongation { display: flex; align-items: center; gap: 5px; min-height: 36px; padding: 0 1px; white-space: nowrap; font-size: 12px; }
.contract-entry-grid .contract-auto-prolongation input { width: 16px; min-height: 16px; margin: 0; }
.contract-main-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.contract-main-grid .contract-half { grid-column: span 2; }
.contract-entry-form input,
.contract-entry-form select,
.contract-entry-form textarea { padding: 7px 9px; min-height: 36px; }
.contract-entry-form textarea { min-height: 72px; }
.contract-registration-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.contract-section-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.contract-object-section-head { align-items: flex-start; gap: 12px; }
.contract-object-section-head > div:first-child { flex: 0 0 auto; }
.contract-selected-objects { display: flex; flex: 1 1 auto; align-items: center; flex-wrap: wrap; gap: 4px; min-width: 0; min-height: 28px; padding: 2px; border: 1px solid #cbd5e1; border-radius: 7px; background: color-mix(in srgb, var(--panel) 88%, #e2e8f0); }
.contract-selected-objects.is-empty { border-color: transparent; background: transparent; }
.contract-selected-object { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 5px 3px 8px; border: 1px solid #cbd5e1; border-radius: 999px; background: #e8edf3; color: #334155; font-size: 11px; font-weight: 600; line-height: 1.15; }
.contract-selected-object > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contract-selected-object button { display: grid; flex: 0 0 auto; place-items: center; width: 15px; height: 15px; min-height: 15px; padding: 0; border: 0; border-radius: 50%; background: #d7dee8; color: #64748b; cursor: pointer; }
.contract-selected-object button:hover { background: #c5ceda; color: #334155; }
.contract-selected-object svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 2; }
html[data-theme="dark"] .contract-selected-objects { border-color: var(--line); background: var(--soft); }
html[data-theme="dark"] .contract-selected-object { border-color: #465564; background: #303d49; color: #dbe4ec; }
html[data-theme="dark"] .contract-selected-object button { background: #465564; color: #b9c5cf; }
html[data-theme="dark"] .contract-selected-object button:hover { background: #566779; color: #fff; }
.contract-object-picker { display: grid; gap: 6px; }
.contract-object-picker > input[type="search"] { width: 100%; }
.contract-object-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; max-height: 190px; overflow: auto; padding: 1px; }
.contract-object-option { display: flex; align-items: flex-start; gap: 6px; padding: 6px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); cursor: pointer; }
.contract-object-option:hover { border-color: #9bbfa1; background: #f7fbf7; }
.contract-object-option:has(input:checked) { border-color: var(--green); background: #f1f8f2; box-shadow: inset 3px 0 var(--green); }
.contract-object-option input { flex: 0 0 auto; width: 15px; min-height: 15px; margin: 1px 0 0; }
.contract-object-option span { display: grid; gap: 1px; min-width: 0; }
.contract-object-option strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.contract-object-option small { overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.contract-object-count { color: var(--green-dark); font-size: 12px; white-space: nowrap; }

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

@media (max-width: 720px) {
  .contract-view-summary,
  .contract-view-fields,
  .contract-view-document,
  .contract-entry-grid { grid-template-columns: 1fr; }
  .contract-main-grid { grid-template-columns: 1fr; }
  .contract-main-grid .contract-half { grid-column: auto; }
  .contract-registration-row { grid-template-columns: 1fr; }
  .contract-view-summary > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .contract-view-summary > div:last-child { border-bottom: 0; }
  .contract-view-section-head { display: grid; gap: 4px; }
  .contract-view-section-head span { text-align: left; }
  .contract-entry-grid .span-2,
  .contract-entry-grid .span-3 { grid-column: auto; }
  .contract-object-options { grid-template-columns: 1fr; }
  .contract-section-actions { align-items: flex-start; justify-content: flex-start; flex-wrap: wrap; }
  .contract-selected-objects { width: 100%; }
}

.contract-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

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

.contract-card-head strong,
.contract-card-head span {
  display: block;
}

.contract-card-head > div > span {
  margin-top: 4px;
  color: var(--muted);
}

.requisites-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 0 0 16px;
}
.employee-profile-phones{grid-column:2}.employee-profile-phones dd{display:grid;gap:5px}.employee-profile-phones dd span{display:grid;gap:1px}.employee-profile-phones dd small{color:var(--muted);font-size:10px;font-weight:500}@media(max-width:650px){.employee-profile-phones{grid-column:1}}
.employee-phone-stack{grid-column:1;display:grid;gap:10px;align-content:start}@media(max-width:650px){.employee-phone-stack{grid-column:1}}

.requisites-list div {
  min-width: 0;
}

.requisites-list .wide {
  grid-column: 1 / -1;
}

.requisites-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.requisites-list dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.field-title {
  display: block;
  margin-bottom: 8px;
  color: #354151;
  font-weight: 700;
  font-size: 14px;
}

.employee-picker,
.object-employee-list {
  display: grid;
  gap: 8px;
}

.employee-picker {
  max-height: 260px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.employee-check {
  justify-content: start;
  align-content: center;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.employee-check:last-child {
  border-bottom: 0;
}

.contract-form.object-form {
  width: min(1040px, 100%);
  padding: 0;
}

.object-form > .form-head {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.object-form-body {
  display: grid;
  gap: 0;
  padding: 0 18px;
}

.object-form-section {
  padding: 12px 0 14px;
  border-bottom: 1px solid var(--line);
}

.object-form-section:last-child {
  border-bottom: 0;
}

.object-form-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
}

.object-form-section-head h4,
.object-form-section-head p {
  margin: 0;
}

.object-form-section-head h4 {
  color: var(--ink);
  font-size: 14px;
}

.object-form-section-head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.object-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.object-form-grid label {
  display: grid;
  gap: 4px;
  color: #354151;
  font-size: 12px;
  font-weight: 700;
}

.object-form-grid .span-2 {
  grid-column: span 2;
}

.object-form-grid .span-3 {
  grid-column: span 3;
}

.object-form input,
.object-form select {
  min-height: 38px;
}

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

.object-posts-field {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
}

.object-posts-head,
.object-post-row {
  display: grid;
  align-items: end;
  gap: 10px;
}

.object-posts-head {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.object-posts-head span {
  color: #354151;
  font-size: 12px;
  font-weight: 700;
}

.object-post-row {
  grid-template-columns: 92px minmax(150px, 1fr) 38px;
  gap: 6px;
}

.object-post-row .icon-button {
  width: 38px;
  height: 38px;
}

.object-post-list {
  display: grid;
  gap: 6px;
}

.object-employee-toolbar input {
  width: min(300px, 100%);
  min-height: 38px;
}

.object-form .employee-picker {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  max-height: 220px;
  padding: 0;
  border-radius: 6px;
}

.object-form .employee-check {
  min-height: 54px;
  padding: 8px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.object-form .employee-check:nth-child(even) {
  border-right: 0;
}

.object-form .employee-check:hover {
  background: var(--soft);
}

.employee-check-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

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

.employee-check-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.object-form > .form-actions {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  width: 100%;
  box-sizing: border-box;
  align-self: stretch;
  justify-content: flex-end;
  margin: 0;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

@media (max-width: 820px) {
  .object-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .object-form-grid .span-2,
  .object-form-grid .span-3 {
    grid-column: span 2;
  }

  .object-contact-grid .object-textarea-field {
    grid-column: span 2;
  }
}

@media (max-width: 600px) {
  .object-form > .form-head,
  .object-form-body,
  .object-form > .form-actions {
    padding-left: 14px;
    padding-right: 14px;
  }

  .object-form-grid,
  .object-form .employee-picker,
  .object-post-row {
    grid-template-columns: 1fr;
  }

  .object-form-grid .span-2,
  .object-form-grid .span-3,
  .object-contact-grid .object-textarea-field {
    grid-column: auto;
  }

  .object-form-section-head {
    align-items: stretch;
    display: grid;
  }

  .object-employee-toolbar input {
    width: 100%;
  }

  .object-form .employee-check {
    border-right: 0;
  }
}

.object-employee-list div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

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

.employee-profile {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.employee-photo {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 56px;
  font-weight: 800;
}

.employee-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.employee-table-identity {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.employee-table-identity > div:last-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.employee-table-position {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.employee-print-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.employee-print-columns legend {
  padding: 0 6px;
  color: var(--ink);
  font-weight: 700;
}

.employee-print-columns label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 6px;
  background: var(--soft);
  cursor: pointer;
}

.employee-print-columns input {
  flex: 0 0 auto;
  width: 17px;
  min-height: 17px;
  margin: 0;
}

@media (max-width: 560px) {
  .employee-print-columns { grid-template-columns: 1fr; }
}

.employee-qualification-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 6px;
}

.employee-grade-badge {
  padding: 4px 8px;
  border: 2px solid var(--accent);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgb(23 32 42 / 10%);
}

.employee-document-dates {
  display: grid;
  gap: 3px;
}

.employee-document-item {
  display: grid;
  grid-template-columns: 82px max-content;
  justify-content: start;
  gap: 4px;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.25;
}

.employee-document-item b {
  color: var(--muted);
  font-weight: 600;
}

.employee-document-item.is-warning span,
.employee-document-item.is-expired span {
  font-weight: 700;
}

.employee-document-item.is-warning span { color: #a65b00; }
.employee-document-item.is-expired span { color: var(--danger); }
.employee-document-item.is-missing span { color: var(--muted); font-weight: 400; }

.employee-document-item.is-control-reason > span {
  width: fit-content;
  margin: -2px -4px;
  padding: 2px 4px;
  border-radius: 4px;
  background: #fff0c9;
  box-shadow: inset 0 0 0 1px #eccb7b;
}

.employee-document-item.is-control-reason.is-expired > span {
  background: #ffe2e2;
  box-shadow: inset 0 0 0 1px #e6a2a2;
}

.employee-document-item.is-control-reason.is-missing > span {
  background: transparent;
  box-shadow: none;
}

.employee-table-photo {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--soft);
  color: var(--accent);
  font-size: 17px;
  font-weight: 800;
}

.employee-table-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.employee-photo-upload-state {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.employee-photo-upload-state .muted {
  min-width: 0;
  overflow-wrap: anywhere;
}

.employee-photo-upload-state .icon-button {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
}

.required-mark {
  color: #dc2626;
  font-weight: 800;
  margin-left: 3px;
}

.danger-icon-button {
  color: var(--danger);
}

.danger-icon-button:hover {
  border-color: #efb2b2;
  background: #fff0f0;
}

@media (max-width: 1280px) {
  .employees-table {
    min-width: 900px;
  }

  .employees-table .employees-col-name { width: 220px; }
  .employees-table .employees-col-qualifications { width: 270px; }
  .employees-table .employees-col-phone { width: 135px; }
  .employees-table .employees-col-status { width: 110px; }
  .employees-table .employees-col-actions { width: 155px; }
}

.employee-absence-history .object-employee-list > div {
  grid-template-columns: minmax(0, 1fr) auto;
}

.employee-absence-history .object-employee-list strong,
.employee-absence-history .object-employee-list span { grid-column: 1; }
.employee-absence-history .object-employee-list .action-row {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  justify-content: flex-end;
  min-width: 0;
}

.employee-absence-history .object-employee-list .action-row button {
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  .employee-absence-history .object-employee-list > div {
    grid-template-columns: 1fr;
  }

  .employee-absence-history .object-employee-list .action-row {
    grid-column: 1;
    grid-row: auto;
    justify-content: flex-start;
  }
}

.nested-form-grid {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 24, 32, 0.52);
}

#fleetViewModal { z-index: 120; }
#fleetActionModal { z-index: 130; }
#fleetVehicleModal { z-index: 130; }

/* Карточка автотранспорта всегда помещается в видимую область планшета. */
#fleetViewModal {
  box-sizing: border-box;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  align-items: stretch;
  justify-items: center;
  padding-top: max(8px, env(safe-area-inset-top));
  padding-right: max(8px, env(safe-area-inset-right));
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  padding-left: max(8px, env(safe-area-inset-left));
  overflow: hidden;
}

#fleetViewModal > #fleetViewContent {
  width: min(1480px, 100%);
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.contract-form {
  width: min(1040px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

#contractForm.contract-entry-form { width: min(1180px, 100%); }

.contract-form.workflow-form {
  width: min(960px, 100%);
  padding: 0;
}

.workflow-form.compact-form { width: min(760px, 100%); }
#toolActionForm.workflow-form { width: min(820px, 100%); }
#techActionForm.workflow-form { width: min(720px, 100%); }

#salesDealContent.sales-deal-dialog {
  display: flex;
  flex-direction: column;
  width: calc(100vw - 16px);
  max-width: none;
  height: calc(100vh - 16px);
  max-height: none;
  overflow: hidden;
  padding: 0;
  border-radius: 16px;
}

#salesDealContent .sales-stage-ribbon {
  flex: 0 0 68px;
  box-sizing: border-box;
  min-height: 68px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-top: 12px;
  padding-bottom: 12px;
  scrollbar-width: thin;
}

#salesDealContent .sales-stage-ribbon button {
  flex-shrink: 0;
  height: 42px;
  min-height: 42px;
}

#salesDealContent .sales-deal-workspace {
  flex: 1 1 auto;
  grid-template-columns: minmax(760px, 1.65fr) minmax(360px, .72fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.sales-lane > header {
  box-sizing: border-box;
  min-height: 76px;
  grid-template-rows: minmax(34px, auto) 16px;
  align-content: center;
}

.sales-lane > header div {
  min-height: 34px;
}

.sales-lane > header strong {
  display: -webkit-box;
  overflow: hidden;
  min-height: 32px;
  line-height: 16px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sales-lane > header small {
  overflow: hidden;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-quick-deal {
  min-height: 36px;
  height: 36px;
}

#salesDealContent .sales-tab-panel,
#salesDealContent .sales-activity-rail {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

#salesDealContent .sales-tab-panel {
  animation: sales-tab-enter 180ms ease-out both;
}

#salesDealContent .sales-deal-tabs button,
#salesDealContent .sales-stage-ribbon button,
.sales-view-switch button,
.sales-card,
.sales-quick-deal {
  transition:
    color 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

#salesDealContent .sales-deal-tabs button:hover,
.sales-view-switch button:hover {
  transform: translateY(-1px);
}

#salesDealContent .sales-deal-tabs button:active,
#salesDealContent .sales-stage-ribbon button:active,
.sales-view-switch button:active,
.sales-quick-deal:active {
  transform: scale(.97);
}

#salesDealContent .sales-stage-ribbon button:not(:disabled):hover {
  filter: saturate(1.08);
  box-shadow: 0 5px 12px rgb(15 23 42 / 9%);
  transform: translateY(-1px);
}

.sales-card:hover {
  box-shadow: 0 9px 22px rgb(15 23 42 / 11%);
  transform: translateY(-2px);
}

.sales-activity-feed article {
  animation: sales-feed-enter 220ms ease-out both;
}

.sales-activity-feed article:nth-child(2) { animation-delay: 30ms; }
.sales-activity-feed article:nth-child(3) { animation-delay: 60ms; }
.sales-activity-feed article:nth-child(4) { animation-delay: 90ms; }

@keyframes sales-tab-enter {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sales-feed-enter {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 1180px) {
  #salesDealContent .sales-deal-workspace {
    grid-template-columns: minmax(620px, 1.4fr) minmax(320px, .7fr);
  }
}

@media (max-width: 920px) {
  #salesDealContent.sales-deal-dialog {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
  }
  #salesDealContent .sales-deal-workspace {
    display: block;
    overflow: auto;
  }
  #salesDealContent .sales-tab-panel,
  #salesDealContent .sales-activity-rail {
    overflow: visible;
  }
}

/* Tenders */
.content-panel:has(.tender-head) {
  padding: 18px;
  background: color-mix(in srgb, var(--background) 88%, #eef6ff);
}

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

.tender-head h3 {
  margin: 0;
  font-size: 26px;
}

.tender-head p {
  margin: 3px 0 0;
  color: var(--muted);
}

.tender-kanban {
  display: grid;
  grid-auto-columns: minmax(248px, 270px);
  grid-auto-flow: column;
  gap: 9px;
  overflow-x: auto;
  padding: 4px 2px 16px;
  scroll-snap-type: x proximity;
}

.tender-lane {
  min-height: 500px;
  padding: 0 6px 10px;
  border: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  scroll-snap-align: start;
}

.tender-lane > header {
  display: grid;
  box-sizing: border-box;
  grid-template-rows: minmax(28px, auto) 15px;
  align-content: center;
  min-height: 64px;
  margin: 0 -6px 7px;
  padding: 8px 10px 7px;
  border-radius: 13px 13px 6px 6px;
  background: var(--tender-stage);
  color: #263449;
}

.tender-lane > header div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
}

.tender-lane > header strong {
  display: -webkit-box;
  overflow: hidden;
  min-height: 32px;
  line-height: 16px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tender-lane > header span {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgb(255 255 255 / 55%);
  text-align: center;
}

.tender-lane > header small {
  overflow: hidden;
  line-height: 16px;
  opacity: .72;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tender-lane-stack {
  display: grid;
  align-content: start;
  min-width: 0;
  gap: 6px;
}

.tender-lane-empty {
  padding: 26px 12px;
  color: var(--muted);
  text-align: center;
}

.tender-card {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 8px 9px;
  border: 1px solid color-mix(in srgb, var(--border) 86%, transparent);
  border-left: 3px solid var(--tender-stage, var(--accent));
  border-radius: 9px;
  background: var(--panel);
  box-shadow: 0 4px 14px rgb(15 23 42 / 5%);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.tender-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 9px 22px rgb(15 23 42 / 10%);
}

.tender-card.is-urgent {
  border-left-color: #ef4444;
}

.tender-card-top,
.tender-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.tender-card-top span,
.tender-card footer,
.tender-card p {
  color: var(--muted);
  font-size: 11px;
}

.tender-card-top strong {
  color: var(--text);
  font-size: 12px;
}

.tender-card h4 {
  display: -webkit-box;
  overflow: hidden;
  margin: 5px 0 3px;
  font-size: 13px;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}

.tender-card p {
  overflow: hidden;
  margin: 0 0 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tender-card-tags {
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
  gap: 5px;
  margin-bottom: 6px;
}

.tender-card-tags span {
  overflow: hidden;
  padding: 2px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 8%, var(--background));
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tender-search-filter {
  box-sizing: border-box;
  flex: 1 1 360px;
  width: min(460px, 40vw);
  min-width: 280px;
  max-width: 460px;
  overflow: hidden;
}

.tender-search-filter input {
  box-sizing: border-box;
  flex: 1 1 auto;
  width: 0 !important;
  min-width: 0;
  padding-right: 6px;
  padding-left: 8px;
  text-overflow: ellipsis;
}

.tender-search-filter > span:first-child {
  flex: 0 0 auto;
}

.tender-head .sales-crm-actions {
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}

.tender-search-filter button {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.tender-search-filter button:hover {
  background: color-mix(in srgb, var(--border) 55%, transparent);
  color: var(--text);
}

@media (max-width: 980px) {
  .tender-search-filter {
    width: 100%;
    min-width: 0;
    max-width: none;
  }
}

.danger-text {
  color: #dc2626 !important;
  font-weight: 800;
}

#tenderContent.tender-dialog {
  display: flex;
  flex-direction: column;
  width: calc(100vw - 16px);
  max-width: none;
  height: calc(100vh - 16px);
  max-height: none;
  overflow: hidden;
  padding: 0;
  border-radius: 16px;
}

.tender-stage-line {
  display: flex;
  flex: 0 0 70px;
  align-items: stretch;
  gap: 5px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 7px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  scrollbar-width: thin;
}

.tender-stage-line button {
  flex: 0 0 124px;
  min-height: 54px;
  padding: 7px 8px;
  border: 1px solid color-mix(in srgb, var(--tender-stage) 70%, var(--border));
  border-radius: 9px;
  background: color-mix(in srgb, var(--tender-stage) 45%, var(--panel));
  color: #344256;
  font: 700 11px/1.15 inherit;
  white-space: normal;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.tender-stage-line button.is-current {
  background: var(--tender-stage);
  box-shadow: inset 0 0 0 2px rgb(255 255 255 / 55%), 0 4px 12px rgb(15 23 42 / 10%);
}

.tender-stage-line button:not(:disabled):hover {
  transform: translateY(-1px);
}

.tender-workspace {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(740px, 1.6fr) minmax(350px, .7fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.tender-workspace > .sales-tab-panel,
.tender-workspace > .sales-activity-rail {
  min-height: 0;
  overflow: auto;
}

.tender-deadline {
  display: grid;
  gap: 4px;
  margin: 0 0 16px;
  padding: 14px;
  border-radius: 12px;
  background: color-mix(in srgb, #fde68a 35%, var(--panel));
}

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

.tender-approval-route {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.tender-approval-route article {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.tender-approval-route article > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--background);
  font-weight: 800;
}

.tender-approval-route article div {
  display: grid;
  gap: 3px;
}

.tender-approval-route article small {
  color: var(--muted);
}

.tender-approval-route article.is-approved {
  border-color: #86efac;
  background: color-mix(in srgb, #dcfce7 65%, var(--panel));
}

.tender-approval-route article.is-current {
  border-color: #93c5fd;
  background: color-mix(in srgb, #dbeafe 62%, var(--panel));
}

@media (max-width: 920px) {
  .tender-head {
    align-items: stretch;
    flex-direction: column;
  }
  #tenderContent.tender-dialog {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
  }
  .tender-workspace {
    display: block;
    overflow: auto;
  }
  .tender-workspace > .sales-tab-panel,
  .tender-workspace > .sales-activity-rail {
    overflow: visible;
  }
}

.tool-workflow-form { width: min(820px, 100%) !important; }
#toolViewContent { width: min(820px, 100%); }

.tool-workflow-form,
#toolActionForm,
#toolViewContent {
  max-height: calc(100dvh - 24px);
}

.tool-workflow-form > .form-head,
#toolActionForm > .form-head {
  padding: 13px 16px 11px;
}

.tool-workflow-form > .form-head h3,
#toolActionForm > .form-head h3 {
  font-size: 18px;
}

.tool-workflow-form > .form-head p,
#toolActionForm > .form-head p {
  margin-top: 3px;
  font-size: 12px;
}

.tool-workflow-form > .form-grid,
#toolActionForm > .form-grid {
  gap: 10px 12px;
  padding: 13px 16px;
}

.tool-workflow-form > .form-grid label,
#toolActionForm > .form-grid label {
  gap: 4px;
  min-width: 0;
  font-size: 12px;
  line-height: 1.2;
}

.tool-workflow-form input,
.tool-workflow-form select,
#toolActionForm input,
#toolActionForm select {
  height: 38px;
  min-height: 38px;
  padding: 8px 10px;
}

.tool-workflow-form textarea,
#toolActionForm textarea {
  min-height: 58px;
  padding: 8px 10px;
}

.tool-workflow-form > .form-grid .tool-field-span-2,
#toolActionForm > .form-grid .tool-field-span-2 {
  grid-column: span 2;
}

#toolActionForm > .form-grid .tool-action-list-field {
  grid-column: 1 / -1;
}

.tool-workflow-form > .form-actions,
#toolActionForm > .form-actions {
  padding: 9px 16px;
}

#toolActionForm .tool-issue-list {
  gap: 4px;
  max-height: 210px;
  padding: 6px;
}

#toolActionForm .tool-issue-row {
  min-height: 42px;
  padding: 5px 7px;
}

#toolActionForm .tool-issue-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
}

.equipment-workflow-form { width: min(840px, 100%) !important; }
.equipment-view-form { width: min(900px, 100%); }

.equipment-workflow-form,
.equipment-view-form {
  max-height: calc(100dvh - 24px);
}

.equipment-workflow-form > .form-head {
  padding: 13px 16px 11px;
}

.equipment-workflow-form > .form-head h3 {
  font-size: 18px;
}

.equipment-workflow-form > .form-grid {
  gap: 10px 12px;
  padding: 13px 16px;
}

.equipment-workflow-form > .form-grid label {
  gap: 4px;
  min-width: 0;
  font-size: 12px;
  line-height: 1.2;
}

.equipment-workflow-form input,
.equipment-workflow-form select {
  height: 38px;
  min-height: 38px;
  padding: 8px 10px;
}

.equipment-workflow-form textarea {
  min-height: 58px;
  padding: 8px 10px;
}

.equipment-workflow-form > .form-actions {
  padding: 9px 16px;
}

.equipment-view-form {
  padding: 16px;
}

.equipment-view-form > h3 {
  margin: 14px 0 10px;
  font-size: 16px;
}

.equipment-view-form .requisites-list {
  margin-bottom: 10px;
}

.employee-workflow-form { width: min(800px, 100%); }

.debtor-tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.debtor-tabs button { flex: 0 0 auto; padding: 11px 14px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.debtor-tabs button.is-active { border-bottom-color: #3297f5; color: var(--ink); font-weight: 700; }
.debtor-filters { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.debtor-filters.debtor-filters-without-stage { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.debtor-filters label { display: grid; gap: 5px; color: #303841; font-size: 13px; }
.debtor-filters input, .debtor-filters select { width: 100%; min-height: 36px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.debtor-period-filter { position: relative; min-width: 0; color: #303841; font-size: 13px; }
.debtor-period-filter[open] { z-index: 40; }
.debtor-period-filter summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px 10px; min-height: 58px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; list-style: none; }
.debtor-period-filter summary::-webkit-details-marker { display: none; }
.debtor-period-filter summary span { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.debtor-period-filter summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.debtor-period-filter summary::after { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; content: ""; transform: rotate(45deg) translateY(-2px); }
.debtor-period-filter[open] summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.debtor-period-options { position: absolute; top: calc(100% + 6px); right: 0; left: 0; display: grid; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 12px 30px rgba(25, 35, 45, .16); }
.debtor-period-options button { width: 100%; padding: 9px 10px; border: 0; border-radius: 6px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.debtor-period-options button:hover, .debtor-period-options button.is-active { background: var(--soft); color: var(--accent); }
.debtor-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.debtor-kpis article { display: grid; gap: 5px; min-height: 108px; padding: 17px 18px; border-radius: 18px; background: #f1f2f4; }
.debtor-kpis span, .debtor-kpis small { color: #858b91; }
.debtor-kpis strong { font-size: 24px; }
.danger-text { color: #f04b16 !important; }
.debtor-dashboard-columns { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .95fr); gap: 34px; margin-bottom: 26px; }
.debtor-dashboard-columns h3, .debtor-trend h3, #debtorWorkspace > h3 { margin: 0 0 14px; font-size: 21px; }
.debtor-stage-bars { display: grid; gap: 12px; }
.debtor-stage-bars button { display: grid; grid-template-columns: 140px minmax(80px, 1fr) 110px; align-items: center; gap: 12px; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.debtor-stage-bars i { height: 14px; overflow: hidden; border-radius: 8px; background: #eceeef; }
.debtor-stage-bars b { display: block; height: 100%; border-radius: inherit; background: #3297f5; }
.debtor-stage-bars strong { text-align: right; font-weight: 500; }
.debtor-critical-list { display: grid; }
.debtor-critical-list button { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.debtor-critical-list strong { flex: 0 0 auto; padding: 5px 10px; border-radius: 18px; background: #e3f1ff; color: #2489e8; }
.debtor-trend { margin: 0 0 28px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.debtor-trend-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.debtor-trend-head h3 { margin-bottom: 4px; }
.debtor-trend-head p { margin: 0; color: var(--muted); font-size: 12px; }
.debtor-trend-total { display: grid; justify-items: end; gap: 2px; }
.debtor-trend-total span, .debtor-trend-total small { color: var(--muted); font-size: 11px; }
.debtor-trend-total strong { font-size: 20px; }
.debtor-month-chart { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.debtor-month-card { display: grid; gap: 16px; min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--soft); }
.debtor-month-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.debtor-month-card header strong { text-transform: capitalize; }
.debtor-month-card header span { padding: 4px 7px; border-radius: 999px; background: #e8f2fc; color: #247ac4; font-size: 10px; font-weight: 750; white-space: nowrap; }
.debtor-month-metric { display: grid; gap: 7px; }
.debtor-month-metric > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.debtor-month-metric span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.debtor-month-metric span i { width: 8px; height: 8px; border-radius: 50%; }
.debtor-month-metric b { font-size: 13px; white-space: nowrap; }
.debtor-month-metric em { display: block; height: 8px; overflow: hidden; border-radius: 999px; background: #e3e8ed; }
.debtor-month-metric em i { display: block; height: 100%; border-radius: inherit; }
.debtor-month-metric .blue { background: #3297f5; }
.debtor-month-metric .orange { background: #f48336; }
.debtor-legend { display: flex; gap: 18px; margin-bottom: 8px; font-size: 12px; }
.debtor-legend span { display: flex; align-items: center; gap: 6px; }
.debtor-legend i { width: 10px; height: 10px; border-radius: 50%; }
.debtor-legend .blue { background: #3297f5; } .debtor-legend .orange { background: #f48336; }
.debtor-table { min-width: 1120px; }
.debtor-table td { vertical-align: top; }
.debtor-table .action-row { min-width: 130px; }
.debtor-kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 300px); gap: 14px; padding: 2px 2px 16px; overflow-x: auto; scroll-snap-type: x proximity; }
.debtor-kanban-lane { min-height: 520px; overflow: hidden; border: 1px solid #e2e7eb; border-radius: 16px; background: color-mix(in srgb, var(--debtor-lane-color) 42%, #fff); scroll-snap-align: start; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.debtor-kanban-lane > header { box-sizing: border-box; display: grid; align-content: center; gap: 6px; height: 82px; padding: 12px 14px; border-bottom: 1px solid #e0e5e9; background: var(--debtor-lane-color); }
.debtor-kanban-lane > header div { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.debtor-kanban-lane > header strong { line-height: 1.22; }
.debtor-kanban-lane > header span { flex: 0 0 auto; min-width: 24px; padding: 2px 7px; border-radius: 12px; background: rgba(255,255,255,.75); text-align: center; font-size: 12px; }
.debtor-kanban-lane > header > b { color: #4e5963; font-size: 13px; font-weight: 600; }
.debtor-kanban-lane.is-dragover { border-color: #3297f5; box-shadow: 0 0 0 3px rgba(50,151,245,.14); transform: translateY(-2px); }
.debtor-kanban-cards { display: grid; align-content: start; gap: 10px; min-height: 430px; padding: 11px; }
.debtor-kanban-card { display: grid; gap: 9px; padding: 13px; border: 1px solid #e2e6e9; border-radius: 12px; background: #fff; box-shadow: 0 3px 10px rgba(37,50,62,.05); cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease; }
.debtor-kanban-card:hover { transform: translateY(-2px); box-shadow: 0 7px 18px rgba(37,50,62,.1); }
.debtor-kanban-card.is-dragging { opacity: .45; }
.debtor-kanban-card.is-urgent { border-left: 4px solid #ef6a62; }
.debtor-kanban-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); }
.debtor-kanban-card > strong { line-height: 1.3; }
.debtor-kanban-card > b { color: #1d2730; font-size: 18px; }
.debtor-kanban-card dl { display: grid; gap: 7px; margin: 0; }
.debtor-kanban-card dl div { display: grid; grid-template-columns: 82px minmax(0,1fr); gap: 7px; }
.debtor-kanban-card dt { color: var(--muted); font-size: 11px; }
.debtor-kanban-card dd { margin: 0; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.debtor-kanban-card footer { padding-top: 8px; border-top: 1px solid #edf0f2; color: #66717a; font-size: 11px; line-height: 1.35; }
.debtor-kanban-card footer.is-overdue { color: #d74840; font-weight: 700; }
.debtor-risk { min-width: 24px; padding: 3px 7px; border-radius: 10px; background: #edf0f2; color: #56616a; text-align: center; font-size: 11px; font-weight: 800; }
.debtor-risk-d, .debtor-risk-e { background: #ffe7e5; color: #c33c35; }
.debtor-risk-a, .debtor-risk-b { background: #e4f6eb; color: #25794a; }
.debtor-kanban-empty { margin: 18px 0; color: #98a0a7; text-align: center; font-size: 13px; }
.debtor-form { width: min(920px, 100%); }
.debtor-form.debtor-create-form {
  box-sizing: border-box;
  width: min(1240px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  padding: 22px 26px;
}
.debtor-form.debtor-stage-form {
  box-sizing: border-box;
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-x: hidden;
  padding: 0;
  border-radius: 14px;
}
.debtor-stage-head { margin: 0; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.debtor-stage-main { display: grid; gap: 16px; padding: 16px 20px; }
.debtor-stage-control-row { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(180px, .65fr); gap: 14px; }
.debtor-stage-select { display: grid; gap: 7px; font-weight: 700; }
.debtor-stage-select select { box-sizing: border-box; width: 100%; height: 42px; margin: 0; }
.debtor-stage-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.debtor-stage-fields:empty { display: none; }
.debtor-stage-fields label { display: grid; min-width: 0; gap: 6px; font-weight: 650; }
.debtor-stage-fields .wide { grid-column: 1 / -1; }
.debtor-stage-fields input,
.debtor-stage-fields select { box-sizing: border-box; width: 100%; min-width: 0; height: 40px; margin: 0; }
.debtor-stage-fields input[type="file"] { height: auto; min-height: 40px; overflow: hidden; padding: 5px; font-size: 12px; }
.debtor-stage-fields input[type="file"]::file-selector-button { max-width: 145px; margin-right: 8px; overflow: hidden; text-overflow: ellipsis; }
.debtor-stage-date-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-column: 1 / -1; gap: 14px; }
.debtor-stage-document-card { display: grid; gap: 10px; min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.debtor-stage-document-card h4 { margin: 0; font-size: 14px; }
.debtor-stage-document-card small { color: var(--muted); }
.debtor-stage-or { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.debtor-stage-or::before,.debtor-stage-or::after { height: 1px; flex: 1; background: var(--line); content: ""; }
.debtor-stage-actions { margin: 0; padding: 13px 20px; border-top: 1px solid var(--line); background: var(--panel); }
.debtor-create-form > .debtor-form-sections { width: 100%; }
.debtor-create-form .debtor-form-section { width: 100%; }
.debtor-create-form .debtor-form-section .debtor-form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 14px 16px;
}
.debtor-create-form .debtor-form-grid > label:not(.wide) {
  display: grid;
  grid-template-rows: minmax(34px, auto) 42px auto;
  align-content: start;
  min-width: 0;
}
.debtor-create-form .debtor-form-grid > label:not(.wide) > input,
.debtor-create-form .debtor-form-grid > label:not(.wide) > select {
  box-sizing: border-box;
  width: 100%;
  height: 42px;
  margin-top: 0;
}
.debtor-create-form .debtor-form-grid > .wide { width: 100%; }
.debtor-create-form .debtor-party-lookup { min-height: 42px; align-items: center; }
.debtor-create-form > .form-actions { position: sticky; z-index: 2; bottom: -22px; margin: 16px -26px -22px; padding: 14px 26px; border-top: 1px solid var(--line); background: var(--panel); }
.debtor-form.debtor-editor-form {
  display: grid;
  grid-template-columns: minmax(560px, 1.25fr) minmax(390px, .85fr);
  width: min(1440px, calc(100vw - 36px));
  height: calc(100vh - 36px);
  max-height: calc(100vh - 36px);
  overflow: hidden;
  padding: 0;
  border-radius: 14px;
  background: #f5f7fa;
}
.debtor-editor-main { display: flex; min-width: 0; min-height: 0; flex-direction: column; overflow: hidden; border-right: 1px solid var(--line); background: #fff; }
.debtor-editor-main > .form-head { flex: 0 0 auto; margin: 0; padding: 18px 20px 15px; border-bottom: 1px solid var(--line); }
.debtor-editor-main > .debtor-form-sections { min-height: 0; overflow: auto; gap: 14px; padding: 16px 18px 22px; background: #f6f8fa; }
.debtor-editor-main > .form-actions { flex: 0 0 auto; margin: 0; padding: 12px 20px; border-top: 1px solid var(--line); background: #fff; }
.debtor-editor-discussion { display: flex; min-width: 0; min-height: 0; flex-direction: column; background: #f7f9fb; }
.debtor-editor-discussion > header { flex: 0 0 auto; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.debtor-editor-discussion > header div { display: grid; gap: 3px; }
.debtor-editor-discussion > header strong { font-size: 15px; }
.debtor-editor-discussion > header span { color: var(--muted); font-size: 12px; }
.debtor-discussion-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.debtor-discussion-feed { display: grid; min-height: 0; align-content: start; gap: 10px; overflow: auto; padding: 14px; }
.debtor-discussion-message { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; }
.debtor-discussion-message > span { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; }
.debtor-discussion-message > div { min-width: 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 4px 12px 12px; background: #fff; }
.debtor-discussion-message p { margin: 4px 0; overflow-wrap: anywhere; font-size: 13px; line-height: 1.4; }
.debtor-discussion-message small { color: var(--muted); font-size: 10px; }
.debtor-discussion-message.is-activity > span { background: #8b96a3; }
.debtor-discussion-message.is-activity > div { background: #eef2f5; }
.debtor-discussion-compose { display: grid; grid-template-columns: minmax(0, 1fr) auto; flex: 0 0 auto; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); background: #fff; }
.debtor-discussion-compose textarea { min-height: 42px; resize: none; }
.debtor-discussion-compose button { align-self: stretch; min-width: 46px; }
.debtor-discussion-readonly { flex: 0 0 auto; padding: 12px 14px; border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 12px; text-align: center; }
.debtor-form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.debtor-form-grid .wide { grid-column: 1 / -1; }
.debtor-form-sections { display: grid; gap: 0; }
.debtor-form-section { padding: 15px 0 17px; border-bottom: 1px solid var(--line); }
.debtor-form-section:first-child { padding-top: 2px; }
.debtor-form-section:last-child { border-bottom: 0; }
.debtor-form-section > h4 { margin: 0 0 12px; color: var(--ink); font-size: 16px; }
.debtor-pretrial-section { display: grid; gap: 14px; }
.debtor-court-section { display: grid; gap: 14px; }
.debtor-pretrial-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.debtor-pretrial-head > div { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.debtor-pretrial-head h4 { margin: 0; font-size: 16px; }
.debtor-pretrial-dates, .debtor-pretrial-documents { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.debtor-court-details { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.debtor-court-details > div { display: grid; min-width: 0; gap: 5px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.debtor-court-details span { color: var(--muted); font-size: 11px; }
.debtor-court-details strong { overflow-wrap: anywhere; font-size: 13px; }
.debtor-pretrial-dates > div, .debtor-pretrial-documents article { display: grid; min-width: 0; gap: 5px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.debtor-pretrial-dates span, .debtor-pretrial-documents small { color: var(--muted); font-size: 11px; }
.debtor-pretrial-documents h5 { margin: 0 0 3px; font-size: 13px; }
.debtor-pretrial-documents .file-button { width: fit-content; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.debtor-editable-attachment { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.debtor-editable-attachment > div { min-width: 0; }
.debtor-form-section .debtor-form-grid { gap: 11px 12px; }
.debtor-editor-form .debtor-form-section { padding: 15px 16px 17px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 2px 8px rgba(24, 39, 55, .035); }
.debtor-editor-form .debtor-form-section:first-child { padding-top: 15px; }
.debtor-editor-form .debtor-form-section .debtor-form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; gap: 14px 12px; }
.debtor-editor-form .debtor-form-grid > label { display: grid; min-width: 0; align-content: start; gap: 6px; margin: 0; }
.debtor-editor-form .debtor-form-grid > label:has([name="debtorName"]) { grid-column: span 2; }
.debtor-editor-form .debtor-form-grid > label:has([name="legalPosition"]) { grid-column: 1 / -1; }
.debtor-editor-form .debtor-form-grid input,
.debtor-editor-form .debtor-form-grid select { box-sizing: border-box; width: 100%; min-width: 0; height: 42px; margin: 0; }
.debtor-editor-form .debtor-form-grid textarea { box-sizing: border-box; width: 100%; min-height: 76px; margin: 0; resize: vertical; }
.debtor-editor-form:has(input:disabled) .debtor-form-grid input:disabled,
.debtor-editor-form:has(input:disabled) .debtor-form-grid select:disabled,
.debtor-editor-form:has(input:disabled) .debtor-form-grid textarea:disabled { border-color: #e2e7ec; background: #f8fafb; color: var(--ink); opacity: 1; -webkit-text-fill-color: var(--ink); font-weight: 650; }
.debtor-editor-form:has(input:disabled) .debtor-form-grid select:disabled { appearance: none; background-image: none; }
.debtor-editor-form:has(input:disabled) .debtor-form-grid label:has(input[type="file"]:disabled) { display: none; }
.debtor-editor-form:has(input:disabled) .debtor-form-grid label > .muted,
.debtor-editor-form:has(input:disabled) .debtor-risk-hint { display: none; }
.debtor-editor-form:has(input:disabled) .debtor-form-section:nth-child(3) .debtor-form-grid > label:not(.wide) { grid-template-rows: auto 42px; }
.debtor-form-section:nth-child(3) .debtor-form-grid { align-items: start; }
.debtor-form-section:nth-child(3) .debtor-form-grid > label:not(.wide) { display: grid; grid-template-rows: minmax(28px, auto) auto auto; align-content: start; }
.debtor-form-section:nth-child(3) .debtor-form-grid > label:not(.wide) > input,
.debtor-form-section:nth-child(3) .debtor-form-grid > label:not(.wide) > select { margin-top: 0; }
.debtor-risk-hint { display: block; min-height: 32px; margin-top: 4px; line-height: 1.25; }
.debtor-action-history { display: grid; gap: 7px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.debtor-action-history p { display: grid; grid-template-columns: 95px 1fr; gap: 10px; margin: 0; font-size: 13px; }
.debtor-action-history time { color: var(--muted); }
.debtor-full-history { max-height: 360px; overflow: auto; }
.debtor-full-history p > span { display: grid; gap: 2px; }
.debtor-full-history p small { color: var(--muted); font-style: normal; }
.debtor-full-history p em { color: #4b5560; font-style: normal; }
.debtor-task-groups { display: grid; gap: 18px; }
.debtor-task-groups section { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.debtor-task-groups h3 { display: flex; gap: 8px; margin: 0 0 10px; }
.debtor-task-groups h3 span { color: var(--muted); }
.debtor-task-groups section > button { display: grid; grid-template-columns: 220px 1fr 110px; gap: 12px; width: 100%; padding: 10px 0; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }

@media (max-width: 850px) {
  .debtor-filters, .debtor-kpis, .debtor-dashboard-columns { grid-template-columns: 1fr; }
  .debtor-month-chart { grid-template-columns: 1fr; }
  .debtor-trend-head { align-items: stretch; flex-direction: column; }
  .debtor-trend-total { justify-items: start; }
  .debtor-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .debtor-form.debtor-create-form { width: min(100%, calc(100vw - 20px)); max-height: calc(100vh - 20px); padding: 18px; }
  .debtor-create-form .debtor-form-section .debtor-form-grid { grid-template-columns: 1fr; }
  .debtor-editor-form .debtor-form-section .debtor-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .debtor-create-form .debtor-form-grid .wide { grid-column: 1; }
  .debtor-create-form > .form-actions { bottom: -18px; margin: 14px -18px -18px; padding: 12px 18px; }
  .debtor-form.debtor-stage-form { width: min(100%, calc(100vw - 20px)); max-height: calc(100vh - 20px); padding: 0; }
  .debtor-stage-main { padding: 14px; }
  .debtor-stage-control-row { grid-template-columns: 1fr; }
  .debtor-stage-fields, .debtor-stage-date-row { grid-template-columns: 1fr; }
  .debtor-stage-fields .wide { grid-column: 1; }
  .debtor-pretrial-head { align-items: stretch; flex-direction: column; }
  .debtor-pretrial-dates, .debtor-pretrial-documents { grid-template-columns: 1fr; }
  .debtor-court-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .debtor-stage-head { padding: 15px 14px 12px; }
  .debtor-stage-actions { padding: 12px 14px; }
  .debtor-stage-bars button { grid-template-columns: 110px minmax(60px, 1fr) 95px; }
}

@media (max-width: 560px) {
  .debtor-editor-form .debtor-form-section .debtor-form-grid { grid-template-columns: 1fr; }
  .debtor-editor-form .debtor-form-grid > label:has([name="debtorName"]) { grid-column: 1; }
  .debtor-court-details { grid-template-columns: 1fr; }
}

@media (max-width: 1050px) {
  .debtor-form.debtor-editor-form { grid-template-columns: 1fr; overflow: auto; }
  .debtor-editor-main { min-height: 720px; overflow: visible; border-right: 0; }
  .debtor-editor-main > .debtor-form-sections { overflow: visible; }
  .debtor-editor-discussion { min-height: 560px; }
}

.workflow-form > .form-head {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 0;
  padding: 18px 20px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.workflow-form > .form-grid,
.workflow-form > .nested-fieldset,
.workflow-form > .workflow-form-body {
  margin: 0;
  padding: 18px 20px;
}

.workflow-form > .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 12px;
}

.workflow-form > .form-grid .wide { grid-column: span 3; }

.employee-workflow-form > .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 10px;
  padding: 14px 16px;
}

.employee-workflow-form > .form-grid .wide {
  grid-column: 1 / -1;
}

.employee-workflow-form .guard-fields,
.employee-workflow-form .employee-photo-upload-state {
  grid-column: 1 / -1;
}

.employee-workflow-form > .form-head,
.employee-workflow-form > .form-actions {
  padding-left: 16px;
  padding-right: 16px;
}

.employee-workflow-form .form-grid label,
.employee-workflow-form .employee-organization-select {
  font-size: 12px;
}

.employee-workflow-form .form-grid label {
  display: block;
  min-width: 0;
  line-height: 1.15;
}

.employee-workflow-form .form-grid label > input,
.employee-workflow-form .form-grid label > select {
  margin-top: 4px;
}

.employee-workflow-form .employee-stack-fields {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.employee-workflow-form .employee-stack-fields input {
  height: 38px;
}

.employee-workflow-form .employee-position-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  min-width: 0;
}
.employee-workflow-form .employee-position-row > label { grid-column: auto; }

.employee-workflow-form .employee-organization-select {
  grid-column: 1 / -1;
  gap: 4px;
  min-width: 0;
}

.employee-workflow-form input,
.employee-workflow-form select {
  height: 38px;
  min-height: 38px;
  padding: 8px 10px;
}

.employee-workflow-form .employee-organization-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 8px;
  max-height: 96px;
  overflow: auto;
  padding: 6px;
}

.employee-workflow-form .employee-organization-options label {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 2px 4px;
  line-height: 1.1;
}

.employee-workflow-form .employee-organization-options label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-workflow-form .employee-organization-options input {
  width: 14px;
  height: 14px;
  min-height: 14px;
  margin: 0;
}

.employee-workflow-form .nested-form-grid {
  grid-template-columns: minmax(86px, 0.55fr) repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
}

.employee-workflow-form #employeeGradeSelect {
  height: 38px;
  min-height: 38px;
}

.employee-workflow-form .employee-photo-file-field {
  grid-column: auto;
}

.workflow-form > .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  width: 100%;
  margin: 0;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.workflow-form textarea { resize: vertical; }
.workflow-form .guard-fields,
.workflow-form .nested-fieldset {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
}
.workflow-form .tool-issue-list { max-height: 300px; overflow: auto; }

.document-form-body { display: grid; padding-top: 0 !important; padding-bottom: 0 !important; }
.document-form-section { padding: 17px 0 19px; border-bottom: 1px solid var(--line); }
.document-form-section:last-child { border-bottom: 0; }
.document-form-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 13px; }
.document-form-section-head h4 { margin: 0; font-size: 16px; }
.document-form-section-head span { color: var(--muted); font-size: 12px; text-align: right; }
.document-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px 12px; }
.document-form-grid label { display: grid; gap: 6px; color: #354151; font-size: 13px; font-weight: 700; }
.document-form-grid .span-3 { grid-column: span 3; }
.document-form-note { display: grid; align-content: center; gap: 4px; min-height: 44px; padding: 7px 11px; border: 1px solid var(--line); background: var(--soft); }
.document-form-note span { color: var(--muted); font-size: 11px; }
.document-form-section > .nested-fieldset { margin-top: 14px; }

@media (max-width: 760px) {
  .workflow-form > .form-grid { grid-template-columns: 1fr; }
  .workflow-form > .form-grid .wide { grid-column: auto; }
  .employee-workflow-form > .form-grid,
  .employee-workflow-form .nested-form-grid,
  .employee-workflow-form .employee-position-row { grid-template-columns: 1fr; }
  .employee-workflow-form .employee-stack-fields { grid-template-rows: none; }
  .employee-workflow-form .guard-fields,
  .employee-workflow-form .employee-photo-upload-state,
  .employee-workflow-form .employee-organization-select,
  .employee-workflow-form .employee-position-row,
  .employee-workflow-form .employee-photo-file-field { grid-column: auto; }
  .employee-workflow-form .employee-organization-options { grid-template-columns: 1fr; }
  .workflow-form > .form-head,
  .workflow-form > .form-grid,
  .workflow-form > .form-actions { padding-left: 14px; padding-right: 14px; }
  .document-form-grid { grid-template-columns: 1fr; }
  .document-form-grid .span-3 { grid-column: auto; }
  .document-form-section-head { display: grid; gap: 4px; }
  .document-form-section-head span { text-align: left; }
  .tool-workflow-form > .form-grid,
  #toolActionForm > .form-grid,
  .equipment-workflow-form > .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-workflow-form > .form-grid .wide,
  #toolActionForm > .form-grid .wide,
  .equipment-workflow-form > .form-grid .wide { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  #toolModal,
  #toolActionModal,
  #toolViewModal,
  #equipmentModal,
  #equipmentViewModal { padding: 8px; }
  .tool-workflow-form > .form-grid,
  #toolActionForm > .form-grid,
  .equipment-workflow-form > .form-grid { grid-template-columns: 1fr; }
  .tool-workflow-form > .form-grid .tool-field-span-2,
  #toolActionForm > .form-grid .tool-field-span-2 { grid-column: auto; }
  #toolActionForm .tool-issue-row { grid-template-columns: auto minmax(0, 1fr) 64px; }
}

#timesheetModal {
  padding: 10px;
}
.process-studio-head,.process-editor-head,.process-editor-actions{display:flex;align-items:center;justify-content:space-between;gap:10px}.process-studio-head{margin-bottom:12px}.process-studio-layout{display:grid;grid-template-columns:260px minmax(0,1fr);gap:12px;min-height:620px}.process-model-list{display:grid;align-content:start;gap:6px;padding:8px;border:1px solid var(--line);border-radius:9px;background:#f6f8f9}.process-model-item{display:grid;grid-template-columns:auto 1fr;gap:3px 8px;padding:10px;border:1px solid transparent;border-radius:7px;background:#fff;text-align:left;cursor:pointer}.process-model-item strong{align-self:center}.process-model-item small{grid-column:2;color:var(--muted)}.process-model-item.is-active{border-color:var(--accent);box-shadow:0 0 0 2px rgb(31 111 99 / 10%)}.process-editor{min-width:0;padding:12px;border:1px solid var(--line);border-radius:9px;background:#fff}.process-editor-head label{display:grid;flex:1;gap:4px;font-size:12px;font-weight:700}.process-editor-tabs{display:flex;gap:8px;margin:10px 0 6px;color:var(--muted);font-size:12px}.process-xml-editor{width:100%;min-height:330px;padding:12px;border:1px solid #bec9cc;border-radius:7px;background:#172126;color:#d8eee9;font:12px/1.55 Consolas,monospace;tab-size:2;resize:vertical}.process-editor-actions{justify-content:flex-start;margin:8px 0}.process-preview{padding:12px;border:1px solid var(--line);border-radius:8px;background:#f8fafb}.process-preview h3{margin:0 0 10px}.bpmn-preview-flow{display:flex;align-items:center;gap:8px;overflow:auto;padding:8px}.bpmn-preview-node,.dmn-decision-card{display:grid;flex:0 0 auto;gap:4px;min-width:130px;padding:10px;border:2px solid var(--accent);border-radius:8px;background:#fff}.bpmn-preview-node small,.dmn-decision-card span{color:var(--muted);font-size:10px}.bpmn-preview-arrow{color:var(--accent);font-size:22px}.dmn-decision-card{display:inline-grid;margin:4px;border-color:#5a68aa}.process-preview-error{padding:12px;color:var(--danger)}.process-empty{display:grid;place-content:center;min-height:500px;text-align:center;color:var(--muted)}@media(max-width:800px){.process-studio-layout{grid-template-columns:1fr}.process-model-list{max-height:220px;overflow:auto}.process-editor-head{align-items:end}.process-studio-head{align-items:flex-start;flex-direction:column}}

.process-builder { display: grid; gap: 14px; margin-top: 12px; }
.process-builder-toolbar {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(145px, .8fr) minmax(210px, 1.4fr) minmax(150px, .9fr) auto;
  align-items: end;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f6f8f9;
}
.process-builder-toolbar label,
.process-builder-flow-form label { display: grid; gap: 4px; min-width: 0; font-size: 11px; font-weight: 700; }
.process-builder-toolbar input,
.process-builder-toolbar select,
.process-builder-flow-form input,
.process-builder-flow-form select { width: 100%; min-width: 0; min-height: 36px; }
.process-builder-toolbar button,
.process-builder-flow-form button { min-height: 36px; white-space: nowrap; }
.process-builder-lanes { display: grid; gap: 8px; overflow-x: auto; }
.process-builder-lane {
  min-width: 760px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 5px solid var(--process-role-color);
  border-radius: 8px;
  background: #fbfcfc;
}
.process-builder-lane > header { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--process-role-color) 9%, #fff); }
.process-builder-lane > header strong { font-size: 13px; }
.process-builder-lane > header span { flex: 1; color: var(--muted); font-size: 11px; }
.process-builder-node-row { display: flex; align-items: stretch; gap: 9px; min-height: 104px; overflow-x: auto; padding: 10px; }
.process-builder-node {
  display: grid;
  flex: 0 0 190px;
  align-content: space-between;
  gap: 6px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--process-role-color) 42%, var(--line));
  border-top: 4px solid var(--process-role-color);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 3px 8px rgb(30 50 55 / 8%);
}
.process-builder-node > span { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.process-builder-node > strong { font-size: 12px; line-height: 1.35; }
.process-builder-node > div { display: flex; gap: 5px; }
.process-builder-node .small-button { padding: 4px 6px; font-size: 10px; }
.process-builder-flows { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #f8fafb; }
.process-builder-flow-form { display: grid; grid-template-columns: repeat(3, minmax(140px, 1fr)) auto; align-items: end; gap: 8px; }
.process-builder-flow-list { display: grid; gap: 5px; margin-top: 10px; }
.process-builder-flow-list > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font-size: 11px; }
.process-xml-expert { margin: 14px 0; border: 1px solid var(--line); border-radius: 8px; background: #f6f8f9; }
.process-xml-expert > summary { padding: 10px 12px; color: var(--ink); font-size: 12px; font-weight: 800; cursor: pointer; }
.process-xml-expert .process-xml-editor { display: block; width: calc(100% - 16px); margin: 0 8px; }
.process-xml-expert .process-editor-actions { padding: 0 8px 8px; }
@media (max-width: 1180px) {
  .process-builder-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .process-builder-toolbar button { width: 100%; }
}
@media (max-width: 760px) {
  .process-builder-toolbar,
  .process-builder-flow-form { grid-template-columns: 1fr; }
}

#timesheetPayrollModal {
  position: fixed;
  inset: 0;
  z-index: 2400;
  padding: 8px;
}
.bpmn-swimlane .bpmn-lane-label{grid-column:1;left:0;z-index:8;width:170px;min-width:170px;background:#edf2f3;box-shadow:5px 0 9px rgb(30 50 55 / 14%)}.bpmn-swimlane .bpmn-lane-label strong{font-size:12px;line-height:1.3}.bpmn-swimlane .bpmn-connector-layer>path{stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}.bpmn-swimlane .bpmn-connector-layer marker path{fill:#34484d!important;stroke:none!important}
.bpmn-connector-layer .bpmn-arrow-head{stroke:#fff;stroke-width:1;stroke-linejoin:round}
.bpmn-swimlane-scroll{overflow:auto;padding:4px;border:1px solid var(--line);background:#fff}.bpmn-swimlane{position:relative;display:grid;grid-template-columns:170px repeat(var(--bpmn-columns),150px);grid-template-rows:repeat(var(--bpmn-rows),118px);width:max-content;min-width:100%;isolation:isolate}.bpmn-lane-bg{grid-column:1/-1;border-bottom:1px solid #c8d0d3;background:#fbfcfc;z-index:0}.bpmn-lane-bg:nth-of-type(4n+1){background:#f3f7f7}.bpmn-lane-label{position:sticky;left:0;z-index:4;display:grid;place-items:center;padding:10px;border-right:4px solid;border-bottom:1px solid #c8d0d3;background:#edf2f3;text-align:center}.bpmn-lane-label strong{font-size:12px}.bpmn-swimlane .bpmn-preview-node{position:relative;z-index:3;align-self:center;justify-self:center;display:grid;place-content:center;gap:3px;width:126px;min-width:0;min-height:66px;padding:8px;border:2px solid;border-radius:9px;background:#fff;text-align:center;box-shadow:0 3px 8px rgb(30 50 55 / 10%)}.bpmn-swimlane .bpmn-preview-node small{font-size:8px}.bpmn-swimlane .bpmn-preview-node strong{font-size:11px;line-height:1.25}.bpmn-node-symbol{font-size:17px;line-height:1}.bpmn-swimlane .bpmn-exclusiveGateway{width:105px;border-radius:4px;background:#fff9e9;transform:rotate(0)}.bpmn-swimlane .bpmn-startEvent,.bpmn-swimlane .bpmn-endEvent{border-radius:40px}.bpmn-connector-layer{position:absolute;inset:0;z-index:2;overflow:visible;pointer-events:none}.bpmn-connector-layer path{fill:none;stroke-width:2;marker-end:url(#bpmnArrow)}.bpmn-connector-layer path.is-return{stroke-dasharray:6 4;stroke-width:2.5}.bpmn-flow-label{fill:#6c4a18;font:700 10px Arial}.bpmn-link-data{display:none}
.process-preview .bpmn-preview-flow{display:grid;grid-template-columns:repeat(3,minmax(190px,1fr));align-items:stretch;gap:10px;overflow:visible;padding:4px}.process-preview .bpmn-preview-node{display:grid;grid-template-rows:auto 1fr;gap:9px;min-width:0;border-width:1px;border-left-width:4px}.bpmn-preview-title{display:grid;gap:3px}.bpmn-preview-links{display:grid;align-content:end;gap:4px;padding-top:7px;border-top:1px solid var(--line)}.bpmn-preview-links span{display:block;padding:5px 6px;border-radius:5px;background:#eef6f4;color:#28675e;font-size:10px;line-height:1.3}.bpmn-preview-links .is-return{background:#fff0e3;color:#a45112;font-weight:700}.bpmn-preview-links .is-finish{background:#eef0f2;color:var(--muted)}.bpmn-exclusiveGateway{border-left-color:#d89b2b!important;background:#fffbf2}.bpmn-startEvent{border-left-color:#35a66f!important}.bpmn-endEvent{border-left-color:#c84c4c!important}@media(max-width:1100px){.process-preview .bpmn-preview-flow{grid-template-columns:repeat(2,minmax(190px,1fr))}}@media(max-width:650px){.process-preview .bpmn-preview-flow{grid-template-columns:1fr}}

.bpmn-swimlane :is(.bpmn-parallelGateway,.bpmn-inclusiveGateway,.bpmn-eventBasedGateway,.bpmn-complexGateway) { width: 105px; border-radius: 4px; background: #fff9e9; }
.bpmn-swimlane :is(.bpmn-intermediateCatchEvent,.bpmn-intermediateThrowEvent) { border-radius: 40px; }
.bpmn-swimlane :is(.bpmn-subProcess,.bpmn-callActivity) { border-style: double; border-width: 4px; }
.bpmn-connector-layer path { marker-end: none; }

#timesheetPayrollModal .timesheet-payroll-form {
  width: calc(100vw - 16px);
  max-width: none;
  height: calc(100vh - 16px);
  max-height: calc(100vh - 16px);
  padding: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#timesheetPayrollContent > .form-head,
#timesheetPayrollContent > .payroll-period-filter,
#timesheetPayrollContent > .saved-payroll-toolbar,
#timesheetPayrollContent > .form-actions { flex: 0 0 auto; }
#timesheetPayrollResults,
#directPayrollResults,
#timesheetPayrollContent > .payroll-saved-report {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
#timesheetPayrollResults > .payroll-totals,
.payroll-saved-report > .payroll-totals {
  position: sticky;
  z-index: 4;
  top: 0;
  padding-block: 6px;
  background: #fff;
}
.saved-payroll-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 7px;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f6f8f9;
}
.saved-payroll-toolbar > label { display: grid; gap: 4px; min-width: 150px; color: var(--ink); font-size: 12px; font-weight: 700; }
.saved-payroll-toolbar > .check-row { display: flex; min-width: auto; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.saved-payroll-toolbar > .saved-payroll-search { flex: 1 1 240px; }
.saved-payroll-toolbar input,
.saved-payroll-toolbar select { min-height: 38px; }

#timesheetPayrollModal .timesheet-payroll-table {
  width: 100%;
  font-size: 12px;
}

#timesheetModal .contract-form:not(.timesheet-document-form) {
  width: min(700px, 100%);
  max-height: calc(100vh - 40px);
  overflow: visible;
}

.contract-form.timesheet-document-form {
  width: calc(100vw - 20px);
  max-width: none;
  max-height: calc(100vh - 20px);
  padding: 16px;
}

.timesheet-document-form .timesheet-calendar th,
.timesheet-document-form .timesheet-calendar td {
  min-width: 28px;
  padding: 2px 1px;
  font-size: 11px;
}

.timesheet-document-form .timesheet-calendar th:first-child {
  min-width: 160px;
  max-width: 160px;
  padding-left: 8px;
  font-size: 12px;
}

.timesheet-calendar .timesheet-department-row th {
  position: static;
  min-width: 0;
  max-width: none;
  padding: 7px 10px;
  background: #e8edf1;
  color: var(--ink);
  font-size: 12px;
  text-align: left;
}

.timesheet-document-form .timesheet-calendar th:nth-last-child(-n + 2),
.timesheet-document-form .timesheet-calendar td:nth-last-child(-n + 2) {
  min-width: 68px;
}

.timesheet-document-form .timesheet-calendar input[type="number"],
.timesheet-document-form .timesheet-calendar input[type="text"] {
  width: 26px;
  min-width: 26px;
  min-height: 28px;
  height: 28px;
  padding: 2px 1px;
  font-size: 16px;
  line-height: 1;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

.timesheet-document-form .timesheet-calendar input[type="number"]::-webkit-inner-spin-button,
.timesheet-document-form .timesheet-calendar input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.timesheet-document-form .timesheet-calendar input.timesheet-rate-input[type="number"] {
  width: 96px !important;
  min-width: 96px !important;
  max-width: 96px !important;
  padding-inline: 6px !important;
  font-size: 14px !important;
  line-height: 1 !important;
}
.timesheet-readonly-note { margin: 0 0 14px; border-left: 4px solid #5a9bd8; background: #eef6fd; }
.timesheet-table-subtitle { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.25; }
.timesheet-readonly .timesheet-note-input::placeholder { color: transparent; -webkit-text-fill-color: transparent; }
.timesheet-readonly .timesheet-calendar input:disabled { opacity: 1; border-color: transparent; background: transparent; color: var(--ink); -webkit-text-fill-color: var(--ink); cursor: default; }
.timesheet-readonly .timesheet-calendar .timesheet-day-off input:disabled { background: transparent; color: #a52323; -webkit-text-fill-color: #a52323; }

.timesheet-document-form .timesheet-calendar th:nth-last-child(4),
.timesheet-document-form .timesheet-calendar td:nth-last-child(4) {
  width: 108px;
  min-width: 108px;
}

.timesheet-document-form .timesheet-calendar tbody td:nth-last-child(5),
.timesheet-document-form .timesheet-calendar tbody td:nth-last-child(3) {
  vertical-align: middle;
  padding-bottom: 20px;
}

.timesheet-document-form .timesheet-calendar .timesheet-note-input {
  color: #111;
  height: 28px;
  min-height: 28px;
  line-height: 1;
  padding: 2px 6px;
  width: 150px;
  min-width: 150px;
  text-align: left;
}

.timesheet-document-form .timesheet-calendar .timesheet-note-input::placeholder {
  color: #a8b0ba;
  opacity: 1;
}

.timesheet-add-employee {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
}

.timesheet-add-employee input { min-width: 0; }

.timesheet-add-employee:has(#timesheetEmployeeSection) {
  grid-template-columns: minmax(150px, 190px) minmax(220px, 1fr) auto;
}

.timesheet-add-row th,
.timesheet-add-row td { background: #f7f9fb; vertical-align: middle; }

.timesheet-inline-add {
  display: grid;
  grid-template-columns: 30px minmax(150px, 1fr);
  align-items: center;
  gap: 6px;
}

.timesheet-inline-add .timesheet-row-control {
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
}

.timesheet-inline-add input { width: 100%; min-width: 0; text-align: left; }

.timesheet-object-search-field {
  position: relative;
  z-index: 4;
}

.timesheet-object-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(28, 37, 47, 0.12);
}

.timesheet-object-search-results:empty {
  display: none;
}

.timesheet-object-search-results button,
.timesheet-object-search-results span {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  padding: 8px 10px;
  text-align: left;
}

.timesheet-object-search-results button {
  cursor: pointer;
}

.timesheet-object-search-results button:hover,
.timesheet-object-search-results button:focus-visible {
  background: #eef4f7;
  outline: none;
}

.timesheet-object-search-results span {
  color: var(--muted);
}

.timesheet-document-form .timesheet-calendar { table-layout: fixed; }
.timesheet-employee-name {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}
.timesheet-employee-name span { min-width: 0; overflow-wrap: anywhere; }
.timesheet-employee-name { grid-template-columns: auto minmax(0, 1fr); }
.timesheet-row-order-controls { display: inline-flex; gap: 3px; }
.timesheet-row-order-controls .timesheet-row-control { color: var(--ink); }
.timesheet-row-order-controls [data-timesheet-remove-row] { color: var(--danger); }
.timesheet-drag-handle { width: 22px; height: 22px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--muted); font-weight: 800; cursor: grab; user-select: none; }
.timesheet-drag-handle:active { cursor: grabbing; }
.timesheet-calendar tr.is-dragging { opacity: .45; }
.timesheet-calendar tr.is-drag-over > * { box-shadow: inset 0 3px 0 var(--accent); }
.timesheet-calendar .timesheet-department-row.is-drag-over > * {
  background: color-mix(in srgb, var(--accent) 12%, var(--soft));
  box-shadow: inset 0 0 0 2px var(--accent);
}
.timesheet-row-control {
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.timesheet-employee-name .timesheet-row-control { color: var(--danger); }
.account-security-form { width:min(900px,calc(100vw - 24px)); max-height:calc(100vh - 32px); overflow:auto; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; padding:0; border-radius:14px; background:#f4f7f8; }
.account-security-form>.form-head { position:sticky; top:0; z-index:3; grid-column:1/-1; margin:0; padding:18px 22px; border-bottom:1px solid var(--line); background:linear-gradient(135deg,#edf6f3,#f8fafb); }
.account-security-form>.form-head h3 { margin:0 0 3px; font-size:21px; }
.account-security-form>.form-head p { margin:0; color:var(--muted); }
.account-security-form>.contract-card { margin:0 0 18px; padding:18px; border:0; border-top:4px solid var(--accent); border-radius:10px; box-shadow:0 6px 18px rgb(36 54 58 / 9%); }
.account-security-form>.contract-card:first-of-type { margin-left:18px; border-top-color:#4d6fb3; }
.account-security-form>.contract-card:last-of-type { margin-right:18px; border-top-color:#287d70; }
.account-security-form .contract-card-head { padding-bottom:12px; border-bottom:1px solid var(--line); }
.account-security-form .contract-card-head strong { font-size:16px; }
.account-security-form .form-grid { grid-template-columns:1fr; gap:11px; }
.account-security-form label { gap:5px; color:#354151; font-weight:650; }
.account-security-form input { min-height:40px; background:#fbfcfd; }
.account-security-form .form-actions { justify-content:flex-end; margin-top:14px; padding-top:12px; border-top:1px solid var(--line); }
.account-password-field { position:relative; }
.account-password-field input { padding-right:78px; }
.account-password-toggle { position:absolute; right:6px; bottom:5px; min-height:30px!important; padding:4px 8px!important; border:0!important; background:transparent!important; color:var(--accent)!important; font-size:11px!important; }
.account-2fa-setup { display:grid; gap:10px; margin-top:14px; padding:14px; border:1px solid #b9d8d1; border-radius:8px; background:#f0f8f6; }
.account-2fa-setup [data-account-2fa-secret] { font:700 14px Consolas,monospace; letter-spacing:1.5px; }
.account-2fa-setup input[name="code"] { max-width:180px; font:700 20px Consolas,monospace; letter-spacing:5px; text-align:center; }
.account-profile-form{width:min(760px,calc(100vw - 24px));padding:0;border-radius:14px;overflow:auto}.account-profile-form>.form-head{margin:0;padding:18px 22px;border-bottom:1px solid var(--line);background:linear-gradient(135deg,#edf6f3,#f8fafb)}.account-profile-layout{display:grid;grid-template-columns:210px minmax(0,1fr);gap:22px;padding:22px}.account-profile-photo{display:grid;justify-items:center;align-content:start;gap:9px;padding:16px;border:1px solid var(--line);border-radius:10px;background:#f7faf9;text-align:center}.account-profile-photo>span,.account-profile-photo>small{color:var(--muted)}.account-profile-avatar{width:112px;height:112px;display:grid;place-items:center;overflow:hidden;border:4px solid #fff;border-radius:50%;background:#dfeae7;box-shadow:0 5px 16px rgb(30 60 55 / 16%);color:var(--accent);font-size:38px;font-weight:800}.account-profile-avatar img{width:100%;height:100%;object-fit:cover}.account-profile-upload{display:inline-flex;align-items:center;justify-content:center;cursor:pointer}.account-profile-fields{align-content:start}.account-profile-form>.form-actions{margin:0;padding:14px 22px;border-top:1px solid var(--line);background:#fafcfc}@media(max-width:650px){.account-profile-layout{grid-template-columns:1fr;padding:14px}.account-profile-photo{grid-template-columns:auto 1fr;justify-items:start;text-align:left}.account-profile-avatar{grid-row:1/5;width:84px;height:84px}}
.account-profile-form .account-profile-fields{grid-template-columns:1fr}
@media(max-width:760px){.account-security-form{grid-template-columns:1fr}.account-security-form>.contract-card:first-of-type,.account-security-form>.contract-card:last-of-type{margin:0 12px}.account-security-form>.contract-card:last-of-type{margin-bottom:12px}}

.timesheet-section-head { align-items: center; }
.timesheet-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.payroll-summary-buttons { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.payment-register-select-all { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #f4f7f8; font-weight: 700; }
.payment-register-select-all input,
.payment-register-report-list input { width: 17px; min-width: 17px; min-height: 17px; margin: 0; }
.payment-register-report-list { display: grid; gap: 7px; max-height: 380px; margin-top: 10px; overflow-y: auto; }
.payment-register-report-list > label { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.payment-register-report-list > label:has(input:checked) { border-color: var(--accent); background: #f1f8f5; box-shadow: inset 3px 0 var(--accent); }
.payment-register-report-list > label > span { display: grid; gap: 3px; min-width: 0; }
.payment-register-report-list strong { font-size: 13px; }
.payment-register-report-list small { color: var(--muted); font-size: 11px; line-height: 1.3; }

#payrollEmployeePrintModal { z-index: 2500; }
.payroll-employee-print-form { width: min(980px, 100%); }
.payroll-print-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px minmax(0, 1fr);
  gap: 12px;
  min-height: 430px;
}
.payroll-print-picker > section {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fa;
}
.payroll-print-picker h4 { margin: 0; }
.payroll-print-picker input[type="search"] { min-height: 38px; }
.payroll-print-employee-list {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 0;
  max-height: 350px;
  overflow: auto;
}
.payroll-print-employee-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.payroll-print-employee-list span { min-width: 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 600; }
.payroll-print-picker-arrows { display: grid; place-content: center; gap: 20px; color: var(--muted); font-size: 11px; font-weight: 700; text-align: center; }
@media (max-width: 700px) {
  .payroll-print-picker { grid-template-columns: 1fr; }
  .payroll-print-picker-arrows { display: none; }
  .payroll-print-employee-list { max-height: 230px; }
}
.timesheet-period-nav {
  display: inline-grid;
  grid-template-columns: 38px minmax(150px, auto) 38px;
  align-items: center;
  gap: 6px;
}
.timesheet-period-nav strong { text-align: center; text-transform: capitalize; }
.timesheet-period-current {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 36px;
  padding: 0 10px;
  text-align: center;
  text-transform: capitalize;
}
.timesheet-period-current:hover,
.timesheet-period-current:focus-visible {
  background: #eef4f7;
  border-color: var(--line);
  border-radius: 8px;
  outline: none;
}
.timesheet-period-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 14px;
}
.timesheet-month-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.timesheet-month-option,
.timesheet-year-option {
  border: 0;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  min-height: 38px;
  padding: 8px 10px;
  text-align: center;
  text-transform: capitalize;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.timesheet-month-option {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.timesheet-month-option:nth-child(3n) { border-right: 0; }
.timesheet-month-option:nth-last-child(-n + 3) { border-bottom: 0; }
.timesheet-year-option {
  border: 1px solid var(--line);
  border-radius: 8px;
}
.timesheet-month-option:hover,
.timesheet-year-option:hover {
  background: #eef4f7;
  transform: translateY(-1px);
}
.timesheet-month-option.is-active,
.timesheet-year-option.is-active {
  background: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent-dark), 0 6px 14px rgba(31, 111, 99, 0.18);
  color: #fff;
  font-weight: 800;
  transform: scale(1.02);
}
.timesheet-year-list {
  display: grid;
  gap: 0;
  max-height: 176px;
  overflow-y: auto;
  padding-right: 4px;
}
.timesheet-year-option + .timesheet-year-option { margin-top: 6px; }

@media (max-width: 680px) {
  .timesheet-add-employee,
  .timesheet-add-employee:has(#timesheetEmployeeSection) { grid-template-columns: 1fr; }
  .timesheet-period-nav { width: 100%; grid-template-columns: 38px minmax(0, 1fr) 38px; }
  .timesheet-period-picker { grid-template-columns: 1fr; }
  .timesheet-month-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timesheet-year-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: 132px;
  }
}

@media (max-width: 1100px) {
  .timesheet-list-bar { align-items: stretch; gap: 8px; }
  .timesheet-list-bar .timesheet-totals > div { min-width: 105px; }
  .timesheet-list-bar .table-pagination { gap: 6px; }
}

.form-head,
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.form-head {
  margin-bottom: 16px;
}

.form-head h3,
.form-head p {
  margin: 0;
}

.form-head p {
  margin-top: 6px;
  color: var(--muted);
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  color: #354151;
  font-weight: 700;
  font-size: 14px;
}

.check-row {
  align-content: end;
  display: flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px !important;
  min-height: 44px;
}

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

.form-grid .wide {
  grid-column: span 2;
}

.input-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.input-action-row .secondary-button {
  white-space: nowrap;
}

@media (max-width: 560px) {
  .input-action-row { grid-template-columns: 1fr; }
}

.form-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

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

.role-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

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

.project-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.project-list {
  display: grid;
  gap: 12px;
}

.project-card,
.task-card,
.kanban-column {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.project-card,
.task-card {
  padding: 14px;
}

.project-card-head,
.task-card-head,
.project-footer,
.kanban-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.project-card-head strong,
.task-card-head strong {
  display: block;
}

.project-card-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.project-card p,
.task-card p {
  color: var(--muted);
  line-height: 1.45;
}

.project-meta {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  margin: 12px 0;
}

.progress-line {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf1;
  margin: 12px 0;
}

.progress-line span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.project-footer {
  align-items: center;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.kanban-column {
  min-width: 220px;
  background: var(--soft);
}

.kanban-head {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.kanban-head span {
  min-width: 28px;
  min-height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #e8edf1;
  color: #354151;
  font-weight: 700;
}

.task-stack {
  display: grid;
  gap: 10px;
  padding: 10px;
}

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

.projects-crm-head h3 { margin: 0; font-size: 24px; }
.projects-crm-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.content-panel > .projects-crm-head,
.content-panel > .tender-head {
  gap: 24px;
  margin: -18px -18px 14px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  background: color-mix(in srgb, var(--panel) 94%, var(--accent));
}

.content-panel > .tender-head {
  margin-bottom: 0;
}

.content-panel:has(> .tender-head) > .sales-crm-toolbar {
  margin: 0 -18px 14px;
}

.content-panel > .projects-crm-head h3,
.content-panel > .tender-head h3 {
  margin: 2px 0 3px;
  font-size: 26px;
}

.content-panel > .projects-crm-head p,
.content-panel > .tender-head p {
  margin: 0;
}

.projects-head-actions { display: flex; align-items: center; gap: 10px; }
.projects-create-button { min-height: 42px; white-space: nowrap; }
.projects-search { position: relative; display: block; width: min(390px, 34vw); }
.projects-search span { position: absolute; z-index: 1; top: 50%; left: 12px; display: grid; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.projects-search svg { width: 17px; height: 17px; }
.projects-search input { width: 100%; min-height: 42px; padding: 9px 12px 9px 38px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }

.projects-tabs {
  display: flex;
  gap: 4px;
  margin: 0 -18px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.projects-tabs button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.projects-tabs button::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  opacity: 0;
  transform: scaleX(.5);
  transition: opacity .16s ease, transform .16s ease;
}

.projects-tabs button:hover,
.projects-tabs button.is-active { color: var(--accent-dark); }
.projects-tabs button.is-active::after { opacity: 1; transform: scaleX(1); }
.projects-tabs button span { display: grid; min-width: 23px; height: 23px; place-items: center; padding: 0 6px; border-radius: 999px; background: #edf1f4; color: #53606d; font-size: 11px; }
.projects-tabs button.is-active span { background: #dcefe9; color: var(--accent-dark); }

.projects-filterbar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 0;
}

.projects-filterbar select {
  min-width: 170px;
  min-height: 38px;
  padding: 7px 32px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

.projects-overdue-filter {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid #f2c7c3;
  border-radius: 7px;
  background: #fff4f2;
  color: #a83b32;
  font-weight: 700;
}

.projects-overdue-filter span { display: inline-grid; min-width: 20px; height: 20px; margin-left: 4px; place-items: center; border-radius: 50%; background: #dc493d; color: #fff; font-size: 11px; }
.projects-overdue-filter.is-active { border-color: #dc493d; background: #dc493d; color: #fff; }

.projects-table-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.projects-table-shell .table-wrap { border: 0; border-radius: 0; box-shadow: none; }
.projects-crm-table { min-width: 1080px; }
.projects-crm-table th { height: 44px; background: #f7f9fb; color: #687583; font-size: 12px; font-weight: 700; white-space: nowrap; }
.projects-crm-table td { height: 72px; vertical-align: middle; }
.projects-crm-table tbody tr { transition: background-color .15s ease, box-shadow .15s ease; }
.projects-crm-table tbody tr:hover { background: #f9fcfb; box-shadow: inset 3px 0 var(--accent); }
.projects-crm-table td small { display: block; max-width: 320px; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.projects-id-cell { width: 78px; color: var(--muted); font-variant-numeric: tabular-nums; }
.projects-title-button { max-width: 330px; overflow: hidden; color: var(--ink) !important; font-weight: 700; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.projects-project-mark { display: inline-grid; width: 28px; height: 28px; margin-right: 9px; place-items: center; border: 2px solid #78bce8; border-radius: 50%; background: #eaf6fd; color: #2778ac; font-size: 12px; vertical-align: middle; }

.projects-date-pill {
  display: inline-flex;
  padding: 5px 9px;
  border: 1px solid #bed7ee;
  border-radius: 999px;
  background: #f5faff;
  color: #32698e;
  font-size: 12px;
  white-space: nowrap;
}

.projects-date-pill.is-overdue { border-color: #ffd0ca; background: #fff0ee; color: #c23f33; }
.projects-date-pill.is-done { border-color: #d9e0e5; background: #f2f4f5; color: #7b8791; }
.project-task-overdue { background: #fffdfc; }
.projects-progress { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 150px; }
.projects-progress > span { width: 86px; height: 7px; overflow: hidden; border-radius: 999px; background: #e8edf1; }
.projects-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #39a88b, #63c7ab); }
.projects-progress strong { min-width: 34px; color: var(--muted); font-size: 12px; }
.projects-progress small { flex: 0 0 100%; color: var(--muted); font-size: 9px; line-height: 1.2; }
.projects-progress.is-medium i { background: linear-gradient(90deg, #d79a2e, #efbd58); }
.projects-progress.is-low i { background: linear-gradient(90deg, #c64b43, #e27a70); }
.projects-progress.is-good strong { color: #287d70; }
.projects-progress.is-medium strong { color: #9a681b; }
.projects-progress.is-low strong { color: #aa3b35; }
.projects-table-summary { padding: 12px 15px; border-top: 1px solid var(--line); background: #fbfcfd; color: var(--muted); font-size: 12px; }
.project-task-project-select { display: block; margin: 0 0 14px; font-weight: 600; }
.project-task-project-select select { width: 100%; min-height: 44px; margin-top: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; background: #fff; }

.projects-kanban { padding: 3px 1px 8px; }
.projects-kanban .kanban-column { min-width: 0; overflow: hidden; border-width: 1px; border-top-width: 4px; box-shadow: 0 5px 14px rgba(23, 32, 42, .05); }
.projects-kanban .kanban-todo { border-top-color: #8795a5; background: #f4f6f8; }
.projects-kanban .kanban-progress { border-top-color: #3f8fd2; background: #eef7fd; }
.projects-kanban .kanban-review { border-top-color: #e5a326; background: #fff8e8; }
.projects-kanban .kanban-done { border-top-color: #39a575; background: #edf8f2; }
.projects-kanban .kanban-todo .kanban-head span { background: #dfe4e9; color: #526170; }
.projects-kanban .kanban-progress .kanban-head span { background: #cfe8f8; color: #246d9f; }
.projects-kanban .kanban-review .kanban-head span { background: #f8e4b9; color: #976612; }
.projects-kanban .kanban-done .kanban-head span { background: #cfeadb; color: #23704e; }
.projects-kanban .task-stack { min-width: 0; gap: 7px; padding: 7px; }
.projects-kanban .task-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border: 0;
  border-left: 3px solid transparent;
  padding: 9px 10px;
  box-shadow: 0 2px 8px rgba(23, 32, 42, .07);
}
.projects-kanban .task-card.is-subtask {
  position: relative;
  width: calc(100% - min(calc(var(--task-depth) * 11px), 28px));
  margin-left: min(calc(var(--task-depth) * 11px), 28px);
  border-left-width: 2px;
}
.projects-kanban .task-card.is-subtask::before {
  position: absolute;
  top: -8px;
  left: -9px;
  width: 7px;
  height: 19px;
  border-bottom: 1px solid #aebbc5;
  border-left: 1px solid #aebbc5;
  border-radius: 0 0 0 5px;
  content: "";
  pointer-events: none;
}
.projects-kanban .task-subtask-label {
  margin: -2px 0 4px;
  color: #718394;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.projects-kanban .task-card-head { min-width: 0; gap: 6px; align-items: center; }
.projects-kanban .task-card-head strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.projects-kanban .task-card-head .status { flex: 0 0 auto; padding: 2px 6px; font-size: 10px; }
.projects-kanban .task-card > p {
  display: -webkit-box;
  overflow: hidden;
  margin: 5px 0;
  color: #667584;
  font-size: 11px;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.projects-kanban .project-meta {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 3px 7px;
  margin: 5px 0 7px;
  font-size: 10.5px;
}
.projects-kanban .project-meta .task-meta-project {
  width: 100%;
  overflow: hidden;
  color: #526170;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.projects-kanban .project-meta .task-meta-assignee,
.projects-kanban .project-meta .task-meta-due {
  flex: 1 1 100%;
  min-width: 0;
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.projects-kanban .project-meta .task-meta-secondary { display: none; }
.projects-kanban .project-meta .task-meta-badge {
  border-radius: 999px;
  padding: 1px 5px;
  background: rgb(255 255 255 / 72%);
  color: #526170;
}
.projects-kanban .task-card .action-row {
  width: 100%;
  min-width: 0;
  gap: 4px;
}
.projects-kanban .task-card .small-button {
  flex: 0 1 auto;
  min-width: 0;
  min-height: 24px;
  padding: 0 6px;
  font-size: 10px;
}
.projects-kanban .kanban-todo .task-card { border-left-color: #8795a5; }
.projects-kanban .kanban-progress .task-card { border-left-color: #3f8fd2; }
.projects-kanban .kanban-review .task-card { border-left-color: #e5a326; }
.projects-kanban .kanban-done .task-card { border-left-color: #39a575; }
.projects-kanban .task-card[draggable="true"] { cursor: grab; }
.projects-kanban .task-card.is-dragging {
  cursor: grabbing;
  opacity: .45;
  transform: scale(.98);
}
.projects-kanban .kanban-column {
  transition: outline-color 150ms ease, background-color 150ms ease, transform 150ms ease;
}
.projects-kanban .kanban-column.is-drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
  transform: translateY(-2px);
}
.projects-kanban .kanban-column.is-drop-target .task-stack { min-height: 130px; }

.project-info-layer {
  padding: 18px;
  background: rgb(15 23 42 / 62%);
  backdrop-filter: blur(3px);
}

.project-info-dialog {
  position: relative;
  display: grid;
  grid-template-columns: minmax(480px, 620px) minmax(420px, 1fr);
  width: min(1500px, 100%);
  height: calc(100vh - 36px);
  max-height: calc(100vh - 36px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f5f7fa;
  box-shadow: 0 24px 70px rgb(15 23 42 / 30%);
}
.project-modal-close {
  position: absolute;
  z-index: 30;
  top: 10px;
  right: 10px;
  width: 36px;
  min-height: 36px;
  border: 1px solid #dce4ea;
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 3px 10px rgb(31 42 55 / 10%);
}
.project-editor-main {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #eef2f5;
}
.project-editor-head {
  display: grid;
  flex: 0 0 64px;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  padding: 10px 18px;
  background: rgb(255 255 255 / 94%);
}
.project-editor-head .project-info-mark { width: 40px; height: 40px; border-radius: 10px; font-size: 14px; }
.project-editor-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.project-editor-head .project-info-title-row h3 {
  overflow: hidden;
  max-width: 100%;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-editor-content {
  display: grid;
  min-height: 0;
  overflow-y: auto;
  gap: 12px;
  padding: 14px 16px 20px;
}
.project-editor-content .project-info-metrics { margin-bottom: 0; }
.project-editor-content .project-info-metrics > div { padding: 11px 12px; }
.project-editor-content .project-info-metrics span { margin-bottom: 4px; font-size: 11px; }
.project-editor-content .project-info-metrics strong { font-size: 16px; }
.project-editor-content .project-info-card { padding: 13px; }
.project-editor-content .project-info-card h4 { margin-bottom: 9px; }
.project-editor-content .project-info-description { min-height: 0; }
.project-compact-parameters { padding: 9px 12px !important; }
.project-compact-parameters dl {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
}
.project-compact-parameters dl > div:nth-child(1),
.project-compact-parameters dl > div:nth-child(2) { grid-column: span 3; }
.project-compact-parameters dl > div:nth-child(n + 3) { grid-column: span 2; }
.project-editor-content .project-compact-parameters dl div {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 2px;
}
.project-compact-parameters dt { color: var(--muted); font-size: 10px; }
.project-compact-parameters dd {
  overflow: hidden;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-tasks-open-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 1px solid #cfdae3;
  border-radius: 10px;
  padding: 11px 13px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 3px 10px rgb(23 32 42 / 4%);
}
.project-tasks-open-button:hover { border-color: #9fc6e5; background: #f8fcff; }
.project-tasks-open-button span,
.project-tasks-open-button b,
.project-tasks-open-button small { display: block; }
.project-tasks-open-button small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.project-tasks-open-button > strong {
  display: grid;
  min-width: 26px;
  min-height: 26px;
  place-items: center;
  border-radius: 999px;
  background: #e8f3fb;
  color: #2774aa;
  font-size: 12px;
}
.project-tasks-open-button > i { color: #8493a0; font-size: 22px; font-style: normal; }
.project-tasks-layer {
  z-index: 110;
  padding: 28px;
  background: rgb(15 23 42 / 52%);
  backdrop-filter: blur(2px);
}
.project-tasks-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1000px, calc(100vw - 56px));
  max-height: min(720px, calc(100vh - 56px));
  overflow: hidden;
  border-radius: 12px;
  background: #f5f7fa;
  box-shadow: 0 24px 70px rgb(15 23 42 / 32%);
}
.project-tasks-dialog > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 13px 16px;
  background: #fff;
}
.project-tasks-dialog h3,
.project-tasks-dialog p { margin: 0; }
.project-tasks-dialog p { margin-top: 3px; color: var(--muted); font-size: 11px; }
.project-tasks-list { min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 12px; }
.project-tasks-list .table-wrap { width: 100%; min-width: 0; overflow-x: hidden; }
.project-tasks-list .project-tasks-modal-table { width: 100%; min-width: 0; table-layout: fixed; }
.project-tasks-modal-table th:nth-child(1) { width: 36%; }
.project-tasks-modal-table th:nth-child(2) { width: 11%; }
.project-tasks-modal-table th:nth-child(3) { width: 35%; }
.project-tasks-modal-table th:nth-child(4) { width: 10%; }
.project-tasks-modal-table th:nth-child(5) { width: 8%; }
.project-tasks-modal-table th,
.project-tasks-modal-table td { min-width: 0; overflow-wrap: anywhere; }
.project-tasks-modal-table .projects-title-button { max-width: 100%; white-space: normal; }
.project-tasks-modal-table td:nth-child(3) strong { display: block; min-width: 0; overflow-wrap: anywhere; }
.project-tasks-modal-table td small { max-width: 100%; white-space: normal; }
.project-tasks-modal-table td:last-child { padding-right: 8px; padding-left: 6px; }
.project-tasks-modal-table td:last-child .small-button { max-width: 100%; padding-right: 8px; padding-left: 8px; }
.project-tasks-list td small { display: block; margin-top: 3px; color: var(--muted); }
@media (max-width: 760px) {
  .project-tasks-layer { padding: 8px; }
  .project-tasks-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .project-tasks-list { padding: 8px; }
  .project-tasks-modal-table,
  .project-tasks-modal-table tbody,
  .project-tasks-modal-table tr,
  .project-tasks-modal-table td { display: block; width: 100%; }
  .project-tasks-modal-table thead { display: none; }
  .project-tasks-modal-table tbody { padding: 0; }
  .project-tasks-modal-table tr { padding: 12px; border-bottom: 1px solid var(--line); }
  .project-tasks-modal-table tr:last-child { border-bottom: 0; }
  .project-tasks-modal-table td { height: auto; padding: 4px 0; border: 0; }
  .project-tasks-modal-table td:first-child { padding-bottom: 8px; }
  .project-tasks-modal-table td:last-child { padding-top: 8px; }
  .project-tasks-modal-table td:last-child .small-button { width: 100%; }
}
.project-editor-tasks {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.project-editor-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
}
.project-editor-section-head h4 { margin: 0; }
.project-editor-section-head span { color: var(--muted); font-size: 12px; }
.project-editor-tasks .projects-crm-table { min-width: 650px; }
.project-editor-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  background: rgb(255 255 255 / 96%);
}
.project-editor-discussion { max-height: 100%; }
.project-editor-discussion > header { padding-right: 58px; }

.project-info-head {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #fff 0%, #edf6ff 100%);
}

.project-info-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgb(31 111 235 / 20%);
}

.project-info-title-row,
.project-info-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.project-info-title-row h3 { margin: 0; font-size: 22px; }
.project-info-head p { margin: 5px 0 0; color: var(--muted); }
.project-info-actions { justify-content: flex-end; }

.project-info-tabs {
  position: sticky;
  top: 93px;
  z-index: 3;
  display: flex;
  gap: 4px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.project-info-tabs button {
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 15px 18px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.project-info-tabs button.is-active {
  border-bottom-color: var(--accent);
  color: var(--accent-dark);
}

.project-info-body { padding: 22px 24px 28px; }
.project-info-panel { display: none; }
.project-info-panel.is-active { display: block; }

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

.project-info-metrics > div,
.project-info-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 14px rgb(23 32 42 / 5%);
}

.project-info-metrics > div { padding: 16px 18px; }
.project-info-metrics span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 13px; }
.project-info-metrics strong { font-size: 20px; }

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

.project-info-card { padding: 18px; }
.project-info-card h4 { margin: 0 0 14px; }
.project-info-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.project-info-description { grid-column: 1 / -1; min-height: 130px; }
.project-info-card dl { display: grid; gap: 12px; margin: 0; }
.project-info-card dl div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; }
.project-info-card dt { color: var(--muted); }
.project-info-card dd { margin: 0; font-weight: 650; }

.project-people { display: flex; flex-wrap: wrap; gap: 8px; }
.project-people > span {
  padding: 7px 10px;
  border: 1px solid #cfe1f3;
  border-radius: 999px;
  background: #eef7ff;
  color: #245c8a;
  font-size: 13px;
}

.project-info-tasks small { display: block; margin-top: 4px; color: var(--muted); }
.project-history { display: grid; max-width: 850px; gap: 0; }
.project-history-item { position: relative; display: grid; grid-template-columns: 24px 1fr; gap: 12px; min-height: 82px; }
.project-history-item::before { content: ""; position: absolute; top: 18px; bottom: -4px; left: 7px; width: 2px; background: #d9e5ef; }
.project-history-item:last-child::before { display: none; }
.project-history-dot { position: relative; z-index: 1; width: 16px; height: 16px; margin-top: 2px; border: 4px solid #dcecff; border-radius: 50%; background: var(--accent); }
.project-history-item p { margin: 5px 0; color: var(--muted); }
.project-history-item small { color: var(--muted); }

.project-observers-field {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.project-observers-field legend { padding: 0 6px; font-weight: 700; }
.project-observers-field > p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.contract-form .project-observers-search {
  position: relative;
  display: block;
  margin-bottom: 10px;
}
.project-observers-search > span {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 12px;
  display: grid;
  width: 18px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}
.contract-form .project-observers-search input { padding-left: 40px; }
.project-observers-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 230px;
  overflow: auto;
  gap: 6px;
}

.contract-form .project-observers-list label {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  background: #fff;
  cursor: pointer;
}

.contract-form .project-observers-list input {
  grid-row: 1 / 3;
  width: 17px;
  min-height: 17px;
  margin: 0;
}

.project-observers-list span { overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.project-observers-list small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.project-observers-empty { padding: 12px; text-align: center; }

#taskModal { padding: 16px; }
#taskForm {
  position: relative;
  display: grid;
  grid-template-columns: minmax(470px, 620px) minmax(420px, 1fr);
  width: min(1500px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  height: calc(100vh - 32px);
  overflow: hidden;
  padding: 0;
  border-radius: 14px;
  background: #eef2f5;
}
.task-modal-close {
  position: absolute;
  z-index: 30;
  top: 10px;
  right: 10px;
  width: 36px;
  min-height: 36px;
  border: 1px solid #dce4ea;
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 3px 10px rgb(31 42 55 / 10%);
}
.task-modal-close:hover { border-color: #c8d5de; background: #fff; }
.task-editor-discussion > header { padding-right: 58px; }
.task-editor-main {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #eef2f5;
}
.task-editor-main > .form-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex: 0 0 64px;
  align-items: center;
  height: 64px;
  min-height: 64px;
  margin: 0;
  padding: 9px 20px;
  border-bottom: 1px solid var(--line);
  background: rgb(238 242 245 / 96%);
  backdrop-filter: blur(6px);
}
.task-editor-main > .project-task-project-select { margin: 14px 18px 0; }
.task-editor-main > .form-grid {
  position: relative;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 14px 18px 20px;
}
.task-editor-main > .form-grid > .wide { grid-column: 1 / -1; }
.task-editor-main > .form-grid > label {
  gap: 5px;
  color: #71808f;
  font-size: 12px;
}
#taskForm .task-editor-main input:not([type="checkbox"]):not([type="file"]),
#taskForm .task-editor-main select,
#taskForm .task-editor-main textarea {
  min-height: 36px;
  border-color: #d7dee5;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 14px;
}
#taskForm .task-editor-main textarea { min-height: 70px; }
.task-editor-main > .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-top: auto;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(6px);
}
.task-editor-discussion {
  display: flex;
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(145deg, #f6fbfa, #edf6ff);
}
.task-editor-discussion > header {
  display: flex;
  flex: 0 0 64px;
  height: 64px;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgb(214 225 233 / 80%);
  padding: 12px 20px;
  background: rgb(255 255 255 / 90%);
}
.task-editor-discussion > header strong,
.task-editor-discussion > header span { display: block; }
.task-editor-discussion > header span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.task-editor-discussion > .project-chat-messages {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 20px;
}
.task-editor-discussion > .project-chat-compose {
  position: static;
  margin: auto 16px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgb(31 42 55 / 8%);
}
.task-editor-discussion > .project-chat-compose textarea { border: 0; box-shadow: none; }

/* Task editor uses its own split layout, so its light surfaces need explicit dark-theme colors. */
html[data-theme="dark"] #taskForm,
html[data-theme="dark"] .task-editor-main {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

html[data-theme="dark"] .task-editor-main > .form-head,
html[data-theme="dark"] .task-editor-main > .form-actions {
  border-color: var(--line);
  background: rgb(34 45 56 / 96%);
  color: var(--ink);
}

html[data-theme="dark"] .task-editor-main > .form-grid > label,
html[data-theme="dark"] .task-editor-main > .project-task-project-select {
  color: var(--muted);
}

html[data-theme="dark"] #taskForm .task-editor-main input:not([type="checkbox"]):not([type="file"]),
html[data-theme="dark"] #taskForm .task-editor-main select,
html[data-theme="dark"] #taskForm .task-editor-main textarea {
  border-color: var(--line);
  background: var(--soft);
  color: var(--ink);
}

html[data-theme="dark"] .task-editor-discussion {
  background: linear-gradient(145deg, #18232c, #172330);
  color: var(--ink);
}

html[data-theme="dark"] .task-editor-discussion > header,
html[data-theme="dark"] .task-discussion-files {
  border-color: var(--line);
  background: rgb(27 36 46 / 94%);
  color: var(--ink);
}

html[data-theme="dark"] .task-chat-placeholder strong { color: var(--ink); }
html[data-theme="dark"] .task-chat-placeholder p { color: var(--muted); }

html[data-theme="dark"] .task-editor-discussion > .project-chat-compose {
  border-color: var(--line);
  background: var(--soft);
  box-shadow: 0 8px 24px rgb(0 0 0 / 24%);
}

html[data-theme="dark"] .task-modal-close,
html[data-theme="dark"] .task-modal-close:hover {
  border-color: var(--line);
  background: var(--soft);
  color: var(--ink);
}

/* Dark theme: project and task read-only dialogs must use the same surface
   hierarchy as the rest of the application. */
html[data-theme="dark"] .project-info-dialog,
html[data-theme="dark"] #taskForm {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 70px rgb(0 0 0 / 42%);
}

html[data-theme="dark"] .project-editor-main,
html[data-theme="dark"] .task-view-main {
  border-color: var(--line);
  background: var(--panel);
}

html[data-theme="dark"] .project-editor-head,
html[data-theme="dark"] .project-editor-actions,
html[data-theme="dark"] .task-view-main > .form-head,
html[data-theme="dark"] .task-view-main > .form-actions {
  border-color: var(--line);
  background: rgb(34 45 56 / 96%);
  color: var(--ink);
}

html[data-theme="dark"] .project-editor-content,
html[data-theme="dark"] .task-view-content {
  background: var(--panel);
}

html[data-theme="dark"] .project-info-metrics > div,
html[data-theme="dark"] .project-info-card,
html[data-theme="dark"] .project-editor-tasks,
html[data-theme="dark"] .task-view-content > section,
html[data-theme="dark"] .task-view-details {
  border-color: var(--line);
  background: var(--soft);
  color: var(--ink);
  box-shadow: 0 4px 14px rgb(0 0 0 / 12%);
}

html[data-theme="dark"] .project-info-card p,
html[data-theme="dark"] .task-view-content p { color: #bdc9d4; }
html[data-theme="dark"] .project-info-card dt,
html[data-theme="dark"] .project-info-metrics span,
html[data-theme="dark"] .task-view-details dt { color: var(--muted); }
html[data-theme="dark"] .project-info-card dd,
html[data-theme="dark"] .project-info-metrics strong,
html[data-theme="dark"] .task-view-details dd { color: var(--ink); }

html[data-theme="dark"] .project-people > span {
  border-color: #3c6384;
  background: #20384d;
  color: #acd4f5;
}

html[data-theme="dark"] .project-tasks-open-button {
  border-color: var(--line);
  background: var(--soft);
  color: var(--ink);
  box-shadow: 0 3px 10px rgb(0 0 0 / 12%);
}
html[data-theme="dark"] .project-tasks-open-button:hover {
  border-color: #4c80ad;
  background: #293a4a;
}
html[data-theme="dark"] .project-tasks-open-button > strong {
  background: #203d58;
  color: #a8d5fa;
}
html[data-theme="dark"] .project-tasks-open-button > i { color: #9aabba; }

html[data-theme="dark"] .task-view-checklist > div > span {
  border-color: #506170;
}

html[data-theme="dark"] .task-editor-discussion {
  border-color: var(--line);
  background: linear-gradient(145deg, #18232c, #172330);
  color: var(--ink);
}
html[data-theme="dark"] .task-editor-discussion > header {
  border-color: var(--line);
  background: rgb(27 36 46 / 94%);
  color: var(--ink);
}
html[data-theme="dark"] .project-chat-message > span {
  background: #29445a;
  color: #acd5f4;
}
html[data-theme="dark"] .project-chat-message > div {
  border-color: #3a4b5a;
  background: #25323e;
  color: #d8e1e9;
  box-shadow: 0 3px 10px rgb(0 0 0 / 12%);
}
html[data-theme="dark"] .project-chat-message > div > strong { color: #d7e3ec; }
html[data-theme="dark"] .project-chat-message p { color: #c0ccd6; }
html[data-theme="dark"] .project-chat-message.is-own > span {
  background: #204f47;
  color: #a1e1cf;
}
html[data-theme="dark"] .project-chat-message.is-own > div {
  border-color: #356c61;
  background: #1e3d3a;
}
html[data-theme="dark"] .project-chat-message.is-activity > span {
  background: #304252;
  color: #b0c5d5;
}
html[data-theme="dark"] .project-chat-message.is-activity > div {
  border-color: #465665;
  background: #2b3742;
}
html[data-theme="dark"] .project-chat-message.is-activity strong,
html[data-theme="dark"] .project-chat-message.is-activity p { color: #b8c7d3; }
html[data-theme="dark"] .project-chat-message-actions button:hover {
  background: #304556;
  color: #9bd0fa;
}
html[data-theme="dark"] .project-chat-message-delete:hover {
  background: #512d33;
  color: #ffc0c7;
}
html[data-theme="dark"] .project-chat-day > span {
  border-color: #465867;
  background: rgb(49 64 76 / 94%);
  color: #bdcad4;
  box-shadow: 0 2px 5px rgb(0 0 0 / 18%);
}
html[data-theme="dark"] .task-discussion-files,
html[data-theme="dark"] .project-chat-compose {
  border-color: var(--line);
  background: rgb(34 45 56 / 96%);
}
html[data-theme="dark"] .task-discussion-files > div {
  border-color: #465867;
  background: #263542;
  color: #d0dbe4;
}
html[data-theme="dark"] .project-chat-attach-button {
  border-color: var(--line);
  background: #263542;
  color: #b8c9d7;
}
html[data-theme="dark"] .project-chat-attach-button:hover {
  border-color: #4d8bc0;
  background: #29455c;
  color: #b9e0ff;
}
.task-view-content {
  display: grid;
  gap: 12px;
  padding: 16px 18px 24px;
}
.task-view-status-row { display: flex; flex-wrap: wrap; gap: 8px; }
.task-view-content > section,
.task-view-details {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 14px;
  background: #fff;
}
.task-view-content h4 { margin: 0 0 9px; }
.task-view-content h4 small { color: var(--muted); font-weight: 600; }
.task-view-content p { margin: 0; color: #526170; line-height: 1.5; white-space: pre-wrap; }
.task-view-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.task-view-details div { min-width: 0; }
.task-view-details dt { margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.task-view-details dd { margin: 0; font-weight: 650; }
.task-view-checklist { display: grid; gap: 6px; }
.task-view-checklist > div { display: grid; grid-template-columns: 20px 1fr; gap: 7px; align-items: center; }
.task-view-checklist > div > span { display: grid; width: 18px; height: 18px; place-items: center; border: 1px solid #cbd6df; border-radius: 4px; color: #fff; font-size: 11px; }
.task-view-checklist > div.is-done { color: var(--muted); text-decoration: line-through; }
.task-view-checklist > div.is-done > span { border-color: #39a575; background: #39a575; }
.task-view-actions .primary-button { min-width: 120px; }
.task-worker-tools { display: grid; gap: 10px; }
.task-worker-tools > .task-extra-field { width: 100%; }
.task-worker-checklist {
  border: 0;
  border-radius: 9px;
  padding: 0;
  background: #fff;
}
.task-worker-checklist legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.task-checklist-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 28px;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid #e7edf2;
  padding: 7px 10px 6px 12px;
}
.task-checklist-title-view { color: var(--ink) !important; font-size: 13px !important; font-weight: 750; }
.task-checklist-title-edit { display: none; }
.task-checklist-group.is-editing .task-checklist-title-view { display: none; }
.task-checklist-group.is-editing .task-checklist-title-edit { display: block; }
.task-checklist-head input {
  min-height: 26px !important;
  border-color: transparent !important;
  padding: 2px 4px !important;
  background: transparent;
  font-size: 14px !important;
  font-weight: 700;
}
.task-checklist-head input:focus { border-color: #a8cce8 !important; background: #fff; }
.task-checklist-head [data-checklist-progress] { color: var(--muted); font-size: 10px; white-space: nowrap; }
.task-checklist-head [data-checklist-progress]::after {
  display: inline-block;
  width: 38px;
  height: 4px;
  margin-left: 8px;
  border-radius: 3px;
  background: #e6ebef;
  content: "";
  vertical-align: middle;
}
.task-checklist-menu-wrap { position: relative; }
#taskForm .task-checklist-menu-button {
  width: 28px;
  min-height: 26px;
  border: 0;
  padding: 0;
  font-size: 14px;
  letter-spacing: 1px;
}
.task-checklist-menu {
  position: absolute;
  z-index: 20;
  top: 30px;
  right: 0;
  display: grid;
  min-width: 155px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgb(31 42 55 / 18%);
}
.task-checklist-menu.is-hidden { display: none; }
.task-checklist-menu button {
  border: 0;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.task-checklist-menu button:hover { background: #f2f7fa; }
.task-checklist-menu button.is-danger { color: var(--danger); }
.task-worker-checklist .task-checklist { gap: 0; padding: 0 12px; }
.task-worker-checklist .task-checklist-row {
  grid-template-columns: 17px minmax(0, 1fr);
  gap: 7px;
  min-height: 31px;
  border-bottom: 1px solid #edf1f4;
}
#taskForm .task-worker-checklist .task-checklist-row [data-checklist-done] {
  width: 15px;
  min-height: 15px;
}
#taskForm .task-worker-checklist .task-checklist-row [data-checklist-text] {
  display: none;
  min-height: 29px;
  border-color: transparent;
  padding: 3px 6px;
  background: transparent;
  font-size: 12px;
}
.task-checklist-row [data-checklist-text-view] {
  align-self: center;
  min-width: 0;
  overflow-wrap: anywhere;
  color: #43515e;
  font-size: 12px;
}
.task-checklist-remove { display: none !important; }
.task-checklist-group.is-editing .task-checklist-row {
  grid-template-columns: 17px minmax(0, 1fr) 26px;
}
.task-checklist-group.is-editing .task-checklist-row [data-checklist-text-view] { display: none; }
#taskForm .task-checklist-group.is-editing .task-checklist-row [data-checklist-text] { display: block; }
.task-checklist-group.is-editing .task-checklist-remove { display: grid !important; }
#taskForm .task-worker-checklist .task-checklist-row [data-checklist-text]:focus {
  border-color: #a8cce8;
  background: #fff;
}
#taskForm .task-worker-checklist .task-checklist-row .icon-button {
  width: 28px;
  min-height: 28px;
  padding: 5px;
}
.task-worker-checklist .task-checklist-row:has([data-checklist-done]:checked) [data-checklist-text],
.task-worker-checklist .task-checklist-row:has([data-checklist-done]:checked) [data-checklist-text-view] {
  color: var(--muted);
  text-decoration: line-through;
}
.task-worker-checklist .task-checklist-add {
  display: none;
  grid-template-columns: 18px 1fr auto;
  gap: 8px;
  align-items: center;
  margin: 0;
  padding: 5px 12px 7px;
}
.task-checklist-group.is-editing .task-checklist-add { display: grid; }
#taskForm .task-worker-checklist .task-checklist-add > span { color: #7d8b98; font-size: 19px; }
#taskForm .task-worker-checklist .task-checklist-add input { min-height: 31px; font-size: 12px; }
#taskForm .task-worker-checklist .task-checklist-add button { min-height: 31px; padding: 0 9px; font-size: 11px; }
.task-checklist-group + .task-checklist-group { border-top: 5px solid #eef2f5; }
.task-new-checklist {
  width: 100%;
  border: 0;
  border-top: 1px solid #e7edf2;
  padding: 10px 14px;
  color: #748391;
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.task-new-checklist:hover { color: #1685d4; background: #f8fbfd; }
.task-file-preview-layer {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(18 29 39 / 78%);
  backdrop-filter: blur(3px);
}
.task-file-preview-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, calc(100vw - 40px));
  height: min(820px, calc(100vh - 40px));
  overflow: hidden;
  border-radius: 12px;
  background: #f3f6f8;
  box-shadow: 0 24px 70px rgb(0 0 0 / 32%);
}
.task-file-preview-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 11px 14px;
  background: #fff;
}
.task-file-preview-card > header strong,
.task-file-preview-card > header span { display: block; }
.task-file-preview-card > header strong {
  overflow: hidden;
  max-width: min(700px, 60vw);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-file-preview-card > header span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.task-file-preview-content {
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: auto;
  padding: 14px;
}
.task-file-preview-content iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 7px;
  background: #fff;
}
.task-file-preview-content img,
.task-file-preview-content video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.task-file-preview-content audio { width: min(620px, 100%); }
.project-chat-message.is-activity {
  align-self: center;
  width: min(560px, 94%);
  margin: 3px auto;
  opacity: .9;
}
.project-chat-message.is-activity > span {
  background: #dce8f1;
  color: #587184;
}
.project-chat-message.is-activity > div {
  border: 1px solid #dfe8ee;
  background: rgb(255 255 255 / 76%);
  box-shadow: none;
}
.project-chat-message.is-activity strong { color: #587184; font-size: 11px; }
.project-chat-message.is-activity p { color: #536574; font-size: 12px; }
.task-chat-placeholder {
  display: grid;
  max-width: 430px;
  margin: auto;
  place-items: center;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}
.task-chat-placeholder strong { color: var(--ink); font-size: 18px; }
.task-discussion-files {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  border-bottom: 1px solid rgb(214 225 233 / 80%);
  padding: 9px 16px;
  background: rgb(255 255 255 / 70%);
}
.task-discussion-files > div { align-items: center; }
.task-file-delete {
  display: grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  border: 1px solid transparent;
  background: #f3f6f8;
  color: #84929e;
  cursor: pointer;
}
.task-file-delete svg { width: 13px; height: 13px; stroke-width: 2; }
.task-file-delete:hover {
  border-color: #f1cccc;
  background: #fff1f1;
  color: var(--danger);
  transform: scale(1.04);
}
.task-discussion-files > strong { width: 100%; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.task-discussion-files > div {
  display: flex;
  gap: 7px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: #fff;
  font-size: 12px;
}
.task-discussion-files label { color: var(--danger); cursor: pointer; }
.task-discussion-files input { width: 14px; min-height: 14px; margin: 0; }
[data-task-pending-files] { padding: 10px 18px 0; }
.task-pending-file { margin-bottom: 8px; }
.task-extra-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0;
}
.task-extra-actions button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 32px;
  border: 1px solid #d7e0e8;
  border-radius: 7px;
  padding: 6px 9px;
  background: #fff;
  color: #607080;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, transform 150ms ease;
}
.task-extra-actions button:hover,
.task-extra-actions button.is-active {
  border-color: #8dc7f3;
  background: #eef8ff;
  color: #1875b8;
  transform: translateY(-1px);
}
.task-extra-actions button > span { color: #718294; font-size: 17px; }
.task-extra-actions button.is-active > span { color: #1685d4; }
.task-extra-actions button > b {
  display: grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  padding: 0 5px;
  background: #1685d4;
  color: #fff;
  font-size: 11px;
}

html[data-theme="dark"] .task-extra-actions button {
  border-color: #3b5063;
  background: #243342;
  color: #c1cfdb;
  box-shadow: inset 0 1px rgb(255 255 255 / 3%);
}

html[data-theme="dark"] .task-extra-actions button > span {
  color: #8eacc5;
}

html[data-theme="dark"] .task-extra-actions button:hover,
html[data-theme="dark"] .task-extra-actions button.is-active {
  border-color: #4f80aa;
  background: #29445c;
  color: #eef7ff;
}

html[data-theme="dark"] .task-extra-actions button:hover > span,
html[data-theme="dark"] .task-extra-actions button.is-active > span {
  color: #75bfff;
}
.task-selected-coexecutors {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 12px;
}
.task-selected-coexecutors > div { display: flex; flex-wrap: wrap; gap: 5px; }
.task-selected-coexecutors b {
  border-radius: 999px;
  padding: 4px 8px;
  background: #dfefff;
  color: #246698;
  font-size: 11px;
  font-weight: 650;
}
.task-extra-field {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 14px;
  background: #f8fafc;
  animation: portal-surface-enter 150ms ease-out both;
}
.task-extra-field.task-coexecutors-popup {
  position: fixed;
  z-index: 100;
  width: min(410px, calc(100vw - 24px));
  max-height: min(460px, calc(100vh - 24px));
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 55px rgb(15 23 42 / 28%);
}
.task-coexecutors-popup .task-coexecutors-list { max-height: 330px; }
.task-coexecutors-popup legend {
  width: calc(100% + 28px);
  margin: -14px -14px 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}
.task-extra-field legend { padding: 0 6px; font-weight: 750; }
.contract-form .task-people-search {
  position: relative;
  display: block;
  margin-bottom: 10px;
}
.task-people-search > span {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 12px;
  display: grid;
  width: 18px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}
.contract-form .task-people-search input { padding-left: 40px; }
.task-coexecutors-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 210px;
  overflow: auto;
  gap: 6px;
}
.contract-form .task-coexecutors-list label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #fff;
  cursor: pointer;
}
.contract-form .task-coexecutors-list input {
  grid-row: 1 / 3;
  width: 17px;
  min-height: 17px;
  margin: 0;
}
.task-coexecutors-list span,
.task-coexecutors-list small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-coexecutors-list small { color: var(--muted); }
.task-checklist { display: grid; gap: 7px; }
.task-checklist-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}
.contract-form .task-checklist-row [data-checklist-done] { width: 18px; min-height: 18px; margin: 0; }
.contract-form .task-checklist-row .icon-button { width: 38px; min-height: 38px; }
.task-checklist-add { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 10px; }
.task-attachment-list { display: grid; gap: 7px; margin-bottom: 12px; }
.task-attachment-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  background: #fff;
}
.contract-form .task-attachment-list label { display: flex; gap: 5px; align-items: center; color: var(--danger); }
.contract-form .task-attachment-list input { width: 16px; min-height: 16px; margin: 0; }
.task-file-picker small { display: block; margin-top: 5px; color: var(--muted); }
.project-task-files { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }

.project-chat {
  max-width: 900px;
  margin: 0 auto;
}
.project-chat-messages {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  max-height: 440px;
  overflow: auto;
  gap: 3px;
  padding: 4px 4px 16px;
}
.project-chat-message {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 7px;
  row-gap: 0;
  align-items: start;
}
.project-chat-message > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: #dcecff;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
}
.project-chat-message > div {
  position: relative;
  width: fit-content;
  max-width: min(720px, 100%);
  border: 1px solid var(--line);
  border-radius: 4px 12px 12px;
  padding: 6px 9px;
  background: #fff;
}
.project-chat-message-actions {
  position: absolute;
  top: 2px;
  right: 3px;
  display: flex;
  gap: 1px;
  opacity: 0;
  transition: opacity 120ms ease;
}
.project-chat-message-actions button {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  color: #9aa6af;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: color 120ms ease, background-color 120ms ease;
}
.project-chat-message:hover .project-chat-message-actions,
.project-chat-message:focus-within .project-chat-message-actions { opacity: 1; }
.project-chat-message-actions button:hover { background: #eef6fb; color: #287caf; }
.project-chat-message-delete:hover { background: #fff0f0; color: var(--danger); }
.project-chat-message:has(.project-chat-message-actions) > div { padding-right: 46px; }
.project-chat-message > div > strong { font-size: 11px; }
.project-chat-message.is-own { grid-template-columns: minmax(0, 1fr) 30px; }
.project-chat-message.is-own > span {
  grid-column: 2;
  grid-row: 1;
  background: #d7f3e3;
  color: #23704e;
}
.project-chat-message.is-own > div {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  border-radius: 12px 4px 12px 12px;
  border-color: #c4e6d3;
  background: #eaf8f0;
}
.project-chat-message p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.35; white-space: pre-wrap; }
.project-chat-message-time {
  grid-column: 2;
  grid-row: 2;
  justify-self: start;
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
}
.project-chat-message.is-own > .project-chat-message-time {
  grid-column: 1;
  justify-self: end;
}
.project-chat-day {
  position: sticky;
  z-index: 3;
  top: 2px;
  display: flex;
  align-self: start;
  justify-content: center;
  height: max-content;
  min-height: 0;
  margin: 5px 0 3px;
  pointer-events: none;
}
.project-chat-day > span {
  border: 1px solid rgb(205 218 227 / 80%);
  border-radius: 999px;
  padding: 2px 8px;
  background: rgb(244 248 250 / 92%);
  color: #73818d;
  box-shadow: 0 2px 5px rgb(31 42 55 / 5%);
  font-size: 9px;
  line-height: 1.25;
  backdrop-filter: blur(4px);
}
.project-chat-empty { padding: 30px 10px; text-align: center; }
.project-chat-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  position: sticky;
  bottom: 0;
  border-top: 1px solid var(--line);
  padding: 12px 0 2px;
  background: #f5f7fa;
}
.project-chat-compose textarea { width: 100%; min-height: 56px; resize: vertical; }
.project-chat-compose-files { grid-template-columns: minmax(0, 1fr) 36px auto; }
.project-chat-attach-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #607487;
  cursor: pointer;
}
.project-chat-attach-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.project-chat-attach-button:hover { border-color: #2196f3; color: #1685df; background: #f2f9ff; }
.project-chat-file { margin-top: 5px; }
.project-chat-file button {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.project-chat-file.is-image > button:first-child {
  display: block;
  overflow: hidden;
  max-width: 280px;
  border-radius: 9px;
  background: #e8eef4;
}
.project-chat-file img {
  display: block;
  width: auto;
  max-width: 280px;
  max-height: 190px;
  object-fit: cover;
}
.project-chat-file-name {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  max-width: 320px;
  padding: 7px 9px !important;
  border: 1px solid rgb(255 255 255 / 45%) !important;
  border-radius: 8px !important;
  background: rgb(255 255 255 / 22%) !important;
  text-align: left;
}
.project-chat-file-name span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-chat-file-size { opacity: .7; font-size: 10px; }
.project-chat-readonly {
  border-top: 1px solid var(--line);
  padding: 14px;
  color: var(--muted);
  text-align: center;
}
.task-chat-field .project-chat-messages { max-height: 280px; }
.task-chat-field .project-chat-compose { background: #f8fafc; }

@media (max-width: 1050px) {
  #taskForm {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .task-editor-main {
    min-height: auto;
    overflow: visible;
    border-right: 0;
  }
  .task-editor-discussion { min-height: 0; }
  .project-info-dialog {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .project-editor-main {
    min-height: auto;
    overflow: visible;
    border-right: 0;
  }
  .project-editor-content { overflow: visible; }
  .project-editor-discussion { min-height: 520px; }
}

@media (max-width: 760px) {
  .project-info-layer { padding: 8px; }
  .project-info-dialog { max-height: calc(100vh - 16px); border-radius: 10px; }
  .project-info-head { grid-template-columns: auto 1fr; padding: 14px; }
  .project-info-actions { grid-column: 1 / -1; justify-content: stretch; }
  .project-info-actions > button:not(.icon-button) { flex: 1; }
  .project-info-tabs { top: 151px; overflow-x: auto; padding: 0 10px; }
  .project-info-body { padding: 14px; }
  .project-info-metrics,
  .project-info-grid,
  .project-observers-list,
  .task-coexecutors-list { grid-template-columns: 1fr; }
  .project-info-description { grid-column: auto; }
  .task-checklist-add,
  .project-chat-compose { grid-template-columns: 1fr; }
  .task-attachment-list > div { grid-template-columns: 1fr auto; }
  #taskModal { padding: 6px; }
  #taskForm { width: calc(100vw - 12px); max-height: calc(100vh - 12px); border-radius: 9px; }
  .task-editor-main > .form-grid { grid-template-columns: 1fr; padding: 10px; }
  .task-editor-main > .form-grid > .wide { grid-column: auto; }
  .task-extra-actions { gap: 5px; }
  .task-extra-actions button { flex: 1 1 auto; justify-content: center; }
}

@media (max-width: 900px) {
  .projects-crm-head,
  .tender-head { align-items: stretch; flex-direction: column; }
  .projects-head-actions { align-items: stretch; }
  .projects-search { width: 100%; }
  .projects-filterbar { align-items: stretch; flex-direction: column; }
  .projects-filterbar select { width: 100%; }
  .projects-tabs { overflow-x: auto; }
  .projects-tabs button { white-space: nowrap; }
}

.purchase-list {
  display: grid;
  gap: 14px;
}

.document-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.tool-workspace,
.tool-list {
  display: grid;
  gap: 14px;
}

.tool-list {
  margin-top: 16px;
}

.purchase-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

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

.document-card {
  background: var(--soft);
}

.tool-card {
  background: #fff;
}

.movement-log {
  display: grid;
  gap: 8px;
  padding: 12px;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.movement-log > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.fleet-history {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.fleet-history section {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.fleet-history h4 {
  margin: 0;
  color: #253140;
}

.fleet-history div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 6px;
  background: #fff;
}

.fleet-history span,
.fleet-history small {
  color: var(--muted);
  line-height: 1.4;
}

.tool-issue-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.tool-issue-row {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) 90px;
  align-items: center;
  gap: 10px !important;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

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

.tool-issue-row span,
.tool-issue-row small {
  display: block;
  min-width: 0;
}

.tool-issue-row small {
  color: var(--muted);
  font-weight: 500;
  margin-top: 3px;
}

.purchase-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 8px 14px;
  color: var(--muted);
  font-size: 13px;
  margin: 12px 0;
}

.approval-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

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

.approval-step strong,
.approval-step span,
.approval-step small {
  display: block;
}

.approval-step span {
  margin-top: 5px;
  color: var(--muted);
  font-weight: 700;
}

.approval-step p {
  margin: 8px 0 0;
  color: var(--muted);
}

.approval-step small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}

.approval-step.approved {
  border-color: #9bc9bd;
  background: #e8f3ef;
}

.approval-step.rejected {
  border-color: #efb2b2;
  background: #ffe8e8;
}

.purchase-approval-card {
  padding: 12px;
}

.purchase-approval-card .project-card-head {
  align-items: center;
}

.purchase-approval-card .project-card-head strong {
  font-size: 15px;
  line-height: 1.25;
}

.purchase-approval-card .project-card-head span {
  margin-top: 2px;
  font-size: 12px;
}

.purchase-approval-card .purchase-meta {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px 12px;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.3;
}

.purchase-approval-card .approval-flow {
  gap: 6px;
  margin: 8px 0;
}

.purchase-approval-card .approval-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  gap: 2px 8px;
  padding: 8px 9px;
  border-radius: 6px;
}

.purchase-approval-card .approval-step strong {
  min-width: 0;
  font-size: 12px;
  line-height: 1.25;
}

.purchase-approval-card .approval-step span {
  margin: 0;
  font-size: 11px;
  line-height: 1.25;
  text-align: right;
}

.purchase-approval-card .approval-step small,
.purchase-approval-card .approval-step p {
  grid-column: 1 / -1;
}

.purchase-approval-card .approval-step small {
  margin-top: 1px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
}

.purchase-approval-card .approval-step p {
  margin: 3px 0 0;
  font-size: 11px;
  line-height: 1.3;
}

.purchase-approval-card .attachment-list {
  gap: 6px;
  margin: 7px 0;
  font-size: 12px;
}

.purchase-approval-card > .action-row {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .purchase-approval-card .purchase-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .purchase-approval-card .approval-flow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .purchase-approval-card .purchase-meta,
  .purchase-approval-card .approval-flow {
    grid-template-columns: 1fr;
  }
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.contract-current-file,
.contract-editable-attachment-list {
  display: grid;
  gap: 8px;
}

.contract-editable-attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7f9fa;
}

.contract-editable-attachment > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.contract-editable-attachment > button { flex: 0 0 auto; }

@media (max-width: 680px) {
  .contract-editable-attachment {
    align-items: flex-start;
    flex-direction: column;
  }
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  display: grid;
  place-items: center;
  box-shadow: 0 1px 2px rgba(23, 32, 42, 0.06);
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.icon-button:hover {
  border-color: #aebbc5;
  background: #f6f8fa;
  box-shadow: 0 2px 6px rgba(23, 32, 42, 0.08);
  transform: translateY(-1px);
}

.mobile-only {
  display: none;
}

@media (max-width: 980px) {
  .auth-screen {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .auth-aside {
    margin: 0;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, 300px);
    z-index: 10;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

  .workspace { max-width: 100vw; margin-left: 0; }
  .desktop-widgets { display: none; }
  .weapon-report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gbr-weapon-row { grid-template-columns: 1fr; }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-only {
    display: grid;
  }

  .dashboard-grid,
  .card-list,
  .contract-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

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

  .purchase-toolbar,
  .tech-toolbar,
  .document-toolbar,
  .instruments-toolbar,
  .fleet-toolbar,
  .duty-toolbar,
  .equipment-toolbar,
  .equipment-movement-toolbar,
  .payroll-period-filter,
  .purchase-meta,
  .approval-flow {
    grid-template-columns: 1fr;
  }

  .pagination-controls {
    justify-content: flex-start;
  }

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

  .role-grid,
  .fleet-history,
  .project-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .auth-screen {
    padding: 16px;
  }

  .auth-panel {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 24px;
  }

  .auth-aside,
  .dashboard-grid,
  .card-list,
  .toolbar,
  .contract-detail-grid,
  .contract-toolbar,
  .objects-toolbar,
  .employees-toolbar,
  .projects-toolbar,
  .purchase-toolbar,
  .tech-toolbar,
  .document-toolbar,
  .instruments-toolbar,
  .fleet-toolbar,
  .duty-toolbar,
  .purchase-meta,
  .approval-flow,
  .requisites-list,
  .fleet-history,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .employee-profile,
  .nested-form-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 14px;
  }

  .topbar {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: flex-start;
    gap: 10px;
  }

  .topbar > div:nth-child(2) {
    min-width: 0;
  }

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

  .user-pill {
    border: 0;
    padding: 0;
    background: transparent;
  }

  .user-pill .account-menu-button {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    padding: 0;
    border-color: var(--line);
    background: #fff;
    color: var(--ink);
  }

  .account-menu-button:hover {
    background: #f6f8fa;
    color: var(--accent-dark);
  }

  .account-menu-panel {
    position: absolute;
    z-index: 75;
    top: calc(100% + 8px);
    right: 0;
    width: min(250px, calc(100vw - 28px));
    display: none;
    gap: 5px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(28, 37, 47, 0.2);
  }

  .user-pill.is-open .account-menu-panel {
    display: grid;
  }

  .account-menu-panel > span {
    display: block;
    overflow: hidden;
    padding: 8px 10px 10px;
    border-bottom: 1px solid var(--line);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .account-menu-panel > button {
    width: 100%;
    min-height: 42px;
    border: 0;
    padding: 0 11px;
    background: transparent;
    color: var(--ink);
    box-shadow: none;
    text-align: left;
  }

  .account-menu-panel > button:hover {
    background: #eef5f3;
    color: var(--accent-dark);
    box-shadow: none;
    transform: none;
  }

  #logoutButton {
    color: var(--danger);
  }

  .topbar-actions {
    align-items: flex-start;
  }

  .notification-panel {
    position: fixed;
    top: 72px;
    right: 14px;
    left: 14px;
    width: auto;
  }

  .icon-button.notification-button {
    width: 46px;
    height: 46px;
  }

  .section-head {
    display: grid;
  }

  .form-grid .wide {
    grid-column: auto;
  }

  .form-head,
  .form-actions,
  .contract-card-head,
  .project-card-head,
  .project-footer,
  .task-card-head {
    display: grid;
  }

  .settings-tabs {
    display: grid;
  }

  .system-color-grid {
    grid-template-columns: 1fr;
  }

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

  .audit-pagination {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    justify-content: stretch;
  }

  .audit-pagination label,
  .audit-pagination .pagination-info {
    grid-column: 1 / -1;
    width: 100%;
    text-align: center;
  }

  .audit-pagination label { justify-content: center; }
  .audit-pagination .secondary-button { width: 100%; min-width: 0; }
}

@media (max-width: 680px) {
  .payroll-period-filter.payroll-auto-period-filter {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .payroll-period-filter.payroll-auto-period-filter label,
  .payroll-period-filter.payroll-auto-period-filter .payroll-employee-filter {
    grid-column: 1 / -1;
  }

  .payroll-period-filter.payroll-auto-period-filter button {
    width: 100%;
    min-width: 0;
    padding-inline: 4px;
    font-size: 12px;
    white-space: nowrap;
  }

  .payroll-period-filter.payroll-auto-period-filter .payroll-print-button { display: none; }
  .payroll-period-filter.payroll-auto-period-filter .wide-label { display: none; }
  .payroll-period-filter.payroll-auto-period-filter .compact-label { display: inline; }
}
.recycle-bin-json {
  margin: 0;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.recycle-bin-details dd {
  min-width: 0;
}

.recycle-bin-toolbar {
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(150px, 210px)) auto;
}

@media (max-width: 1000px) {
  .recycle-bin-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.envelope-print-layout {
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(420px, 1.4fr);
  gap: 18px;
  align-items: start;
}

.envelope-print-layout .settings-form { margin: 0; }
.envelope-sender-card, .envelope-recipient-card { display: grid; gap: 14px; }
.envelope-address-preview { display: grid; gap: 6px; padding: 14px; border-radius: 12px; background: var(--surface-soft, #f5f7fa); }
.envelope-address-preview span, .envelope-address-preview b { color: var(--muted); font-size: 12px; }
.envelope-format-hint { display: grid; gap: 3px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft, #f5f7fa); }
.envelope-format-hint strong { font-size: 13px; }
.envelope-format-hint span { color: var(--muted); font-size: 12px; }
.envelope-adjustment-panel { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.envelope-adjustment-panel summary { cursor: pointer; font-weight: 700; }
.envelope-adjustment-panel > p { margin: 8px 0; font-size: 12px; }
.envelope-adjustment-grid { display: grid; grid-template-columns: minmax(120px, 1fr) 76px 76px; gap: 7px; align-items: center; }
.envelope-adjustment-grid > strong { font-size: 11px; color: var(--muted); }
.envelope-adjustment-grid > label { font-size: 12px; font-weight: 600; }
.envelope-adjustment-grid input { min-width: 0; }
.envelope-adjustment-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.envelope-recipient-list { display: grid; gap: 6px; max-height: 52vh; overflow: auto; padding-right: 4px; }
.envelope-recipient-list > label { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.envelope-recipient-list > label:hover { background: var(--surface-soft, #f5f7fa); }
.envelope-recipient-list span { display: grid; gap: 3px; }
.envelope-recipient-list small { color: var(--muted); }
.envelope-recipient-list b { font-size: 12px; white-space: nowrap; }
.envelope-print-actions { grid-column: 1 / -1; }

.fias-address-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 12px; align-items: end; }
.contract-address-label { display: flex; align-items: center; justify-content: flex-start; gap: 8px; }
.contract-address-copy { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.contract-address-copy input { width: 15px; min-height: 15px; margin: 0; }
.fias-address-row input[readonly] { background: var(--soft); color: var(--muted); }
.fias-address-field { position: relative; }
.fias-suggestions { position: absolute; z-index: 30; top: calc(100% + 4px); right: 0; left: 0; max-height: 260px; overflow-y: auto; padding: 6px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface, #fff); box-shadow: 0 14px 32px rgba(20, 31, 43, .16); }
.fias-suggestions button { width: 100%; display: grid; gap: 3px; padding: 9px 10px; border: 0; border-radius: 7px; background: transparent; color: inherit; text-align: left; }
.fias-suggestions button:hover { background: var(--surface-soft, #f5f7fa); }
.fias-suggestions small, .fias-suggestion-status { color: var(--muted); font-size: 12px; }
.fias-suggestion-status { display: block; padding: 9px 10px; }
.fias-error { color: #b42318; }

@media (max-width: 900px) {
  .envelope-print-layout { grid-template-columns: 1fr; }
  .envelope-print-actions { grid-column: auto; }
  .fias-address-row { grid-template-columns: 1fr; }
}

/* Лёгкая анимация интерфейса: только opacity и transform, без тяжёлых эффектов. */
@keyframes portal-surface-enter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes portal-dialog-backdrop-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes portal-dialog-enter {
  from { opacity: 0; transform: translateY(8px) scale(.992); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.content-panel > :not(.modal-layer),
.table-wrap,
.audit-table-wrap,
.settings-tab-panel,
.sales-tab-panel {
  animation: portal-surface-enter 180ms ease-out both;
}

.modal-layer:not(.is-hidden) {
  animation: portal-dialog-backdrop-enter 140ms ease-out both;
}

.modal-layer:not(.is-hidden) > .contract-form,
.modal-layer:not(.is-hidden) > [role="dialog"],
.modal-layer:not(.is-hidden) > section {
  animation: portal-dialog-enter 190ms cubic-bezier(.2, .72, .3, 1) both;
}

.nav-item,
.icon-button,
.notification-item,
.metric-card,
.data-card,
.contract-card,
.project-card,
.task-card,
.settings-form,
.status,
.toolbar input,
.toolbar select,
.contract-form input,
.contract-form select,
.contract-form textarea {
  transition:
    color 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .metric-card:hover,
  .data-card:hover,
  .contract-card:hover,
  .project-card:hover,
  .task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(23, 32, 42, .08);
  }

  .notification-item:hover {
    transform: translateX(2px);
  }
}

.toolbar input:focus,
.toolbar select:focus,
.contract-form input:focus,
.contract-form select:focus,
.contract-form textarea:focus {
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Compact user controls in the top bar. */
.topbar-actions {
  gap: 12px;
}

.topbar-action-separator {
  width: 1px;
  height: 34px;
  flex: 0 0 1px;
  background: var(--line);
}

.icon-button.notification-button {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
}

.icon-button.notification-button:hover {
  background: var(--soft);
  color: var(--accent);
}

.notification-badge {
  top: -3px;
  right: -3px;
  min-width: 20px;
  height: 20px;
  border-color: var(--panel);
  background: #3b82f6;
  font-size: 11px;
}

.quick-theme-button {
  width: 96px;
  height: 40px;
  min-height: 40px;
  display: grid;
  grid-template-columns: 22px 34px 22px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 6px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.quick-theme-button:hover {
  border-color: #9aa8b5;
  background: var(--soft);
  color: var(--ink);
}

.quick-theme-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle-track {
  position: relative;
  width: 34px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
}

.theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 9px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 1px 3px rgb(0 0 0 / 25%);
  transition: left .18s ease, background-color .18s ease;
}

.quick-theme-button[data-theme-preference="light"] .theme-toggle-thumb { left: 2px; }
.quick-theme-button[data-theme-preference="dark"] .theme-toggle-thumb { left: 18px; }
.quick-theme-button[data-theme-preference="light"] .theme-sun-icon,
.quick-theme-button[data-theme-preference="dark"] .theme-moon-icon { color: var(--accent); }

.user-pill {
  position: relative;
  border: 0;
  border-radius: 10px;
  padding: 0;
  background: transparent;
}

.user-pill .account-menu-button {
  min-height: 48px;
  display: grid;
  grid-template-columns: 42px minmax(110px, auto) 20px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 10px;
  padding: 3px 5px 3px 3px;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  text-align: left;
}

.user-pill .account-menu-button:hover,
.user-pill.is-open .account-menu-button {
  background: var(--soft);
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

.topbar-user-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

.topbar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topbar-user-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

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

.topbar-user-copy strong { color: var(--ink); font-size: 14px; }
.topbar-user-copy small { color: var(--muted); font-size: 12px; font-weight: 500; }
.account-menu-chevron { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; transition: transform .18s ease; }
.user-pill.is-open .account-menu-chevron { transform: rotate(180deg); }

.account-menu-panel {
  position: absolute;
  z-index: 75;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  display: none;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.user-pill.is-open .account-menu-panel { display: grid; }
.account-menu-panel > span { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); }
.account-menu-panel > button { width: 100%; min-height: 40px; border: 0; padding: 0 10px; background: transparent; color: var(--ink); box-shadow: none; text-align: left; }
.account-menu-panel > button:hover { background: var(--soft); color: var(--accent); box-shadow: none; transform: none; }

html[data-theme="dark"] .icon-button.notification-button:hover,
html[data-theme="dark"] .quick-theme-button:hover,
html[data-theme="dark"] .user-pill .account-menu-button:hover,
html[data-theme="dark"] .user-pill.is-open .account-menu-button,
html[data-theme="dark"] .account-menu-panel > button:hover { background: #222d38; }
html[data-theme="dark"] .theme-toggle-track { background: #0f141a; }
html[data-theme="dark"] .theme-toggle-thumb { background: #e8edf2; }

@media (max-width: 760px) {
  .topbar-action-separator { display: none; }
  .quick-theme-button { width: 78px; grid-template-columns: 18px 28px 18px; gap: 2px; }
  .quick-theme-button svg { width: 17px; height: 17px; }
  .theme-toggle-track { width: 28px; }
  .theme-toggle-thumb { left: 7px; }
  .quick-theme-button[data-theme-preference="dark"] .theme-toggle-thumb { left: 12px; }
  .topbar-user-copy { display: none; }
  .user-pill .account-menu-button { grid-template-columns: 42px 16px; min-width: 64px; }
}

/* Compact theme choice inside the personal profile. */
.account-theme-settings {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
}

.account-theme-settings label {
  min-width: 0;
  min-height: 38px;
  gap: 7px;
  padding: 5px 7px;
  border: 1px solid transparent;
}

.account-theme-settings label:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.account-theme-settings label span { min-width: 0; }
.account-theme-settings label strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-theme-settings label small { display: none; }
.account-profile-form .account-theme-settings input[type="radio"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
}

@media (max-width: 650px) {
  .account-theme-settings { grid-template-columns: 1fr; }
  .account-theme-settings label small { display: block; }
}

@media (max-width: 760px) {
  #pageSubtitle,
  .section-head p,
  .subsection-head p,
  .sales-crm-head > div > p,
  .tender-head > div > p {
    display: none !important;
  }

  .kanban-board,
  .projects-kanban,
  .sales-kanban,
  .tender-kanban,
  .debtor-kanban {
    display: none !important;
  }

  [data-projects-tab="kanban"],
  [data-sales-view="kanban"],
  [data-tender-view="kanban"],
  [data-debtor-tab="kanban"] {
    display: none !important;
  }
}

/* Cockpit dashboard refresh and collapsible navigation */
@media (min-width: 981px) {
  .sidebar { width:268px; padding:18px 14px; border-right:1px solid color-mix(in srgb,var(--line) 72%,transparent); box-shadow:18px 0 42px rgb(3 10 18 / 18%); transform:translateX(-104%); transition:transform 220ms ease,box-shadow 220ms ease; }
  .sidebar.open, body.sidebar-pinned .sidebar { transform:translateX(0); }
  .workspace { max-width:100vw; margin-left:0; padding:0 24px 28px; transition:margin-left 220ms ease,max-width 220ms ease; }
  body.sidebar-pinned .workspace { max-width:calc(100vw - 268px); margin-left:268px; }
  .sidebar-backdrop { display:none; }
}

.portal-menu-button { display:grid; flex:0 0 auto; }
.sidebar-head { border-bottom:1px solid rgb(255 255 255 / 9%); margin-bottom:14px; }
.sidebar-head > div:nth-child(2) { min-width:0; flex:1; }
.sidebar-head strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:17px; }
.sidebar-pin-button { width:34px; height:34px; display:grid; place-items:center; align-self:center; margin-left:auto; flex:0 0 auto; border:1px solid rgb(255 255 255 / 12%); border-radius:8px; color:#91a5bb; background:rgb(255 255 255 / 4%); cursor:pointer; }
.sidebar-pin-button:hover, .sidebar-pin-button[aria-pressed="true"] { color:#fff; border-color:color-mix(in srgb,var(--accent) 65%,transparent); background:color-mix(in srgb,var(--accent) 25%,transparent); }
.sidebar-pin-button svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.topbar { min-height:82px; margin:0 -24px 24px; padding:16px 24px; border-bottom:1px solid var(--line); background:color-mix(in srgb,var(--panel) 92%,transparent); backdrop-filter:blur(16px); }
.topbar > div:nth-child(2) { margin-right:auto; }
.topbar h2 { font-size:clamp(22px,2vw,28px); letter-spacing:-.02em; }
.topbar-actions { margin-left:auto; }
.content-panel, .metric-card, .data-card, .toolbar { border-radius:12px; box-shadow:0 12px 32px rgb(9 20 32 / 8%); }
.content-panel { padding:20px; }
.manager-metrics { gap:14px; margin:0 0 18px; padding:0; border:0; background:transparent; overflow:visible; }
.manager-metric { min-height:126px; padding:18px 20px; border:1px solid var(--line); border-radius:12px; box-shadow:0 10px 28px rgb(9 20 32 / 7%); }
.manager-metric strong { color:var(--ink); font-size:32px; letter-spacing:-.03em; }
.manager-metric small { margin-top:auto; }
.manager-dashboard-grid { gap:16px; }
.manager-panel { padding:18px; border:1px solid var(--line); border-radius:12px; background:var(--panel); box-shadow:0 10px 28px rgb(9 20 32 / 7%); }
.manager-list > button { padding:12px 4px; }
html[data-theme="dark"] { --bg:#0b1420; --panel:#131f2c; --soft:#182635; --line:#26384a; --ink:#eef5fb; --muted:#91a3b6; --sidebar-bg:#0d1824; --sidebar-active:#183454; background:radial-gradient(circle at 70% 0%,#142539 0,#0b1420 46%); }
html[data-theme="dark"] body { background:transparent; }
html[data-theme="dark"] .topbar, html[data-theme="dark"] .sidebar { background:color-mix(in srgb,var(--sidebar-bg) 96%,transparent); }
html[data-theme="dark"] .content-panel { background:transparent; border-color:transparent; box-shadow:none; }
html[data-theme="dark"] .manager-metric, html[data-theme="dark"] .manager-panel, html[data-theme="dark"] .metric-card, html[data-theme="dark"] .data-card, html[data-theme="dark"] .toolbar { background:linear-gradient(145deg,#152332,#111d29); }
html[data-theme="dark"] .manager-metric:hover { background:linear-gradient(145deg,#1a2d40,#142538); border-color:#335b84; }
@media (max-width:980px) { .sidebar-pin-button{display:none}.workspace{padding:0 16px 20px}.topbar{margin:0 -16px 18px;padding:12px 16px} }

/* Clear navigation controls and accessible tooltips */
.portal-menu-button {
  position: relative;
  width: 44px;
  height: 44px;
  border: 1px solid color-mix(in srgb, var(--accent) 72%, #fff);
  border-radius: 11px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 7px 18px color-mix(in srgb, var(--accent) 34%, transparent), inset 0 1px rgb(255 255 255 / 20%);
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.portal-menu-button:hover {
  color: #fff;
  background: var(--accent-dark);
  box-shadow: 0 9px 24px color-mix(in srgb, var(--accent) 44%, transparent), inset 0 1px rgb(255 255 255 / 24%);
  transform: translateY(-1px);
}
.portal-menu-button svg { width: 23px; height: 23px; stroke-width: 2.35; }
body.sidebar-pinned .portal-menu-button { display: none; }

.has-ui-tooltip { position: relative; }
.has-ui-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 9px);
  left: 50%;
  z-index: 120;
  width: max-content;
  max-width: 220px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 8px 24px rgb(5 15 25 / 22%);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -4px);
  transition: opacity 120ms ease, transform 120ms ease;
}
.has-ui-tooltip:hover::after,
.has-ui-tooltip:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: 350ms; }
.sidebar-pin-button.has-ui-tooltip::after { top: 50%; right: calc(100% + 9px); left: auto; transform: translate(4px, -50%); }
.sidebar-pin-button.has-ui-tooltip:hover::after,
.sidebar-pin-button.has-ui-tooltip:focus-visible::after { transform: translate(0, -50%); }

/* Login progress after password / authenticator verification */
.login-form > button[type="submit"] { position:relative; min-height:44px; }
.login-form > button[type="submit"].is-loading { display:flex; align-items:center; justify-content:center; gap:10px; opacity:1; cursor:wait; }
.login-form > button[type="submit"].is-loading::before {
  content:"";
  width:17px;
  height:17px;
  flex:0 0 auto;
  border:2px solid rgb(255 255 255 / 38%);
  border-top-color:#fff;
  border-radius:50%;
  animation:portalBootSpin .7s linear infinite;
}
.login-form.is-submitting input { opacity:.72; cursor:wait; }

/* Основные индикаторы загрузки должны оставаться заметными даже при
   включённом в системе режиме уменьшения движения. */
body.app-booting::after {
  animation-duration: .8s !important;
  animation-iteration-count: infinite !important;
}
.login-form > button[type="submit"].is-loading::before {
  animation-duration: .7s !important;
  animation-iteration-count: infinite !important;
}
.login-progress {
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:18px;
  margin-top:-7px;
  color:var(--muted);
  font-size:12px;
  font-weight:600;
  text-align:center;
}
.login-progress:empty { display:none; }

/* Complete dark theme for the authentication screen */
html[data-theme="dark"] .auth-screen {
  color:var(--ink);
  background:
    radial-gradient(circle at 18% 22%, rgb(59 130 246 / 15%), transparent 34%),
    radial-gradient(circle at 82% 78%, rgb(31 111 99 / 13%), transparent 31%),
    linear-gradient(135deg, #09121d 0%, #0d1926 54%, #0a1420 100%);
}
html[data-theme="dark"] .auth-screen::before {
  content:"";
  position:absolute;
  inset:0;
  z-index:0;
  pointer-events:none;
  opacity:.28;
  background-image:
    linear-gradient(rgb(116 148 180 / 10%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(116 148 180 / 10%) 1px, transparent 1px);
  background-size:64px 64px;
  mask-image:linear-gradient(to bottom, transparent, #000 18%, #000 82%, transparent);
}
html[data-theme="dark"] .auth-panel {
  color:var(--ink);
  border-color:rgb(91 119 148 / 32%);
  background:linear-gradient(145deg, rgb(21 35 50 / 96%), rgb(13 25 38 / 96%));
  box-shadow:0 24px 65px rgb(0 0 0 / 38%), inset 0 1px rgb(255 255 255 / 4%);
}
html[data-theme="dark"] .auth-panel h1,
html[data-theme="dark"] .summary-tile strong { color:var(--ink); }
html[data-theme="dark"] .auth-panel p,
html[data-theme="dark"] .summary-tile span,
html[data-theme="dark"] .install-app-hint,
html[data-theme="dark"] .login-progress { color:var(--muted); }
html[data-theme="dark"] .login-form label { color:#c7d3df; }
html[data-theme="dark"] .login-form input {
  border-color:#33485c;
  color:var(--ink);
  background:#0d1a27;
  box-shadow:inset 0 1px 2px rgb(0 0 0 / 24%);
}
html[data-theme="dark"] .login-form input:hover { border-color:#45617b; }
html[data-theme="dark"] .login-form input:focus {
  border-color:var(--accent);
  background:#102131;
  box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 20%,transparent);
}
html[data-theme="dark"] .login-form input:-webkit-autofill,
html[data-theme="dark"] .login-form input:-webkit-autofill:hover,
html[data-theme="dark"] .login-form input:-webkit-autofill:focus {
  -webkit-text-fill-color:var(--ink);
  caret-color:var(--ink);
  box-shadow:0 0 0 1000px #0d1a27 inset;
  transition:background-color 9999s ease-out;
}
html[data-theme="dark"] .login-form .secondary-button {
  border-color:#3a5066;
  color:#d6e2ed;
  background:#182838;
}
html[data-theme="dark"] .login-form .secondary-button:hover {
  border-color:#56728d;
  color:#fff;
  background:#203448;
}
html[data-theme="dark"] .summary-tile {
  border-color:rgb(91 119 148 / 28%);
  background:linear-gradient(145deg, rgb(22 37 53 / 88%), rgb(14 27 40 / 88%));
  box-shadow:0 16px 38px rgb(0 0 0 / 24%), inset 0 1px rgb(255 255 255 / 4%);
}
html[data-theme="dark"] .form-error { color:#ff9ca5; }
html[data-theme="dark"] .license-error-code {
  padding:7px 9px;
  border:1px solid #3b4d5f;
  border-radius:6px;
  color:#c6d4e0;
  background:#0b1722;
}

/* High-contrast sidebar pin control */
.sidebar .sidebar-pin-button {
  width:32px;
  height:32px;
  border:1px solid rgb(255 255 255 / 55%);
  border-radius:10px;
  color:#fff;
  background:color-mix(in srgb,var(--accent) 55%,#073f75);
  box-shadow:0 6px 16px rgb(0 0 0 / 22%), inset 0 1px rgb(255 255 255 / 24%);
  opacity:1;
  transition:transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.sidebar .sidebar-pin-button svg {
  width:17px;
  height:17px;
  color:#fff;
  opacity:1;
  filter:none;
  fill:none;
  stroke:#fff;
  stroke-width:2.1;
}
.sidebar .sidebar-pin-button svg path {
  fill:none;
  stroke:#fff;
  stroke-width:2.1;
}
.sidebar .sidebar-pin-button:hover {
  color:#fff;
  border-color:#fff;
  background:color-mix(in srgb,var(--accent) 68%,#052f59);
  box-shadow:0 8px 20px rgb(0 0 0 / 28%), 0 0 0 3px rgb(255 255 255 / 14%);
  transform:translateY(-1px);
}
.sidebar .sidebar-pin-button[aria-pressed="true"] {
  color:#fff;
  border-color:#bff3d8;
  background:#168653;
  box-shadow:0 7px 18px rgb(0 0 0 / 26%), 0 0 0 3px rgb(76 210 139 / 20%);
}

/* Keep header popovers above dashboard content without covering the sidebar */
.topbar {
  position:sticky;
  z-index:2450;
  top:0;
  overflow:visible;
  box-shadow:0 8px 24px rgb(9 20 32 / 8%);
}
.workspace { overflow-x:clip; }
body:has(.modal-layer:not(.is-hidden), .rp-modal-layer) .topbar { z-index:10; }
.topbar-actions,
.user-pill,
.notification-center { overflow:visible; }
.topbar .account-menu-panel,
.topbar .notification-panel { z-index:100; }

/* Wider and vertically compact contract editor */
#contractModal { padding:14px; }
#contractForm.contract-entry-form {
  width:min(1480px, calc(100vw - 28px));
  max-width:none;
  max-height:calc(100vh - 28px);
  padding:14px 16px;
}
#contractForm > .form-head { margin-bottom:10px; }
#contractForm > .form-head p { margin-top:3px; }
#contractForm .contract-entry-section { padding:6px 0 8px; }
#contractForm .contract-entry-section:first-child { padding-top:0; }
#contractForm .contract-entry-grid { gap:6px 9px; }
#contractForm .contract-entry-grid label { gap:3px; font-size:12px; line-height:1.2; }
#contractForm input,
#contractForm select {
  min-height:32px;
  height:32px;
  padding:4px 8px;
  font-size:13px;
}
#contractForm textarea {
  min-height:56px;
  padding:6px 8px;
  font-size:13px;
  line-height:1.3;
}
#contractForm .contract-end-date-field { gap:4px; }
#contractForm .contract-entry-grid .contract-auto-prolongation { min-height:32px; }
#contractForm .contract-entry-grid .contract-auto-prolongation input,
#contractForm .contract-object-option input {
  width:15px;
  height:15px;
  min-height:15px;
  padding:0;
}
#contractForm .contract-object-options { max-height:150px; gap:3px; }
#contractForm .contract-object-option { padding:4px 6px; }
#contractForm .form-actions { margin-top:10px; }

@media (max-width:720px) {
  #contractModal { padding:8px; }
  #contractForm.contract-entry-form { width:100%; max-height:calc(100vh - 16px); padding:12px; }
}
input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}
/* Fleet profile card and stable full-width table rows. */
#fleetViewContent{width:min(1320px,calc(100vw - 32px));max-height:calc(100vh - 28px);padding:0;overflow:auto}.fleet-view-head{position:sticky;z-index:3;top:0;margin:0;padding:18px 20px;border-bottom:1px solid var(--line);background:var(--panel)}.fleet-view-head .fleet-view-photo{width:154px;height:96px}.fleet-profile-body{display:grid;grid-template-columns:300px minmax(0,1fr);min-height:520px}.fleet-profile-sidebar{display:flex;flex-direction:column;gap:16px;padding:20px;border-right:1px solid var(--line);background:var(--soft)}.fleet-profile-sidebar-title{display:flex;align-items:center;gap:10px;padding-bottom:14px;border-bottom:1px solid var(--line)}.fleet-profile-sidebar-title>span{display:grid;width:38px;height:38px;place-items:center;border-radius:9px;color:var(--accent);background:color-mix(in srgb,var(--accent) 12%,#fff)}.fleet-profile-sidebar-title svg{width:20px;height:20px}.fleet-profile-sidebar-title>div{display:grid;gap:3px}.fleet-profile-sidebar-title small{color:var(--muted);font-size:10px}.fleet-profile-details{grid-template-columns:1fr;gap:0;margin:0}.fleet-profile-details>div{gap:4px;padding:10px 0;border-bottom:1px solid var(--line)}.fleet-profile-details span{font-size:10px}.fleet-profile-details strong{font-size:12px}.fleet-profile-edit{display:flex;align-items:center;justify-content:center;gap:7px;margin-top:auto}.fleet-profile-edit svg{width:15px;height:15px}.fleet-profile-main{min-width:0;padding:20px;background:var(--panel)}.fleet-profile-main-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:16px}.fleet-profile-main-head>div:first-child{display:grid;gap:4px}.fleet-profile-main-head>div:first-child strong{font-size:16px}.fleet-profile-main-head>div:first-child span{color:var(--muted);font-size:11px}.fleet-profile-main .fleet-history{grid-template-columns:1fr;margin-top:0}.fleet-profile-main .fleet-history section{border-radius:10px;background:var(--soft)}#fleetViewContent>.form-actions{position:sticky;bottom:0;margin:0;padding:12px 20px;border-top:1px solid var(--line);background:var(--panel)}
@media(max-width:1020px){.fleet-profile-body{grid-template-columns:1fr}.fleet-profile-sidebar{border-right:0;border-bottom:1px solid var(--line)}.fleet-profile-details{grid-template-columns:repeat(2,minmax(0,1fr));gap:0 18px}.fleet-profile-edit{margin-top:0}.fleet-profile-main-head{flex-direction:column}}
@media(max-width:680px){#fleetViewContent{width:calc(100vw - 12px)}.fleet-profile-details{grid-template-columns:1fr}.fleet-view-head .fleet-view-photo{width:100%;height:140px}.fleet-profile-main,.fleet-profile-sidebar{padding:14px}}
/* Reference-style fleet vehicle card. */
#fleetViewContent{width:min(1480px,calc(100vw - 24px));max-height:calc(100vh - 20px);padding:0}.fleet-card-topbar{position:sticky;z-index:5;top:0;display:flex;align-items:stretch;justify-content:space-between;min-height:58px;border-bottom:1px solid var(--line);background:var(--panel)}.fleet-card-topbar nav{display:flex;align-items:stretch;gap:2px;padding-left:304px}.fleet-card-topbar nav button{position:relative;padding:0 18px;border:0;color:var(--muted);background:transparent;font-size:11px;font-weight:700;cursor:pointer}.fleet-card-topbar nav button.is-active{color:var(--accent)}.fleet-card-topbar nav button.is-active:after{position:absolute;right:10px;bottom:0;left:10px;height:2px;background:var(--accent);content:""}.fleet-card-topbar>.icon-button{align-self:center;margin-right:12px}.fleet-reference-card{display:grid;grid-template-columns:270px minmax(480px,1fr) 300px;min-height:650px}.fleet-reference-aside{display:flex;flex-direction:column;gap:14px;padding:18px;border-right:1px solid var(--line);background:var(--panel)}.fleet-reference-identity{display:grid;grid-template-columns:90px minmax(0,1fr);gap:12px;align-items:start}.fleet-reference-image{display:grid;width:90px;height:72px;overflow:hidden;place-items:center;border-radius:9px;color:var(--muted);background:var(--soft)}.fleet-reference-image img{width:100%;height:100%;object-fit:contain}.fleet-reference-image svg{width:40px;height:40px}.fleet-reference-identity h3{margin:1px 0 4px;font-size:18px}.fleet-reference-identity span{display:block;margin-bottom:9px;color:var(--muted);font-size:10px}.fleet-reference-identity .status{display:inline-flex;font-size:9px}.fleet-auto-photo-note{margin-top:-8px;color:var(--muted);font-size:9px}.fleet-reference-specs{display:grid;gap:0;margin:2px 0 0}.fleet-reference-specs>div{display:grid;grid-template-columns:92px minmax(0,1fr);gap:8px;padding:7px 0}.fleet-reference-specs dt{color:var(--muted);font-size:10px}.fleet-reference-specs dd{margin:0;overflow-wrap:anywhere;font-size:11px;font-weight:750}.fleet-reference-aside section{padding-top:14px;border-top:1px solid var(--line)}.fleet-reference-aside section strong{font-size:11px}.fleet-reference-aside section p{margin:7px 0 0;color:var(--muted);font-size:10px;line-height:1.55}.fleet-reference-edit{display:flex;align-items:center;justify-content:center;gap:7px;margin-top:auto}.fleet-reference-edit svg{width:14px;height:14px}.fleet-reference-main{display:grid;align-content:start;gap:14px;min-width:0;padding:16px;background:var(--soft)}.fleet-reference-main>section,.fleet-reference-right>section{border:1px solid var(--line);border-radius:10px;background:var(--panel);box-shadow:0 2px 8px rgb(31 48 68 / 4%)}.fleet-next-service,.fleet-current-repair{padding:16px}.fleet-block-title{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}.fleet-block-title>div{display:grid;gap:4px}.fleet-block-title strong{font-size:12px}.fleet-block-title span{color:var(--muted);font-size:9px}.fleet-service-summary{display:grid;grid-template-columns:auto minmax(150px,1fr) minmax(120px,1fr);gap:12px;align-items:center;margin:14px 0;padding:14px 0;border-top:1px solid var(--line);border-bottom:1px solid var(--line)}.fleet-service-summary>span{display:grid;width:36px;height:36px;place-items:center;border-radius:8px;color:var(--accent);background:color-mix(in srgb,var(--accent) 10%,#fff)}.fleet-service-summary svg{width:20px;height:20px}.fleet-service-summary>div{display:grid;gap:4px}.fleet-service-summary strong{font-size:13px}.fleet-service-summary small{color:var(--muted);font-size:9px}.fleet-maintenance-plan h4{margin:0 0 10px;font-size:11px}.fleet-maintenance-plan>div{display:grid;grid-template-columns:18px minmax(150px,1fr) 130px 70px;gap:9px;align-items:center;min-height:27px;font-size:10px}.fleet-maintenance-plan i{display:grid;width:14px;height:14px;place-items:center;border:1px solid var(--line);border-radius:50%;color:#fff;font-size:8px;font-style:normal}.fleet-maintenance-plan i.is-done{border-color:#48bb78;background:#48bb78}.fleet-maintenance-plan small{color:var(--muted)}.fleet-maintenance-plan b{color:var(--muted);font-size:9px;font-weight:500}.fleet-maintenance-plan i.is-done~b{color:#31a768}.fleet-current-repair.is-active{border-color:#f2c9c9;background:linear-gradient(135deg,#fffafa,#fff)}.fleet-repair-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:15px 28px;margin:16px 0;padding:15px;border:1px solid color-mix(in srgb,var(--danger) 20%,var(--line));border-radius:8px;background:var(--panel)}.fleet-repair-grid>div{display:grid;gap:5px}.fleet-repair-grid small{color:var(--muted);font-size:9px}.fleet-repair-grid strong{font-size:10px}.fleet-repair-flow{display:grid;grid-template-columns:22px auto 1fr 22px auto 1fr 22px auto 1fr 22px auto 1fr 22px auto;align-items:center;gap:5px;color:var(--muted);font-size:8px}.fleet-repair-flow b{display:grid;width:20px;height:20px;place-items:center;border-radius:50%;color:#6f7c89;background:#e7ebef}.fleet-repair-flow b.is-current,.fleet-repair-flow b:first-child{color:#fff;background:var(--accent)}.fleet-repair-flow i{height:1px;background:var(--line)}.fleet-reference-right{display:grid;align-content:start;gap:14px;padding:16px;border-left:1px solid var(--line);background:var(--soft)}.fleet-reference-right>section{padding:14px}.fleet-parts-list{display:grid;gap:9px;margin-top:12px}.fleet-parts-list article{display:grid;gap:5px;padding:11px;border:1px solid var(--line);border-radius:8px;background:var(--panel)}.fleet-parts-list article header{display:flex;align-items:center;justify-content:space-between;gap:8px}.fleet-parts-list article strong,.fleet-parts-list article p{margin:0;font-size:10px}.fleet-parts-list article small,.fleet-parts-list article span{color:var(--muted);font-size:8px}.fleet-quick-actions{display:grid;gap:9px}.fleet-quick-actions>strong{margin-bottom:3px;font-size:11px}.fleet-quick-actions button{display:flex;align-items:center;gap:8px;min-height:38px;padding:8px 10px;border:1px solid color-mix(in srgb,var(--accent) 25%,var(--line));border-radius:7px;color:var(--accent);background:var(--panel);font-size:10px;font-weight:650;text-align:left;cursor:pointer}.fleet-quick-actions svg{width:15px;height:15px}.fleet-empty-state{margin:12px 0 0;padding:18px;border:1px dashed var(--line);border-radius:8px;color:var(--muted);font-size:10px;text-align:center}
@media(max-width:1180px){.fleet-card-topbar nav{padding-left:0}.fleet-reference-card{grid-template-columns:250px minmax(430px,1fr)}.fleet-reference-right{grid-column:1/-1;grid-template-columns:1fr 1fr;border-top:1px solid var(--line);border-left:0}}
@media(max-width:800px){.fleet-card-topbar{overflow-x:auto}.fleet-card-topbar nav button{padding:0 10px;white-space:nowrap}.fleet-reference-card{grid-template-columns:1fr}.fleet-reference-aside{border-right:0;border-bottom:1px solid var(--line)}.fleet-reference-right{grid-template-columns:1fr}.fleet-maintenance-plan>div{grid-template-columns:18px 1fr}.fleet-maintenance-plan small,.fleet-maintenance-plan b{display:none}.fleet-repair-flow{display:none}}
.fleet-vehicle-illustration{display:block;width:100%;height:100%;object-fit:contain}.fleet-thumb .fleet-vehicle-illustration{width:58px;height:42px}.fleet-reference-image .fleet-vehicle-illustration{width:90px;height:72px}.fleet-photo-preview .fleet-vehicle-illustration{width:150px;height:96px}

/* Mobile layout hardening: keep every section inside the viewport and let wide data scroll locally. */
@media (max-width: 680px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
  .app-shell, .workspace, .content-panel, .content-panel > *, main, section { min-width: 0; max-width: 100%; }
  .workspace { width: 100%; padding: 0 10px 18px; overflow-x: hidden; }
  .content-panel { width: 100%; padding: 12px; overflow: hidden; }

  .topbar {
    width: auto;
    min-height: 74px;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin: 0 -10px 16px;
    padding: 10px;
    overflow: visible;
  }
  .topbar > div:nth-child(2) { overflow: hidden; }
  .topbar h2 {
    display: -webkit-box;
    max-width: 100%;
    margin: 0;
    overflow: hidden;
    font-size: 19px;
    line-height: 1.12;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .topbar-actions { display: flex; align-items: center; gap: 3px; min-width: 0; }
  .quick-theme-button, .topbar-action-separator { display: none !important; }
  .icon-button.notification-button { width: 40px; height: 40px; }
  .topbar-user-avatar { width: 38px; height: 38px; }
  .user-pill .account-menu-button { min-width: 52px; min-height: 42px; grid-template-columns: 38px 12px; gap: 2px; padding: 2px; }
  .account-menu-chevron { width: 14px; }
  .portal-assistant { right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); }
  .assistant-launcher { width: 44px; height: 44px; }
  .assistant-panel { position: fixed; right: 8px; bottom: calc(72px + env(safe-area-inset-bottom)); left: 8px; width: auto; max-height: calc(100dvh - 96px); }

  .section-head, .subsection-head, .sales-crm-head, .tender-head, .fleet-section-head {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
    gap: 10px;
  }
  .section-head > *, .subsection-head > *, .sales-crm-head > *, .tender-head > * { min-width: 0; max-width: 100%; }
  .section-head h2, .section-head h3, .sales-crm-head h3, .tender-head h3 { font-size: 22px; overflow-wrap: anywhere; }
  .section-head button, .sales-crm-actions > button, .fleet-section-head button { max-width: 100%; white-space: normal; }

  .manager-metrics { width: auto; margin: 0 0 14px; gap: 10px; background: transparent; border: 0; overflow: visible; }
  .manager-metric { min-height: 112px; border: 1px solid var(--line); border-radius: 10px; }
  .manager-metric span { min-height: 30px; }
  .manager-metric strong { max-width: 100%; overflow: hidden; font-size: clamp(20px, 6vw, 27px); text-overflow: ellipsis; white-space: nowrap; }

  .sales-crm-head, .tender-head { padding: 14px 12px; }
  .sales-crm-actions { width: 100%; display: grid; grid-template-columns: 1fr; gap: 8px; }
  .sales-crm-actions > button, .sales-search { width: 100%; min-width: 0; }
  .sales-crm-toolbar { width: 100%; display: block; padding: 8px 10px; overflow-x: auto; }
  .sales-view-switch { width: max-content; min-width: 100%; display: flex; }
  .sales-view-switch button { flex: 0 0 auto; }
  .sales-toolbar-summary { display: none; }
  #salesView, #tendersView { padding: 12px 0; }

  .toolbar, .contract-toolbar, .objects-toolbar, .timesheet-toolbar, .equipment-toolbar,
  .equipment-movement-toolbar, .fleet-toolbar, .sales-crm-toolbar {
    width: 100%;
    min-width: 0;
    grid-template-columns: 1fr !important;
  }
  .toolbar > *, .contract-toolbar > *, .objects-toolbar > *, .timesheet-toolbar > *,
  .equipment-toolbar > *, .equipment-movement-toolbar > *, .fleet-toolbar > * { min-width: 0; max-width: 100%; width: 100%; }

  .settings-tabs, .equipment-tabs, .projects-tabs, .debtor-tabs {
    width: 100%;
    display: flex;
    grid-template-columns: none;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }
  .settings-tabs button, .equipment-tabs button, .projects-tabs button, .debtor-tabs button { flex: 0 0 auto; white-space: nowrap; }

  .table-wrap, .audit-table-wrap, .settings-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap table, .audit-table-wrap table { width: max-content; min-width: 680px; }
  .contract-table { min-width: 980px !important; }
  .objects-table, .timesheet-table { min-width: 720px !important; }
  .payroll-adjustment-table table { min-width: 560px !important; table-layout: auto; }
  .payroll-adjustment-table th, .payroll-adjustment-table td { white-space: normal; }

  .table-pagination, .pagination-controls, .audit-pagination {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    white-space: normal !important;
  }
  .table-pagination label, .table-pagination .pagination-info { flex: 1 1 auto; min-width: 0; }

  .timesheet-list-bar { display: grid; grid-template-columns: 1fr; align-items: stretch; }
  .timesheet-list-bar .timesheet-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .timesheet-list-bar .timesheet-totals > div { min-width: 0; }
  .timesheet-list-bar #timesheetTopPagination { width: 100%; }

  .payroll-adjustments-grid { grid-template-columns: 1fr; }
  .payroll-adjustment-panel { min-width: 0; padding: 12px; overflow: hidden; }
  .payroll-adjustment-head { align-items: center; gap: 8px; }
  .payroll-adjustment-head h3 { font-size: 18px; }

  .equipment-tabs + *, .fleet-workspace, .manager-dashboard-grid, .manager-panel { min-width: 0; max-width: 100%; }
  .equipment-section-actions, .fleet-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .equipment-section-actions button, .fleet-actions button { width: 100%; min-width: 0; white-space: normal; }
  .fleet-metrics { grid-template-columns: 1fr; }

  input, select, textarea, button { max-width: 100%; }
  input[type="search"] { min-width: 0; width: 100%; }
}
.integrations-settings-grid {
  display: grid;
  gap: 18px;
}
.integrations-settings-grid > .settings-form,
.integrations-settings-grid .system-settings-card,
.integrations-settings-grid .tenderland-settings-card {
  width: 100%;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
}

/* Sidebar visual language shared with the landing demo. */
.sidebar {
  padding: 20px 16px 18px;
  background:
    radial-gradient(circle at 12% 4%, rgb(31 111 99 / 9%), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #f7faf9 56%, #eef4f2 100%);
  border-right: 1px solid #d8e2df;
  box-shadow: 14px 0 36px rgb(31 55 48 / 9%);
}

html[data-theme="dark"] .sidebar {
  background:
    radial-gradient(circle at 18% 8%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 31%),
    linear-gradient(180deg, color-mix(in srgb, var(--sidebar-bg) 38%, #061431), color-mix(in srgb, var(--sidebar-bg) 42%, #071b42) 58%, color-mix(in srgb, var(--sidebar-bg) 34%, #06132c));
  border-right-color: rgb(107 162 220 / 14%);
  box-shadow: 18px 0 44px rgb(3 10 26 / 28%);
}

html[data-theme="dark"] .topbar {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--panel) 96%, #08111c);
  box-shadow: 0 10px 28px rgb(0 0 0 / 16%);
}

html[data-theme="dark"] .topbar h2 { color: var(--ink); }
html[data-theme="dark"] .topbar #pageSubtitle { color: var(--muted); }

.sidebar-head {
  min-height: 58px;
  margin-bottom: 0;
  padding: 0 6px 15px;
  border-bottom: 1px solid #dce7e3;
}

.sidebar .brand-mini {
  border-radius: 10px;
  box-shadow: 0 8px 25px color-mix(in srgb, var(--accent) 42%, transparent);
}

.sidebar-head strong { font-size: 17px; letter-spacing: -.02em; }
.sidebar-head span { margin-top: 3px; color: #8fa8c8; font-size: 11px; }

.sidebar .nav-list {
  gap: 3px;
  padding: 12px 0 8px;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.helpdesk-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  margin: 10px 4px 0;
  padding: 10px 4px 2px;
  border-top: 1px solid #dce7e3;
  color: #176f53;
  transition: color 180ms ease, background 180ms ease;
}

.helpdesk-link:hover { color: #0d5a42; }
.helpdesk-link > svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.helpdesk-link > span:nth-child(2) { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; }
.helpdesk-link strong { font-size: 12px; font-weight: 700; }
.helpdesk-link small { color: #648579; font-size: 10px; }
.helpdesk-link-arrow { font-size: 16px; line-height: 1; }

html[data-theme="dark"] .helpdesk-link {
  border-top-color: rgb(255 255 255 / 10%);
  color: #a8f0cf;
}

html[data-theme="dark"] .helpdesk-link:hover { color: #d5ffec; background: rgb(255 255 255 / 5%); }
html[data-theme="dark"] .helpdesk-link small { color: #9bb8b1; }

.sidebar .nav-list::-webkit-scrollbar { width: 7px; height: 0; }
.sidebar .nav-list::-webkit-scrollbar-track { background: transparent; }
.sidebar .nav-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 62%, #afc8c0);
  background-clip: padding-box;
}

.sidebar .nav-item {
  position: relative;
  min-height: 42px;
  padding: 10px 12px;
  border-left: 3px solid transparent;
  border-radius: 8px;
  color: #344b45;
  font-size: 13px;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.sidebar .nav-item svg {
  width: 20px;
  height: 20px;
  color: #2b8b68;
}
.sidebar .nav-item:hover {
  color: #143e31;
  background: #edf5f1;
}

.sidebar .nav-item.active {
  color: #0e4b37;
  border-left-color: #25a46f;
  background: linear-gradient(90deg, #dcefe6, #edf7f2);
  box-shadow: inset 3px 0 #25a46f, 0 5px 14px rgb(27 112 78 / 8%);
}

html[data-theme="dark"] .sidebar .nav-item { color: #c8d7e9; }
html[data-theme="dark"] .sidebar .nav-item svg { color: color-mix(in srgb, var(--accent) 44%, #a9c9ea); }
html[data-theme="dark"] .sidebar .nav-item:hover,
html[data-theme="dark"] .sidebar .nav-item.active { color: #fff; }
html[data-theme="dark"] .sidebar .nav-item:hover { background: rgb(255 255 255 / 9%); }
html[data-theme="dark"] .sidebar .nav-item.active {
  border-left-color: #3b82f6;
  background: linear-gradient(90deg, rgb(59 130 246 / 24%), rgb(59 130 246 / 8%));
  box-shadow: inset 3px 0 #3b82f6, 0 5px 14px rgb(0 0 0 / 12%);
}
html[data-theme="dark"] .sidebar-head { border-bottom-color: rgb(255 255 255 / 10%); }
html[data-theme="light"] .sidebar-head strong { color: #173d32; }
html[data-theme="light"] .sidebar-head span { color: #60766f; }
html[data-theme="light"] .sidebar .sidebar-pin-button {
  position: relative;
  width: 36px;
  height: 36px;
  border-color: #9bcbb9;
  color: #176f53;
  background: linear-gradient(145deg, #ffffff, #e8f5f0);
  box-shadow: 0 6px 16px rgb(31 111 83 / 16%), inset 0 1px #fff;
}
html[data-theme="light"] .sidebar .sidebar-pin-button svg,
html[data-theme="light"] .sidebar .sidebar-pin-button svg path {
  color: #176f53;
  stroke: #176f53;
  stroke-width: 2.2;
}
html[data-theme="light"] .sidebar .sidebar-pin-button:hover {
  border-color: #167653;
  color: #fff;
  background: linear-gradient(145deg, #27936c, #176f53);
  box-shadow: 0 8px 20px rgb(23 111 83 / 24%), 0 0 0 3px rgb(39 147 108 / 13%);
}
html[data-theme="light"] .sidebar .sidebar-pin-button:hover svg,
html[data-theme="light"] .sidebar .sidebar-pin-button:hover svg path,
html[data-theme="light"] .sidebar .sidebar-pin-button[aria-pressed="true"] svg,
html[data-theme="light"] .sidebar .sidebar-pin-button[aria-pressed="true"] svg path {
  color: #fff;
  stroke: #fff;
}
html[data-theme="light"] .sidebar .sidebar-pin-button[aria-pressed="true"] {
  border-color: #0e6348;
  color: #fff;
  background: linear-gradient(145deg, #1f8863, #105d45);
  box-shadow: 0 7px 18px rgb(16 93 69 / 27%), 0 0 0 3px rgb(39 147 108 / 15%);
}
html[data-theme="light"] .sidebar .sidebar-pin-button:focus-visible {
  outline: 3px solid rgb(39 147 108 / 24%);
  outline-offset: 2px;
}
html[data-theme="light"] .sidebar .clock-widget,
html[data-theme="light"] .sidebar .weather-widget { color:#294a40; border-color:#d7e4df; background:rgb(255 255 255 / 86%); box-shadow:0 6px 18px rgb(31 68 57 / 7%); }
html[data-theme="light"] .sidebar .clock-widget strong,
html[data-theme="light"] .sidebar .weather-widget strong { color:#183d32; }
html[data-theme="light"] .sidebar .clock-widget span,
html[data-theme="light"] .sidebar .weather-widget span,
html[data-theme="light"] .sidebar .weather-widget button { color:#60766f; }
html[data-theme="light"] .sidebar .weather-current-icon { border-color:#d7e4df; background:#eef5f2; color:#47685d; box-shadow:inset 0 1px #fff,0 3px 8px rgb(31 68 57 / 8%); }
html[data-theme="light"] .sidebar .weather-current-icon.sun { background:#fff8e7; color:#b77c0f; }
html[data-theme="light"] .sidebar .weather-current-icon.cloud { background:#eef3f6; color:#657b89; }
html[data-theme="light"] .sidebar .weather-current-icon.cloud-rain { background:#e9f4fb; color:#347fae; }

.sidebar .nav-item.active svg { color: color-mix(in srgb, var(--accent) 55%, #8ae9ff); }
.sidebar .desktop-widgets { gap: 9px; padding: 13px 4px 0; }
.sidebar .clock-widget,
.sidebar .weather-widget {
  border-color: rgb(41 174 255 / 22%);
  border-radius: 10px;
  background: rgb(12 68 133 / 18%);
  box-shadow: inset 0 1px rgb(255 255 255 / 4%);
}

@media (max-height: 760px) {
  .sidebar .nav-item { min-height: 38px; padding-block: 8px; }
  .sidebar .clock-widget, .sidebar .weather-widget { padding-block: 9px; }
}

.fleet-maintenance-plan b.is-planned {
  color: #d58512;
  font-weight: 700;
}

.timesheet-calendar td.timesheet-date-blocked {
  background: repeating-linear-gradient(135deg, #f3f4f6, #f3f4f6 7px, #e7e9ed 7px, #e7e9ed 14px) !important;
}

.timesheet-calendar td.timesheet-date-blocked input {
  cursor: not-allowed;
  opacity: .45;
}

/* Sales and tender cards are full working surfaces; never constrain them to a narrow dialog. */
#salesDealModal.sales-modal-layer,
#tenderModal.sales-modal-layer {
  position: fixed !important;
  inset: 0 !important;
  display: grid;
  place-items: center;
  padding: 8px !important;
}

#salesDealModal > #salesDealContent.sales-deal-dialog,
#tenderModal > #tenderContent.tender-dialog {
  box-sizing: border-box;
  width: calc(100vw - 16px) !important;
  min-width: calc(100vw - 16px) !important;
  max-width: calc(100vw - 16px) !important;
  height: calc(100vh - 16px) !important;
  max-height: calc(100vh - 16px) !important;
  margin: 0 !important;
}

@supports (width: 100dvw) {
  #salesDealModal > #salesDealContent.sales-deal-dialog,
  #tenderModal > #tenderContent.tender-dialog {
    width: calc(100dvw - 16px) !important;
    min-width: calc(100dvw - 16px) !important;
    max-width: calc(100dvw - 16px) !important;
    height: calc(100dvh - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
  }
}
