:root {
  --app-bg: #e4e9f0;
  --app-bg-2: #dce3eb;
  --surface: #fbfcff;
  --surface-soft: #f2f5f9;
  --surface-strong: #e8edf4;
  --field-bg: #ffffff;
  --field-bg-focus: #ffffff;
  --border: #d6dee8;
  --border-strong: #bfccd9;
  --text: #172033;
  --heading: #111827;
  --muted: #667085;
  --muted-2: #8793a5;
  --primary: #7366ff;
  --primary-strong: #574bd8;
  --primary-soft: #f0eeff;
  --teal: #18b7be;
  --teal-soft: #e9fbfb;
  --amber: #f29b38;
  --amber-soft: #fff4e7;
  --danger: #ef5b5b;
  --danger-soft: #fff0f0;
  --success: #12805c;
  --success-soft: #e7f6ee;
  --shadow-sm: 0 8px 22px rgba(28, 39, 76, 0.07);
  --shadow-md: 0 18px 42px rgba(28, 39, 76, 0.12);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar-width: 276px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, #e8edf4 0%, var(--app-bg) 42%, var(--app-bg-2) 100%),
    var(--app-bg);
  background-size: auto;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

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

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

img,
svg {
  max-width: 100%;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

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

.app-content {
  width: 100%;
  max-width: 100%;
  padding: 20px 22px;
}

.auth-body {
  background:
    radial-gradient(circle at 18% 18%, rgba(115, 102, 255, 0.16), transparent 32%),
    radial-gradient(circle at 82% 74%, rgba(24, 183, 190, 0.14), transparent 34%),
    linear-gradient(135deg, #e4e9f0 0%, #eef2f7 54%, #dce3eb 100%);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 860px);
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(360px, 1fr);
  background: #fbfcff;
  border: 1px solid rgba(214, 222, 232, 0.92);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.login-visual {
  min-height: 430px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  padding: 30px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(115, 102, 255, 0.94), rgba(24, 183, 190, 0.88)),
    #7366ff;
}

.login-visual::after {
  content: "";
  width: 100%;
  height: 118px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.78;
}

.login-mark {
  width: 56px;
  height: 56px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius);
  color: #172033;
  background: #ffffff;
  font-weight: 950;
  box-shadow: 0 14px 28px rgba(17, 24, 39, 0.18);
}

.login-visual h1 {
  max-width: 260px;
  margin: 14px 0 0;
  font-size: 28px;
  line-height: 1.12;
  font-weight: 900;
}

.login-form {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 34px;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
  font-weight: 800;
  letter-spacing: 0;
}

.login-form h2 {
  margin: 2px 0 0;
  color: var(--heading);
  font-size: 26px;
  line-height: 1.18;
  font-weight: 800;
}

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

.login-form .form-control {
  min-height: 44px;
  padding-left: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.login-field {
  display: grid;
  gap: 7px;
}

.login-input {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid #aebccd;
  border-radius: var(--radius-sm);
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.login-input:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(115, 102, 255, 0.16);
}

.login-input i {
  color: var(--primary);
  font-size: 18px;
}

.login-input .form-control:focus {
  border: 0;
  box-shadow: none;
}

.login-submit {
  min-height: 44px;
  margin-top: 6px;
}

.login-form .alert {
  margin: 0;
  padding: 10px 12px;
}

.sidebar {
  position: sticky;
  top: 0;
  width: var(--sidebar-width);
  min-height: 100vh;
  flex: 0 0 var(--sidebar-width);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 14px;
  background: #ffffff;
  color: var(--text);
  border-right: 1px solid var(--border);
  box-shadow: 8px 0 24px rgba(16, 24, 40, 0.05);
  z-index: 20;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 8px 8px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius);
  color: #ffffff;
  background: linear-gradient(135deg, #7366ff, #18b7be);
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(115, 102, 255, 0.26);
}

.sidebar-brand strong,
.sidebar-brand small {
  display: block;
}

.sidebar-brand strong {
  color: var(--heading);
  font-size: 16px;
  font-weight: 850;
}

.sidebar-brand small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: auto;
  padding-right: 2px;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #435166;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
  text-align: left;
  transition: color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.nav-item i {
  width: 22px;
  flex: 0 0 22px;
  color: #718198;
  font-size: 19px;
  text-align: center;
  transition: color 0.16s ease;
}

.nav-item:hover {
  color: var(--heading);
  background: #f4f7fb;
}

.nav-item:hover i {
  color: var(--primary);
}

.nav-item.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), #18b7be);
  box-shadow: 0 10px 22px rgba(115, 102, 255, 0.22);
}

.nav-item.active::before {
  display: none;
}

.nav-item.active i {
  color: #ffffff;
}

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

.nav-parent {
  cursor: pointer;
}

.nav-caret {
  margin-left: auto;
  width: auto !important;
  flex: 0 0 auto !important;
  color: var(--muted-2) !important;
  font-size: 12px !important;
  transition: transform 0.18s ease;
}

.nav-group.is-open .nav-caret {
  transform: rotate(180deg);
}

.nav-subitems {
  display: none;
  position: relative;
  margin: 0 0 4px 30px;
  padding: 2px 0 2px 14px;
}

.nav-group.is-open .nav-subitems {
  display: grid;
  gap: 2px;
}

.nav-subitems::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: #dbe3ed;
}

.nav-subitem {
  position: relative;
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  color: #5f6d80;
  font-size: 14px;
  font-weight: 700;
  transition: color 0.16s ease, background 0.16s ease;
}

.nav-subitem::before {
  content: "";
  position: absolute;
  left: -10px;
  width: 6px;
  height: 1px;
  background: #dbe3ed;
}

.nav-subitem:hover {
  color: var(--heading);
  background: #f4f7fb;
}

.nav-subitem.active {
  color: var(--primary-strong);
  background: linear-gradient(90deg, rgba(115, 102, 255, 0.13), rgba(24, 183, 190, 0.08));
}

.topbar {
  min-height: 74px;
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  background: rgba(250, 252, 255, 0.92);
  border-bottom: 1px solid rgba(214, 222, 232, 0.72);
  backdrop-filter: blur(16px);
}

.topbar-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar h1 {
  margin: 0;
  color: var(--heading);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 850;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.icon-btn,
.tool-btn,
.filter-btn,
.primary-action-btn,
.secondary-action-btn,
.danger-action-btn,
.btn {
  min-height: 38px;
  border-radius: var(--radius-sm);
  font-weight: 750;
  letter-spacing: 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  color: #46566d;
  background: linear-gradient(180deg, #ffffff, #f7f9fd);
  box-shadow: var(--shadow-sm);
}

.icon-btn:hover {
  color: var(--primary);
  border-color: #b8c9e3;
  background: #f8fbff;
}

.user-chip {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--heading);
  background: linear-gradient(180deg, #ffffff, #f7f9fd);
  font-weight: 750;
  box-shadow: var(--shadow-sm);
}

.user-chip:hover {
  color: var(--primary-strong);
  border-color: #b8c9e3;
}

.page-heading,
.section-heading,
.entity-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.page-heading h2,
.section-heading h2,
.entity-page-header h2 {
  margin: 0;
  color: var(--heading);
  font-size: 20px;
  font-weight: 850;
}

.page-heading p,
.section-heading p,
.entity-page-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.detail-header > div:first-child {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 5px;
}

.detail-header {
  padding: 12px 14px;
  border: 1px solid #d8e2ee;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(245, 248, 252, 0.94)),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.detail-header .status-badge {
  margin-bottom: 2px;
}

.detail-header h2 {
  max-width: min(980px, 100%);
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.detail-header p {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 26px;
  margin: 0;
  padding: 4px 9px;
  border: 1px solid #dce7f3;
  border-radius: 999px;
  color: #35445d;
  background: #f7faff;
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.entity-page-header > :first-child {
  min-width: 0;
}

.entity-page-header > .btn,
.entity-page-header > .detail-actions,
.detail-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

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

.metric-card {
  position: relative;
  min-height: 78px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fbfcff 0%, #f2f5fb 100%);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 12px 12px auto auto;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: rgba(115, 102, 255, 0.12);
}

.metric-card::after {
  content: "\F246";
  position: absolute;
  top: 19px;
  right: 20px;
  color: var(--primary);
  font-family: "bootstrap-icons";
  font-size: 15px;
  line-height: 1;
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  max-width: calc(100% - 50px);
}

.metric-card strong {
  color: var(--heading);
  font-size: 20px;
  line-height: 1;
  font-weight: 900;
}

.metric-card.sales { background: linear-gradient(135deg, #fbfcff 0%, #eeeaff 100%); }
.metric-card.cash { background: linear-gradient(135deg, #fbfcff 0%, #e3f7f8 100%); }
.metric-card.debt { background: linear-gradient(135deg, #fbfcff 0%, #f8ebd9 100%); }
.metric-card.stock { background: linear-gradient(135deg, #fbfcff 0%, #e8eefb 100%); }
.metric-card.customer { background: linear-gradient(135deg, #fbfcff 0%, #e5f2f8 100%); }
.metric-card.import { background: linear-gradient(135deg, #fbfcff 0%, #e9edf3 100%); }
.metric-card.sales::before { background: rgba(115, 102, 255, 0.14); }
.metric-card.cash::before { background: rgba(24, 183, 190, 0.14); }
.metric-card.debt::before { background: rgba(242, 155, 56, 0.16); }
.metric-card.stock::before { background: rgba(66, 133, 244, 0.13); }
.metric-card.customer::before { background: rgba(14, 165, 233, 0.13); }
.metric-card.import::before { background: rgba(100, 116, 139, 0.13); }
.metric-card.sales::after { content: "\F5D3"; color: var(--primary); }
.metric-card.cash::after { content: "\F636"; color: var(--teal); }
.metric-card.debt::after { content: "\F63B"; color: var(--amber); }
.metric-card.stock::after { content: "\F290"; color: #4285f4; }
.metric-card.customer::after { content: "\F4D7"; color: #0ea5e9; }
.metric-card.import::after { content: "\F1C7"; color: #64748b; }

.dashboard-hero,
.panel,
.login-panel,
.error-panel {
  border: 1px solid rgba(225, 231, 240, 0.88);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.dashboard-hero {
  padding: 16px 18px;
}

.dashboard-hero h2 {
  margin: 0 0 6px;
  color: var(--heading);
  font-size: 24px;
  font-weight: 850;
}

.dashboard-hero p {
  margin: 0;
  color: var(--muted);
}

.dashboard-hero-actions,
.panel-actions,
.list-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.panel {
  padding: 0;
  overflow: hidden;
}

.panel-header,
.panel-header.compact,
.list-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(90deg, rgba(115, 102, 255, 0.08), rgba(24, 183, 190, 0.045) 42%, rgba(251, 252, 255, 0)),
    linear-gradient(180deg, #fbfcff 0%, #f0f4f9 100%);
}

.panel-header h2 {
  margin: 0;
  color: var(--heading);
  font-size: 15px;
  line-height: 1.25;
  font-weight: 850;
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel-body,
.panel-content {
  padding: 12px;
}

.form-panel,
.sales-form-panel {
  overflow: visible;
}

.entity-form {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.dense-form-grid {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.form-field {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 7px;
  border: 1px solid #dbe3ec;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #f6f8fc);
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.form-field:focus-within {
  border-color: #9fbee9;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(115, 102, 255, 0.12);
}

.form-field.wide {
  grid-column: 1 / -1;
}

.form-field .form-label {
  margin: 0;
  color: #334155;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 5px;
}

.balance-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
}

.label-manage-link {
  color: #7b8faa;
  font-size: 11px;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.label-manage-link:hover {
  color: var(--primary);
  opacity: 1;
}

.form-control,
.form-select,
.customer-picker-control {
  min-height: 34px;
  border: 1px solid #aebccd;
  border-radius: var(--radius-sm);
  color: var(--text);
  background-color: #ffffff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.92), 0 0 0 1px rgba(174, 188, 205, 0.2), inset 0 1px 2px rgba(15, 23, 42, 0.035);
}

.form-control,
.form-select {
  padding: 5px 9px;
}

textarea.form-control {
  min-height: 62px;
  resize: vertical;
}

.form-control:focus,
.form-select:focus {
  color: var(--heading);
  background-color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(115, 102, 255, 0.16), 0 0 0 1px rgba(31, 111, 235, 0.08);
}

.form-control:disabled,
.form-select:disabled,
.form-control[readonly] {
  color: #596579;
  background: #e8edf3;
  border-color: #cfd8e4;
  opacity: 1;
}

.input-group .btn {
  border-color: var(--border-strong);
}

.input-action {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.input-action .form-control,
.input-action .form-select {
  flex: 1 1 auto;
  min-width: 0;
}

.input-action .icon-only,
.input-action .btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

/* 1C-style compact document form (label on top, dense two-column, flat) */
.compact-doc-form .dense-form-grid {
  gap: 10px 22px;
}

.compact-doc-form .form-field {
  display: grid;
  gap: 3px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.compact-doc-form .form-field:focus-within {
  background: transparent;
  box-shadow: none;
}

.compact-doc-form .form-field .form-label {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-doc-form .form-field .form-control,
.compact-doc-form .form-field .form-select,
.compact-doc-form .form-field .customer-picker-control {
  min-height: 32px;
}

.compact-doc-form .form-field:has(textarea) {
  grid-column: 1 / -1;
}

.compact-doc-form textarea.form-control {
  min-height: 44px;
}

.primary-action-btn,
.tool-btn.primary,
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--primary);
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), #18b7be);
  box-shadow: 0 12px 24px rgba(115, 102, 255, 0.22);
}

.primary-action-btn:hover,
.tool-btn.primary:hover,
.btn-primary:hover {
  color: #ffffff;
  background: linear-gradient(135deg, #574bd8, #129aa0);
}

.secondary-action-btn,
.tool-btn,
.filter-btn,
.btn-light,
.btn-outline-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  color: #35445a;
  background: #ffffff;
}

.secondary-action-btn:hover,
.tool-btn:hover,
.filter-btn:hover,
.btn-light:hover,
.btn-outline-secondary:hover {
  color: var(--primary-strong);
  border-color: #b8c9e3;
  background: #f8fbff;
}

.danger-action-btn,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--danger);
  color: #ffffff;
  background: var(--danger);
}

.danger-action-btn:hover,
.btn-danger:hover {
  color: #ffffff;
  background: #a92c25;
}

.btn:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.data-table-wrap {
  width: 100%;
  overflow: auto;
  border-top: 0;
}

.data-table {
  width: 100%;
  min-width: 920px;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}

.compact-table {
  min-width: 680px;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #344054;
  background: linear-gradient(180deg, #f4f6fb, #e9eef8);
  border-bottom: 1px solid var(--border-strong);
  font-size: 12px;
  font-weight: 850;
  text-transform: none;
  white-space: nowrap;
}

.data-table td,
.data-table th {
  padding: 9px 10px;
  vertical-align: middle;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e7edf4;
}

.data-table td:last-child,
.data-table th:last-child {
  border-right: 0;
}

.data-table tbody tr {
  background: #ffffff;
}

.data-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

.data-table tbody tr:hover {
  background: #f6f4ff;
}

.data-table .table-link,
.table-link {
  color: var(--primary-strong);
  font-weight: 800;
}

.data-table .table-link:hover,
.table-link:hover {
  color: #0f3f9f;
  text-decoration: underline;
}

.action-cell {
  width: 1%;
  white-space: nowrap;
}

.muted-code {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid #d9e3ef;
  border-radius: 999px;
  color: #42526b;
  background: #f4f7fb;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.muted-cell {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.btn.compact-btn {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  flex: 0 0 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.status-badge,
.badge-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid #d9e3ef;
  color: #42526b;
  background: #f4f7fb;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.quality-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.quality-badge.warning {
  color: #7a4b00;
  background: #fff2d8;
}

.quality-badge.danger {
  color: #9f2525;
  background: #ffe6e6;
}

.quality-alerts {
  display: grid;
  gap: 8px;
}

.quality-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid #dfe8f3;
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--heading);
  font-size: 13px;
  font-weight: 800;
}

.quality-alert.warning {
  border-color: #f4d7a6;
  background: #fff8ea;
}

.quality-alert.danger {
  border-color: #f2b6b6;
  background: #fff0f0;
}

.status-badge.active,
.status-badge.success,
.badge-soft.success {
  color: var(--success);
  border-color: #b9e4ce;
  background: var(--success-soft);
}

.status-badge.warning,
.badge-soft.warning {
  color: var(--amber);
  border-color: #f4d39b;
  background: var(--amber-soft);
}

.status-badge.danger,
.badge-soft.danger,
.status-badge.deleted {
  color: var(--danger);
  border-color: #f0bab4;
  background: var(--danger-soft);
}

.contract-kind-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.contract-kind-badge.official {
  color: #1a5fa8;
  border: 1px solid #b3d4f5;
  background: #e8f2fd;
}

.contract-kind-badge.unofficial {
  color: #6b4fa0;
  border: 1px solid #d4c3f0;
  background: #f3eeff;
}

.contract-direction-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.contract-direction-badge.purchase {
  color: #1a7a4a;
  border: 1px solid #a8dfc0;
  background: #e6f7ee;
}

.contract-direction-badge.sale {
  color: #a05c1a;
  border: 1px solid #f0d0a8;
  background: #fef3e6;
}

.contract-direction-badge.both {
  color: #555;
  border: 1px solid #d0d0d0;
  background: #f5f5f5;
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.data-table th.sortable:hover {
  background: var(--hover-bg, #f0f4f9);
}

.data-table th.sortable a {
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.data-table th.sortable a .sort-icon {
  font-size: 11px;
  opacity: 0.45;
  flex-shrink: 0;
}

.data-table th.sortable.active a .sort-icon {
  opacity: 1;
  color: var(--primary, #2563eb);
}

.repair-print-page {
  padding: 20px 28px;
  background: #fff;
  min-height: 100vh;
}

.repair-print-page h1 {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 4px;
}

.repair-print-page .print-meta {
  font-size: 13px;
  color: #666;
  margin-bottom: 20px;
}

.repair-print-page .print-section {
  margin-bottom: 20px;
}

.repair-print-page .print-section h2 {
  font-size: 14px;
  font-weight: 700;
  border-bottom: 1.5px solid #333;
  padding-bottom: 4px;
  margin-bottom: 10px;
}

.repair-print-page dl.print-dl {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 4px 12px;
  font-size: 13px;
}

.repair-print-page dl.print-dl dt {
  font-weight: 600;
  color: #444;
}

.repair-print-page dl.print-dl dd {
  margin: 0;
}

.repair-print-page table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.repair-print-page table th,
.repair-print-page table td {
  border: 1px solid #ccc;
  padding: 5px 8px;
  text-align: left;
}

.repair-print-page table th {
  background: #f3f4f6;
  font-weight: 700;
}

.repair-print-page .print-total {
  text-align: right;
  margin-top: 10px;
  font-size: 14px;
  font-weight: 700;
}

@media print {
  .repair-print-page {
    padding: 0;
  }
}

.data-table.is-resizable {
  table-layout: fixed;
}

.data-table.is-resizable th {
  position: relative;
}

.data-table .column-resizer {
  position: absolute;
  top: 0;
  right: -5px;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  z-index: 4;
}

.data-table .column-resizer::after {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 4px;
  width: 2px;
  border-radius: 999px;
  background: transparent;
}

.data-table th:hover .column-resizer::after,
.data-table .column-resizer:focus-visible::after {
  background: var(--primary);
}

.data-table.is-resizable td:not(.action-cell),
.data-table.is-resizable th {
  min-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pagination {
  gap: 4px;
}

.page-link {
  border-color: var(--border);
  color: #435166;
  font-weight: 750;
}

.page-item.active .page-link {
  border-color: var(--primary);
  background: var(--primary);
}

.detail-list,
.info-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 10px;
  margin: 0;
  padding: 14px;
}

.detail-list > div,
.info-list > div,
.detail-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.42fr) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid #dfe8f3;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 10px 22px rgba(20, 44, 76, 0.05);
}

.detail-list > div:last-child,
.info-list > div:last-child,
.detail-row:last-child {
  border-bottom: 1px solid #dfe8f3;
}

.detail-list dt,
.info-list dt,
.detail-label {
  margin: 0;
  color: #6f7d90;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.35;
  text-transform: uppercase;
}

.detail-list dd,
.info-list dd,
.detail-value {
  margin: 0;
  min-width: 0;
  color: var(--heading);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.customer-picker {
  position: relative;
  min-width: 0;
}

.customer-picker-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

.customer-picker-control:focus-within {
  background: #ffffff;
  border-color: #86afe6;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.13);
}

.customer-picker-control i {
  color: var(--muted-2);
}

.customer-picker-control input {
  min-width: 0;
  width: 100%;
  height: 40px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.customer-picker-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: none;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  z-index: 50;
}

.customer-picker-results.is-open {
  display: block;
}

.customer-picker-option {
  width: 100%;
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #e8eef5;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.customer-picker-option:last-child {
  border-bottom: 0;
}

.customer-picker-option:hover,
.customer-picker-option:focus,
.customer-picker-option.is-active {
  outline: 0;
  background: #e4eeff;
}

.customer-picker-option strong {
  color: var(--heading);
  font-size: 13px;
  font-weight: 850;
}

.customer-picker-option span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.sales-lines-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}

.sales-lines-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #eef3f8;
  overflow: visible;
  padding: 8px;
}

.sales-lines-grid td.category-field-off > * {
  visibility: hidden;
}

.sales-lines-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: stretch;
  gap: 8px;
  margin-top: 8px;
}

.sales-lines-summary .lines-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 130px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  text-align: right;
}

.sales-lines-summary .lines-summary-item span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.sales-lines-summary .lines-summary-item strong {
  font-size: 16px;
  font-weight: 850;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
}

.sales-lines-summary .lines-summary-item.total {
  background: #eaf2ff;
  border-color: #b9d3ff;
}

.sales-lines-summary .lines-summary-item.total strong {
  color: #0d5bd1;
}

.sales-lines-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.sales-lines-grid {
  width: 100%;
  min-width: 0;
  margin: 0;
  display: block;
  border-collapse: initial;
  border-spacing: 0;
}

.sales-lines-grid thead {
  display: none;
}

.sales-lines-grid tbody {
  display: grid;
  gap: 8px;
}

.sales-lines-grid tbody tr {
  display: grid;
  grid-template-columns: 34px repeat(12, minmax(0, 1fr));
  gap: 8px;
  padding: 9px;
  border: 1px solid #d6dee8;
  border-radius: var(--radius);
  background: #fbfcff;
  box-shadow: var(--shadow-sm);
}

.sales-lines-grid tbody tr:hover {
  background: #ffffff;
}

.sales-lines-grid td {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 0;
  border: 0;
  vertical-align: top;
}

.sales-lines-grid td::before {
  color: #475569;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.15;
}


.sales-lines-grid .form-control,
.sales-lines-grid .form-select,
.sales-lines-grid .customer-picker-control {
  min-height: 32px;
  background-color: #ffffff;
  border-color: #aebccd;
  font-size: 12px;
}

.sales-lines-grid .customer-picker-control {
  gap: 5px;
  padding: 0 7px;
}

.sales-lines-grid .customer-picker-control input {
  height: 30px;
  font-size: 12px;
}

.sales-lines-grid .customer-picker-control i {
  font-size: 12px;
}

.sales-lines-grid .customer-picker-results {
  top: calc(100% + 4px);
  max-height: 220px;
  border-radius: var(--radius-sm);
}

.sales-lines-grid .customer-picker-option {
  gap: 2px;
  padding: 7px 9px;
}

.sales-lines-grid .customer-picker-option strong {
  font-size: 12px;
}

.sales-lines-grid .customer-picker-option span {
  font-size: 11px;
}

.sales-lines-grid td:nth-child(2) {
  grid-column: span 2;
}

.sales-lines-grid td:nth-child(3) {
  grid-column: span 3;
}

.sales-lines-grid td:nth-child(4) {
  grid-column: span 2;
}

.sales-lines-grid td:nth-child(4)::before {
  content: "Elektron qaimə";
}

.sales-lines-grid td:nth-child(5) {
  grid-column: span 2;
}

.sales-lines-grid td:nth-child(5)::before {
  content: "Anbar";
}

.sales-lines-grid td:nth-child(6) {
  grid-column: span 2;
}

.sales-lines-grid td:nth-child(6)::before {
  content: "Ölçü";
}

.sales-lines-grid td:nth-child(7),
.sales-lines-grid td:nth-child(8),
.sales-lines-grid td:nth-child(9),
.sales-lines-grid td:nth-child(10),
.sales-lines-grid td:nth-child(11),
.sales-lines-grid td:nth-child(12),
.sales-lines-grid td:nth-child(13) {
  grid-column: span 1;
  margin-top: 9px;
}

.sales-lines-grid td:nth-child(7)::before {
  content: "Miqdar";
}

.sales-lines-grid td:nth-child(8)::before {
  content: "Kəsr";
}

.sales-lines-grid td:nth-child(9)::before {
  content: "Tam miqdar";
}

.sales-lines-grid td:nth-child(10)::before {
  content: "Qiymət";
}

.sales-lines-grid td:nth-child(11)::before {
  content: "Əsas məbləğ";
}

.sales-lines-grid td:nth-child(12)::before {
  content: "ƏDV";
}

.sales-lines-grid td:nth-child(13)::before {
  content: "Toplam";
}

.sales-lines-grid td:nth-child(14) {
  grid-column: span 4;
}

.sales-lines-grid td:nth-child(14)::before {
  content: "Maşın məlumatları";
}

.sales-lines-grid td:nth-child(15) {
  grid-column: span 1;
  align-content: end;
  justify-content: end;
}

.sales-lines-grid td:nth-child(15)::before {
  content: "";
}

.sales-lines-grid td:nth-child(2)::before {
  content: "Təsnifat";
}

.sales-lines-grid td:nth-child(3)::before {
  content: "Mal və xidmət";
}

.sales-lines-grid td:nth-child(3)::before,
.sales-lines-grid td:nth-child(5)::before,
.sales-lines-grid td:nth-child(6)::before,
.sales-lines-grid td:nth-child(7)::before,
.sales-lines-grid td:nth-child(9)::before,
.sales-lines-grid td:nth-child(10)::before,
.sales-lines-grid td:nth-child(11)::before,
.sales-lines-grid td:nth-child(13)::before {
  color: #ef4444;
}

.sales-lines-grid .form-control,
.sales-lines-grid .form-select,
.sales-lines-grid .customer-picker-control,
.sales-lines-grid .customer-picker-control input {
  font-size: 13px;
}

.is-required-empty .customer-picker-control,
.form-control.is-required-empty,
.form-select.is-required-empty {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.search-picker.is-disabled {
  opacity: 0.72;
}

.search-picker.is-disabled .customer-picker-control {
  background: #eef2f7;
}

.line-no-cell {
  width: 28px;
  min-height: 28px;
  height: 28px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  align-self: start;
  justify-self: center;
  border-radius: 999px !important;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.line-no-cell::before {
  display: none;
}

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

.status-inline-form {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 4px;
  border: 1px solid #dbe5f1;
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.status-inline-form .form-select {
  width: 118px;
  min-height: 30px;
  padding: 4px 28px 4px 8px;
  font-size: 12px;
}

.status-inline-form .icon-only {
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
}

.vehicle-cell::before {
  grid-column: 1 / -1;
}

.danger-row-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #f0bab4;
  border-radius: var(--radius-sm);
  color: var(--danger);
  background: var(--danger-soft);
}

.danger-row-btn:hover {
  color: #ffffff;
  background: var(--danger);
}

.alert {
  border-radius: var(--radius);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.modal-content {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.placeholder-panel,
.error-panel {
  padding: 28px;
}

.error-panel {
  max-width: 720px;
  margin: 40px auto;
}

.error-panel h1 {
  color: var(--heading);
  font-size: 34px;
  font-weight: 900;
}

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

.quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--heading);
  background: var(--surface);
  font-weight: 800;
}

.quick-link:hover {
  color: var(--primary-strong);
  border-color: #b8c9e3;
  background: #f8fbff;
}

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

.report-health-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.report-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.report-tab {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: #ffffff;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
}

.report-tab:hover,
.report-tab.active {
  color: var(--primary-strong);
  border-color: #b8c9e3;
  background: #f7faff;
}

.report-metrics {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: #fbfcff;
}

.table-action-inline {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
}

.table-action-inline:hover {
  color: var(--primary-strong);
}

.report-health-item {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fbff;
}

.report-health-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-health-item strong {
  display: block;
  margin-top: 3px;
  color: var(--heading);
  font-size: 16px;
  font-weight: 900;
}

.list-toolbar .form-control,
.list-toolbar .form-select {
  min-height: 38px;
  color: var(--heading);
  background-color: #ffffff;
  border-color: #aebccd;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 1px rgba(174, 188, 205, 0.18);
}

.list-toolbar .form-control:focus,
.list-toolbar .form-select:focus {
  background-color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(115, 102, 255, 0.16);
}

.list-toolbar .form-select {
  width: auto;
  min-width: 130px;
  max-width: none;
  flex: 1 1 150px;
}

.list-toolbar .toolbar-date {
  flex: 0 1 170px;
  min-width: 140px;
}

.multi-select-filter {
  position: relative;
  min-width: 130px;
  flex: 1 1 150px;
}

.multi-select-button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}

.multi-select-label {
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-select-filter.has-selection .multi-select-button {
  color: var(--heading);
  border-color: #8da2bd;
}

.multi-select-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  display: none;
  overflow: auto;
  padding: 6px;
  border: 1px solid #cbd7e6;
  border-radius: var(--radius-sm);
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(21, 32, 54, 0.16);
}

.multi-select-filter.is-open .multi-select-menu {
  display: grid;
  gap: 3px;
}

.multi-select-option {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 7px 8px;
  border-radius: 7px;
  color: var(--heading);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.multi-select-option:hover {
  background: #f1f5fb;
}

.multi-select-option input {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  accent-color: var(--primary);
}

.multi-select-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-toolbar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: #f3f6fa;
  justify-content: flex-start;
  flex-wrap: nowrap;
}

.search-field {
  position: relative;
  min-width: 180px;
  width: auto;
  flex: 2 1 260px;
}

.search-field i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
}

.search-field .form-control {
  padding-left: 38px;
}

.list-toolbar .filter-btn,
.list-toolbar .tool-btn,
.list-toolbar .primary-action-btn {
  flex: 0 0 auto;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.row-actions form {
  display: inline-flex;
  margin: 0;
}

.action-stack {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.table-action-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #dde5ef;
  border-radius: var(--radius-sm);
  color: #526176;
  background: #ffffff;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.table-action-btn:hover {
  color: #ffffff;
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), #18b7be);
  transform: translateY(-1px);
}

.list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 20px;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.result-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.empty-cell {
  padding: 24px !important;
  color: var(--muted);
  text-align: center;
  font-weight: 750;
}

.print-body {
  min-height: 100vh;
  background: #e4e9f0;
}

.barcode-print-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.barcode-label {
  width: min(100%, 420px);
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 24px 26px 22px;
  border: 1px solid #c8d3df;
  border-radius: var(--radius);
  color: var(--heading);
  background: #ffffff;
  box-shadow: var(--shadow-md);
}

.barcode-label h1 {
  width: 100%;
  margin: 0;
  color: var(--heading);
  font-size: 18px;
  line-height: 1.25;
  font-weight: 850;
  text-align: center;
  overflow-wrap: anywhere;
}

.barcode-svg {
  width: 100%;
  max-width: 340px;
  min-height: 92px;
  display: block;
  padding: 10px 12px;
  border: 1px solid #dde5ef;
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.barcode-code {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border: 1px solid #d8e1ec;
  border-radius: 999px;
  color: #172033;
  background: #f4f7fb;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-align: center;
  overflow-wrap: anywhere;
}

.mobile-drawer {
  background: #ffffff;
}

.mobile-drawer .offcanvas-header {
  border-bottom: 1px solid var(--border);
}

.mobile-drawer .sidebar-nav {
  gap: 4px;
}

.mobile-drawer .nav-item.active::before {
  left: 0;
}

.data-table-wrap::-webkit-scrollbar,
.sales-lines-scroll::-webkit-scrollbar,
.customer-picker-results::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.data-table-wrap::-webkit-scrollbar-thumb,
.sales-lines-scroll::-webkit-scrollbar-thumb,
.customer-picker-results::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #c6d2df;
}

@media (max-width: 1399.98px) {
  .dense-form-grid {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }
}

@media (max-width: 991.98px) {
  .app-shell {
    display: block;
  }

  .app-content {
    padding: 14px;
  }

  .topbar {
    min-height: 62px;
    padding: 12px 16px;
  }

  .topbar h1 {
    font-size: 19px;
  }

  .topbar-actions .icon-btn {
    display: none;
  }

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

  .form-field.wide {
    grid-column: span 2;
  }

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

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

  .panel-header,
  .panel-header.compact,
  .list-panel-header,
  .page-heading,
  .section-heading,
  .entity-page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-actions,
  .list-toolbar,
  .entity-page-header > .btn,
  .entity-page-header > .detail-actions,
  .detail-actions {
    width: 100%;
  }

  .entity-page-header > .btn,
  .entity-page-header > .detail-actions,
  .detail-actions {
    margin-left: 0;
    justify-content: flex-start;
  }

  .list-toolbar {
    flex-wrap: wrap;
  }

  .search-field,
  .list-toolbar .form-select {
    min-width: 180px;
  }

  .sales-lines-grid tbody tr {
    grid-template-columns: 32px repeat(6, minmax(0, 1fr));
  }

  .sales-lines-grid td:nth-child(1) {
    grid-column: 1;
  }

  .sales-lines-grid td:nth-child(2),
  .sales-lines-grid td:nth-child(3),
  .sales-lines-grid td:nth-child(4),
  .sales-lines-grid td:nth-child(5),
  .sales-lines-grid td:nth-child(14) {
    grid-column: span 6;
  }

  .sales-lines-grid td:nth-child(6),
  .sales-lines-grid td:nth-child(7),
  .sales-lines-grid td:nth-child(8),
  .sales-lines-grid td:nth-child(9),
  .sales-lines-grid td:nth-child(10),
  .sales-lines-grid td:nth-child(11),
  .sales-lines-grid td:nth-child(12),
  .sales-lines-grid td:nth-child(13) {
    grid-column: span 3;
  }

  .sales-lines-grid td:nth-child(15) {
    grid-column: span 6;
  }

  .detail-list,
  .info-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .auth-shell {
    padding: 16px;
  }

  .login-panel {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 150px;
    padding: 22px;
  }

  .login-visual::after {
    display: none;
  }

  .login-visual h1 {
    margin-top: 10px;
    font-size: 22px;
  }

  .login-form {
    padding: 24px;
  }

  .app-content {
    padding: 12px;
  }

  .metric-grid,
  .metrics-grid,
  .stat-grid,
  .report-health-grid,
  .content-grid,
  .quick-links,
  .two-column-grid,
  .form-grid,
  .dense-form-grid {
    grid-template-columns: 1fr;
  }

  .form-field.wide {
    grid-column: auto;
  }

  .entity-form {
    padding: 12px;
  }

  .detail-header p {
    border-radius: var(--radius-sm);
  }

  .detail-list,
  .info-list {
    padding: 12px;
  }

  .detail-list > div,
  .info-list > div,
  .detail-row {
    grid-template-columns: 1fr;
    gap: 5px;
    min-height: 0;
    padding: 11px;
  }

  .panel-header,
  .panel-header.compact,
  .list-panel-header {
    padding: 12px;
  }

  .metric-card {
    min-height: 82px;
    padding: 13px;
  }

  .metric-card strong {
    font-size: 21px;
  }

  .user-chip span {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .customer-table {
    min-width: 0;
    border-collapse: separate;
  }

  .customer-table thead {
    display: none;
  }

  .customer-table,
  .customer-table tbody,
  .customer-table tr,
  .customer-table td {
    display: block;
    width: 100%;
  }

  .customer-table tr {
    margin: 0 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }

  .customer-table td {
    display: grid;
    grid-template-columns: minmax(110px, 38%) minmax(0, 1fr);
    gap: 10px;
    padding: 10px 12px;
    border-right: 0;
    text-align: left;
    white-space: normal !important;
  }

  .customer-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
  }

  .customer-table .action-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .customer-table .action-cell::before {
    display: none;
  }

  .sales-lines-editor {
    padding: 8px;
  }

  .sales-lines-grid tbody tr {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .sales-lines-grid td,
  .sales-lines-grid td:nth-child(n) {
    grid-column: auto;
  }

  .line-no-cell {
    width: 28px;
    min-height: 28px;
    justify-content: center;
    padding: 0 !important;
  }

  .vehicle-cell {
    grid-template-columns: 1fr;
  }

  .data-table.is-resizable colgroup,
  .data-table .column-resizer {
    display: none;
  }

  .data-table.is-resizable {
    table-layout: auto;
  }
}

@media (max-width: 480px) {
  .topbar {
    gap: 8px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
  }

  .user-chip {
    padding: 0 10px;
  }

  .form-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .form-actions .btn,
  .form-actions button,
  .form-actions a {
    width: 100%;
  }

  .customer-table td {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  @page {
    margin: 8mm;
  }

  .sidebar,
  .topbar,
  .mobile-drawer,
  .app-content > .alert,
  .no-print {
    display: none !important;
  }

  .app-shell,
  .app-main,
  .app-content {
    display: block;
    padding: 0;
    min-height: auto;
  }

  .panel,
  .login-panel,
  .error-panel {
    border: 0;
    box-shadow: none;
  }

  .print-body {
    min-height: auto;
    background: #ffffff;
  }

  .barcode-print-page {
    min-height: auto;
    display: block;
    padding: 0;
  }

  .barcode-label {
    width: 72mm;
    max-width: 100%;
    margin: 0 auto;
    padding: 5mm 5mm 4mm;
    border: 0.35mm solid #111827;
    border-radius: 2mm;
    box-shadow: none;
    break-inside: avoid;
  }

  .barcode-label h1 {
    font-size: 11pt;
  }

  .barcode-svg {
    max-width: 62mm;
    min-height: 24mm;
    padding: 2mm;
    border: 0;
  }

  .barcode-code {
    min-height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: #111827;
    font-size: 10pt;
  }
}

/* Compact ERP theme inspired by desktop accounting systems. */
:root {
  --app-bg: #eef1f5;
  --app-bg-2: #e6ebf1;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --surface-strong: #edf2f7;
  --border: #c8d1dc;
  --border-strong: #aeb9c7;
  --shadow-sm: none;
  --shadow-md: 0 10px 24px rgba(15, 23, 42, 0.08);
  --radius: 4px;
  --radius-sm: 3px;
  --sidebar-width: 214px;
}

body {
  background: #eef1f5;
  font-size: 13px;
}

.sidebar {
  gap: 8px;
  padding: 8px 7px;
  background: #f8fafc;
  border-right-color: #cbd5e1;
  box-shadow: none;
}

.sidebar-brand {
  min-height: 44px;
  gap: 8px;
  padding: 5px 5px 8px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  border-radius: 4px;
  font-size: 12px;
  box-shadow: none;
}

.sidebar-brand strong {
  font-size: 13px;
  line-height: 1.1;
}

.sidebar-brand small {
  font-size: 10px;
}

.sidebar-nav {
  gap: 1px;
}

.nav-item {
  min-height: 30px;
  gap: 7px;
  padding: 5px 7px;
  border-radius: 3px;
  color: #334155;
  font-size: 13px;
  font-weight: 650;
}

.nav-item i {
  width: 17px;
  flex-basis: 17px;
  font-size: 15px;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(115, 102, 255, 0.92), rgba(24, 183, 190, 0.86));
  box-shadow: none;
}

.nav-group {
  gap: 1px;
}

.nav-subitems {
  margin-left: 18px;
  padding-left: 10px;
}

.nav-subitem {
  min-height: 26px;
  padding: 4px 7px;
  font-size: 12px;
  font-weight: 650;
}

.topbar {
  min-height: 44px;
  padding: 7px 12px;
  background: #ffffff;
  border-bottom-color: #cbd5e1;
  backdrop-filter: none;
}

.topbar h1 {
  font-size: 16px;
  font-weight: 780;
}

.topbar p {
  display: none;
}

.topbar-title {
  gap: 7px;
}

.topbar-actions,
.panel-actions,
.detail-actions,
.form-actions {
  gap: 5px;
}

.icon-btn,
.tool-btn,
.filter-btn,
.primary-action-btn,
.secondary-action-btn,
.danger-action-btn,
.btn,
.user-chip {
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 650;
  box-shadow: none;
}

.icon-btn {
  width: 30px;
  height: 30px;
}

.user-chip {
  min-height: 30px;
}

.app-content {
  padding: 14px 16px;
}

.page-heading,
.section-heading,
.entity-page-header {
  min-height: 34px;
  align-items: center;
  margin-bottom: 6px;
  padding: 0 2px;
}

/* Detail (show-page) header keeps its card look in the dense layer */
.detail-header.entity-page-header {
  min-height: 0;
  align-items: flex-end;
  margin-bottom: 12px;
  padding: 12px 14px;
}

.page-heading h2,
.section-heading h2,
.entity-page-header h2 {
  font-size: 16px;
  font-weight: 760;
}

.page-heading p,
.section-heading p,
.entity-page-header p {
  margin-top: 1px;
  font-size: 11px;
}

.metric-grid,
.metrics-grid,
.stat-grid {
  gap: 6px;
  margin-bottom: 8px;
}

.metric-card {
  min-height: 54px;
  padding: 8px 10px;
  border-radius: 4px;
  box-shadow: none;
}

.metric-card::before,
.metric-card::after {
  display: none;
}

.metric-card span {
  font-size: 11px;
}

.metric-card strong {
  margin-top: 1px;
  font-size: 18px;
}

.panel,
.error-panel {
  border-radius: 4px;
  box-shadow: none;
}

.panel-header,
.panel-header.compact,
.list-panel-header {
  min-height: 38px;
  padding: 6px 8px;
  border-bottom-color: #cbd5e1;
}

.panel-header h2 {
  font-size: 15px;
  font-weight: 760;
}

.panel-header p {
  display: none;
}

.panel-body,
.panel-content,
.form-panel,
.sales-form-panel {
  padding: 8px;
}

.form-section-title {
  margin: 4px 0 6px;
  padding: 4px 6px;
  border: 1px solid #d6dee8;
  border-radius: 3px;
  background: #f7f9fc;
  color: #334155;
  font-size: 12px;
  font-weight: 760;
}

.entity-form,
.dense-entity-form {
  gap: 8px;
}

.form-grid,
.dense-form-grid {
  gap: 7px 10px;
}

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

.form-label {
  margin-bottom: 3px;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
}

.form-control,
.form-select {
  min-height: 28px;
  padding: 4px 7px;
  border-radius: 3px;
  border-color: #aeb9c7;
  font-size: 12px;
  box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.04);
}

textarea.form-control {
  min-height: 56px;
}

.input-action .btn {
  min-width: 30px;
  min-height: 28px;
}

.customer-picker-control {
  min-height: 28px;
  padding: 0 7px;
  border-radius: 3px;
  border-color: #aeb9c7;
}

.customer-picker-control input {
  height: 26px;
  font-size: 12px;
}

.customer-picker-results,
.multi-select-menu {
  border-radius: 3px;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.14);
}

.customer-picker-results.is-floating {
  position: fixed;
  right: auto;
  bottom: auto;
  z-index: 3000;
  max-height: 270px;
  overflow: auto;
  border: 1px solid #aeb9c7;
  background: #ffffff;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.2);
}

.sales-document-form {
  min-width: 0;
  overflow: visible;
}

.sales-document-form .form-actions {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
  padding: 7px 0 0;
  border-top: 1px solid #d6dee8;
  transform: none;
}

.sales-document-form .sales-lines-editor,
.sales-document-form .sales-lines-scroll {
  max-width: 100%;
  min-width: 0;
}

.list-toolbar {
  min-height: 44px;
  padding: 6px 8px;
  gap: 6px;
  border-bottom-color: #cbd5e1;
  background: #f7f9fc;
}

.search-field {
  min-width: 180px;
  flex: 2 1 260px;
}

.list-toolbar .form-control,
.list-toolbar .form-select,
.multi-select-button {
  min-height: 28px;
  font-size: 12px;
  box-shadow: none;
}

.list-toolbar .form-select,
.multi-select-filter {
  min-width: 136px;
  flex: 1 1 150px;
}

.multi-select-option {
  min-height: 28px;
  padding: 5px 7px;
  font-size: 12px;
  font-weight: 650;
}

.data-table-wrap {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  box-shadow: none;
}

.data-table {
  font-size: 12px;
}

.data-table thead th {
  padding: 5px 7px;
  border-color: #c4ceda;
  color: #334155;
  background: #edf2f7;
  font-size: 11px;
  font-weight: 760;
}

.data-table td,
.data-table th {
  height: 28px;
  padding: 4px 7px;
  border-color: #d5dde7;
}

.data-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

.data-table tbody tr:hover {
  background: #fff7d6;
}

.table-action-btn {
  width: 25px;
  height: 25px;
  border-radius: 3px;
}

.status-badge,
.quality-badge,
.muted-code {
  border-radius: 3px;
  font-size: 11px;
}

.list-footer {
  min-height: 36px;
  padding: 6px 8px;
}

.pagination-clean .page-link {
  min-width: 28px;
  min-height: 28px;
  padding: 4px 7px;
}

.sales-lines-heading {
  margin-top: 4px;
}

.sales-lines-editor {
  padding: 5px;
  border-radius: 3px;
  background: #f1f5f9;
}

.sales-lines-grid tbody {
  gap: 5px;
}

.sales-lines-grid tbody tr {
  gap: 5px;
  padding: 6px;
  border-radius: 3px;
  box-shadow: none;
}

.sales-lines-grid td {
  gap: 2px;
}

.sales-lines-grid td::before {
  font-size: 10px;
}

.sales-lines-grid .form-control,
.sales-lines-grid .form-select,
.sales-lines-grid .customer-picker-control,
.sales-lines-grid .customer-picker-control input {
  min-height: 26px;
  font-size: 12px;
}

.line-no-cell {
  width: 24px;
  min-height: 24px;
  height: 24px;
  border-radius: 3px;
  font-size: 11px;
}

.detail-list,
.info-list {
  gap: 6px;
}

.detail-list > div,
.info-list > div {
  min-height: 44px;
  padding: 7px 8px;
  border-radius: 3px;
}

.detail-list dt,
.info-list dt {
  font-size: 10px;
}

.detail-list dd,
.info-list dd {
  font-size: 12px;
}

@media (max-width: 991.98px) {
  .app-content {
    padding: 6px;
  }

  .topbar {
    min-height: 42px;
    padding: 6px 8px;
  }

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

  .list-toolbar {
    flex-wrap: wrap;
  }

  .search-field,
  .list-toolbar .form-select,
  .multi-select-filter {
    min-width: 160px;
  }
}

@media (max-width: 767.98px) {
  body {
    font-size: 12px;
  }

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

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

  .panel,
  .data-table-wrap {
    border-radius: 3px;
  }

  .list-toolbar {
    align-items: stretch;
  }

  .search-field,
  .list-toolbar .form-select,
  .multi-select-filter,
  .filter-btn {
    width: 100%;
    flex: 1 1 100%;
  }

  .data-table td {
    min-height: 30px;
    padding: 5px 7px;
  }

  .sales-lines-grid tbody tr {
    grid-template-columns: 28px repeat(4, minmax(0, 1fr));
  }
}

/* 1C-like document workspace for sales documents. */
.sales-document-page .entity-page-header {
  margin-bottom: 4px;
}

.sales-document-panel .panel-header {
  min-height: 30px;
  padding: 4px 7px;
  background: #f8fafc;
}

.sales-document-form .form-section-title:not(.sales-lines-heading) {
  border: 0;
  border-bottom: 1px solid #cbd5e1;
  border-radius: 0;
  background: transparent;
  padding: 2px 0 5px;
  margin: 2px 0 7px;
}

@media (min-width: 768px) {
  .sales-document-form .dense-form-grid {
    grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr);
    gap: 5px 36px;
    align-items: start;
  }

  .sales-document-form .form-field {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    min-height: 28px;
  }

  .sales-document-form .form-field:has(textarea) {
    align-items: start;
  }

  .sales-document-form .form-label {
    margin: 0;
    color: #475569;
    font-size: 12px;
    font-weight: 650;
    text-align: left;
  }

  .sales-document-form textarea.form-control {
    min-height: 38px;
  }

  .sales-lines-heading {
    min-height: 31px;
    display: flex;
    justify-content: flex-start;
    gap: 0;
    margin: 8px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .sales-lines-heading > span {
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border: 1px solid #cbd5e1;
    border-bottom-color: #ffffff;
    border-radius: 4px 4px 0 0;
    background: #ffffff;
    color: #172033;
    font-size: 12px;
    font-weight: 700;
  }

  .sales-lines-heading .sales-lines-add-secondary {
    margin-left: auto;
    align-self: center;
  }

  .sales-lines-editor {
    border-radius: 0 3px 3px 3px;
    border-color: #cbd5e1;
    background: #ffffff;
    padding: 7px 8px 12px;
  }

  .sales-lines-scroll {
    overflow-x: auto;
    overflow-y: visible;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    padding-bottom: 6px;
  }

  .sales-lines-grid {
    min-width: 1585px;
    display: table;
    table-layout: fixed;
    border-collapse: collapse;
    border-spacing: 0;
  }

  .sales-lines-grid thead {
    display: table-header-group;
  }

  .sales-lines-grid tbody {
    display: table-row-group;
  }

  .sales-lines-grid tbody tr {
    display: table-row;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #fff7c7;
  }

  .sales-lines-grid tbody tr:hover {
    background: #fff3ad;
  }

  .sales-lines-grid th,
  .sales-lines-grid td {
    display: table-cell;
    height: 27px;
    padding: 0;
    border: 1px solid #d5dde7;
    vertical-align: middle;
    background: transparent;
  }

  .sales-lines-grid th {
    padding: 5px 7px;
    color: #334155;
    background: #edf2f7;
    font-size: 11px;
    font-weight: 760;
    white-space: nowrap;
  }

  .sales-lines-grid td::before,
  .sales-lines-grid th::before {
    display: none !important;
  }

  .sales-lines-grid th.req-col {
    color: #ef4444;
  }

  .sales-lines-grid th:nth-child(1),
  .sales-lines-grid td:nth-child(1) { width: 42px; text-align: center; }
  .sales-lines-grid th:nth-child(2),
  .sales-lines-grid td:nth-child(2) { width: 140px; }
  .sales-lines-grid th:nth-child(3),
  .sales-lines-grid td:nth-child(3) { width: 260px; }
  .sales-lines-grid th:nth-child(4),
  .sales-lines-grid td:nth-child(4) { width: 190px; }
  .sales-lines-grid th:nth-child(5),
  .sales-lines-grid td:nth-child(5) { width: 150px; }
  .sales-lines-grid th:nth-child(6),
  .sales-lines-grid td:nth-child(6) { width: 78px; }
  .sales-lines-grid th:nth-child(7),
  .sales-lines-grid td:nth-child(7),
  .sales-lines-grid th:nth-child(8),
  .sales-lines-grid td:nth-child(8),
  .sales-lines-grid th:nth-child(9),
  .sales-lines-grid td:nth-child(9) { width: 92px; }
  .sales-lines-grid th:nth-child(10),
  .sales-lines-grid td:nth-child(10),
  .sales-lines-grid th:nth-child(11),
  .sales-lines-grid td:nth-child(11),
  .sales-lines-grid th:nth-child(12),
  .sales-lines-grid td:nth-child(12),
  .sales-lines-grid th:nth-child(13),
  .sales-lines-grid td:nth-child(13) { width: 108px; }
  .sales-lines-grid th:nth-child(14),
  .sales-lines-grid td:nth-child(14) { width: 250px; }
  .sales-lines-grid th:nth-child(15),
  .sales-lines-grid td:nth-child(15) { width: 42px; }

  .sales-lines-grid .line-no-cell {
    width: auto;
    min-height: 0;
    height: auto;
    display: table-cell !important;
    border-radius: 0 !important;
    color: #172033;
    background: #fff0a6;
    font-size: 12px;
    font-weight: 700;
  }

  .sales-lines-grid .form-control,
  .sales-lines-grid .form-select,
  .sales-lines-grid .customer-picker-control {
    width: 100%;
    min-height: 26px;
    height: 26px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 12px;
  }

  .sales-lines-grid .form-control:focus,
  .sales-lines-grid .form-select:focus,
  .sales-lines-grid .customer-picker-control:focus-within {
    background: #ffffff;
    box-shadow: inset 0 0 0 2px rgba(115, 102, 255, 0.35);
  }

  .sales-lines-grid .customer-picker-control {
    padding: 0 5px;
    gap: 4px;
  }

  .sales-lines-grid .customer-picker-control input {
    height: 24px;
    font-size: 12px;
  }

  .vehicle-cell {
    display: flex !important;
    gap: 1px;
  }

  .vehicle-cell .form-control {
    min-width: 0;
    border-right: 1px solid #d5dde7;
  }

  .vehicle-cell .form-control:last-child {
    border-right: 0;
  }

  .sales-lines-grid .danger-row-btn {
    width: 26px;
    height: 24px;
    min-height: 24px;
    margin: 1px auto;
  }
}

@media (max-width: 767.98px) {
  .sales-document-form .form-field {
    display: grid;
    gap: 3px;
  }

  .sales-lines-editor::before {
    display: none;
  }
}

/* ── Filter Modal ─────────────────────────────────────────────────────── */
.filter-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(15, 23, 42, 0.35);
  display: none;
  align-items: stretch;
  justify-content: flex-end;
}
.filter-modal-overlay.open {
  display: flex;
}
.filter-modal-panel {
  width: 400px;
  max-width: 100vw;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 32px rgba(0, 0, 0, 0.14);
  animation: filterSlideIn 0.2s ease;
}
@keyframes filterSlideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.filter-modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
}
.filter-modal-header strong {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}
.filter-modal-close {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #64748b;
  display: flex;
  align-items: center;
  border-radius: 4px;
  line-height: 1;
}
.filter-modal-close:hover { background: #f1f5f9; color: #1e293b; }
.filter-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.filter-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-section-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
}
.filter-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.filter-checkbox-group label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 6px;
  transition: background 0.1s;
}
.filter-checkbox-group label:hover { background: #f8fafc; }
.filter-checkbox-group input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.filter-date-range {
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-date-range span {
  color: #94a3b8;
  font-size: 13px;
  flex-shrink: 0;
}
.filter-date-range .form-control {
  flex: 1;
  min-width: 0;
}
.filter-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.filter-modal-footer .btn:first-child { margin-right: auto; }
.filter-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  margin-left: 2px;
}
.filter-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 0 -20px;
}
.filter-search-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.filter-search-picker-input {
  width: 100%;
  box-sizing: border-box;
  font-size: 12px;
  padding: 5px 8px;
  height: 30px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  color: #1e293b;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.filter-search-picker-input:focus {
  border-color: var(--primary);
  background: #fff;
}
.filter-search-picker-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
}
.filter-search-picker-list label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 6px;
  transition: background 0.1s;
  user-select: none;
}
.filter-search-picker-list label:hover { background: #f8fafc; }
.filter-search-picker-list input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.filter-search-picker-empty {
  font-size: 12px;
  color: #94a3b8;
  padding: 4px 8px;
  text-align: center;
}
@media (max-width: 600px) {
  .filter-modal-panel { width: 100vw; }
}

.is-access-disabled,
[data-access-disabled="true"] {
  background-color: var(--bs-secondary-bg) !important;
  cursor: not-allowed !important;
}

.access-denied-note {
  font-size: .78rem;
  color: var(--bs-secondary-color);
}

/* ── Debitor/Kreditor qruplaşdırma seçici ─────────────── */
.report-group-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: #f6f8fc;
  flex-wrap: wrap;
}

.report-group-bar-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.report-group-seg {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-wrap: wrap;
  background: #fff;
}

.report-group-seg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  text-decoration: none;
  border-right: 1px solid var(--border);
  transition: background 0.14s, color 0.14s;
  white-space: nowrap;
  line-height: 1.3;
}

.report-group-seg-item:last-child {
  border-right: none;
}

.report-group-seg-item i {
  font-size: 13px;
  opacity: 0.75;
}

.report-group-seg-item:hover {
  background: #eef2ff;
  color: var(--primary-strong);
  text-decoration: none;
}

.report-group-seg-item:hover i {
  opacity: 1;
}

.report-group-seg-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.report-group-seg-item.active i {
  opacity: 1;
}

@media (max-width: 768px) {
  .report-group-bar {
    padding: 8px 12px;
    gap: 8px;
  }
  .report-group-bar-label {
    display: none;
  }
  .report-group-seg {
    flex-wrap: wrap;
    width: 100%;
  }
  .report-group-seg-item {
    flex: 1 1 auto;
    justify-content: center;
    padding: 6px 10px;
    font-size: 12px;
  }
  .report-group-seg-item span {
    display: none;
  }
  .report-group-seg-item i {
    font-size: 15px;
    opacity: 1;
  }
}

/* Bulk action bar */
.bulk-action-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  background: #eef3ff;
  border-bottom: 1px solid #c7d4f5;
  flex-wrap: wrap;
}
.bulk-action-bar .bulk-count {
  font-size: 13px;
  color: var(--text-secondary, #555);
  white-space: nowrap;
}
.bulk-action-bar .form-select {
  font-size: 13px;
  padding: 4px 8px;
  height: auto;
  min-width: 160px;
}
.bulk-check-col {
  width: 36px;
  text-align: center;
}
.bulk-check-col input[type="checkbox"] {
  cursor: pointer;
}
.data-table tbody tr.bulk-row-selected,
.data-table tbody tr.bulk-row-selected:nth-child(even),
.data-table tbody tr.bulk-row-selected:hover {
  background: #cfe1ff;
  --bs-table-bg: #cfe1ff;
  --bs-table-hover-bg: #bed6ff;
  color: #0f1f3d;
  box-shadow: inset 5px 0 0 #1d4ed8;
}
.data-table tbody tr.bulk-row-selected > th,
.data-table tbody tr.bulk-row-selected > td,
.data-table tbody tr.bulk-row-selected:nth-child(even) > th,
.data-table tbody tr.bulk-row-selected:nth-child(even) > td,
.data-table tbody tr.bulk-row-selected:hover > th,
.data-table tbody tr.bulk-row-selected:hover > td {
  background: #cfe1ff;
  --bs-table-bg: #cfe1ff;
  --bs-table-accent-bg: #cfe1ff;
}
.data-table tbody tr.bulk-row-selected > td {
  border-bottom-color: #8fb9ff;
}
.data-table tbody tr.bulk-row-selected .bulk-check-col {
  background: #a9c8ff;
}
.data-table tbody tr.bulk-row-selected .table-link {
  color: #143f8f;
  font-weight: 700;
}

/* Admin workspace */
.admin-surface {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 100%;
}

.admin-page-header {
  padding: 16px 18px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(31, 41, 55, 0.06);
}

.admin-page-header .page-title {
  font-size: 24px;
  line-height: 1.2;
}

.admin-primary-action {
  min-height: 38px;
  padding-inline: 14px;
}

.admin-list-card,
.admin-form-card,
.admin-access-card {
  border-color: #dbe3ee;
  box-shadow: 0 10px 26px rgba(31, 41, 55, 0.07);
  overflow: hidden;
}

.admin-card-header,
.admin-access-card > .card-header {
  background: #f7f9fc;
  border-bottom: 1px solid #dbe3ee;
}

.admin-table-wrap,
.admin-matrix-wrap {
  scrollbar-width: thin;
  scrollbar-color: #b8c4d4 #eef2f7;
}

.admin-table thead th {
  background: #f7f9fc;
  color: #526071;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-table td {
  vertical-align: middle;
}

.admin-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-row-actions .btn {
  border-radius: 6px !important;
  padding: 5px 9px;
  font-size: 12px;
}

.admin-form-card .card-body {
  padding: 20px;
}

.admin-access-tabs {
  position: sticky;
  top: 0;
  z-index: 7;
  padding-bottom: 0;
}

.admin-access-tabs .nav-tabs {
  gap: 4px;
  border-bottom: 0;
}

.admin-access-tabs .nav-link {
  border: 0;
  border-radius: 7px 7px 0 0;
  color: #5c6678;
  font-weight: 650;
  padding: 10px 13px;
}

.admin-access-tabs .nav-link:hover {
  background: #eef3f9;
  color: #263244;
}

.admin-access-tabs .nav-link.active {
  background: #fff;
  color: #182235;
  box-shadow: inset 0 2px 0 #18b7be;
}

.admin-tab-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid #e3e9f1;
  background: #fbfcff;
  color: #5f6d7d;
  font-size: 12.5px;
}

.admin-tab-intro strong {
  color: #1f2937;
  font-size: 13.5px;
}

.admin-matrix-wrap {
  max-height: 68vh;
  overflow: auto;
}

.admin-matrix-table {
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}

.admin-matrix-table th,
.admin-matrix-table td {
  white-space: nowrap;
}

.admin-matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f4f7fb;
  color: #536173;
  border-bottom: 1px solid #d8e1ec;
}

.admin-matrix-table thead th:first-child,
.admin-matrix-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 4;
  background: #fff;
  box-shadow: 1px 0 0 #e1e7ef;
}

.admin-matrix-table thead th:first-child {
  z-index: 6;
  background: #f4f7fb;
}

.admin-matrix-table .admin-group-row td {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #eaf7f8;
  color: #0f646b;
  border-top: 1px solid #c9ecef;
  border-bottom: 1px solid #c9ecef;
}

.admin-permission-row:hover td {
  background: #f8fbff;
}

.admin-matrix-table .form-check-input {
  width: 17px;
  height: 17px;
  cursor: pointer;
}

.access-effect-select {
  width: 86px;
  min-width: 86px;
  margin: auto;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 6px;
}

.access-effect-select[data-effect="allow"] {
  border-color: #12805c;
  background: #e7f6ee;
  color: #0b6246;
}

.access-effect-select[data-effect="deny"] {
  border-color: #ef5b5b;
  background: #fff0f0;
  color: #b42318;
}

.admin-accordion .accordion-item {
  border-color: #e2e8f0;
}

.admin-accordion .accordion-button {
  gap: 8px;
  background: #fff;
}

.admin-accordion .accordion-button:not(.collapsed) {
  background: #f3f8fb;
  color: #1f2937;
  box-shadow: inset 3px 0 0 #18b7be;
}

.admin-field-table {
  min-width: 620px;
}

.admin-field-table tbody tr:hover {
  background: #f8fbff;
}

.admin-field-table select.form-select {
  width: 104px !important;
  margin: auto !important;
  border-radius: 6px;
}

.admin-scope-pane {
  background: #fff;
}

.admin-scope-card {
  min-height: 100%;
  padding: 12px;
  border: 1px solid #e1e7ef;
  border-radius: 8px;
  background: #fbfcff;
}

.scope-action-flags {
  padding: 8px;
  border-radius: 7px;
  background: #f2f6fa;
  border: 1px solid #e1e7ef;
}

.admin-check-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.admin-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  margin: 0;
  padding: 5px 7px;
  border-radius: 6px;
}

.admin-check-row:hover {
  background: #eef6f8;
}

.admin-chip-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-chip-checks .form-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 7px 10px 7px 30px;
  border: 1px solid #dce4ee;
  border-radius: 999px;
  background: #fff;
}

.admin-chip-checks .form-check-input {
  margin-left: -20px;
}

.admin-chip-checks .form-check:has(.form-check-input:checked) {
  border-color: #18b7be;
  background: #e9fbfb;
  color: #0f646b;
}

.admin-docstatus-pane {
  background: #fff;
}

.admin-sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 8;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -8px 22px rgba(31, 41, 55, 0.08);
  backdrop-filter: blur(8px);
}

.admin-key-card {
  padding: 12px;
  border: 1px solid #e1e7ef;
  border-radius: 8px;
  background: #fbfcff;
}

.admin-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf2f7;
  color: #435065;
  font-size: 12px;
}

@media (max-width: 768px) {
  .admin-page-header {
    padding: 14px;
  }
  .admin-page-header .page-title {
    font-size: 21px;
  }
  .admin-tab-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .admin-access-tabs {
    position: static;
  }
  .admin-access-tabs .nav-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .admin-access-tabs .nav-link {
    width: 100%;
    border-radius: 7px;
    background: #eef3f9;
  }
  .admin-matrix-wrap {
    max-height: none;
  }
  .admin-sticky-actions {
    justify-content: stretch !important;
  }
  .admin-sticky-actions .btn {
    flex: 1 1 0;
  }
}

/* Admin modern redesign */
.admin-surface {
  gap: 18px;
}

.admin-page-header {
  position: relative;
  overflow: hidden;
  padding: 18px 20px;
  border: 1px solid #e2e8ee;
  background:
    linear-gradient(135deg, rgba(24, 183, 190, 0.1), rgba(255, 255, 255, 0) 42%),
    #ffffff;
}

.admin-page-header::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #18b7be, #12805c);
}

.admin-page-header .text-muted {
  max-width: 760px;
}

.admin-access-card {
  border: 1px solid #dfe7ef;
  background: #ffffff;
}

.admin-access-tabs {
  padding: 10px 12px 0;
  background: #f8fafc;
}

.admin-access-tabs .nav-tabs {
  gap: 8px;
}

.admin-access-tabs .nav-link {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
  color: #526071;
  background: transparent;
}

.admin-access-tabs .nav-link.active {
  border-color: #dfe7ef #dfe7ef #ffffff;
  background: #ffffff;
  box-shadow: inset 0 3px 0 #18b7be;
}

.admin-tab-intro {
  padding: 15px 18px;
  background: #ffffff;
}

.admin-permission-designer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  background: #f7fafc;
}

.admin-permission-section {
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.admin-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #e5ebf2;
  background: #fbfcfe;
}

.admin-section-heading span {
  color: #1f2937;
  font-weight: 750;
}

.admin-section-heading small {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e9fbfb;
  color: #0f646b;
  font-weight: 700;
}

.admin-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 12px;
  padding: 14px;
}

.admin-module-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 13px;
  border: 1px solid #e3eaf1;
  border-radius: 8px;
  background: #ffffff;
  transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s;
}

.admin-module-card:hover {
  border-color: #b9dfe3;
  box-shadow: 0 10px 24px rgba(31, 41, 55, 0.08);
  transform: translateY(-1px);
}

.admin-module-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.admin-module-card-head strong {
  min-width: 0;
  color: #172033;
  font-size: 14px;
}

.admin-module-card-head code {
  max-width: 46%;
  overflow: hidden;
  color: #64748b;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.admin-permission-pill {
  display: inline-flex;
  margin: 0;
}

.admin-permission-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.admin-permission-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #dbe4ee;
  border-radius: 999px;
  background: #f8fafc;
  color: #526071;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  transition: background 0.14s, border-color 0.14s, color 0.14s, box-shadow 0.14s;
  user-select: none;
}

.admin-permission-pill input:checked + span {
  border-color: #18b7be;
  background: #0f766e;
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.2);
}

.admin-permission-pill input:focus-visible + span {
  outline: 3px solid rgba(24, 183, 190, 0.24);
  outline-offset: 2px;
}

.admin-user-action-pills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}

.admin-effect-pill {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  margin: 0;
  padding: 8px;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #f8fafc;
}

.admin-effect-pill > span {
  color: #526071;
  font-size: 11px;
  font-weight: 750;
}

.admin-effect-pill .access-effect-select {
  width: 100%;
  min-width: 0;
  margin: 0;
  border-radius: 7px;
  background: #ffffff;
}

.admin-effect-pill[data-effect="allow"] {
  border-color: #87d7bd;
  background: #edf9f4;
}

.admin-effect-pill[data-effect="deny"] {
  border-color: #f1aaa6;
  background: #fff5f5;
}

.admin-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
  padding: 14px;
  background: #f7fafc;
}

.admin-field-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e1e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.admin-field-name {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.admin-field-name strong {
  color: #1f2937;
  font-size: 13px;
}

.admin-field-name code {
  max-width: 48%;
  overflow: hidden;
  color: #64748b;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-field-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.admin-field-controls label {
  display: grid;
  gap: 4px;
  margin: 0;
}

.admin-field-controls label > span {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.admin-field-controls .form-select {
  width: 100% !important;
  margin: 0 !important;
  border-radius: 7px;
  font-size: 12px;
}

.admin-scope-card {
  background: #ffffff;
  box-shadow: inset 0 3px 0 rgba(24, 183, 190, 0.18);
}

.admin-check-list {
  max-height: 320px;
}

.admin-sticky-actions {
  border-color: #d7e2ed;
}

@media (max-width: 900px) {
  .admin-module-grid,
  .admin-field-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .admin-permission-designer,
  .admin-module-grid,
  .admin-field-grid {
    padding: 10px;
  }
  .admin-field-controls {
    grid-template-columns: 1fr;
  }
  .admin-user-action-pills {
    grid-template-columns: 1fr;
  }
}

/* Admin simplification pass: collapsed groups and stable checkbox areas */
.admin-access-card {
  border-radius: 8px;
}

.admin-permission-designer {
  gap: 10px;
  padding: 14px;
}

.admin-permission-disclosure {
  overflow: hidden;
}

.admin-permission-disclosure > summary {
  cursor: pointer;
  list-style: none;
}

.admin-permission-disclosure > summary::-webkit-details-marker {
  display: none;
}

.admin-permission-disclosure > summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 9px;
  border-radius: 6px;
  background: #edf2f7;
  color: #435065;
  font-weight: 800;
}

.admin-permission-disclosure[open] > summary::before {
  content: "-";
  background: #e9fbfb;
  color: #0f646b;
}

.admin-permission-disclosure:not([open]) {
  background: #fff;
}

.admin-permission-disclosure:not([open]) .admin-section-heading {
  border-bottom: 0;
}

.admin-module-grid {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  padding: 12px;
}

.admin-module-card {
  box-shadow: none;
  transform: none !important;
}

.admin-module-card:hover {
  transform: none;
}

.admin-action-pills {
  gap: 6px;
}

.admin-permission-pill span {
  min-height: 28px;
  padding: 6px 9px;
}

.admin-user-action-pills {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-field-grid {
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  padding: 12px;
}

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

.admin-scope-disclosure {
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.admin-scope-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
  background: #fbfcfe;
  border-bottom: 0;
}

.admin-scope-disclosure[open] > summary {
  border-bottom: 1px solid #e5ebf2;
}

.admin-scope-disclosure > summary::-webkit-details-marker {
  display: none;
}

.admin-scope-disclosure > summary span {
  color: #1f2937;
  font-weight: 750;
}

.admin-scope-disclosure > summary small {
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf2f7;
  color: #526071;
  font-weight: 700;
}

.admin-scope-disclosure > .scope-action-flags,
.admin-scope-disclosure > .admin-check-list,
.admin-scope-disclosure > p {
  margin: 12px;
}

.admin-scope-pane .form-check,
.admin-docstatus-pane .form-check,
.admin-chip-checks .form-check,
.scope-action-flags .form-check,
.admin-check-row {
  padding-left: 0 !important;
}

.admin-scope-pane .form-check-input,
.admin-docstatus-pane .form-check-input,
.admin-chip-checks .form-check-input,
.scope-action-flags .form-check-input,
.admin-check-row .form-check-input {
  position: static !important;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin: 0 !important;
  cursor: pointer;
}

/* Dashboard experience */
.dashboard-page {
  display: grid;
  gap: 14px;
}

.dashboard-command {
  position: relative;
  min-height: 148px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(198, 211, 228, 0.88);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(19, 35, 63, 0.92), rgba(34, 83, 122, 0.88)),
    linear-gradient(90deg, #17324f, #23606d);
  color: #ffffff;
  box-shadow: 0 18px 44px rgba(20, 35, 59, 0.16);
  overflow: hidden;
}

.dashboard-command::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -90px;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}

.dashboard-command > * {
  position: relative;
  z-index: 1;
}

.dashboard-eyebrow {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: #d9f5f7;
  background: rgba(255, 255, 255, 0.1);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
}

.dashboard-command h2 {
  margin: 0;
  color: #ffffff;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.12;
}

.dashboard-command p {
  max-width: 680px;
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
}

.dashboard-command-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.dashboard-command-actions .btn {
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: none;
}

.dashboard-command-actions .tool-btn {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

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

.dashboard-kpi-card {
  position: relative;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 14px;
  border: 1px solid #d9e3ef;
  border-radius: 8px;
  color: var(--heading);
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(32, 45, 69, 0.07);
  overflow: hidden;
}

.dashboard-kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #5277d8;
}

.dashboard-kpi-card:hover {
  transform: translateY(-1px);
  border-color: #b8c9e3;
  box-shadow: 0 16px 32px rgba(32, 45, 69, 0.11);
}

.dashboard-kpi-card span,
.dashboard-kpi-card small {
  position: relative;
  z-index: 1;
}

.dashboard-kpi-card span {
  color: #5e6d82;
  font-size: 12px;
  font-weight: 850;
}

.dashboard-kpi-card strong {
  position: relative;
  z-index: 1;
  color: #111827;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.08;
}

.dashboard-kpi-card small {
  color: #718096;
  font-size: 12px;
  font-weight: 700;
}

.dashboard-kpi-card.sales::before { background: #5277d8; }
.dashboard-kpi-card.cash::before { background: #159a9f; }
.dashboard-kpi-card.debt::before { background: #d97706; }
.dashboard-kpi-card.stock::before { background: #2563eb; }
.dashboard-kpi-card.customer::before { background: #0f766e; }
.dashboard-kpi-card.import::before { background: #64748b; }
.dashboard-kpi-card.warning::before { background: #d97706; }
.dashboard-kpi-card.danger::before { background: #dc2626; }

.dashboard-kpi-card.sales { background: linear-gradient(135deg, #ffffff 0%, #f4f7ff 100%); }
.dashboard-kpi-card.cash { background: linear-gradient(135deg, #ffffff 0%, #eefafa 100%); }
.dashboard-kpi-card.debt,
.dashboard-kpi-card.warning { background: linear-gradient(135deg, #ffffff 0%, #fff7ed 100%); }
.dashboard-kpi-card.stock { background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%); }
.dashboard-kpi-card.customer { background: linear-gradient(135deg, #ffffff 0%, #edfafa 100%); }
.dashboard-kpi-card.danger { background: linear-gradient(135deg, #ffffff 0%, #fff1f2 100%); }

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

.dashboard-lane-grid-wide {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
}

.dashboard-panel {
  min-width: 0;
  border: 1px solid #d9e3ef;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(32, 45, 69, 0.07);
  overflow: hidden;
}

.dashboard-panel-head {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #fbfdff 0%, #f5f8fc 100%);
}

.dashboard-panel-head h2 {
  margin: 0;
  color: #172033;
  font-size: 16px;
  font-weight: 900;
}

.dashboard-panel-head p {
  margin: 3px 0 0;
  color: #6b778b;
  font-size: 12px;
  font-weight: 650;
}

.dashboard-soft-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #0f766e;
  background: #e8f7f5;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.dashboard-alert-stack,
.dashboard-activity-list,
.dashboard-mini-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.dashboard-alert-row,
.dashboard-mini-row,
.dashboard-activity-row,
.dashboard-quick-action {
  text-decoration: none;
}

.dashboard-alert-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #ead7bd;
  border-radius: 8px;
  color: #5f390c;
  background: #fff8ed;
  font-weight: 850;
}

.dashboard-alert-row span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.dashboard-alert-row strong {
  color: #9a3412;
  font-size: 18px;
  font-weight: 900;
}

.dashboard-empty-state {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #5e6d82;
  background: #f8fbff;
  font-weight: 800;
}

.dashboard-full-row {
  grid-column: 1 / -1;
}

.dashboard-mini-title {
  margin-bottom: 2px;
  color: #526174;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-mini-row {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #172033;
  background: #ffffff;
}

.dashboard-mini-row:hover {
  border-color: #b8c9e3;
  background: #f8fbff;
}

.dashboard-mini-row span {
  min-width: 0;
  display: grid;
  gap: 2px;
  font-weight: 850;
}

.dashboard-mini-row small {
  color: #7a8798;
  font-size: 11px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.dashboard-mini-row strong {
  flex: 0 0 auto;
  color: #172033;
  font-weight: 900;
  text-align: right;
}

.dashboard-mini-row.good strong { color: #12805c; }
.dashboard-mini-row.warning strong { color: #d97706; }
.dashboard-mini-row.danger strong { color: #dc2626; }
.dashboard-mini-row.muted strong { color: #64748b; }

.dashboard-muted-note {
  padding: 12px;
  border: 1px dashed #d5dee9;
  border-radius: 8px;
  color: #6b778b;
  background: #fafcff;
  font-size: 13px;
  font-weight: 750;
}

.dashboard-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #edf2f7;
}

.dashboard-quick-action {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #dce6f2;
  border-radius: 8px;
  color: #172033;
  background: #fbfdff;
  font-weight: 850;
}

.dashboard-quick-action i {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #0f766e;
  background: #e8f7f5;
}

.dashboard-quick-action:hover {
  color: #0f766e;
  border-color: #a8d8d4;
  background: #f2fbfa;
}

.dashboard-activity-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #172033;
  background: #ffffff;
}

.dashboard-activity-row:hover {
  border-color: #b8c9e3;
  background: #f8fbff;
}

.dashboard-activity-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #2563eb;
  background: #eff6ff;
}

.dashboard-activity-row.cash .dashboard-activity-icon { color: #0f766e; background: #e8f7f5; }
.dashboard-activity-row.garage .dashboard-activity-icon { color: #d97706; background: #fff7ed; }
.dashboard-activity-row.writeoff .dashboard-activity-icon { color: #dc2626; background: #fff1f2; }
.dashboard-activity-row.production .dashboard-activity-icon { color: #5277d8; background: #f0f4ff; }

.dashboard-activity-main,
.dashboard-activity-amount {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.dashboard-activity-main strong {
  overflow: hidden;
  color: #172033;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-activity-main small,
.dashboard-activity-amount small {
  color: #728196;
  font-size: 11px;
  font-weight: 700;
}

.dashboard-activity-amount {
  text-align: right;
}

.dashboard-activity-amount strong {
  color: #172033;
  font-size: 13px;
  font-weight: 900;
}

.dashboard-debt-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
}

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

  .dashboard-lane-grid,
  .dashboard-lane-grid-wide,
  .dashboard-debt-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .dashboard-command {
    align-items: flex-start;
    flex-direction: column;
    min-height: 0;
    padding: 16px;
  }

  .dashboard-command h2 {
    font-size: 22px;
  }

  .dashboard-command-actions,
  .dashboard-command-actions .btn {
    width: 100%;
  }

  .dashboard-kpi-grid,
  .dashboard-quick-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-activity-row {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .dashboard-activity-amount {
    grid-column: 2;
    text-align: left;
  }
}

.scope-action-flags {
  gap: 8px !important;
}

.scope-action-flags .form-check {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid #e1e7ef;
  border-radius: 7px;
  background: #fff;
}

.admin-check-list {
  max-height: 250px;
  border: 1px solid #edf2f7;
  border-radius: 7px;
  background: #fbfcfe;
  padding: 6px;
}

.admin-check-row {
  display: grid !important;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 8px;
  border-radius: 6px;
}

.admin-check-row .form-check-label {
  min-width: 0;
  overflow-wrap: anywhere;
  cursor: pointer;
  line-height: 1.25;
}

.admin-chip-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

.admin-chip-checks .form-check {
  display: grid !important;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #dfe7ef;
  border-radius: 8px;
  background: #fff;
}

.admin-chip-checks .form-check-label,
.admin-chip-checks span.form-check-label {
  min-width: 0;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.admin-chip-checks .form-check:has(.form-check-input:checked) {
  border-color: #18b7be;
  background: #f0fcfc;
}

@media (max-width: 760px) {
  .admin-module-grid,
  .admin-field-grid,
  .admin-scope-grid,
  .admin-chip-checks,
  .admin-user-action-pills {
    grid-template-columns: 1fr;
  }
}
