:root {
  --font-family: Inter, "Segoe UI", Arial, sans-serif;
  --text-primary: #10213b;
  --text-secondary: #46566d;
  --text-muted: #69788f;
  --text-placeholder: #8693a5;
  --primary: #145edb;
  --ink: #17202a;
  --muted: #647282;
  --line: #dce3ea;
  --bg: #f4f7fa;
  --panel: #ffffff;
  --blue: #1769aa;
  --teal: #0b8f83;
  --green: #27834f;
  --amber: #b9770e;
  --red: #b03a2e;
  --shadow: 0 14px 36px rgba(23, 32, 42, 0.08);
  --sidebar-navy: #071a2d;
  --sidebar-navy-2: #0a2236;
  --sidebar-cyan: #1fb5d3;
  --sidebar-soft: #bcd2e5;
  --sidebar-border: rgba(255, 255, 255, 0.14);
  --sidebar-border-strong: rgba(255, 255, 255, 0.22);
  --sidebar-hover: rgba(255, 255, 255, 0.07);
  --sidebar-active: linear-gradient(90deg, #1976d2 0%, #1d8fd1 52%, #24b9d1 100%);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
.page-title {
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.4px;
}

h2,
.section-title {
  color: var(--text-primary);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.15px;
}

h3,
.card-title {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0;
}

p,
.page-description {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

label,
.form-label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

input,
select,
textarea,
.form-control {
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
}

input::placeholder,
textarea::placeholder,
.form-control::placeholder {
  color: var(--text-placeholder);
  font-weight: 400;
}

button,
.btn {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 700;
}

th,
.table-heading {
  color: #34445d;
  font-size: 12px;
  font-weight: 700;
}

td,
.table-text {
  color: #2d3d54;
  font-size: 13px;
  font-weight: 400;
}

.text-muted,
.record-meta,
.panel-heading span,
.metric small {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
}

.money,
.money-cell,
.metric strong,
.commercial-summary-card strong {
  font-variant-numeric: tabular-nums;
}

.kpi-value,
.metric strong {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.2px;
}

.kpi-label,
.metric span {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.tab,
.accounting-tab,
.document-type-tab {
  color: #536278;
  font-size: 13px;
  font-weight: 600;
}

.tab.active,
.accounting-tab.active,
.document-type-tab.active {
  color: var(--primary);
  font-weight: 700;
}

.status-badge,
.pill {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #edf3f7;
}

.login-screen[hidden],
.app-authenticated[hidden] {
  display: none;
}

.login-card {
  width: min(100%, 980px);
  min-height: 620px;
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(15, 37, 51, 0.18);
}

.login-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 28px;
  padding: 46px;
  overflow: hidden;
  background:
    linear-gradient(128deg, rgba(34, 177, 207, 0.88) 0 26%, transparent 26% 100%),
    linear-gradient(36deg, rgba(23, 105, 170, 0.92) 0 45%, transparent 45% 100%),
    linear-gradient(156deg, #102134 0%, #172c4d 54%, #07131f 100%);
  color: #ffffff;
}

.login-visual::before,
.login-visual::after {
  content: "";
  position: absolute;
  inset: auto auto -120px -70px;
  width: 280px;
  height: 420px;
  transform: rotate(-24deg);
  background: rgba(255, 255, 255, 0.08);
}

.login-visual::after {
  inset: -80px -120px auto auto;
  background: rgba(34, 177, 207, 0.18);
}

.login-visual-mark,
.login-visual h2,
.login-visual p {
  position: relative;
  z-index: 1;
}

.login-visual-mark {
  width: min(100%, 300px);
  border-radius: 8px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.96);
}

.login-visual-mark img {
  display: block;
  width: 100%;
  height: auto;
}

.login-visual h2 {
  margin: 0;
  font-size: 42px;
  line-height: 1;
}

.login-visual p {
  margin: 8px 0 0;
  color: #d7eef5;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.login-visual h2 {
  text-align: center;
}

.login-panel {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 54px 72px;
  background: #ffffff;
}

.login-form-heading {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  justify-items: center;
  text-align: center;
}

.login-form-heading img {
  width: 96px;
  height: auto;
}

.login-form-heading h1 {
  margin: 0;
  font-size: 48px;
  line-height: 1;
}

.login-form-heading p {
  max-width: 360px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.login-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-panel input,
.login-panel select {
  min-height: 48px;
}

.login-panel button[type="submit"] {
  min-height: 48px;
  background: linear-gradient(90deg, #22b1cf 0%, #1769aa 54%, #07131f 100%);
}

.login-panel .text-button {
  min-height: 0;
  justify-self: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 800;
  box-shadow: none;
}

.login-panel .text-button:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.settings-page {
  width: 100%;
  max-width: none;
}

.settings-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.94);
}

.settings-form {
  align-items: end;
}

.settings-form input,
.settings-form select {
  min-height: 44px;
}

.settings-form .form-actions {
  justify-content: flex-start;
}

.fleet-page {
  width: 100%;
}

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

.fleet-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.fleet-overview-panel,
.fleet-drivers-panel,
.fleet-history-panel {
  grid-column: 1 / -1;
}

.fleet-overview-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.fleet-overview-summary article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.76);
  padding: 14px;
}

.fleet-overview-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.fleet-overview-summary strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 24px;
}

.fleet-overview-activity {
  display: grid;
  gap: 10px;
}

.fleet-add-vehicle-button {
  min-width: 132px;
  justify-self: end;
}

.fleet-vehicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.fleet-vehicle-card {
  position: relative;
  min-height: 188px;
  border: 1px solid #b9cce0;
  border-radius: 8px;
  overflow: hidden;
  padding: 32px 22px 20px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.82) 54%, rgba(255, 255, 255, 0.54) 100%),
    linear-gradient(135deg, rgba(222, 237, 248, 0.95), rgba(197, 225, 242, 0.72)),
    radial-gradient(circle at 82% 62%, rgba(22, 104, 158, 0.22), transparent 32%);
  box-shadow: 0 12px 26px rgba(15, 53, 89, 0.08);
}

.fleet-vehicle-card::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 16px;
  width: 150px;
  height: 72px;
  opacity: 0.22;
  background:
    radial-gradient(circle at 24px 58px, transparent 0 11px, #123451 12px 17px, transparent 18px),
    radial-gradient(circle at 116px 58px, transparent 0 11px, #123451 12px 17px, transparent 18px),
    linear-gradient(8deg, transparent 32%, #123451 33% 58%, transparent 59%),
    linear-gradient(0deg, transparent 54%, #123451 55% 72%, transparent 73%);
  pointer-events: none;
}

.fleet-vehicle-card h3,
.fleet-vehicle-card p,
.fleet-vehicle-card strong,
.fleet-vehicle-card .pill {
  position: relative;
  z-index: 1;
}

.fleet-vehicle-card h3 {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
}

.fleet-vehicle-card p {
  margin: 0 0 14px;
  color: #55708c;
  font-size: 18px;
}

.fleet-vehicle-card strong {
  display: block;
  margin-bottom: 16px;
  color: var(--ink);
  font-size: 18px;
}

.fleet-vehicle-card .pill {
  justify-content: flex-start;
  min-width: min(100%, 210px);
  border-radius: 999px;
  padding-inline: 18px;
  font-size: 14px;
  text-transform: lowercase;
}

.fleet-vehicle-card-actions {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  display: flex;
  gap: 10px;
}

.fleet-vehicle-card-actions .icon-action-button {
  width: 46px;
  height: 46px;
  background: rgba(255, 255, 255, 0.88);
  border-color: #c7d8e8;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(15, 53, 89, 0.08);
}

.fleet-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: rgba(248, 251, 255, 0.72);
}

.fleet-checklist legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.fleet-checklist label {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--ink);
  font-size: 13px;
}

.fleet-checklist input {
  width: 18px;
  min-height: 18px;
}

.fleet-record {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.fleet-record h3 {
  margin: 0;
  font-size: 15px;
}

.fleet-record p,
.fleet-record small {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
}

.fleet-status-available,
.fleet-status-approved,
.fleet-status-returned {
  background: #e7f8ef;
  color: #0f8a51;
}

.fleet-status-pending,
.fleet-status-on_request {
  background: #fff3d8;
  color: #9a6200;
}

.fleet-status-in_use {
  background: #e7f0ff;
  color: #1d63d8;
}

.fleet-status-maintenance,
.fleet-status-rejected,
.fleet-status-inactive {
  background: #fee8ea;
  color: #c62836;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--ink);
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px 22px 24px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(8, 31, 50, 0.98), rgba(7, 27, 45, 1));
  color: #ffffff;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 18px 42px rgba(5, 24, 41, 0.2);
  transition: width 0.24s ease, padding 0.24s ease;
  z-index: 30;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 220px;
  pointer-events: none;
  background:
    linear-gradient(130deg, rgba(31, 181, 211, 0.24) 0 28%, transparent 28% 100%),
    linear-gradient(63deg, rgba(29, 115, 212, 0.16) 0 31%, transparent 31% 100%),
    linear-gradient(115deg, transparent 0 52%, rgba(31, 181, 211, 0.08) 52% 67%, transparent 67% 100%);
}

.brand {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 14px;
  min-height: 82px;
}

.brand img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: #ffffff;
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 8px 22px rgba(1, 20, 33, 0.2);
}

.brand strong,
.brand span {
  display: block;
}

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

.brand strong {
  color: #ffffff;
  font-size: 17px;
  font-weight: 800;
}

.sidebar-toggle {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--sidebar-border-strong);
  border-radius: 12px;
  padding: 0;
  background: rgba(255, 255, 255, 0.04);
  color: #dbeefa;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.24s ease;
}

.sidebar-toggle:hover {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.sidebar-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand span,
.sidebar-footer span {
  color: var(--sidebar-soft);
  font-size: 13px;
}

nav {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.nav-item {
  position: relative;
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 5px 12px;
  background: transparent;
  color: #f7fbff;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-group-title {
  position: relative;
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  margin-top: 2px;
  padding: 5px 12px;
  background: transparent;
  color: #eaf3f8;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
  text-align: left;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.nav-icon {
  width: 36px;
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--sidebar-border-strong);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018));
  color: #f5fbff;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.nav-chevron {
  margin-left: auto;
  color: #b8d1e2;
  font-size: 16px;
}

.nav-chevron::before {
  content: "▸";
}

.nav-group-title.open .nav-chevron::before {
  content: "▾";
}

.nav-group-title.open .nav-chevron {
  color: #d8eef8;
}

.nav-group-title:hover,
.nav-group-title.open {
  border-color: rgba(255, 255, 255, 0.06);
  background: var(--sidebar-hover);
  color: #ffffff;
}

.nav-submenu {
  position: relative;
  display: grid;
  gap: 5px;
  margin: 0 0 4px 18px;
  padding: 4px 0 4px 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.13);
}

.nav-submenu[hidden] {
  display: none;
}

.nav-subitem {
  min-height: 38px;
  margin-left: 0;
  border-radius: 9px;
  padding: 6px 12px;
  color: var(--sidebar-soft);
  font-size: 13px;
  font-weight: 650;
}

.nav-subitem .nav-icon {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 8px;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.025);
  opacity: 0.82;
}

.nav-subitem .nav-icon svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

.nav-subitem.active .nav-icon,
.nav-subitem:hover .nav-icon {
  opacity: 1;
}

.nav-nested-title {
  margin-top: 6px;
  font-weight: 700;
}

.nav-nested-submenu {
  display: grid;
  gap: 2px;
  margin: 2px 0 6px 34px;
  border-left: 1px solid rgba(127, 152, 168, 0.35);
}

.nav-nested-item {
  min-height: 30px;
  margin-left: 0;
  padding-left: 14px;
  font-size: 12px;
}

.nav-nested-item::before {
  content: "";
  margin-right: 0;
}

.nav-placeholder {
  cursor: default;
  opacity: 0.48;
}

.nav-item:hover,
.nav-item.active {
  border-color: rgba(255, 255, 255, 0.08);
  background: var(--sidebar-active);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(0, 106, 180, 0.2);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 999px 999px 0;
  background: #6ee2f4;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon,
.nav-group-title:hover .nav-icon,
.nav-group-title.open .nav-icon {
  background: rgba(255, 255, 255, 0.1);
}

.nav-placeholder:hover {
  background: transparent;
  color: #c7d7e1;
}

.sidebar-footer {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-footer strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.2;
}

.sidebar-logout {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  border: 1px solid var(--sidebar-border-strong);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.018);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.sidebar-logout .nav-icon {
  color: currentColor;
}

.sidebar-logout .nav-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  margin-left: 300px;
  padding: 28px;
  transition: margin-left 0.18s ease;
}

body.sidebar-collapsed .sidebar {
  width: 88px;
  gap: 14px;
  padding: 24px 14px 20px;
}

body.sidebar-collapsed .brand {
  flex-direction: column;
  align-items: center;
  display: flex;
  gap: 10px;
  min-height: auto;
}

body.sidebar-collapsed .brand img {
  width: 48px;
  height: 48px;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-chevron,
body.sidebar-collapsed .sidebar-footer > span,
body.sidebar-collapsed .sidebar-footer strong {
  display: none;
}

body.sidebar-collapsed .sidebar-toggle {
  margin-left: 0;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
}

body.sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

body.sidebar-collapsed nav {
  align-items: center;
  overflow-x: clip;
  padding-right: 0;
  gap: 6px;
}

body.sidebar-collapsed .nav-group {
  align-items: center;
  gap: 4px;
  width: 44px;
}

body.sidebar-collapsed .nav-item,
body.sidebar-collapsed .nav-group-title {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  padding: 0;
}

body.sidebar-collapsed .nav-item .nav-icon,
body.sidebar-collapsed .nav-group-title .nav-icon {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border-radius: 12px;
}

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

body.sidebar-collapsed .nav-group-title.open {
  border-color: rgba(31, 181, 211, 0.52);
  background: linear-gradient(180deg, rgba(16, 77, 118, 0.92), rgba(9, 48, 76, 0.92));
  color: #ffffff;
  box-shadow: inset 3px 0 0 var(--sidebar-cyan), 0 8px 18px rgba(0, 0, 0, 0.12);
}

body.sidebar-collapsed .nav-item.active {
  border-color: rgba(31, 181, 211, 0.68);
  background: linear-gradient(180deg, rgba(31, 181, 211, 0.28), rgba(15, 55, 83, 0.78));
  color: #ffffff;
  box-shadow: inset 3px 0 0 var(--sidebar-cyan), 0 8px 18px rgba(0, 0, 0, 0.12);
}

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

body.sidebar-collapsed .nav-group-title.open + .nav-submenu:not([hidden]) {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 44px;
  max-width: 44px;
  margin: 2px 0 4px;
  padding: 5px 0;
  border-left: 0;
  overflow: hidden;
}

body.sidebar-collapsed .nav-subitem {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  margin-left: 0;
  border-radius: 9px;
  padding: 0;
  background: rgba(255, 255, 255, 0.04);
  color: #b8c7d3;
}

body.sidebar-collapsed .nav-subitem .nav-icon {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border-radius: 9px;
  opacity: 1;
}

body.sidebar-collapsed .nav-subitem .nav-icon svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.85;
}

body.sidebar-collapsed .nav-subitem.active {
  border-color: rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  box-shadow: inset 3px 0 0 #ffffff;
}

body.sidebar-collapsed .nav-subitem:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

body.sidebar-collapsed .sidebar-footer {
  min-height: 1px;
  width: 100%;
  display: flex;
  justify-content: center;
  padding-top: 14px;
}

body.sidebar-collapsed .sidebar-logout {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin-top: 0;
  padding: 0;
  border-radius: 12px;
  color: #dce8ef;
}

body.sidebar-collapsed .sidebar-logout .nav-icon {
  display: inline-flex;
  width: 24px;
  min-width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
}

body.sidebar-collapsed .sidebar-logout:hover {
  background: #ffffff;
  color: #0f2533;
}

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

body.dashboard-view .app-shell {
  padding: 8px 6px 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

body.dashboard-view .topbar {
  display: none;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.install-pwa-button {
  min-width: 118px;
  min-height: 44px;
}

select,
input,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #ffffff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

button,
.secondary {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
}

.secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.database-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  border: 1px solid #f1c77c;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff7e8;
  color: #6f4600;
}

.database-notice[hidden] {
  display: none;
}

.database-notice span {
  flex: 1;
}

.database-notice a {
  min-height: 36px;
  border-radius: 6px;
  padding: 9px 12px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

.section-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

#access-roles {
  position: relative;
}

#access-roles.view.active {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  align-content: flex-start;
}

#access-roles > .section-actions {
  position: absolute;
  top: -72px;
  right: 0;
  margin-bottom: 0;
}

#employees {
  position: relative;
}

#employees > .section-actions {
  position: absolute;
  top: -72px;
  right: 0;
  margin-bottom: 0;
}

.accounting-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.document-type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.search-control {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.search-control span {
  color: var(--muted);
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.search-control input {
  min-height: 40px;
  border: 0;
  border-radius: 0 6px 6px 0;
  padding-left: 0;
}

.document-search-field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.accounting-tab,
.document-type-tab {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.accounting-tab.active,
.document-type-tab.active {
  background: var(--blue);
  color: #ffffff;
}

.accounting-section {
  display: none;
}

.accounting-section.active {
  display: block;
}

.commercial-page {
  --commercial-primary: #2468dd;
  --commercial-primary-soft: #eaf2ff;
  --commercial-text: #12213a;
  --commercial-muted: #66758a;
  --commercial-border: #e3e9f1;
  --commercial-shadow: 0 8px 28px rgba(21, 40, 72, 0.07);
  font-family: var(--font-family);
  color: var(--commercial-text);
}

.commercial-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 16px;
}

.commercial-header h1 {
  margin: 0;
  color: var(--commercial-text);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0;
}

.commercial-header p {
  margin: 4px 0 0;
  color: var(--commercial-muted);
  font-size: 13px;
  font-weight: 600;
}

.commercial-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.commercial-icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  border: 1px solid var(--commercial-border);
  border-radius: 8px;
  padding: 0;
  background: #ffffff;
  color: #536278;
}

.commercial-icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.commercial-primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  white-space: nowrap;
  min-height: 42px;
  border: 1px solid var(--commercial-primary);
  border-radius: 8px;
  padding: 0 18px;
  background: var(--commercial-primary);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.commercial-primary-button span {
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  font-size: 15px;
  line-height: 1;
}

.commercial-page .accounting-tabs,
.commercial-page .document-type-tabs {
  gap: 28px;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--commercial-border);
}

.commercial-page .accounting-tabs {
  display: none;
}

.commercial-page .document-type-tabs {
  margin-top: 6px;
}

.commercial-page .accounting-tab,
.commercial-page .document-type-tab {
  position: relative;
  min-height: 44px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  padding: 0 6px;
  background: transparent;
  color: #536278;
  font-size: 13px;
  font-weight: 700;
}

.commercial-page .accounting-tab.active,
.commercial-page .document-type-tab.active {
  border-bottom-color: var(--commercial-primary);
  background: transparent;
  color: var(--commercial-primary);
}

.commercial-page .panel {
  border-color: var(--commercial-border);
  border-radius: 11px;
  padding: 18px;
  background: #ffffff;
  box-shadow: var(--commercial-shadow);
}

.commercial-page .panel-heading {
  align-items: center;
  padding-bottom: 12px;
}

.commercial-page .panel-heading h2 {
  color: var(--commercial-text);
  font-size: 21px;
  font-weight: 800;
}

.commercial-page .panel-heading span,
.commercial-page .document-search-field,
.commercial-page .form-grid label,
.commercial-page .document-form label {
  color: var(--commercial-muted);
  font-size: 12px;
  font-weight: 700;
}

.commercial-page input,
.commercial-page select,
.commercial-page textarea {
  border-color: #d8e0ea;
  border-radius: 8px;
  font-family: var(--font-family);
  font-size: 13px;
}

.commercial-page input:focus,
.commercial-page select:focus,
.commercial-page textarea:focus {
  border-color: #76a8f5;
  box-shadow: 0 0 0 3px rgba(36, 104, 221, 0.1);
  outline: none;
}

.commercial-page .search-control {
  border-color: #d8e0ea;
  border-radius: 8px;
}

.commercial-page .search-control input {
  min-height: 40px;
}

.commercial-page .secondary {
  min-height: 40px;
  border-color: #d8e0ea;
  border-radius: 8px;
  color: #3e4e65;
  font-size: 13px;
  font-weight: 700;
}

.commercial-page .metric-grid.compact {
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 16px;
}

.commercial-page .metric {
  min-height: 112px;
  border-color: var(--commercial-border);
  border-radius: 11px;
  background: #ffffff;
  box-shadow: 0 5px 20px rgba(23, 41, 70, 0.04);
}

.commercial-page .metric span {
  color: var(--commercial-muted);
  font-size: 12px;
  font-weight: 700;
}

.commercial-page .metric strong {
  color: var(--commercial-text);
  font-size: 22px;
  font-weight: 800;
}

.commercial-page .record-list {
  display: grid;
  gap: 10px;
}

.commercial-page .record {
  border-color: var(--commercial-border);
  background: #ffffff;
}

.commercial-page .record h3 {
  color: var(--commercial-text);
  font-size: 15px;
  font-weight: 800;
}

.commercial-page .record-meta {
  color: var(--commercial-muted);
  font-size: 12px;
}

.commercial-page .table-wrap {
  border: 1px solid var(--commercial-border);
  border-radius: 10px;
  background: #ffffff;
}

.commercial-page th {
  background: #fbfcfe;
  color: #34445d;
  font-size: 12px;
  font-weight: 800;
}

.commercial-page td {
  color: #2c3d55;
  font-size: 13px;
}

.commercial-document-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.commercial-summary-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  border: 1px solid var(--commercial-border);
  border-radius: 10px;
  padding: 16px 18px;
  background: #ffffff;
  box-shadow: 0 5px 20px rgba(23, 41, 70, 0.04);
}

.commercial-summary-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 10px;
}

.commercial-summary-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.commercial-summary-icon.total {
  background: #eaf2ff;
  color: #2468dd;
}

.commercial-summary-icon.accepted {
  background: #e8f8ef;
  color: #20b866;
}

.commercial-summary-icon.pending {
  background: #fff2df;
  color: #f59a23;
}

.commercial-summary-icon.declined {
  background: #ffe9eb;
  color: #ef4f55;
}

.commercial-summary-icon.value {
  background: #f2ebff;
  color: #8c5ce6;
}

.commercial-summary-card strong {
  display: block;
  color: var(--commercial-text);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}

.commercial-summary-card span:last-child {
  display: block;
  margin-top: 5px;
  color: var(--commercial-muted);
  font-size: 12px;
  font-weight: 600;
}

.commercial-page {
  --commercial-compact-bg: #f6f8fb;
  --commercial-compact-card: #ffffff;
  --commercial-compact-text: #12223a;
  --commercial-compact-muted: #6f7e92;
  --commercial-compact-line: #e4e9f0;
  --commercial-compact-blue: #2167d8;
  --commercial-compact-blue-soft: #eaf2ff;
  --commercial-compact-green: #1fa85b;
  --commercial-compact-green-soft: #e7f7ed;
  --commercial-compact-orange: #ef8d15;
  --commercial-compact-orange-soft: #fff1df;
  --commercial-compact-red: #ec4444;
  --commercial-compact-red-soft: #ffe7e7;
  --commercial-compact-purple: #8c5be7;
  --commercial-compact-purple-soft: #f0e8ff;
}

body:has(#accounting.view.active) .app-shell {
  background: var(--commercial-compact-bg);
}

#accounting {
  padding-top: 2px;
}

.commercial-page .commercial-header {
  align-items: center;
  margin-bottom: 12px;
}

.commercial-page .commercial-header-actions {
  margin-left: auto;
}

.commercial-currency-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--commercial-compact-line);
  border-radius: 8px;
  background: #ffffff;
  color: #536278;
  box-shadow: 0 5px 16px rgba(24, 42, 72, 0.05);
  font-size: 12px;
  font-weight: 700;
}

.commercial-currency-select span {
  color: #6f7e92;
  font-size: 11px;
}

.commercial-currency-select select {
  width: 74px;
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  background: #f7f9fc;
  color: #12223a;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 800;
}

.commercial-page .commercial-icon-button {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  border-color: var(--commercial-compact-line);
  border-radius: 8px;
  color: #5f6f84;
  box-shadow: 0 5px 16px rgba(24, 42, 72, 0.05);
}

.commercial-page .commercial-icon-button svg {
  width: 18px;
  height: 18px;
}

.commercial-page .commercial-primary-button {
  min-height: 36px;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--commercial-compact-blue);
  border-color: var(--commercial-compact-blue);
  box-shadow: 0 5px 16px rgba(33, 103, 216, 0.14);
  font-size: 13px;
  letter-spacing: 0;
}

.commercial-page .accounting-section[data-accounting-section="overview"].active {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(420px, 1.1fr);
  gap: 12px;
  align-items: start;
}

.commercial-page .metric-grid.compact {
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 0;
}

.commercial-page .metric-grid.compact .metric {
  min-height: 72px;
  align-items: center;
  border-color: var(--commercial-compact-line);
  border-radius: 9px;
  padding: 12px 14px;
  background: var(--commercial-compact-card);
  box-shadow: 0 5px 16px rgba(24, 42, 72, 0.05);
}

.commercial-page .metric-grid.compact .metric span {
  color: var(--commercial-compact-muted);
  font-size: 11px;
  line-height: 1.25;
}

.commercial-page .metric-grid.compact .metric strong {
  color: var(--commercial-compact-text);
  font-size: 18px;
  line-height: 1.05;
}

.commercial-page .metric-grid.compact .metric small {
  color: var(--commercial-compact-muted);
  font-size: 11px;
  font-weight: 600;
}

.commercial-page .accounting-section[data-accounting-section="overview"] .panel {
  min-height: 236px;
  border-color: var(--commercial-compact-line);
  border-radius: 9px;
  padding: 14px;
  box-shadow: 0 5px 16px rgba(24, 42, 72, 0.05);
}

.commercial-page .accounting-section[data-accounting-section="overview"] .panel-heading {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--commercial-compact-line);
}

.commercial-page .accounting-section[data-accounting-section="overview"] .panel-heading h2 {
  font-size: 17px;
  letter-spacing: 0;
}

.commercial-page .accounting-section[data-accounting-section="overview"] .panel-heading span {
  color: var(--commercial-compact-muted);
  font-size: 11px;
  font-weight: 600;
}

.commercial-page #recent-documents {
  gap: 8px;
  margin-top: 10px;
}

.commercial-page #recent-documents .record {
  border-color: var(--commercial-compact-line);
  border-radius: 8px;
  padding: 11px 12px;
  box-shadow: none;
}

.commercial-page #recent-documents .record h3 {
  font-size: 13px;
}

.commercial-page #recent-documents .record-meta {
  font-size: 11px;
}

.commercial-page .document-type-tabs {
  gap: 28px;
  margin-bottom: 14px;
}

.commercial-page .document-type-tab {
  min-height: 38px;
  padding: 0 4px;
  font-size: 12px;
}

.commercial-page [data-accounting-section="document-centre"] > .panel {
  border-color: var(--commercial-compact-line);
  border-radius: 9px;
  padding: 16px;
  box-shadow: 0 5px 16px rgba(24, 42, 72, 0.05);
}

.commercial-page [data-accounting-section="document-centre"] > .panel .panel-heading h2 {
  font-size: 17px;
}

.commercial-page .document-search-field {
  display: block;
  margin: 12px 0;
  color: var(--commercial-compact-muted);
  font-size: 11px;
}

.commercial-page .search-control {
  margin-top: 6px;
  border-color: var(--commercial-compact-line);
  border-radius: 7px;
}

.commercial-page .search-control input {
  min-height: 34px;
  font-size: 11px;
}

.commercial-page #document-list {
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--commercial-compact-line);
  border-radius: 9px;
  background: #ffffff;
}

.commercial-page #document-list .record {
  border: 0;
  border-bottom: 1px solid var(--commercial-compact-line);
  border-radius: 0;
  padding: 10px 12px;
  box-shadow: none;
}

.commercial-page #document-list .record:last-child {
  border-bottom: 0;
}

.commercial-page #document-list .record h3 {
  font-size: 12px;
}

.commercial-page #document-list .empty-state {
  display: grid;
  min-height: 168px;
  place-items: center;
  border: 0;
  color: var(--commercial-compact-muted);
  font-size: 12px;
}

.commercial-document-summary {
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
  align-items: stretch;
  margin: 0 0 14px;
}

.commercial-summary-card {
  min-height: 70px;
  gap: 10px;
  border-color: var(--commercial-compact-line);
  border-radius: 9px;
  padding: 11px 12px;
  box-shadow: 0 5px 16px rgba(24, 42, 72, 0.05);
  user-select: none;
}

.commercial-summary-icon {
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 9px;
}

.commercial-summary-icon svg {
  width: 18px;
  height: 18px;
}

.commercial-summary-icon.total {
  background: var(--commercial-compact-blue-soft);
  color: var(--commercial-compact-blue);
}

.commercial-summary-icon.accepted {
  background: var(--commercial-compact-green-soft);
  color: var(--commercial-compact-green);
}

.commercial-summary-icon.pending {
  background: var(--commercial-compact-orange-soft);
  color: var(--commercial-compact-orange);
}

.commercial-summary-icon.declined {
  background: var(--commercial-compact-red-soft);
  color: var(--commercial-compact-red);
}

.commercial-summary-icon.value {
  background: var(--commercial-compact-purple-soft);
  color: var(--commercial-compact-purple);
}

.commercial-summary-card strong {
  display: block;
  max-width: 100%;
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.commercial-summary-card span:last-child {
  margin-top: 3px;
  color: var(--commercial-compact-muted);
  font-size: 11px;
  line-height: 1.25;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.compact-actions {
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
}

.icon-action-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  border: 1px solid #c9dbff;
  border-radius: 8px;
  padding: 0;
  background: #edf4ff;
  color: #2167d8;
}

.icon-action-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-action-button:hover {
  filter: brightness(0.98);
  transform: translateY(-1px);
}

.danger-icon-button {
  border-color: #ffc9c9;
  background: #ffecec;
  color: #d93030;
}

.danger-icon-button:hover {
  border-color: #f3a7a7;
  color: #c92a2a;
}

.recent-document-card {
  cursor: pointer;
}

.recent-document-card:hover,
.highlight-record {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.14);
}

.danger-button {
  border-color: #f0b6af;
  color: var(--red);
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.form-message.success {
  color: var(--green);
}

.form-message.error {
  color: var(--red);
}

.form-message.warning {
  color: var(--amber);
  font-weight: 700;
}

.form-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  grid-column: 1 / -1;
}

.form-heading-row h3 {
  margin-bottom: 0;
}

.form-heading-row span {
  color: var(--blue);
  font-size: 13px;
}

.employee-upload-section {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.employee-upload-section h3 {
  margin-bottom: 0;
}

.document-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.document-upload-grid input[type="file"] {
  padding: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(20, 39, 61, 0.08);
  color: var(--ink);
  text-align: left;
}

#dashboard .metric {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: visible;
  padding-left: 14px;
}

#dashboard .metric::before {
  display: none;
}

#dashboard .metric::after {
  display: none;
}

#dashboard .metric > div:last-child {
  display: grid;
  justify-items: start;
  text-align: left;
  padding: 0;
}

.metric-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 10px;
  justify-self: start;
  position: relative;
  z-index: 1;
  border: 1px solid transparent;
  background: #eaf2ff;
  color: #2468dd;
  font-size: 15px;
  font-weight: 800;
}

.metric-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metric-style-1 .metric-icon { border-color: #d7e8ff; background: #eaf2ff; color: #2468dd; }
.metric-style-2 .metric-icon { border-color: #ccefdc; background: #e8f8ef; color: #20b866; }
.metric-style-3 .metric-icon { border-color: #dfd1ff; background: #f2ebff; color: #8c5ce6; }
.metric-style-4 .metric-icon { border-color: #ffd7ba; background: #fff2df; color: #f47d32; }

.metric-button {
  width: 100%;
  color: var(--ink);
  text-align: left;
}

.metric-button:hover {
  border-color: var(--blue);
}

.metric span {
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin: 5px 0 3px;
  color: #111827;
  font-size: 21px;
  line-height: 1.05;
}

.metric small {
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
}

.content-grid,
.split-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  margin-bottom: 18px;
}

.split-layout {
  grid-template-columns: 420px 1fr;
}

.commercial-page [data-accounting-section="clients"] .split-layout:has(#client-form-panel[hidden]) {
  grid-template-columns: 1fr;
}

.commercial-page #client-form-panel {
  align-self: start;
}

.commercial-page #new-client-button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.commercial-page [data-accounting-section="clients"] .small-table table {
  table-layout: fixed;
  min-width: 0;
}

.commercial-page [data-accounting-section="clients"] .small-table th,
.commercial-page [data-accounting-section="clients"] .small-table td {
  padding: 6px 10px;
  vertical-align: middle;
  line-height: 1.2;
}

.commercial-page [data-accounting-section="clients"] .small-table th:nth-child(1),
.commercial-page [data-accounting-section="clients"] .small-table td:nth-child(1) {
  width: 10%;
}

.commercial-page [data-accounting-section="clients"] .small-table th:nth-child(2),
.commercial-page [data-accounting-section="clients"] .small-table td:nth-child(2) {
  width: 15%;
}

.commercial-page [data-accounting-section="clients"] .small-table th:nth-child(3),
.commercial-page [data-accounting-section="clients"] .small-table td:nth-child(3) {
  width: 23%;
}

.commercial-page [data-accounting-section="clients"] .small-table th:nth-child(4),
.commercial-page [data-accounting-section="clients"] .small-table td:nth-child(4) {
  width: 14%;
}

.commercial-page [data-accounting-section="clients"] .small-table th:nth-child(5),
.commercial-page [data-accounting-section="clients"] .small-table td:nth-child(5) {
  width: auto;
}

.commercial-page [data-accounting-section="clients"] .small-table th:nth-child(6),
.commercial-page [data-accounting-section="clients"] .small-table td:nth-child(6) {
  width: 96px;
  text-align: center;
}

.commercial-page [data-accounting-section="clients"] .small-table .record-actions {
  justify-content: center;
  gap: 6px;
}

.commercial-page [data-accounting-section="clients"] .small-table .icon-action-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 7px;
}

.commercial-page [data-accounting-section="clients"] .small-table .icon-action-button svg {
  width: 18px;
  height: 18px;
}

.employee-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.employee-directory-panel {
  width: 100%;
}

.employee-directory-panel table {
  font-family: var(--font-family);
}

.employee-directory-panel th,
.employee-directory-panel td {
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.25;
  vertical-align: middle;
}

.employee-directory-panel th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.employee-directory-panel td {
  color: #17202a;
  font-weight: 400;
}

.employee-directory-panel td strong {
  font-weight: 700;
}

.employee-row {
  cursor: pointer;
}

.employee-row:hover td {
  background: #f7fbff;
}

.employee-name-button {
  min-height: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.employee-name-button:hover {
  color: var(--blue);
}

.employee-directory-panel .icon-action-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
}

.employee-directory-panel .icon-action-button svg {
  width: 18px;
  height: 18px;
}

.employee-detail-panel {
  font-family: var(--font-family);
}

.employee-detail-content {
  display: grid;
  gap: 10px;
}

.employee-export-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #f8fafc;
}

.employee-export-toolbar strong {
  color: #17202a;
  font-size: 13px;
  font-weight: 700;
}

.employee-export-toolbar div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.employee-export-toolbar button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.employee-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.employee-detail-item,
.employee-document-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  background: #fbfcfe;
}

.employee-detail-item span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.employee-detail-item p {
  margin: 0;
  color: #17202a;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 400;
  white-space: pre-wrap;
}

.employee-detail-group {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  background: #ffffff;
}

.employee-detail-group h4 {
  margin: 0;
  color: #17202a;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 700;
}

.compact-detail-grid {
  gap: 6px;
}

.system-user-detail-panel {
  padding: 14px;
}

.system-user-detail-panel .panel-heading {
  margin-bottom: 10px;
}

.system-user-detail-panel .employee-detail-content {
  gap: 10px;
}

.system-user-detail-panel .employee-detail-grid {
  gap: 8px;
}

.system-user-detail-panel .employee-detail-item {
  min-height: 46px;
  padding: 7px 8px;
}

.system-user-detail-panel .employee-detail-item span {
  margin-bottom: 3px;
  font-size: 11px;
  line-height: 1.15;
}

.system-user-detail-panel .employee-detail-item p {
  font-size: 12px;
  line-height: 1.25;
}

.system-user-detail-panel .employee-documents-view {
  gap: 8px;
}

.system-user-detail-panel .summary-table {
  min-width: 360px;
  font-size: 12px;
}

.system-user-detail-panel .summary-table th,
.system-user-detail-panel .summary-table td {
  min-width: 128px;
  padding: 6px 8px;
  line-height: 1.2;
}

.employee-documents-view {
  display: grid;
  gap: 10px;
}

.compact-heading {
  margin-bottom: 0;
}

.employee-document-row {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 12px;
  align-items: start;
}

.document-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.document-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  text-decoration: none;
}

.document-preview-chip {
  border-color: rgba(23, 105, 170, 0.35);
  min-height: 28px;
  color: var(--blue);
  font-weight: 700;
  cursor: pointer;
}

.document-preview-chip:hover {
  border-color: var(--blue);
  background: #eef6fc;
}

.document-missing-preview {
  border-color: var(--line);
  color: var(--muted);
  font-weight: 600;
}

.document-missing-preview:hover {
  border-color: var(--amber);
  background: #fff7e8;
  color: var(--amber);
}

.muted-text {
  color: var(--muted);
}

.panel {
  position: relative;
  min-width: 240px;
  min-height: 120px;
  max-width: none;
  overflow: auto;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 12px;
  height: 12px;
  pointer-events: none;
  background:
    linear-gradient(135deg, transparent 0 55%, #b9c4ce 56% 60%, transparent 61%),
    linear-gradient(135deg, transparent 0 70%, #b9c4ce 71% 75%, transparent 76%);
}

.panel-resize-handle {
  position: absolute;
  z-index: 20;
  background: transparent;
  touch-action: none;
}

.panel-resize-handle::after {
  content: "";
  position: absolute;
  opacity: 0;
  transition: opacity 0.12s ease;
  background: var(--blue);
}

.panel.resizing .panel-resize-handle::after {
  opacity: 0.35;
}

.panel-resize-active {
  user-select: none;
}

.resize-n,
.resize-s {
  left: 12px;
  right: 12px;
  height: 22px;
  cursor: ns-resize;
}

.resize-n {
  top: 0;
}

.resize-s {
  bottom: 0;
}

.resize-n::after,
.resize-s::after {
  left: 0;
  right: 0;
  height: 2px;
}

.resize-n::after {
  top: 0;
}

.resize-s::after {
  bottom: 0;
}

.resize-e,
.resize-w {
  top: 12px;
  bottom: 12px;
  width: 22px;
  cursor: ew-resize;
}

.resize-e {
  right: 0;
}

.resize-w {
  left: 0;
}

.resize-e::after,
.resize-w::after {
  top: 0;
  bottom: 0;
  width: 2px;
}

.resize-e::after {
  right: 0;
}

.resize-w::after {
  left: 0;
}

.resize-ne,
.resize-nw,
.resize-se,
.resize-sw {
  width: 32px;
  height: 32px;
}

.panel-resize-handle:hover::after,
.panel.resizing .panel-resize-handle::after {
  opacity: 0.55;
}

.resize-ne,
.resize-sw {
  cursor: nesw-resize;
}

.resize-nw,
.resize-se {
  cursor: nwse-resize;
}

.resize-ne {
  top: 0;
  right: 0;
}

.resize-nw {
  top: 0;
  left: 0;
}

.resize-se {
  right: 0;
  bottom: 0;
}

.resize-sw {
  left: 0;
  bottom: 0;
}

.wide {
  min-width: 0;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-heading span {
  color: var(--blue);
  font-size: 13px;
}

.department-list,
.access-preview,
.record-list {
  display: grid;
  gap: 12px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.access-workflow-panel {
  margin-bottom: 18px;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.workflow-steps article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.workflow-steps strong {
  display: block;
  margin-bottom: 8px;
}

.workflow-steps p {
  margin: 0;
  color: var(--muted);
}

.role-preview .access-example {
  margin: 0;
}

.access-account-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
  gap: 12px;
  margin-bottom: 12px;
  font-size: 12px;
}

.account-setup-panel,
.role-preview-panel {
  background: #ffffff;
  padding: 12px;
}

.access-panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.access-panel-heading h2 {
  margin-bottom: 2px;
  color: #0f1f3d;
  font-size: 16px;
}

.access-panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.access-note {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef5ff;
  color: #1769aa;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.access-form {
  display: grid;
  gap: 9px;
}

.access-field {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: start;
  margin: 0;
}

.field-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #edf4ff;
  color: #1769aa;
  font-size: 12px;
  font-weight: 800;
}

.field-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.field-body {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.field-body strong {
  color: var(--ink);
  font-size: 12px;
}

.field-body small {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
}

.field-body input,
.field-body select {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.access-account-layout input,
.access-account-layout select {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.compact-button {
  min-height: 32px;
  white-space: nowrap;
  font-size: 12px;
}

.access-form-actions {
  display: grid;
  grid-template-columns: 1fr 128px;
  gap: 8px;
  margin-top: 4px;
}

.access-form-actions button {
  min-height: 34px;
  font-size: 12px;
}

.role-summary-card {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fbff;
}

.role-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #dcecff;
  color: #1769aa;
  font-weight: 800;
}

.role-summary-card h3 {
  margin-bottom: 2px;
  color: #0f1f3d;
  font-size: 14px;
}

.role-summary-card span,
.role-count span {
  color: var(--muted);
  font-size: 11px;
}

.role-count {
  display: grid;
  gap: 3px;
  justify-items: end;
}

.role-count strong {
  border-radius: 999px;
  padding: 4px 8px;
  background: #edf4ff;
  color: #1769aa;
  font-size: 11px;
}

.permission-preview-section {
  margin-top: 10px;
}

.permission-preview-section h3 {
  margin-bottom: 6px;
  font-size: 12px;
}

.permission-preview-section ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.permission-preview-section li {
  display: grid;
  grid-template-columns: 22px 1fr;
  column-gap: 7px;
  row-gap: 2px;
  align-items: start;
  padding: 4px 0;
}

.permission-preview-section li span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  font-weight: 800;
}

.permission-preview-section li strong {
  color: #17202a;
  font-size: 12px;
}

.permission-preview-section li small {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
}

.allowed-section h3 {
  color: var(--green);
}

.allowed-section li span {
  background: #e9f7ef;
  color: var(--green);
}

.restricted-section {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.restricted-section h3 {
  color: var(--red);
}

.restricted-section li span {
  background: #fdecea;
  color: var(--red);
}

.customize-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 10px;
  border: 1px solid #d8e8ff;
  border-radius: 8px;
  padding: 8px;
  background: #f5f9ff;
  color: #0f1f3d;
}

.customize-note div {
  display: grid;
  gap: 4px;
}

.customize-note span {
  color: var(--muted);
  font-size: 11px;
}

.module-grid.single {
  grid-template-columns: 1fr;
  margin-bottom: 0;
}

.module-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.module-card h3,
.access-example h3 {
  margin-bottom: 10px;
}

.module-card ul,
.access-example ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: #17202a;
}

.access-example p {
  margin: 0 0 8px;
}

.access-example ul {
  list-style: none;
  padding-left: 0;
}

.access-example li::before {
  display: inline-block;
  width: 18px;
  font-weight: 800;
}

.access-example .allowed::before {
  content: "✓";
  color: var(--green);
}

.access-example .denied::before {
  content: "×";
  color: var(--red);
}

.mini-stats {
  display: grid;
  gap: 10px;
}

.mini-stats span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.workflow-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.workflow-list span {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfe;
  font-weight: 700;
}

.workflow-list span:not(:last-child)::after {
  content: "↓";
  position: absolute;
  left: 50%;
  bottom: -18px;
  transform: translateX(-50%);
  color: var(--blue);
}

.department-row {
  display: grid;
  grid-template-columns: 190px 1fr 54px;
  align-items: center;
  gap: 12px;
}

.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf2;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.leave-dashboard {
  display: grid;
  gap: 16px;
  font-family: var(--font-family);
}

.leave-top-row,
.leave-dashboard-header,
.leave-controls,
.leave-tabs,
.leave-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.leave-top-row {
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.leave-dashboard-header {
  justify-content: space-between;
  padding-bottom: 4px;
}

.leave-dashboard-header h2 {
  margin: 0;
  color: #0f172a;
  font-size: 22px;
  font-weight: 800;
}

.leave-controls label,
.leave-filter-bar label {
  display: grid;
  gap: 6px;
  color: #42556a;
  font-size: 12px;
  font-weight: 650;
}

.leave-controls select,
.leave-filter-bar select {
  min-width: 150px;
  min-height: 36px;
  font-size: 13px;
}

#leave-toggle-filters {
  min-height: 36px;
  padding: 0 13px;
  font-size: 13px;
}

.leave-tabs {
  gap: 24px;
  overflow-x: auto;
  flex: 1;
}

.leave-tabs button {
  min-height: 40px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #42556a;
  font-size: 13px;
  font-weight: 650;
}

.leave-tabs button.active {
  border-bottom-color: #2878d4;
  color: #0b63d1;
}

.leave-controls {
  justify-content: flex-end;
  align-items: flex-end;
  padding-bottom: 8px;
}

.leave-filter-bar {
  justify-content: flex-start;
  flex-wrap: wrap;
  padding-bottom: 4px;
}

.leave-filter-bar button {
  margin-left: auto;
}

.leave-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(145px, 1fr));
  gap: 12px;
}

.leave-kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(20, 39, 61, 0.06);
}

.leave-kpi-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 999px;
  color: #1769aa;
  background: #d9eaff;
}

.leave-kpi-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.leave-kpi-icon.onleave-icon,
.leave-kpi-icon.approved-icon {
  color: #16a35f;
  background: #daf5e5;
}

.leave-kpi-icon.pending-icon {
  color: #f57c00;
  background: #fff0df;
}

.leave-kpi-icon.upcoming-icon {
  color: #8d4bd6;
  background: #efe3ff;
}

.leave-kpi-card small,
.leave-kpi-card p {
  display: block;
  margin: 0;
  color: #42556a;
  font-size: 12px;
  font-weight: 650;
}

.leave-kpi-card strong {
  display: block;
  margin: 2px 0;
  color: #0f172a;
  font-size: 23px;
  line-height: 1;
}

.hr-module-page {
  display: grid;
  gap: 16px;
}

.page-action-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin: -74px 0 26px;
}

.page-action-bar .primary {
  min-height: 42px;
  border: 1px solid #1769d8;
  border-radius: 8px;
  padding: 0 18px;
  background: #1769d8;
  color: #ffffff;
  font-weight: 750;
}

.hr-document-form {
  display: grid;
  gap: 14px;
}

.hr-document-form .form-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.hr-document-form textarea {
  min-height: 72px;
}

#hr-document-form-panel {
  margin-bottom: 24px;
}

.hr-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
}

.hr-overview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  align-content: flex-start;
}

.hr-overview-grid > .panel {
  flex: 0 1 calc(50% - 6px);
  width: calc(50% - 6px);
  max-width: 100%;
  min-width: 300px;
}

#hr-performance > .content-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  align-content: flex-start;
}

#hr-performance > .content-grid > .panel {
  flex: 0 1 calc(50% - 6px);
  width: calc(50% - 6px);
  max-width: 100%;
  min-width: 300px;
  box-sizing: border-box;
}

.compact-module-card {
  min-height: 86px;
}

.compact-module-card p {
  margin: 8px 0 0;
  color: #0f172a;
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
}

#hr-document-list .summary-table {
  min-width: 900px;
}

#hr-document-list .icon-action-button {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
}

#hr-document-list .icon-action-button svg {
  width: 17px;
  height: 17px;
}

#hr-document-list .summary-table th,
#hr-document-list .summary-table td {
  padding: 11px 12px;
}

#hr-document-list .summary-table span {
  color: var(--text-muted);
  font-size: 12px;
}

#hr-document-list .summary-table .pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #e6f5f1;
  color: #008878;
  font-size: 12px;
  font-weight: 700;
}

#hr-document-list .summary-table .danger-pill {
  background: #fdecea;
  color: #b03a2e;
}

.leave-tab-panel {
  display: grid;
  gap: 16px;
}

.leave-dashboard-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
  align-content: flex-start;
}

.leave-dashboard-grid > .panel {
  order: 3;
  flex: 0 1 calc(62% - 7px);
  width: calc(62% - 7px);
  max-width: 100%;
  min-width: 300px;
  box-sizing: border-box;
}

.leave-dashboard-grid > .panel:first-child {
  order: 1;
}

.leave-dashboard-grid > .leave-wide-panel {
  flex-basis: calc(62% - 7px);
  width: calc(62% - 7px);
}

.leave-side-stack {
  display: flex;
  order: 2;
  flex: 0 1 calc(38% - 7px);
  flex-direction: column;
  gap: 14px;
  width: calc(38% - 7px);
  max-width: 100%;
  min-width: 300px;
  box-sizing: border-box;
}

.leave-side-stack > .panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.leave-table-wrap {
  max-height: 300px;
  max-width: 100%;
  min-width: 0;
  overflow: auto;
}

.leave-table {
  min-width: 720px;
}

.leave-table th,
.leave-table td {
  padding: 8px 10px;
  font-size: 12px;
  vertical-align: middle;
}

.leave-usage {
  display: inline-block;
  width: 92px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  margin-right: 8px;
  background: #edf2f7;
}

.leave-usage i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.leave-footer-link {
  justify-self: center;
  margin-top: 12px;
}

.leave-status-chart {
  display: grid;
  grid-template-columns: 126px 1fr;
  align-items: center;
  gap: 16px;
  min-height: 170px;
  padding: 10px;
}

.leave-donut {
  display: grid;
  place-items: center;
  width: 118px;
  height: 118px;
  border-radius: 50%;
}

.leave-donut strong,
.leave-donut span {
  grid-area: 1 / 1;
}

.leave-donut strong {
  margin-top: -12px;
  color: #0f172a;
  font-size: 22px;
}

.leave-donut span {
  margin-top: 24px;
  color: #647282;
  font-size: 11px;
}

.leave-status-legend,
.leave-compact-list {
  display: grid;
  gap: 10px;
}

.leave-status-legend span,
.leave-compact-list div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  color: #17202a;
  font-size: 12px;
}

.leave-status-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 999px;
}

.leave-status-legend strong,
.leave-compact-list strong {
  color: #1769aa;
  font-weight: 700;
}

.leave-request-form {
  border-bottom: 1px solid var(--line);
  padding: 14px;
  background: #fbfcfe;
}

.leave-request-form .form-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.leave-request-form input,
.leave-request-form select,
.leave-request-form textarea {
  font-size: 13px;
}

.leave-request-form .form-actions {
  margin-top: 18px;
}

.leave-workflow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.leave-avatar {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: 8px;
  border-radius: 50%;
  background: #e8f1ff;
  color: #1769aa;
  font-size: 10px;
  font-weight: 800;
  vertical-align: middle;
}

.dashboard-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.dashboard-toolbar h2 {
  margin: 0;
  color: #0f172a;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.05;
}

.dashboard-toolbar p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.dashboard-toolbar p span {
  color: #1769aa;
  font-weight: 750;
}

.dashboard-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-period-select,
.dashboard-widget-picker summary {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  background: #ffffff;
  color: #1f2937;
  font-size: 13px;
  font-weight: 650;
  box-shadow: 0 8px 20px rgba(20, 39, 61, 0.05);
}

.dashboard-period-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.dashboard-period-select select {
  width: auto;
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: 0 18px 0 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  outline: none;
}

.dashboard-control-icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: #0f172a;
}

.dashboard-control-icon svg,
.panel-title-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-widget-picker {
  position: relative;
  z-index: 2;
}

.dashboard-widget-picker summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dashboard-widget-picker summary::-webkit-details-marker {
  display: none;
}

.dashboard-widget-picker summary::after {
  content: " v";
  color: var(--blue);
}

.dashboard-widget-options {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  min-width: 310px;
  gap: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.dashboard-widget-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.dashboard-widget-options input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-width: 14px;
  accent-color: var(--blue);
}

.dashboard-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 18px;
}

#dashboard .dashboard-grid {
  font-family: var(--font-family);
  font-size: 14px;
}

#dashboard .dashboard-grid .panel {
  display: flex;
  flex-direction: column;
  container-type: inline-size;
  flex: 0 0 calc(50% - 9px);
  width: calc(50% - 9px);
  min-height: 230px;
  min-width: 240px;
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 12px 28px rgba(20, 39, 61, 0.08);
}

#dashboard .dashboard-grid .panel[data-dashboard-widget="financial"] {
  min-height: 300px;
}

#dashboard .dashboard-grid .panel[data-dashboard-widget="commercial"] {
  min-height: 300px;
}

#dashboard .dashboard-grid .panel[data-dashboard-widget="activity"] {
  flex-basis: 100%;
  width: 100%;
}

#dashboard .dashboard-grid .panel[style*="width"] {
  flex-grow: 0;
  flex-shrink: 0;
}

#dashboard .dashboard-grid .panel .panel-heading {
  cursor: grab;
}

#dashboard .dashboard-grid .panel.dragging {
  opacity: 0.55;
  cursor: grabbing;
  outline: 2px dashed var(--blue);
  outline-offset: 2px;
}

#dashboard .dashboard-grid .panel button,
#dashboard .dashboard-grid .panel a,
#dashboard .dashboard-grid .panel input,
#dashboard .dashboard-grid .panel summary {
  cursor: pointer;
}

#dashboard .dashboard-grid h2 {
  color: #000000;
  font-family: var(--font-family);
  font-size: 18px;
  font-weight: 720;
  letter-spacing: 0;
}

#dashboard .dashboard-grid h3 {
  color: #000000;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 700;
}

#dashboard .panel-heading {
  margin-bottom: 14px;
}

.panel-title-with-icon {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-title-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  border: 1px solid #d7e8ff;
  border-radius: 10px;
  background: #eaf2ff;
  color: #2468dd;
  line-height: 1;
}

.panel-title-icon svg {
  width: 22px;
  height: 22px;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.finance-icon {
  border-color: #d7e8ff;
  background: #eaf2ff;
  color: #2468dd;
}

.commercial-icon {
  border-color: #d7e8ff;
  background: #eaf2ff;
  color: #2468dd;
}

.project-overview-body {
  display: grid;
  grid-template-columns: 1fr 210px;
  gap: 14px;
  align-items: center;
}

.commercial-overview-body {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(120px, 170px);
  gap: 18px;
  align-items: start;
  justify-content: space-between;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.project-status-chart {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.commercial-status-chart {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  height: 100%;
}

.donut {
  --active: 1;
  --completed: 1;
  --delayed: 1;
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #ffffff 0 48%, transparent 49%),
    conic-gradient(#16a35f 0 58%, #f5a623 58% 78%, #ef4e64 78% 100%);
}

.commercial-pie {
  display: grid;
  place-items: center;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #ffffff 0 48%, transparent 49%),
    conic-gradient(#1769aa 0 25%, #16a35f 25% 50%, #f5a623 50% 75%, #8d4bd6 75% 100%);
}

.commercial-pie.empty-pie {
  background:
    radial-gradient(circle at center, #ffffff 0 48%, transparent 49%),
    conic-gradient(#dce3ea 0 100%);
}

.commercial-pie strong,
.commercial-pie span {
  grid-area: 1 / 1;
}

.commercial-pie strong {
  margin-top: -14px;
  color: #000000;
  font-size: 17px;
}

.commercial-pie span {
  margin-top: 22px;
  color: #17202a;
  font-size: 11px;
}

.donut strong,
.donut span {
  grid-area: 1 / 1;
}

.donut strong {
  margin-top: -16px;
  color: #000000;
  font-size: 18px;
}

.donut span {
  margin-top: 24px;
  color: #17202a;
  font-size: 11px;
  font-weight: 400;
}

.donut-legend {
  display: grid;
  gap: 5px;
  color: #17202a;
  font-size: 13px;
  font-weight: 400;
}

.donut-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 50%;
}

.commercial-legend-list {
  display: grid;
  gap: 8px;
}

.commercial-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: #17202a;
  font-size: 14px;
  font-weight: 400;
  text-align: left;
}

.commercial-legend-item i {
  width: 10px;
  min-width: 10px;
  height: 10px;
  border-radius: 50%;
}

.commercial-legend-item:hover {
  color: var(--blue);
}

.summary-list {
  display: grid;
  gap: 8px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 7px 0;
  color: #17202a;
  font-weight: 400;
}

button.summary-row {
  width: 100%;
  min-height: 0;
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
  padding: 7px 0;
  color: #17202a;
  font-weight: 400;
  text-align: left;
}

.summary-row-button:hover,
.dashboard-linked-item:hover,
#dashboard .metric:hover,
.panel-link:hover {
  color: var(--blue);
}

.summary-row strong {
  color: #000000;
  font-size: 14px;
  font-weight: 600;
}

#dashboard .empty-state,
#dashboard .record-meta {
  color: #17202a;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 400;
}

#dashboard .summary-list {
  gap: 4px;
}

#dashboard .summary-row,
#dashboard button.summary-row {
  padding: 5px 0;
}

#dashboard [data-dashboard-widget="financial"] #financial-snapshot {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

#dashboard [data-dashboard-widget="financial"] .summary-row,
#dashboard [data-dashboard-widget="financial"] button.summary-row {
  display: grid;
  justify-items: center;
  min-height: 62px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
  text-align: center;
}

#dashboard [data-dashboard-widget="financial"] .summary-row span {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

#dashboard [data-dashboard-widget="financial"] .summary-row strong {
  color: #1769aa;
  font-size: 14px;
}

#dashboard [data-dashboard-widget="commercial"] .commercial-legend-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 10px;
  height: auto;
  min-width: 0;
}

#dashboard [data-dashboard-widget="commercial"] .commercial-legend-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 5px 10px;
  align-items: center;
  width: 100%;
  min-height: 72px;
  border: 1px solid #edf2f7;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  color: #17202a;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
}

#dashboard [data-dashboard-widget="commercial"] .commercial-legend-item strong {
  grid-column: 2;
  color: #0f172a;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

#dashboard [data-dashboard-widget="commercial"] .commercial-legend-item small {
  grid-column: 2;
  color: #5d6c7e;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

#dashboard [data-dashboard-widget="commercial"] .commercial-status-chart {
  display: grid;
  place-items: start center;
  min-height: 130px;
  border-left: 1px solid var(--line);
  padding: 10px 0 0 18px;
}

#dashboard .department-row {
  grid-template-columns: 180px 1fr 42px;
  gap: 8px;
}

#dashboard .rank-list {
  gap: 4px;
}

#dashboard .rank-list li {
  padding: 2px 0;
}

#dashboard .task-list {
  gap: 8px;
}

#dashboard .task-list li {
  padding: 10px 12px;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.quick-link {
  min-height: 36px;
}

.quick-link:disabled {
  opacity: 0.55;
  cursor: default;
}

.panel-link {
  min-height: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.dashboard-linked-item {
  cursor: pointer;
}

.dashboard-compact-record {
  margin-top: 8px;
}

.compact-table {
  overflow-x: auto;
}

.compact-table table {
  min-width: 0;
}

.compact-table th,
.compact-table td {
  padding: 8px 6px;
  font-size: 12px;
}

.rank-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.rank-list li {
  padding: 4px 0;
}

.rank-list span {
  display: inline-block;
  min-width: 150px;
}

.mini-chart {
  display: flex;
  flex: 1 1 auto;
  min-height: 120px;
  margin-top: 18px;
}

.financial-chart {
  display: grid;
  grid-template-columns: 52px 1fr;
  grid-template-areas:
    "axis plot"
    ". legend";
  grid-template-rows: minmax(120px, 1fr) auto;
  gap: 8px 10px;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.financial-y-axis {
  grid-area: axis;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: auto;
  padding-top: 1px;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  text-align: right;
}

.financial-plot {
  grid-area: plot;
  position: relative;
  height: auto;
  min-height: 0;
  padding: 0 10px;
}

.financial-plot::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 30px;
  left: 0;
  height: 1px;
  background: var(--line);
}

.financial-grid-lines {
  position: absolute;
  inset: 0 10px 30px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.financial-grid-lines span {
  height: 1px;
  background: #e8eef4;
}

.financial-bars {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(12, minmax(10px, 1fr));
  align-items: end;
  gap: clamp(2px, 0.8vw, 8px);
  height: 100%;
  min-width: 0;
}

.financial-month {
  display: grid;
  grid-template-rows: minmax(70px, 1fr) 24px;
  align-items: stretch;
  gap: 6px;
  height: 100%;
  min-width: 0;
}

.financial-month strong {
  align-self: start;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.financial-bar-group {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 3px;
  height: 100%;
  min-height: 0;
}

.financial-bar-group span {
  width: 7px;
  min-height: 0;
  border-radius: 4px 4px 0 0;
}

.income-bar {
  background: linear-gradient(180deg, #3b82f6, #1769aa);
}

.expense-bar {
  background: linear-gradient(180deg, #fb7185, #ef4444);
}

.profit-bar {
  background: linear-gradient(180deg, #34d399, #16a35f);
}

.financial-chart-legend {
  grid-area: legend;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.financial-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@container (max-width: 620px) {
  #dashboard [data-dashboard-widget="commercial"] .commercial-overview-body {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  #dashboard [data-dashboard-widget="commercial"] .commercial-status-chart {
    min-height: 110px;
    border-top: 1px solid var(--line);
    border-left: 0;
    padding: 14px 0 0;
  }

  #dashboard [data-dashboard-widget="commercial"] .commercial-pie {
    width: 104px;
    height: 104px;
  }

  #dashboard [data-dashboard-widget="financial"] #financial-snapshot {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .financial-chart {
    grid-template-columns: 44px 1fr;
    gap: 6px;
  }

  .financial-plot {
    padding: 0 4px;
  }

  .financial-grid-lines {
    inset: 0 4px 30px 0;
  }

  .financial-bars {
    gap: 2px;
  }

  .financial-bar-group {
    gap: 1px;
  }

  .financial-bar-group span {
    width: 5px;
  }

  .financial-month strong {
    font-size: 9px;
  }
}

@container (max-width: 430px) {
  #dashboard [data-dashboard-widget="commercial"] .commercial-legend-list {
    grid-template-columns: 1fr;
  }

  #dashboard [data-dashboard-widget="commercial"] .commercial-legend-item {
    min-height: 58px;
    padding: 8px 10px;
  }

  #dashboard [data-dashboard-widget="financial"] #financial-snapshot {
    grid-template-columns: 1fr;
  }

  .financial-chart {
    grid-template-columns: 38px 1fr;
  }

  .financial-y-axis {
    font-size: 10px;
  }

  .financial-month strong {
    writing-mode: vertical-rl;
    justify-self: center;
  }
}

.financial-chart-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.income-dot {
  background: #2563eb;
}

.expense-dot {
  background: #ef4444;
}

.profit-dot {
  background: #16a35f;
}

.task-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-list li,
.record,
.access-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.status,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #e8f3f1;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.status.warning {
  background: #fff3df;
  color: var(--amber);
}

.status.danger {
  background: #fdecea;
  color: var(--red);
}

.form-grid {
  display: grid;
  gap: 12px;
}

#employee-form.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  column-gap: 16px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-section-title {
  margin-top: 6px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: #17202a;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 750;
}

.form-grid .full {
  grid-column: 1 / -1;
}

#employee-form.form-grid label.full {
  grid-column: auto;
}

#employee-form .form-section-title.full,
#employee-form .employee-upload-section.full,
#employee-form .form-message.full {
  grid-column: 1 / -1;
}

.document-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.document-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.document-form [hidden] {
  display: none !important;
}

.document-form .full {
  grid-column: 1 / -1;
}

.document-auto-number {
  align-content: end;
  grid-template-columns: auto 1fr;
}

.document-lines {
  display: grid;
  gap: 10px;
  margin-top: 32px;
}

.commercial-page .document-form-card {
  --document-form-text: #10213b;
  --document-form-muted: #69788f;
  --document-form-line: #dfe6ef;
  --document-form-line-soft: #edf1f6;
  --document-form-blue: #145edb;
  --document-form-blue-soft: #edf4ff;
  --document-form-green: #21a45d;
  --document-form-red: #ef4d5b;
  border-color: var(--document-form-line);
  border-radius: 12px;
  padding: 18px;
  background: #ffffff;
  color: var(--document-form-text);
  box-shadow: 0 5px 20px rgba(21, 42, 72, 0.06);
}

.commercial-page .document-form-card .panel-heading {
  align-items: flex-start;
  margin-bottom: 18px;
  padding-bottom: 0;
  border-bottom: 0;
}

.commercial-page .document-form-card .panel-heading h2 {
  margin: 0;
  color: var(--document-form-text);
  font-size: 19px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0;
}

.commercial-page .document-form-card .panel-heading span {
  color: #46566d;
  font-size: 13px;
  font-weight: 700;
}

.commercial-page .document-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 24px;
}

.commercial-page .document-form label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #46566d;
  font-size: 13px;
  font-weight: 700;
}

.commercial-page .document-form .full {
  grid-column: 1 / -1;
}

.commercial-page .document-form input,
.commercial-page .document-form select,
.commercial-page .document-form textarea {
  min-height: 48px;
  border: 1px solid var(--document-form-line);
  border-radius: 9px;
  background: #ffffff;
  color: var(--document-form-text);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.commercial-page .document-form textarea {
  min-height: 90px;
  padding-top: 12px;
  resize: vertical;
  line-height: 1.35;
}

.commercial-page .document-form input::placeholder,
.commercial-page .document-form textarea::placeholder {
  color: #8693a5;
}

.commercial-page .document-form input:focus,
.commercial-page .document-form select:focus,
.commercial-page .document-form textarea:focus {
  border-color: #7ba8f0;
  box-shadow: 0 0 0 3px rgba(20, 94, 219, 0.08);
}

.commercial-page .document-form input:read-only,
.commercial-page .document-form input:disabled,
.commercial-page .document-form select:disabled {
  background: #f6f7f9;
  color: #7a879a;
}

.commercial-page .document-form .search-control {
  height: 48px;
  margin: 0;
  border: 1px solid var(--document-form-line);
  border-radius: 9px;
  background: #ffffff;
}

.commercial-page .document-form .search-control span {
  width: 42px;
  color: #607088;
  font-size: 17px;
}

.commercial-page .document-form .search-control input {
  min-height: 46px;
  border: 0;
  box-shadow: none;
  padding-left: 0;
}

.commercial-page .document-form .checkbox-row,
.commercial-page .document-form .inline-checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  min-height: auto;
  margin: 0;
  color: #40516b;
  font-size: 13px;
  font-weight: 700;
}

.commercial-page .document-form .checkbox-row input,
.commercial-page .document-form .inline-checkbox input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--document-form-blue);
}

.commercial-page .document-auto-number {
  align-self: end;
  min-height: 48px;
  padding-bottom: 6px;
}

.commercial-page .document-notes-toggle {
  margin-top: -2px;
}

.commercial-page .document-lines {
  gap: 12px;
  margin-top: 34px;
}

.commercial-page .document-lines .compact-heading {
  margin: 0 0 10px;
  padding: 0;
  border-bottom: 0;
}

.commercial-page .document-lines .compact-heading h3 {
  margin: 0;
  color: var(--document-form-text);
  font-size: 19px;
  font-weight: 800;
}

.commercial-page #add-document-line {
  min-height: 40px;
  border-color: var(--document-form-line);
  border-radius: 9px;
  padding: 0 16px;
  background: #ffffff;
  color: #3f4f67;
  font-size: 13px;
  font-weight: 800;
}

.commercial-page #add-document-line:hover {
  background: var(--document-form-blue-soft);
  border-color: var(--document-form-blue);
  color: var(--document-form-blue);
}

.commercial-page .document-lines .table-wrap {
  overflow: hidden;
  border: 1px solid var(--document-form-line);
  border-radius: 10px;
  background: #ffffff;
}

.commercial-page .document-lines .tracking-table {
  min-width: 1080px;
  table-layout: fixed;
  border-collapse: collapse;
}

.commercial-page .document-lines .tracking-table th {
  position: static;
  padding: 14px 13px;
  border-bottom: 1px solid var(--document-form-line);
  background: #fbfcfe;
  color: #33445d;
  font-size: 12px;
  line-height: 1.15;
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
}

.commercial-page .document-lines .tracking-table td {
  padding: 12px;
  border-right: 1px solid var(--document-form-line-soft);
  border-bottom: 1px solid var(--document-form-line);
  color: #2d3d54;
  font-size: 13px;
  vertical-align: top;
}

.commercial-page .document-lines .tracking-table th:last-child,
.commercial-page .document-lines .tracking-table td:last-child {
  border-right: 0;
}

.commercial-page .document-lines .tracking-table th:first-child,
.commercial-page .document-lines .tracking-table td:first-child {
  width: 76px;
  max-width: 76px;
  text-align: center;
}

.commercial-page .document-lines .tracking-table th:nth-child(2),
.commercial-page .document-lines .tracking-table td:nth-child(2) {
  width: 42%;
}

.commercial-page .document-lines .tracking-table th:nth-child(3),
.commercial-page .document-lines .tracking-table td:nth-child(3) {
  width: 104px;
}

.commercial-page .document-lines .tracking-table th:nth-child(4),
.commercial-page .document-lines .tracking-table td:nth-child(4) {
  width: 100px;
}

.commercial-page .document-lines .tracking-table th:nth-child(5),
.commercial-page .document-lines .tracking-table td:nth-child(5),
.commercial-page .document-lines .tracking-table th:nth-child(7),
.commercial-page .document-lines .tracking-table td:nth-child(7) {
  width: 128px;
}

.commercial-page .document-lines .tracking-table th:nth-child(6),
.commercial-page .document-lines .tracking-table td:nth-child(6) {
  width: 78px;
}

.commercial-page .document-lines .tracking-table th:nth-child(8),
.commercial-page .document-lines .tracking-table td:nth-child(8) {
  width: 76px;
}

.commercial-page .document-lines .tracking-table input,
.commercial-page .document-lines .tracking-table textarea {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #ffffff;
  font-size: 13px;
}

.commercial-page .document-lines .tracking-table input {
  min-height: 40px;
  padding: 0 10px;
}

.commercial-page .document-lines .tracking-table textarea {
  min-height: 118px;
  padding: 10px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.commercial-page .document-lines .tracking-table input:focus,
.commercial-page .document-lines .tracking-table textarea:focus {
  border-color: #7ba8f0;
  box-shadow: 0 0 0 3px rgba(20, 94, 219, 0.07);
}

.commercial-page .document-lines .tracking-table .money-input {
  min-width: 0;
  text-align: right;
}

.commercial-page .document-lines .tracking-table .calculated-input {
  border-color: transparent;
  background: #eef4f8;
  color: var(--document-form-text);
  font-weight: 800;
}

.commercial-page .line-item-cell input[name="lineItemName"] {
  margin-bottom: 9px;
  border-color: var(--document-form-line);
  font-weight: 800;
}

.commercial-page .line-image-controls {
  gap: 10px;
  margin-top: 12px;
  color: #41516a;
  font-size: 12px;
  font-weight: 700;
}

.commercial-page .image-icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.commercial-page .add-image-button {
  background: var(--document-form-green);
}

.commercial-page .remove-line-image {
  background: var(--document-form-red);
}

.commercial-page .line-image-preview {
  max-width: 120px;
  max-height: 90px;
  margin-top: 10px;
  border-color: var(--document-form-line);
  border-radius: 9px;
}

.commercial-page .document-form > button[type="submit"],
.commercial-page #cancel-document-form {
  min-height: 48px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 800;
}

.commercial-page .document-form > button[type="submit"] {
  border: 0;
  background: linear-gradient(90deg, #0d59d5, #145edb);
  color: #ffffff;
  box-shadow: 0 5px 14px rgba(20, 94, 219, 0.18);
}

.commercial-page #cancel-document-form {
  border: 1px solid var(--document-form-line);
  background: #ffffff;
  color: #35455d;
}

.delivery-signature-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.delivery-signature-fields[hidden] {
  display: none;
}

.compact-heading {
  margin-bottom: 0;
}

.table-wrap {
  max-height: 420px;
  overflow: auto;
}

.document-lines .table-wrap {
  max-height: none;
  overflow: visible;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 12px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
  line-height: 1.3;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td select,
td input,
td textarea {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.empty-state {
  color: var(--muted);
  font-weight: 700;
}

.matrix-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfcfe;
}

.matrix {
  overflow-x: auto;
}

.permission-heading-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  text-align: right;
}

.access-matrix-panel > .panel-heading {
  align-items: center;
}

.permission-heading-meta .form-message {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.access-account-layout,
.system-user-detail-panel {
  flex: 1 1 100%;
  width: 100%;
}

.access-matrix-panel,
.system-users-panel {
  flex: 0 1 calc(50% - 8px);
  width: calc(50% - 8px);
  max-width: 100%;
  min-width: 300px;
  box-sizing: border-box;
}

.system-users-panel {
  margin-top: 0;
}

.matrix-grid {
  display: grid;
  grid-template-columns: minmax(150px, 1.05fr) minmax(120px, 0.8fr) minmax(108px, 0.7fr) repeat(6, minmax(108px, 1fr));
  min-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  font-size: 12px;
}

.matrix-grid > div {
  min-height: 46px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px;
  background: #ffffff;
}

.matrix-grid .head {
  background: #eef4f8;
  font-weight: 700;
  font-size: 12px;
}

.matrix-grid select {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.matrix-grid .icon-action-button,
.system-users-panel .icon-action-button {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
}

.matrix-grid .icon-action-button svg,
.system-users-panel .icon-action-button svg {
  width: 16px;
  height: 16px;
}

.matrix-grid select.pending-change {
  border-color: var(--amber);
  background: #fff7e8;
  box-shadow: 0 0 0 2px rgba(185, 119, 14, 0.14);
}

.department-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.process-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.7fr);
  gap: 18px;
  margin-bottom: 18px;
}

.project-process-intro {
  display: grid;
  gap: 10px;
}

#projects > .panel,
#projects > .process-summary,
#projects > .content-grid {
  margin-top: 18px;
}

.process-list {
  display: grid;
  gap: 14px;
  max-height: 620px;
  overflow-y: auto;
  padding-right: 4px;
}

.process-step {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.step-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
}

.process-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.process-columns ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.check-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fbfcfe;
}

.check-grid input {
  width: 16px;
  min-height: 16px;
}

.gate-outcomes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tracking-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.tracking-toolbar label {
  width: min(100%, 520px);
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.tracking-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tracking-tables {
  display: grid;
  gap: 18px;
}

.tracking-section {
  display: grid;
  gap: 10px;
}

.tracking-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.tracking-heading span {
  color: var(--muted);
  font-size: 13px;
}

.tracking-wrap {
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tracking-table {
  min-width: 900px;
  font-size: 12px;
}

.document-lines .tracking-table {
  min-width: 0;
  table-layout: fixed;
}

.document-lines .tracking-table th:first-child,
.document-lines .tracking-table td:first-child {
  width: 64px;
  min-width: 0;
  max-width: 64px;
  text-align: center;
}

.document-lines .tracking-table th:nth-child(2),
.document-lines .tracking-table td:nth-child(2) {
  width: auto;
  min-width: 0;
}

.document-lines .tracking-table th:nth-child(3),
.document-lines .tracking-table td:nth-child(3) {
  width: 104px;
  min-width: 0;
}

.document-lines .tracking-table th:nth-child(4),
.document-lines .tracking-table td:nth-child(4) {
  width: 84px;
  min-width: 0;
}

.document-lines .tracking-table th:nth-child(5),
.document-lines .tracking-table td:nth-child(5) {
  width: 128px;
  min-width: 0;
}

.document-lines .tracking-table th:nth-child(6),
.document-lines .tracking-table td:nth-child(6) {
  width: 72px;
  min-width: 0;
}

.document-lines .tracking-table th:nth-child(7),
.document-lines .tracking-table td:nth-child(7) {
  width: 128px;
  min-width: 0;
}

.document-lines .tracking-table th:nth-child(8),
.document-lines .tracking-table td:nth-child(8) {
  width: 76px;
  min-width: 0;
}

.document-lines .tracking-table th,
.document-lines .tracking-table td {
  min-width: 0;
  padding: 8px 6px;
}

.document-lines .tracking-table input,
.document-lines .tracking-table textarea {
  box-sizing: border-box;
  width: 100%;
}

.delivery-note-lines .priced-column {
  display: none;
}

.delivery-note-lines .tracking-table th:first-child,
.delivery-note-lines .tracking-table td:first-child {
  width: 84px;
  max-width: 84px;
}

.delivery-note-lines .tracking-table th:nth-child(6),
.delivery-note-lines .tracking-table td:nth-child(6) {
  width: 120px;
}

.tracking-table th,
.tracking-table td {
  min-width: 128px;
  padding: 8px;
}

.tracking-table input {
  min-height: 32px;
  border-color: transparent;
  background: #ffffff;
  font-size: 12px;
}

.tracking-table .money-input {
  text-align: right;
  font-size: 12px;
  padding-left: 6px;
  padding-right: 6px;
}

.tracking-table .calculated-input {
  background: #eef4f8;
  color: var(--ink);
  font-weight: 700;
}

.document-lines input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.document-lines input[type="number"]::-webkit-inner-spin-button,
.document-lines input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.tracking-table textarea {
  width: 100%;
  min-height: 120px;
  border-color: transparent;
  background: #ffffff;
  font-size: 12px;
  resize: vertical;
  line-height: 1.35;
  white-space: pre-wrap;
}

.tracking-table input:focus,
.tracking-table textarea:focus {
  border-color: var(--blue);
  outline: none;
}

.line-item-cell {
  min-width: 0;
}

.line-item-cell input {
  margin-bottom: 6px;
  font-weight: 700;
}

.inline-checkbox {
  display: inline-grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.inline-checkbox input {
  width: 16px;
  min-height: 16px;
  margin: 0;
}

.line-image-preview {
  display: block;
  max-width: 140px;
  max-height: 100px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: contain;
  background: #ffffff;
}

.line-image-preview[hidden] {
  display: none;
}

.line-image-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.image-icon-button {
  width: 28px;
  min-height: 28px;
  border-radius: 999px;
  padding: 0;
  line-height: 1;
}

.add-image-button {
  background: var(--green);
  color: #ffffff;
}

.remove-line-image {
  background: var(--red);
  color: #ffffff;
}

.remove-line-image[hidden] {
  display: none;
}

.commercial-page .document-lines .tracking-table {
  min-width: 1080px;
  table-layout: fixed;
}

.commercial-page .delivery-note-lines .tracking-table {
  min-width: 620px;
}

.commercial-page .document-lines .tracking-table th,
.commercial-page .document-lines .tracking-table td {
  min-width: 0;
  padding: 12px;
}

.commercial-page .document-lines .tracking-table th:first-child,
.commercial-page .document-lines .tracking-table td:first-child {
  width: 76px;
  max-width: 76px;
  text-align: center;
}

.commercial-page .document-lines .tracking-table th:nth-child(2),
.commercial-page .document-lines .tracking-table td:nth-child(2) {
  width: 42%;
}

.commercial-page .delivery-note-lines .tracking-table th:nth-child(2),
.commercial-page .delivery-note-lines .tracking-table td:nth-child(2) {
  width: auto;
}

.commercial-page .delivery-note-lines .tracking-table th:nth-child(6),
.commercial-page .delivery-note-lines .tracking-table td:nth-child(6) {
  width: 96px;
}

.commercial-page .document-lines .tracking-table input,
.commercial-page .document-lines .tracking-table textarea {
  width: 100%;
  border-radius: 8px;
  font-size: 13px;
}

.commercial-page .document-lines .tracking-table input {
  min-height: 40px;
}

.commercial-page .document-lines .tracking-table .money-input {
  text-align: right;
}

.commercial-page .line-item-cell input[name="lineItemName"] {
  border-color: var(--document-form-line);
  font-weight: 800;
}

.summary-table {
  min-width: 560px;
}

.summary-table th,
.summary-table td {
  min-width: 160px;
}

.department-card {
  min-height: 230px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.department-card ul {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.record {
  display: grid;
  gap: 10px;
}

.record-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.commercial-page #document-list .record-head {
  align-items: center;
  min-height: 42px;
}

.commercial-page #document-list .record-open {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 5px;
  border: 0;
  border-radius: 8px;
  padding: 4px 6px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.commercial-page #document-list .record-open:hover,
.commercial-page #document-list .record-open:focus-visible {
  background: #f4f8fd;
  outline: 1px solid #cfe0f2;
}

.commercial-page #document-list .record-open:hover h3,
.commercial-page #document-list .record-open:focus-visible h3 {
  color: #1769d2;
  text-decoration: underline;
}

.commercial-page #document-list .record-actions {
  align-items: center;
  align-self: center;
  flex-wrap: wrap;
  gap: 8px;
}

.commercial-page #document-list .record-actions .secondary {
  width: auto;
  min-width: 76px;
  min-height: 34px;
  height: 34px;
  padding: 0 12px;
  align-self: center;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1;
}

.commercial-page #document-list .record-actions [data-print-document] {
  min-width: 122px;
}

.commercial-page #document-list .record-actions .document-action-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0;
  background: #ffffff;
  line-height: 1;
}

.commercial-page #document-list .record-actions .document-action-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.commercial-page #document-list .record-actions .invoice-action {
  border-color: #bfead2;
  background: #e9f8ef;
  color: #1fa85b;
}

.commercial-page #document-list .record-actions .edit-action {
  border-color: #c9dbff;
  background: #edf4ff;
  color: #2167d8;
}

.commercial-page #document-list .record-actions .delete-action {
  border-color: #ffc9c9;
  background: #ffecec;
  color: #d93030;
}

.commercial-page #document-list .record-actions .print-action {
  border-color: #dccfff;
  background: #f0e8ff;
  color: #7d4fd6;
}

.commercial-page #document-list .record-actions .document-action-button:hover {
  filter: brightness(0.97);
  transform: translateY(-1px);
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.record-note {
  margin: 8px 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.project-financial-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.project-financial-strip span {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 700;
}

.project-financial-strip strong {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.project-financial-strip .profit-value {
  color: #137a45;
}

.project-financial-strip .loss-value {
  color: #c52f2f;
}

.compact-status-select {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 28px 4px 10px;
  background: #eef8f4;
  color: #008b7b;
  font-size: 12px;
  font-weight: 800;
}

.compact-status-select.danger {
  background: #fff0ee;
  color: #b63228;
}

.compact-status-select.success {
  background: #e8f8ef;
  color: #137a45;
}

.expense-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 14px;
}

#expense-list .record-actions {
  align-items: center;
}

#expense-list .status.pending {
  background: #fff7e8;
  color: #b9770e;
}

#expense-list .status.success {
  background: #e8f8ef;
  color: #137a45;
}

#expense-list .status.danger {
  background: #ffeceb;
  color: #b63228;
}

.score {
  display: grid;
  grid-template-columns: 130px 1fr 44px;
  align-items: center;
  gap: 10px;
}

@media (max-width: 1050px) {
  .login-card {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 270px;
  }

  .login-panel {
    padding: 36px;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    padding: 22px 16px 20px;
  }

  .app-shell {
    margin-left: 260px;
    padding: 22px 16px 20px;
  }

  body.sidebar-collapsed .sidebar {
    width: 78px;
    padding: 18px 10px 16px;
  }

  body.sidebar-collapsed .app-shell {
    margin-left: 78px;
  }

  .content-grid,
  .access-account-layout,
  .dashboard-grid,
  .leave-dashboard-grid,
  .split-layout,
  .process-summary,
  .process-columns,
  .document-form,
  #employee-form.form-grid,
  .metric-grid,
  .metric-grid.compact,
  .module-grid,
  .department-grid,
  .check-grid {
    grid-template-columns: 1fr;
  }

  .leave-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-overview-body,
  .commercial-overview-body {
    grid-template-columns: 1fr;
  }

  .role-summary-card,
  .access-form-actions {
    grid-template-columns: 1fr;
  }

  .commercial-document-summary {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
}

@media (max-width: 680px) {
  .login-screen {
    padding: 12px;
  }

  .login-card {
    min-height: auto;
  }

  .login-visual,
  .login-panel {
    padding: 24px;
  }

  .login-form-heading h1 {
    font-size: 36px;
  }

  .sidebar {
    width: min(82vw, 286px);
    padding: 16px 12px;
  }

  .app-shell {
    margin-left: min(82vw, 286px);
    padding: 12px 10px 18px;
  }

  body.sidebar-collapsed .sidebar {
    width: 68px;
    padding: 14px 8px;
  }

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

  body.sidebar-collapsed .brand img {
    width: 38px;
    height: 38px;
  }

  body.sidebar-collapsed .sidebar-toggle,
  body.sidebar-collapsed .nav-item,
  body.sidebar-collapsed .nav-group-title,
  body.sidebar-collapsed .sidebar-logout {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
  }

  body.sidebar-collapsed .nav-item .nav-icon,
  body.sidebar-collapsed .nav-group-title .nav-icon {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .topbar,
  .topbar-actions,
  .commercial-header,
  .commercial-header-actions,
  .dashboard-toolbar,
  .dashboard-toolbar-actions,
  .leave-top-row,
  .leave-dashboard-header,
  .leave-controls,
  .panel-heading,
  .record-head {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .commercial-document-summary {
    grid-template-columns: 1fr;
  }

  .leave-kpi-grid,
  .leave-status-chart {
    grid-template-columns: 1fr;
  }

  .dashboard-search {
    min-width: 0;
  }

  h1 {
    font-size: 26px;
  }

  .department-row,
  .score {
    grid-template-columns: 1fr;
  }
}

/* ==================================================
   PROJECT MODULE ONLY
================================================== */

#projects {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #10213b;
}

#projects .split-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 18px;
  align-items: start;
}

#projects .panel {
  background: #ffffff;
  border: 1px solid #dce3ea;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 14px 36px rgba(23, 32, 42, 0.06);
}

#projects .panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

#projects .panel-heading h2 {
  margin: 0;
  color: #10213b;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.15px;
}

#projects .panel-heading span {
  color: #69788f;
  font-size: 12px;
  font-weight: 400;
}

#projects .form-grid {
  display: grid;
  gap: 12px;
}

#projects label {
  display: grid;
  gap: 6px;
  color: #46566d;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

#projects input,
#projects select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #d8e1ea;
  border-radius: 7px;
  padding: 9px 12px;
  background: #ffffff;
  color: #10213b;
  font-size: 14px;
  font-weight: 500;
}

#projects input::placeholder {
  color: #8693a5;
  font-weight: 400;
}

#projects button {
  min-height: 42px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 700;
}

#projects button[type="submit"] {
  border: 0;
  background: #1769aa;
  color: #ffffff;
}

#projects .secondary {
  border: 1px solid #d8e1ea;
  background: #ffffff;
  color: #10213b;
}

#project-list {
  display: grid;
  gap: 12px;
}

#project-list .record {
  border: 1px solid #dce3ea;
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

#project-list .record-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

#project-list h3 {
  margin: 0 0 6px;
  color: #10213b;
  font-size: 16px;
  font-weight: 800;
}

#project-list .record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #69788f;
  font-size: 12px;
}

.menu-permission-grid {
  grid-template-columns: minmax(150px, 1fr) minmax(110px, 0.7fr) repeat(var(--permission-columns), minmax(118px, 1fr)) minmax(96px, 0.65fr);
  min-width: calc(356px + (var(--permission-columns) * 118px));
}

#project-list .record-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#projects .compact-status-select {
  width: auto;
  min-height: 32px;
  border: 1px solid #dce3ea;
  border-radius: 999px;
  padding: 5px 30px 5px 12px;
  background: #eef8f4;
  color: #008b7b;
  font-size: 12px;
  font-weight: 800;
}

#projects .compact-status-select.success {
  background: #e8f8ef;
  color: #137a45;
}

#projects .compact-status-select.danger {
  background: #fff0ee;
  color: #b63228;
}

#projects .icon-action-button {
  width: 36px;
  height: 36px;
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #cfe0f5;
  border-radius: 8px;
  background: #eef5ff;
  color: #1769aa;
  padding: 0;
}

#projects .icon-action-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#projects .danger-icon-button {
  border-color: #ffc7bf;
  background: #fff0ee;
  color: #c52f2f;
}

#projects .project-financial-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin: 14px 0 12px;
}

#projects .project-financial-strip span {
  display: grid;
  gap: 5px;
  border: 1px solid #dce3ea;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  color: #10213b;
  font-size: 13px;
  font-weight: 700;
}

#projects .project-financial-strip strong {
  color: #69788f;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

#projects .project-financial-strip .profit-value {
  color: #137a45;
}

#projects .project-financial-strip .loss-value {
  color: #c52f2f;
}

#projects .empty-state {
  border: 1px dashed #d8e1ea;
  border-radius: 8px;
  padding: 18px;
  color: #69788f;
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 1050px) {
  #projects .split-layout {
    grid-template-columns: 1fr;
  }

  #projects .project-financial-strip {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 680px) {
  #project-list .record-head {
    flex-direction: column;
  }

  #projects .project-financial-strip {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   PROJECT MODULE - ATTACHED STYLE APPLIED TO EXISTING APP
========================================================= */

#projects.project-page {
  --project-bg: #f4f7fb;
  --project-surface: #ffffff;
  --project-surface-soft: #f8fafc;
  --project-text: #0f1f38;
  --project-text-secondary: #53657d;
  --project-muted: #74849a;
  --project-primary: #1769d2;
  --project-primary-hover: #0f59b8;
  --project-primary-soft: #eaf3ff;
  --project-green: #11a463;
  --project-green-soft: #e8f8f0;
  --project-red: #d9485f;
  --project-red-soft: #fff0f2;
  --project-orange: #e99a11;
  --project-orange-soft: #fff5e2;
  --project-purple: #7c4dd8;
  --project-purple-soft: #f1ebff;
  --project-border: #d9e3ef;
  --project-border-soft: #e9eef5;
  --project-shadow: 0 10px 30px rgba(28, 47, 75, 0.06);
  --project-shadow-hover: 0 16px 40px rgba(28, 47, 75, 0.11);
  --project-radius-sm: 9px;
  --project-radius-md: 13px;
  --project-radius-lg: 18px;
  width: 100%;
  min-height: calc(100vh - 48px);
  padding: 32px 34px 50px;
  background: var(--project-bg);
  color: var(--project-text);
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#projects.project-page *,
#projects.project-page *::before,
#projects.project-page *::after {
  box-sizing: border-box;
}

#projects.project-page button,
#projects.project-page input,
#projects.project-page select,
#projects.project-page textarea {
  font-family: inherit;
}

#projects .project-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

#projects .project-page-heading {
  min-width: 0;
}

#projects .project-page-title {
  margin: 0;
  color: var(--project-text);
  font-size: 38px;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.7px;
}

#projects .project-page-subtitle {
  margin: 10px 0 0;
  color: var(--project-text-secondary);
  font-size: 17px;
  line-height: 1.5;
  font-weight: 400;
}

#projects .project-detail-section {
  display: grid;
  grid-template-columns: minmax(340px, 0.42fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-top: 0;
}

#projects .project-card {
  width: 100%;
  border: 1px solid var(--project-border);
  border-radius: var(--project-radius-lg);
  background: var(--project-surface);
  box-shadow: var(--project-shadow);
  overflow: hidden;
}

#projects .project-card:hover {
  box-shadow: var(--project-shadow-hover);
}

#projects .project-card-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0;
  padding: 17px 24px;
  border-bottom: 1px solid var(--project-border);
  background: #ffffff;
}

#projects .project-card-title {
  margin: 0;
  color: var(--project-text);
  font-size: 20px;
  line-height: 1.3;
  font-weight: 800;
}

#projects .project-card-subtitle {
  margin: 4px 0 0;
  color: var(--project-muted);
  font-size: 13px;
  font-weight: 400;
}

#projects .project-card-body {
  padding: 22px 24px;
}

#projects .project-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

#projects .project-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #34445a;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 800;
}

#projects .project-form-grid input,
#projects .project-form-grid select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--project-border);
  border-radius: 10px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--project-text);
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#projects .project-form-grid input:focus,
#projects .project-form-grid select:focus {
  border-color: #78aae6;
  box-shadow: 0 0 0 4px rgba(23, 105, 210, 0.1);
}

#projects .project-form-grid input::placeholder {
  color: #8a96a5;
  font-weight: 400;
}

#projects #project-submit-button,
#projects #cancel-project-edit {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  font-size: 14px;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

#projects #project-submit-button {
  border: 1px solid var(--project-primary);
  background: var(--project-primary);
  color: #ffffff;
  box-shadow: 0 7px 18px rgba(23, 105, 210, 0.2);
}

#projects #project-submit-button:hover {
  border-color: var(--project-primary-hover);
  background: var(--project-primary-hover);
  transform: translateY(-1px);
}

#projects #cancel-project-edit {
  border: 1px solid var(--project-border);
  background: #ffffff;
  color: var(--project-text);
}

#projects .project-register {
  margin-bottom: 22px;
}

#projects #project-list {
  display: block;
}

#projects .project-table-wrap {
  width: 100%;
  padding: 0 24px 18px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: #bac7d5 transparent;
}

#projects .project-table-wrap::-webkit-scrollbar {
  height: 8px;
}

#projects .project-table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

#projects .project-table-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #c4ced9;
}

#projects .project-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  border-spacing: 0;
  background: #ffffff;
}

#projects .project-table thead th {
  padding: 17px 12px;
  border-bottom: 1px solid var(--project-border);
  background: #f5f8fc;
  color: var(--project-text-secondary);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

#projects .project-table tbody tr {
  transition: background-color 0.18s ease;
}

#projects .project-table tbody tr:hover {
  background: #fbfdff;
}

#projects .project-table tbody td {
  padding: 17px 12px;
  border-bottom: 1px solid var(--project-border-soft);
  color: var(--project-text);
  font-size: 14px;
  line-height: 1.4;
  vertical-align: middle;
}

#projects .project-table tbody tr:last-child td {
  border-bottom: 0;
}

#projects .project-code {
  display: block;
  margin-bottom: 2px;
  color: #07162b;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 800;
}

#projects .project-name {
  display: block;
  max-width: 260px;
  overflow: hidden;
  color: var(--project-text-secondary);
  font-size: 14px;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#projects .project-client,
#projects .project-quotation,
#projects .project-money {
  color: var(--project-text);
  font-weight: 500;
}

#projects .project-po {
  display: block;
  margin-top: 3px;
  color: var(--project-muted);
  font-size: 12px;
  font-weight: 500;
}

#projects .project-money,
#projects .project-profit,
#projects .project-loss {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#projects .project-profit {
  color: var(--project-green);
  font-weight: 800;
}

#projects .project-loss {
  color: var(--project-red);
  font-weight: 800;
}

#projects .project-status-select {
  min-width: 145px;
  min-height: 38px;
  border: 1px solid var(--project-border);
  border-radius: 999px;
  padding: 0 34px 0 12px;
  color: var(--project-text);
  font-size: 12px;
  font-weight: 800;
  outline: none;
  cursor: pointer;
}

#projects .project-status-select:focus {
  border-color: #78aae6;
  box-shadow: 0 0 0 4px rgba(23, 105, 210, 0.1);
}

#projects .project-status.in-progress {
  background: #e8f2ff;
  color: #0b64d8;
}

#projects .project-status.complete {
  background: var(--project-green-soft);
  color: #08794a;
}

#projects .project-status.on-hold {
  background: var(--project-orange-soft);
  color: #a96800;
}

#projects .project-status.aborted {
  background: var(--project-red-soft);
  color: #b92d43;
}

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

#projects .icon-action-button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cfe0f5;
  border-radius: 10px;
  background: #eef5ff;
  color: var(--project-primary);
  padding: 0;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

#projects .icon-action-button:hover {
  border-color: var(--project-primary);
  background: var(--project-primary-soft);
  box-shadow: 0 5px 12px rgba(23, 105, 210, 0.09);
  transform: translateY(-1px);
}

#projects .icon-action-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#projects .danger-icon-button {
  border-color: #f3c2ca;
  background: #fff5f6;
  color: #b4233b;
}

#projects .danger-icon-button:hover {
  border-color: #ee9aa8;
  background: var(--project-red-soft);
}

#projects .project-empty-state {
  padding: 45px 20px;
  text-align: center;
}

#projects .project-empty-icon {
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  border-radius: 15px;
  background: var(--project-primary-soft);
  color: var(--project-primary);
  font-size: 19px;
  font-weight: 800;
}

#projects .project-empty-title {
  margin: 0 0 5px;
  color: var(--project-text);
  font-size: 16px;
  font-weight: 800;
}

#projects .project-empty-text {
  margin: 0;
  color: var(--project-muted);
  font-size: 13px;
  line-height: 1.5;
}

#projects.project-page button:focus-visible,
#projects.project-page a:focus-visible,
#projects.project-page input:focus-visible,
#projects.project-page select:focus-visible {
  outline: 3px solid rgba(23, 105, 210, 0.22);
  outline-offset: 2px;
}

@media (max-width: 1200px) {
  #projects .project-detail-section {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  #projects.project-page {
    padding: 26px 20px 40px;
  }

  #projects .project-page-header {
    flex-direction: column;
    align-items: stretch;
  }

  #projects .project-page-title {
    font-size: 32px;
  }

  #projects .project-page-subtitle {
    font-size: 15px;
  }

  #projects .project-card-header {
    padding: 16px 20px;
  }

  #projects .project-card-body {
    padding: 20px;
  }

  #projects .project-table-wrap {
    padding: 0 20px 16px;
  }
}

@media (max-width: 650px) {
  #projects.project-page {
    padding: 20px 14px 30px;
  }

  #projects .project-page-title {
    font-size: 28px;
  }

  #projects .project-form-grid {
    grid-template-columns: 1fr;
  }

  #projects .project-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  #projects .project-table-wrap {
    padding: 0 14px 14px;
  }
}

/* Project single-page dashboard layout */
#projects.project-page {
  min-height: auto;
  padding: 4px 22px 26px;
}

#projects .project-page-header {
  align-items: center;
  margin-bottom: 18px;
}

#projects .project-page-title {
  font-size: 32px;
}

#projects .project-page-subtitle {
  margin-top: 6px;
  font-size: 14px;
}

#projects .project-page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#projects .project-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--project-border);
  border-radius: 10px;
  padding: 0 17px;
  background: #ffffff;
  color: var(--project-text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

#projects .project-btn-primary {
  border-color: var(--project-primary);
  background: var(--project-primary);
  color: #ffffff;
  box-shadow: 0 7px 18px rgba(23, 105, 210, 0.2);
}

#projects .project-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

#projects .project-kpi-card {
  min-height: 126px;
  border-radius: 16px;
  padding: 20px 22px;
}

#projects .project-kpi-label {
  font-size: 12px;
}

#projects .project-kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

#projects .project-kpi-value {
  margin-top: 15px;
  font-size: 27px;
}

#projects .project-kpi-description {
  margin-top: 8px;
  font-size: 13px;
}

#projects .project-entry-layout {
  display: block;
  margin-bottom: 18px;
}

#projects .project-entry-layout .project-card {
  max-width: 920px;
}

#projects .project-register {
  margin-bottom: 18px;
}

#projects .project-card-header {
  min-height: 68px;
  padding: 14px 20px;
}

#projects .project-card-title {
  font-size: 18px;
}

#projects .project-register-toolbar {
  padding: 16px 20px 14px;
}

#projects .project-search {
  width: 230px;
  min-height: 44px;
  font-size: 14px;
}

#projects .project-select {
  min-width: 150px;
  min-height: 44px;
  font-size: 14px;
}

#projects .project-table-wrap {
  padding: 0 20px 14px;
}

#projects .project-table {
  min-width: 1010px;
}

#projects .project-table thead th {
  padding: 13px 10px;
  font-size: 11px;
}

#projects .project-table tbody td {
  padding: 13px 10px;
  font-size: 13px;
}

#projects .project-code,
#projects .project-name {
  font-size: 13px;
}

#projects .project-open-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--project-border);
  border-radius: 9px;
  background: #ffffff;
  color: var(--project-text);
  font-size: 12px;
  font-weight: 800;
}

#projects .project-status-select {
  min-width: 130px;
  min-height: 34px;
}

#projects .record-actions {
  gap: 6px;
}

#projects .icon-action-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 9px;
}

#projects .icon-action-button svg {
  width: 16px;
  height: 16px;
}

#projects .project-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.7fr);
  gap: 18px;
  align-items: stretch;
}

#projects .project-bottom-grid .project-card {
  min-height: 250px;
}

#projects .project-detail-header {
  margin-bottom: 16px;
}

#projects .project-detail-title {
  font-size: 24px;
}

#projects .project-financial-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

#projects .project-financial-box {
  min-height: 86px;
  padding: 13px 15px;
}

#projects .project-financial-value {
  font-size: 20px;
}

#projects .project-utilisation {
  margin-top: 18px;
}

#projects .project-linked-expenses {
  margin-top: 20px;
}

#projects .project-expense-row {
  padding: 10px 0;
}

#projects .project-activity-list {
  gap: 9px;
}

#projects .project-activity-item {
  padding: 12px;
}

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

  #projects .project-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  #projects.project-page {
    padding: 0 12px 22px;
  }

  #projects .project-page-actions,
  #projects .project-register-filters {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  #projects .project-kpi-grid,
  #projects .project-financial-grid {
    grid-template-columns: 1fr;
  }

  #projects .project-search,
  #projects .project-select {
    width: 100%;
  }
}

/* Project and Expense module style from attached reference */
#projects.project-page,
.commercial-page .expense-page {
  --module-surface: #ffffff;
  --module-soft: #f8fafc;
  --module-text: #172033;
  --module-muted: #64748b;
  --module-border: #dfe7f0;
  --module-primary: #1769d2;
  --module-green: #16a66a;
  --module-orange: #f59e0b;
  --module-red: #dc4c64;
  --module-purple: #7c3aed;
  --module-shadow: 0 10px 28px rgba(22, 34, 51, 0.07);
  --module-radius: 16px;
}

#projects.project-page {
  padding: 10px 22px 28px;
  color: var(--module-text);
}

#projects .project-page-header {
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  margin-bottom: 14px;
}

#projects .project-page-title {
  font-size: 30px;
  letter-spacing: -0.5px;
}

#projects .project-page-subtitle {
  margin-top: 6px;
  color: var(--module-muted);
  font-size: 14px;
}

#projects .project-btn,
.commercial-page .expense-page .secondary,
.commercial-page .expense-page button[type="submit"] {
  min-height: 40px;
  border: 1px solid var(--module-border);
  border-radius: 10px;
  padding: 9px 14px;
  background: #ffffff;
  color: var(--module-text);
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
}

#projects .project-btn:hover,
.commercial-page .expense-page .secondary:hover {
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

#projects .project-btn-primary,
#projects #project-submit-button,
.commercial-page .expense-page button[type="submit"] {
  border-color: var(--module-primary);
  background: var(--module-primary);
  color: #ffffff;
}

#projects .project-kpi-grid,
.commercial-page .expense-page .expense-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

#projects .project-kpi-card,
.commercial-page .expense-page .commercial-summary-card {
  min-height: 96px;
  border: 1px solid var(--module-border);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--module-surface);
  box-shadow: var(--module-shadow);
}

#projects .project-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#projects .project-kpi-label,
.commercial-page .expense-page .commercial-summary-card span:last-child {
  margin: 0;
  color: var(--module-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#projects .project-kpi-icon,
.commercial-page .expense-page .commercial-summary-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: #eef5ff;
  color: var(--module-primary);
  font-size: 0;
  font-weight: 900;
}

#projects .project-kpi-icon svg,
.commercial-page .expense-page .commercial-summary-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#projects .project-kpi-icon.green,
.commercial-page .expense-page .commercial-summary-icon.accepted {
  background: #e8f8f0;
  color: var(--module-green);
}

#projects .project-kpi-icon.orange,
.commercial-page .expense-page .commercial-summary-icon.pending {
  background: #fff4e5;
  color: var(--module-orange);
}

#projects .project-kpi-icon.purple,
.commercial-page .expense-page .commercial-summary-icon.value {
  background: #f0e8ff;
  color: var(--module-purple);
}

#projects .project-kpi-value,
.commercial-page .expense-page .commercial-summary-card strong {
  display: block;
  margin: 8px 0 4px;
  color: var(--module-text);
  font-size: 22px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.2px;
  font-variant-numeric: tabular-nums;
}

#projects .project-kpi-value.profit {
  color: var(--module-green);
}

#projects .project-kpi-value.loss {
  color: var(--module-red);
}

#projects .project-kpi-description {
  color: var(--module-muted);
  font-size: 12px;
}

#projects .project-card,
.commercial-page .expense-page .panel {
  border: 1px solid var(--module-border);
  border-radius: var(--module-radius);
  background: var(--module-surface);
  box-shadow: var(--module-shadow);
  overflow: hidden;
  resize: none;
  min-width: 340px;
  min-height: 180px;
}

#projects .project-card-header,
.commercial-page .expense-page .panel-heading {
  min-height: 66px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--module-border);
  background: #ffffff;
}

#projects .project-card-title,
.commercial-page .expense-page .panel-heading h2 {
  margin: 0;
  color: var(--module-text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
}

#projects .project-card-subtitle,
.commercial-page .expense-page .panel-heading span {
  color: var(--module-muted);
  font-size: 12px;
  font-weight: 500;
}

#projects .project-card-body,
.commercial-page .expense-page .record-list {
  padding: 16px 20px;
}

#projects .project-register-toolbar,
.commercial-page .expense-page .document-search-field {
  padding: 16px 20px 14px;
  margin: 0;
}

#projects .project-register-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#projects .project-search,
#projects .project-select,
#projects .project-form-grid input,
#projects .project-form-grid select,
.commercial-page .expense-page input,
.commercial-page .expense-page select,
.commercial-page .expense-page textarea {
  border: 1px solid var(--module-border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--module-text);
  font-size: 13px;
  font-weight: 500;
}

#projects .project-search,
#projects .project-select,
.commercial-page .expense-page .search-control,
.commercial-page .expense-page input,
.commercial-page .expense-page select {
  min-height: 40px;
}

#projects .project-search:focus,
#projects .project-select:focus,
#projects .project-form-grid input:focus,
#projects .project-form-grid select:focus,
.commercial-page .expense-page input:focus,
.commercial-page .expense-page select:focus,
.commercial-page .expense-page textarea:focus {
  border-color: #79aef1;
  box-shadow: 0 0 0 3px rgba(23, 105, 210, 0.1);
  outline: none;
}

#projects .project-table-wrap {
  padding: 0 20px 14px;
}

#projects .project-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

#projects .project-table thead th {
  padding: 12px 10px;
  background: var(--module-soft);
  color: var(--module-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#projects .project-table tbody td {
  padding: 12px 10px;
  border-bottom: 1px solid #edf1f6;
  color: var(--module-text);
  font-size: 13px;
  line-height: 1.35;
}

#projects .project-code,
#projects .project-name,
.commercial-page .expense-page .record h3 {
  color: #07162b;
  font-size: 13px;
  font-weight: 800;
}

#projects .project-po,
#projects .project-client,
.commercial-page .expense-page .record-meta,
.commercial-page .expense-page .record-note {
  color: var(--module-muted);
  font-size: 12px;
}

#projects .project-money,
#projects .project-profit,
#projects .project-loss,
.commercial-page .expense-page .record h3 {
  font-variant-numeric: tabular-nums;
}

#projects .project-profit,
#projects .project-financial-value.green {
  color: var(--module-green);
  font-weight: 800;
}

#projects .project-loss,
#projects .project-financial-value.red {
  color: var(--module-red);
  font-weight: 800;
}

#projects .project-status-select {
  min-height: 32px;
  min-width: 126px;
  border-radius: 999px;
  padding: 5px 28px 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

#projects .project-open-btn,
#projects .icon-action-button,
.commercial-page .expense-page .icon-action-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 9px;
}

#projects .project-open-btn {
  width: auto;
  padding: 0 12px;
}

#projects .project-bottom-grid,
.commercial-page .expense-page .split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
  align-items: start;
}

#projects .project-financial-grid {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
}

#projects .project-financial-box {
  min-height: 82px;
  border: 1px solid var(--module-border);
  border-radius: 12px;
  padding: 13px 14px;
  background: var(--module-soft);
}

#projects .project-financial-label {
  color: var(--module-muted);
  font-size: 12px;
  font-weight: 800;
}

#projects .project-financial-value {
  margin-top: 5px;
  font-size: 20px;
}

#projects .project-progress-track {
  height: 9px;
  border-radius: 999px;
  background: #e9eef5;
}

#projects .project-progress-bar {
  background: linear-gradient(90deg, #1d72d8, #20b275);
}

#projects .project-activity-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#projects .project-activity-item,
.commercial-page .expense-page .record {
  border: 1px solid var(--module-border);
  border-radius: 12px;
  padding: 12px;
  background: #fbfcfe;
}

#projects .project-activity-dot {
  width: 9px;
  height: 9px;
  background: var(--module-primary);
}

.commercial-page .expense-page .split-layout {
  grid-template-columns: minmax(360px, 0.62fr) minmax(0, 1fr);
}

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

.commercial-page .expense-page .form-grid label {
  gap: 7px;
  color: #3b4657;
  font-size: 13px;
  font-weight: 800;
}

.commercial-page .expense-page .form-grid .full {
  grid-column: 1 / -1;
}

.commercial-page .expense-page textarea {
  min-height: 90px;
  resize: vertical;
}

.commercial-page .expense-page .record-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.commercial-page .expense-page .record-head {
  align-items: flex-start;
  gap: 14px;
}

.commercial-page .expense-page .status {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 1100px) {
  #projects .project-kpi-grid,
  .commercial-page .expense-page .expense-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #projects .project-bottom-grid,
  .commercial-page .expense-page .split-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  #projects.project-page {
    padding: 8px 12px 22px;
  }

  #projects .project-page-header,
  #projects .project-page-actions,
  #projects .project-register-filters {
    align-items: stretch;
    flex-direction: column;
  }

  #projects .project-kpi-grid,
  #projects .project-financial-grid,
  .commercial-page .expense-page .expense-summary-grid,
  .commercial-page .expense-page .form-grid {
    grid-template-columns: 1fr;
  }

  .commercial-page .expense-page .form-grid .full {
    grid-column: auto;
  }
}

/* Standard typography for Project and Expense modules */
#projects.project-page,
.commercial-page .expense-page {
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

#projects.project-page h1,
#projects .project-page-title {
  color: var(--text-primary);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.4px;
}

#projects.project-page h2,
#projects .project-card-title,
.commercial-page .expense-page .panel-heading h2 {
  color: var(--text-primary);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.15px;
}

#projects.project-page h3,
#projects .project-detail-title,
.commercial-page .expense-page .record h3 {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0;
}

#projects .project-page-subtitle,
#projects .project-card-subtitle,
#projects .project-kpi-description,
#projects .project-po,
#projects .project-detail-meta,
#projects .project-expense-meta,
#projects .project-activity-time,
.commercial-page .expense-page .panel-heading span,
.commercial-page .expense-page .record-meta,
.commercial-page .expense-page .record-note {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}

#projects .project-form-grid label,
.commercial-page .expense-page .form-grid label,
.commercial-page .expense-page .document-search-field,
#projects .project-kpi-label,
#projects .project-financial-label,
#projects .project-table thead th,
.commercial-page .expense-page .commercial-summary-card span:last-child {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0;
}

#projects .project-table tbody td,
#projects .project-client,
#projects .project-name,
#projects .project-code,
#projects .project-expense-name,
#projects .project-activity-text,
.commercial-page .expense-page .record,
.commercial-page .expense-page .record p {
  color: #2d3d54;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
}

#projects .project-code,
#projects .project-name,
#projects .project-expense-name {
  color: var(--text-primary);
  font-weight: 700;
}

#projects .project-kpi-value,
#projects .project-financial-value,
#projects .project-money,
#projects .project-profit,
#projects .project-loss,
#projects .project-expense-amount,
.commercial-page .expense-page .commercial-summary-card strong,
.commercial-page .expense-page .record h3 {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

#projects .project-kpi-value {
  font-size: 20px;
  font-weight: 800;
}

#projects .project-financial-value,
.commercial-page .expense-page .commercial-summary-card strong {
  font-size: 20px;
  font-weight: 800;
}

#projects .project-btn,
#projects .project-open-btn,
#projects #project-submit-button,
#projects #cancel-project-edit,
.commercial-page .expense-page button,
.commercial-page .expense-page .secondary {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 700;
}

#projects input,
#projects select,
#projects textarea,
.commercial-page .expense-page input,
.commercial-page .expense-page select,
.commercial-page .expense-page textarea {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

#projects input::placeholder,
#projects textarea::placeholder,
.commercial-page .expense-page input::placeholder,
.commercial-page .expense-page textarea::placeholder {
  color: var(--text-placeholder);
  font-weight: 400;
}

#projects .project-status-select,
.commercial-page .expense-page .status {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

/* Project page final spacing refinement */
#projects.project-page {
  padding: 0 4px 24px;
}

#projects .project-page-header {
  min-height: 44px;
  margin-top: -58px;
  margin-bottom: 12px;
  padding-right: 0;
  justify-content: flex-end;
}

#projects .project-page-actions {
  gap: 10px;
}

#projects .project-kpi-grid {
  gap: 12px;
}

#projects .project-register {
  margin-top: 10px;
}

@media (max-width: 900px) {
  #projects .project-page-header {
    margin-top: 0;
    justify-content: flex-start;
  }
}

/* Selected project financials should match the compact reference layout */
#projects #selected-project-financials {
  padding: 18px 26px 20px;
}

#projects .project-bottom-grid > .project-card:first-child .project-card-header {
  min-height: 54px;
  padding: 12px 24px;
}

#projects #selected-project-financials .project-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

#projects #selected-project-financials .project-detail-title {
  margin: 0 0 4px;
  color: var(--text-primary);
  font-size: 23px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.25px;
}

#projects #selected-project-financials .project-detail-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

#projects #selected-project-financials .project-status-select {
  width: auto;
  min-width: 150px;
  max-width: 190px;
  min-height: 42px;
  flex: 0 0 auto;
  border-radius: 12px;
  padding: 0 38px 0 16px;
  font-size: 14px;
  font-weight: 500;
}

#projects #selected-project-financials .project-financial-grid {
  display: grid;
  grid-template-columns:
    minmax(150px, 1.25fr)
    minmax(120px, 0.95fr)
    minmax(150px, 1.25fr)
    minmax(78px, 0.65fr);
  gap: 8px;
}

#projects #selected-project-financials .project-financial-box {
  min-height: 78px;
  display: grid;
  align-content: center;
  min-width: 0;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  background: #f8fafc;
  overflow: hidden;
}

#projects #selected-project-financials .project-financial-label {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

#projects #selected-project-financials .project-financial-value {
  color: var(--text-primary);
  font-size: clamp(13px, 1.05vw, 18px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0;
  min-width: 0;
}

#projects #selected-project-financials .project-financial-value.red {
  color: #dc4c64;
}

#projects #selected-project-financials .project-financial-value.green {
  color: #16a66a;
}

#projects #selected-project-financials .project-financial-value.money-value {
  display: flex;
  align-items: baseline;
  gap: 3px;
  max-width: 100%;
  overflow: visible;
  white-space: nowrap;
}

#projects #selected-project-financials .project-financial-currency {
  flex: 0 0 auto;
}

#projects #selected-project-financials .project-financial-amount {
  min-width: 0;
  overflow: visible;
}

#projects #selected-project-financials .project-financial-currency {
  font-size: 0.92em;
}

#projects #selected-project-financials .project-utilisation {
  margin-top: 16px;
}

#projects #selected-project-financials .project-utilisation-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

#projects #selected-project-financials .project-utilisation-label,
#projects #selected-project-financials .project-linked-expenses-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}

#projects #selected-project-financials .project-utilisation-value {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

#projects #selected-project-financials .project-linked-expenses {
  margin-top: 18px;
}

#projects #selected-project-financials .project-linked-expenses-title {
  margin: 0 0 14px;
}

#projects #selected-project-financials .project-expense-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #edf1f6;
}

#projects #selected-project-financials .project-expense-name {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 400;
}

#projects #selected-project-financials .project-expense-name span:first-child::after {
  content: "·";
  margin-left: 6px;
  color: var(--text-muted);
}

#projects #selected-project-financials .project-expense-amount {
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 760px) {
  #projects #selected-project-financials .project-detail-header {
    flex-direction: column;
  }

  #projects #selected-project-financials .project-financial-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Project register compact controls */
#projects .project-register .project-card-header {
  align-items: center;
  min-height: 58px;
  padding: 12px 20px;
}

#projects .project-register-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}

#projects .project-filter-compact {
  width: 132px;
  min-width: 132px;
  max-width: 132px;
  min-height: 36px;
  padding: 0 28px 0 10px;
  font-size: 12px;
}

#projects .project-register-toolbar {
  display: none;
}

#projects .project-register-filters {
  max-width: none;
}

#projects .project-search {
  width: min(100%, 260px);
  max-width: 260px;
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

#projects .project-name-button {
  width: auto;
  min-height: 0;
  display: block;
  border: 0;
  border-radius: 6px;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

#projects .project-name-button:hover .project-code,
#projects .project-name-button:hover .project-name {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

#projects .project-table .project-status-select {
  width: 112px;
  min-width: 112px;
  max-width: 112px;
  min-height: 30px;
  border-radius: 10px;
  padding: 0 24px 0 9px;
  font-size: 11px;
}

#projects .project-table .record-actions {
  gap: 6px;
}

#projects .project-register #project-list.record-list {
  padding-top: 0;
}

#projects .project-register .project-table-wrap {
  padding: 0 20px 12px;
}

#projects .project-register .project-table thead th {
  padding-top: 10px;
  padding-bottom: 10px;
}

#projects .project-register .project-table tbody td {
  padding-top: 10px;
  padding-bottom: 10px;
}

#projects .project-register .project-empty-state {
  min-height: 240px;
  padding: 34px 20px;
}

@media (max-width: 760px) {
  #projects .project-register-actions {
    width: 100%;
    justify-content: flex-start;
  }

  #projects .project-filter-compact,
  #projects .project-register-filters,
  #projects .project-search {
    width: 100%;
    max-width: none;
  }
}

/* Match Project and Expense summary cards to Leave Management card proportions */
#projects .project-kpi-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

#projects .project-kpi-card,
.commercial-page .expense-page .commercial-summary-card {
  min-height: 84px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 16px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(20, 39, 61, 0.06);
}

#projects .project-kpi-content,
.commercial-page .expense-page .commercial-summary-card > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

#projects .project-kpi-top {
  display: contents;
}

#projects .project-kpi-icon,
.commercial-page .expense-page .commercial-summary-icon {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 999px;
  background: #d9eaff;
  color: #1769aa;
}

#projects .project-kpi-icon.green,
.commercial-page .expense-page .commercial-summary-icon.accepted {
  background: #daf5e5;
  color: #16a35f;
}

#projects .project-kpi-icon.orange,
.commercial-page .expense-page .commercial-summary-icon.pending {
  background: #fff0df;
  color: #f57c00;
}

#projects .project-kpi-icon.purple,
.commercial-page .expense-page .commercial-summary-icon.value {
  background: #efe3ff;
  color: #8d4bd6;
}

.commercial-page .expense-page .commercial-summary-icon.declined {
  background: #ffeceb;
  color: #ef4444;
}

#projects .project-kpi-icon svg,
.commercial-page .expense-page .commercial-summary-icon svg {
  width: 23px;
  height: 23px;
}

#projects .project-kpi-label,
.commercial-page .expense-page .commercial-summary-card span:last-child {
  color: #42556a;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  text-transform: none;
  letter-spacing: 0;
}

#projects .project-kpi-value,
.commercial-page .expense-page .commercial-summary-card strong {
  margin: 0;
  color: #0f172a;
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
}

#projects .project-kpi-description {
  color: #42556a;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
}

@media (max-width: 980px) {
  #projects .project-kpi-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

/* Project register edge alignment refinement */
#projects .project-register {
  overflow: hidden;
}

#projects .project-register .project-card-header {
  padding-left: 14px;
  padding-right: 14px;
  gap: 12px;
}

#projects .project-register .project-card-title,
#projects .project-register .project-card-subtitle {
  margin-left: 0;
}

#projects .project-register-actions {
  gap: 6px;
}

#projects .project-register #project-list.record-list {
  padding: 0;
}

#projects .project-register .project-table-wrap {
  padding: 0 8px 10px;
}

#projects .project-register .project-table {
  width: 100%;
  min-width: 900px;
}

#projects .project-register .project-table thead th,
#projects .project-register .project-table tbody td {
  padding-left: 8px;
  padding-right: 8px;
}

#projects .project-register .project-table thead th:first-child,
#projects .project-register .project-table tbody td:first-child {
  padding-left: 4px;
}

#projects .project-register .project-table thead th:last-child,
#projects .project-register .project-table tbody td:last-child {
  padding-right: 4px;
}

#projects .project-register .project-table .record-actions {
  justify-content: flex-end;
  gap: 6px;
}

#projects .project-register .icon-action-button {
  width: 32px;
  height: 32px;
  min-height: 32px;
}

/* Project KPI cards mirror Leave Management KPI card layout */
#projects .project-kpi-grid {
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  gap: 12px;
}

#projects .project-kpi-card {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(20, 39, 61, 0.06);
}

#projects .project-kpi-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 999px;
}

#projects .project-kpi-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#projects .project-kpi-content {
  display: block;
  min-width: 0;
  text-align: left;
}

#projects .project-kpi-label,
#projects .project-kpi-description {
  display: block;
  margin: 0;
  color: #42556a;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  text-transform: none;
  letter-spacing: 0;
}

#projects .project-kpi-value {
  display: block;
  margin: 2px 0;
  color: #0f172a;
  font-family: var(--font-family);
  font-size: clamp(16px, 1.25vw, 21px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#projects .project-kpi-value.profit {
  color: #16a66a;
}

#projects .project-kpi-value.loss {
  color: #dc4c64;
}

/* Compact card spacing across the management system */
.panel,
#projects .project-card,
.commercial-page .panel,
.leave-card,
.dashboard-card {
  padding: 14px;
}

.panel-heading,
#projects .project-card-header,
.commercial-page .panel-heading {
  min-height: 46px;
  padding-top: 10px;
  padding-bottom: 10px;
}

/* Compact selected project financial card */
#projects #selected-project-financials {
  padding: 12px 20px 16px;
}

#projects .project-bottom-grid > .project-card:first-child .project-card-header {
  min-height: 46px;
  padding: 10px 20px;
}

#projects #selected-project-financials .project-detail-header {
  margin-bottom: 12px;
}

#projects #selected-project-financials .project-detail-title {
  margin-bottom: 2px;
  color: #42556a;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: 0;
}

#projects #selected-project-financials .project-detail-meta {
  font-size: 12px;
}

#projects #selected-project-financials .project-status-select {
  min-height: 38px;
  border-radius: 10px;
  font-size: 13px;
}

#projects #selected-project-financials .project-financial-grid {
  grid-template-columns:
    minmax(150px, 1.25fr)
    minmax(120px, 0.95fr)
    minmax(150px, 1.25fr)
    minmax(78px, 0.65fr);
  gap: 8px;
}

#projects #selected-project-financials .project-financial-box {
  min-height: 62px;
  min-width: 0;
  gap: 4px;
  padding: 8px 10px;
  overflow: hidden;
}

#projects #selected-project-financials .project-financial-label {
  font-size: 11px;
}

#projects #selected-project-financials .project-financial-value {
  font-size: clamp(13px, 1vw, 17px);
  line-height: 1.05;
  min-width: 0;
  letter-spacing: 0;
}

#projects #selected-project-financials .project-utilisation {
  margin-top: 12px;
}

#projects #selected-project-financials .project-linked-expenses {
  margin-top: 14px;
}

#projects #selected-project-financials .project-linked-expenses-title {
  margin-bottom: 10px;
}

/* Expense page dashboard layout */
.commercial-page .expense-page {
  font-family: var(--font-family);
  margin-top: 0;
}

.expense-page-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  min-height: 44px;
  margin-top: -58px;
  margin-bottom: 12px;
}

.expense-page-header h1 {
  margin: 0 0 6px;
  color: var(--text-primary);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.3px;
}

.expense-page-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

.expense-page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.expense-page-actions button,
.expense-register-panel .panel-heading button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 700;
}

.expense-page-actions button:not(.secondary) {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.expense-form-panel {
  margin-bottom: 14px;
}

.expense-workspace {
  display: block;
}

.commercial-page .expense-page .expense-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.commercial-page .expense-page .commercial-summary-card {
  min-height: 84px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(20, 39, 61, 0.06);
}

.commercial-page .expense-page .commercial-summary-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 999px;
}

.commercial-page .expense-page .commercial-summary-icon svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.commercial-page .expense-page .commercial-summary-card > div {
  display: block;
  min-width: 0;
}

.commercial-page .expense-page .commercial-summary-card span:not(.commercial-summary-icon),
.commercial-page .expense-page .commercial-summary-card small {
  display: block;
  margin: 0;
  color: #42556a;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
}

.commercial-page .expense-page .commercial-summary-card strong {
  display: block;
  margin: 2px 0;
  color: #0f172a;
  font-size: 23px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.expense-register-panel {
  padding: 0;
  overflow: hidden;
}

.expense-register-panel .panel-heading {
  min-height: 58px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.expense-register-panel .panel-heading h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.1px;
}

.expense-register-filters {
  display: grid;
  grid-template-columns: minmax(250px, 450px) minmax(210px, 325px);
  gap: 12px;
  padding: 16px 18px 12px;
}

.expense-register-filters input,
.expense-register-filters select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
}

.expense-table-wrap {
  overflow-x: auto;
  padding: 0 18px 18px;
}

.expense-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  table-layout: fixed;
}

.expense-table thead th {
  padding: 11px 8px;
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
  text-transform: uppercase;
}

.expense-table tbody td {
  padding: 11px 8px;
  border-top: 1px solid #edf1f6;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  vertical-align: middle;
}

.expense-table tbody td strong {
  color: var(--text-primary);
  font-weight: 700;
}

.expense-table tbody td span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.expense-table .money {
  font-weight: 700;
  white-space: nowrap;
}

.expense-table .record-actions {
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: nowrap;
}

.expense-table .icon-action-button {
  width: 32px;
  height: 32px;
  min-height: 32px;
}

@media (max-width: 1050px) {
  .expense-page-header,
  .expense-page-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .expense-workspace,
  .commercial-page .expense-page .expense-summary-grid {
    grid-template-columns: 1fr;
  }

  .expense-register-filters {
    grid-template-columns: 1fr;
  }
}

/* Project register column alignment */
#projects .project-register .project-table {
  table-layout: fixed;
  min-width: 1080px;
}

#projects .project-register .project-table th:nth-child(1),
#projects .project-register .project-table td:nth-child(1) {
  width: 22%;
}

#projects .project-register .project-table th:nth-child(2),
#projects .project-register .project-table td:nth-child(2) {
  width: 11%;
}

#projects .project-register .project-table th:nth-child(3),
#projects .project-register .project-table td:nth-child(3) {
  width: 15%;
}

#projects .project-register .project-table th:nth-child(4),
#projects .project-register .project-table td:nth-child(4),
#projects .project-register .project-table th:nth-child(5),
#projects .project-register .project-table td:nth-child(5),
#projects .project-register .project-table th:nth-child(6),
#projects .project-register .project-table td:nth-child(6) {
  width: 10%;
  padding-left: 12px;
  padding-right: 12px;
}

#projects .project-register .project-table th:nth-child(7),
#projects .project-register .project-table td:nth-child(7) {
  width: 11%;
  padding-left: 12px;
  padding-right: 12px;
}

#projects .project-register .project-table th:nth-child(8),
#projects .project-register .project-table td:nth-child(8) {
  width: 12%;
  min-width: 136px;
  padding-left: 12px;
  padding-right: 10px;
}

#projects .project-register .project-table th:nth-child(8) {
  text-align: left;
}

#projects .project-register .project-table td:nth-child(8) .record-actions {
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: nowrap;
}

#projects .project-register .icon-action-button {
  flex: 0 0 32px;
}

#projects .project-register .project-name {
  max-width: none;
  color: var(--text-primary);
  font-weight: 700;
}

/* Keep Project panels packed after resizing so empty columns do not remain. */
#projects.project-page.view.active {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
  align-content: flex-start;
}

#projects.project-page > .project-page-header,
#projects.project-page > .project-kpi-grid,
#projects.project-page > .project-entry-layout {
  flex: 0 0 100%;
  width: 100%;
}

#projects.project-page > .project-register {
  width: 100%;
  max-width: none;
  margin-top: 0;
  margin-bottom: 0 !important;
  margin-left: 0 !important;
  flex: 0 0 100%;
}

#projects.project-page > .project-bottom-grid {
  display: contents;
}

#projects.project-page > .project-bottom-grid > .project-card {
  flex: 1 1 320px;
  width: 320px;
  max-width: 100%;
  min-width: 320px;
  margin-top: 0;
  margin-bottom: 0;
  margin-left: 0;
  box-sizing: border-box;
}

/* Commercial overview dashboard refinement */
.commercial-page .accounting-section[data-accounting-section="overview"].commercial-overview-section.active {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  align-content: flex-start;
  font-family: var(--font-family);
}

.commercial-page .metric-grid.compact.commercial-overview-kpis {
  display: grid;
  flex: 0 0 100%;
  width: 100%;
  max-width: 100%;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.commercial-page .commercial-overview-kpis .commercial-overview-metric {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  min-height: 76px;
  gap: 12px;
  border: 1px solid #dce5ef;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(20, 39, 61, 0.06);
  text-align: left;
}

.commercial-page .commercial-overview-metric .commercial-summary-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 10px;
}

.commercial-page .commercial-overview-metric .commercial-summary-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.commercial-page .commercial-overview-metric-text {
  display: block;
  min-width: 0;
}

.commercial-page .commercial-overview-kpis .commercial-overview-metric .commercial-overview-metric-text > span,
.commercial-page .commercial-overview-kpis .commercial-overview-metric small {
  display: block;
  margin: 0;
  color: #42556a;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: none;
}

.commercial-page .commercial-overview-kpis .commercial-overview-metric small {
  margin-top: -1px;
}

.commercial-page .commercial-overview-kpis .commercial-overview-metric strong {
  display: block;
  margin: 2px 0;
  color: #0f172a;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.commercial-page .commercial-overview-section > .panel {
  flex: 0 1 calc(50% - 6px);
  width: calc(50% - 6px);
  max-width: 100%;
  min-width: 300px;
  min-height: 240px;
  border: 1px solid #dce5ef;
  border-radius: 12px;
  padding: 20px 22px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(21, 39, 68, 0.06);
}

.commercial-page .commercial-overview-section > .panel .panel-heading {
  min-height: 0;
  padding: 0 0 14px;
  border-bottom: 1px solid #e9eef5;
}

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

.commercial-page .commercial-panel-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 8px;
  color: #1769d2;
  background: #eaf2ff;
  box-shadow: 0 10px 20px rgba(23, 105, 210, 0.12);
}

.commercial-page .commercial-panel-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.commercial-page .commercial-overview-section > .panel .panel-heading h2 {
  color: #0f1f38;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0;
}

.commercial-page .commercial-overview-section > .panel .panel-heading span {
  color: #69788f;
  font-size: 12px;
  font-weight: 500;
}

.commercial-page .commercial-performance-panel,
.commercial-page .commercial-overview-status-panel {
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.commercial-page .commercial-performance-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.commercial-page .commercial-performance-metrics article {
  min-height: 72px;
  min-width: 0;
  border: 1px solid #e4eaf2;
  border-radius: 8px;
  padding: 12px 14px;
  background: #f8fafc;
}

.commercial-page .commercial-performance-metrics span {
  display: block;
  color: #42556a;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
}

.commercial-page .commercial-performance-metrics strong {
  display: block;
  margin-top: 8px;
  color: #1769d2;
  font-size: clamp(14px, 1.15vw, 17px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  white-space: normal;
  overflow-wrap: anywhere;
}

.commercial-page .commercial-performance-metric.income strong {
  color: #2563eb;
}

.commercial-page .commercial-performance-metric.expense strong {
  color: #ef4444;
}

.commercial-page .commercial-performance-metric.profit strong {
  color: #16a35f;
}

.commercial-page .commercial-performance-chart {
  display: flex;
  flex: 1 1 auto;
  min-height: 150px;
  margin-top: 16px;
}

.commercial-page .commercial-performance-chart .financial-chart {
  min-height: 150px;
  height: auto;
  flex: 1 1 auto;
}

.commercial-page .commercial-performance-chart .financial-month {
  grid-template-rows: minmax(74px, 1fr) 24px;
}

.commercial-page .commercial-overview-status-panel .commercial-overview-body {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(140px, 180px);
  flex: 1 1 auto;
  gap: 20px;
  align-items: center;
  padding-top: 16px;
}

.commercial-page .commercial-overview-status-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr));
  gap: 12px;
}

.commercial-page .commercial-overview-status-card {
  display: grid;
  grid-template-columns: 12px 1fr;
  align-content: center;
  gap: 4px 10px;
  min-height: 74px;
  border: 1px solid #e4eaf2;
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
}

.commercial-page .commercial-overview-status-card i {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 999px;
  grid-row: 1 / span 3;
}

.commercial-page .commercial-overview-status-card span {
  color: #0f172a;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
}

.commercial-page .commercial-overview-status-card strong {
  color: #0f172a;
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.commercial-page .commercial-overview-status-card small {
  color: #69788f;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.commercial-page .commercial-overview-status-panel .commercial-status-chart {
  min-height: 140px;
  border-left: 1px solid #e4eaf2;
  padding-left: 20px;
}

.commercial-page .commercial-overview-status-panel .commercial-pie {
  width: clamp(104px, 40%, 132px);
  height: clamp(104px, 40%, 132px);
}

.commercial-page .commercial-overview-status-panel .commercial-pie strong {
  color: #0f172a;
  font-size: 21px;
  font-weight: 800;
  margin: 0;
}

.commercial-page .commercial-overview-recent-panel #recent-documents {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.commercial-page .commercial-overview-recent-panel {
  flex-basis: 100%;
  width: 100%;
}

.commercial-page .commercial-overview-section > .panel.commercial-panel-wide {
  flex-basis: 100%;
  width: 100%;
}

.commercial-page .commercial-overview-recent-panel #recent-documents .record {
  min-height: 58px;
  border: 1px solid #e4eaf2;
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
}

.commercial-page .commercial-overview-recent-panel #recent-documents .record h3 {
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}

.commercial-page .commercial-overview-recent-panel #recent-documents .record-meta {
  color: #69788f;
  font-size: 12px;
  font-weight: 500;
}

.commercial-page .commercial-overview-recent-panel #recent-documents .pill {
  background: #eaf7f2;
  color: #008c7a;
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 1050px) {
  .commercial-page .commercial-overview-status-panel .commercial-overview-body {
    grid-template-columns: 1fr;
  }

  .commercial-page .commercial-overview-status-panel .commercial-status-chart {
    border-left: 0;
    border-top: 1px solid #e4eaf2;
    padding: 16px 0 0;
  }
}

@media (max-width: 760px) {
  .commercial-page .metric-grid.compact.commercial-overview-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .commercial-page .commercial-overview-status-list,
  .commercial-page .commercial-performance-metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .commercial-page .metric-grid.compact.commercial-overview-kpis,
  .commercial-page .commercial-overview-status-list {
    grid-template-columns: 1fr;
  }
}

/* Dashboard page structure inspired by cloudalign-dashboard.css */
#dashboard.view {
  --db-bg: #f4f8fc;
  --db-surface: #ffffff;
  --db-surface-soft: #f8fbfe;
  --db-text: #10243a;
  --db-text-soft: #5a7088;
  --db-muted: #8191a3;
  --db-primary: #1769d2;
  --db-primary-soft: #eaf3ff;
  --db-success: #169b62;
  --db-danger: #dc4c5e;
  --db-warning: #f59e0b;
  --db-border: #dbe5ef;
  --db-border-soft: #e8eef5;
  --db-shadow: 0 10px 28px rgba(14, 42, 64, 0.055);
  --db-shadow-hover: 0 14px 34px rgba(14, 42, 64, 0.085);
  display: none;
  width: 100%;
  min-height: 100vh;
  padding: 10px 0 32px;
  color: var(--db-text);
  font-family: var(--font-family);
}

#dashboard.view.active {
  display: block;
}

#dashboard *,
#dashboard *::before,
#dashboard *::after {
  box-sizing: border-box;
}

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

#dashboard .dashboard-title-block h2 {
  margin: 0;
  color: var(--db-text);
  font-size: 34px;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: 0;
}

#dashboard .dashboard-title-block p {
  margin: 7px 0 0;
  color: var(--db-text-soft);
  font-size: 14px;
  line-height: 1.4;
}

#dashboard .dashboard-title-block p span {
  color: var(--db-primary);
  font-weight: 700;
}

#dashboard .dashboard-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#dashboard .dashboard-period-select,
#dashboard .dashboard-widget-picker summary {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--db-border);
  border-radius: 10px;
  padding: 0 14px;
  background: #ffffff;
  color: var(--db-text);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 5px 14px rgba(14, 42, 64, 0.035);
}

#dashboard .dashboard-period-select:hover,
#dashboard .dashboard-widget-picker summary:hover {
  border-color: #bdd0e3;
  background: #fbfdff;
}

#dashboard .dashboard-period-select select {
  min-height: 0;
  border: 0;
  padding: 0 24px 0 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

#dashboard .dashboard-control-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--db-primary);
}

#dashboard .dashboard-control-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

#dashboard #metrics .metric {
  min-height: 76px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 1px solid var(--db-border);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(145deg, #ffffff, #fbfdff);
  color: var(--db-text);
  text-align: left;
  box-shadow: var(--db-shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

#dashboard #metrics .metric:hover {
  transform: translateY(-2px);
  border-color: #cbd8e5;
  box-shadow: var(--db-shadow-hover);
}

#dashboard #metrics .metric-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--db-primary-soft);
  color: var(--db-primary);
}

#dashboard #metrics .metric-icon svg {
  width: 20px;
  height: 20px;
}

#dashboard #metrics .metric-body {
  min-width: 0;
}

#dashboard #metrics .metric-body span {
  display: block;
  color: var(--db-text-soft);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0;
}

#dashboard #metrics .metric-body strong {
  display: block;
  margin-top: 3px;
  color: var(--db-text);
  font-size: clamp(17px, 1.35vw, 21px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

#dashboard #metrics .metric-body small {
  display: block;
  margin-top: 3px;
  color: var(--db-text-soft);
  font-size: 11px;
  line-height: 1.25;
}

#dashboard #metrics .metric-style-2 .metric-icon,
#dashboard #metrics .metric-style-2 .metric-body strong {
  color: #2563eb;
}

#dashboard #metrics .metric-style-3 .metric-icon,
#dashboard #metrics .metric-style-3 .metric-body strong {
  color: var(--db-success);
}

#dashboard #metrics .metric-style-4 .metric-icon,
#dashboard #metrics .metric-style-4 .metric-body strong {
  color: var(--db-warning);
}

#dashboard .dashboard-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 16px;
}

#dashboard .dashboard-grid .panel {
  flex: 0 0 calc(50% - 8px);
  width: calc(50% - 8px);
  min-width: 300px;
  min-height: 300px;
  border: 1px solid var(--db-border);
  border-radius: 16px;
  padding: 0;
  background: rgba(255, 255, 255, 0.975);
  box-shadow: var(--db-shadow);
  overflow: auto;
}

#dashboard .dashboard-grid .panel[data-dashboard-widget="activity"] {
  flex-basis: 100%;
  width: 100%;
  min-height: 170px;
}

#dashboard .dashboard-grid .panel > .panel-heading {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0;
  border-bottom: 1px solid var(--db-border-soft);
  padding: 15px 20px;
}

#dashboard .dashboard-grid .panel-heading h2 {
  margin: 0;
  color: var(--db-text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
}

#dashboard .dashboard-grid .panel-heading span {
  color: var(--db-text-soft);
  font-size: 12px;
  font-weight: 600;
}

#dashboard .panel-title-with-icon {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

#dashboard .panel-title-icon {
  width: 54px;
  height: 54px;
  min-width: 54px;
  border-radius: 13px;
  background: var(--db-primary-soft);
  color: var(--db-primary);
  box-shadow: none;
}

#dashboard .hr-icon {
  border-color: #d7f1df;
  background: #eaf8f1;
  color: #169b62;
}

#dashboard .project-icon {
  border-color: #d7e8ff;
  background: #eaf2ff;
  color: #1769d2;
}

#dashboard .dashboard-module-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 20px 18px;
}

#dashboard [data-dashboard-widget="hr"] .summary-row,
#dashboard [data-dashboard-widget="hr"] button.summary-row,
#dashboard [data-dashboard-widget="projects"] .summary-row,
#dashboard [data-dashboard-widget="projects"] button.summary-row {
  display: grid;
  justify-items: start;
  min-height: 72px;
  border: 1px solid var(--db-border-soft);
  border-radius: 11px;
  padding: 12px;
  background: var(--db-surface-soft);
  text-align: left;
}

#dashboard [data-dashboard-widget="hr"] .summary-row span,
#dashboard [data-dashboard-widget="projects"] .summary-row span {
  color: var(--db-text-soft);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

#dashboard [data-dashboard-widget="hr"] .summary-row strong,
#dashboard [data-dashboard-widget="projects"] .summary-row strong {
  color: var(--db-text);
  font-size: clamp(16px, 1.35vw, 21px);
  font-weight: 800;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

#dashboard [data-dashboard-widget="financial"] #financial-snapshot {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 20px 0;
}

#dashboard [data-dashboard-widget="financial"] .summary-row,
#dashboard [data-dashboard-widget="financial"] button.summary-row {
  min-height: 72px;
  border-color: var(--db-border-soft);
  border-radius: 11px;
  padding: 12px;
  background: var(--db-surface-soft);
}

#dashboard [data-dashboard-widget="financial"] .summary-row span {
  color: var(--db-text-soft);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

#dashboard [data-dashboard-widget="financial"] .summary-row strong {
  color: #2563eb;
  font-size: clamp(13px, 1.1vw, 17px);
  font-weight: 800;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

#dashboard #revenue-chart {
  min-height: 150px;
  margin: 16px 20px 18px;
}

#dashboard [data-dashboard-widget="commercial"] .commercial-overview-body {
  grid-template-columns: minmax(0, 1fr) minmax(120px, 170px);
  gap: 18px;
  padding: 16px 20px 18px;
}

#dashboard [data-dashboard-widget="commercial"] .commercial-legend-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#dashboard [data-dashboard-widget="commercial"] .commercial-legend-item {
  min-height: 62px;
  border: 1px solid var(--db-border-soft);
  border-radius: 11px;
  padding: 10px 12px;
  background: var(--db-surface-soft);
}

#dashboard [data-dashboard-widget="commercial"] .commercial-legend-item strong {
  color: var(--db-text);
  font-size: clamp(16px, 1.25vw, 20px);
}

#dashboard [data-dashboard-widget="commercial"] .commercial-legend-item small {
  color: var(--db-muted);
}

#dashboard [data-dashboard-widget="commercial"] .commercial-status-chart {
  min-height: 150px;
  border-left: 1px solid var(--db-border-soft);
  padding: 10px 0 0 18px;
}

#dashboard [data-dashboard-widget="commercial"] .commercial-pie {
  width: 150px;
  height: 150px;
}

#dashboard #recent-activities.task-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 16px 20px 18px;
}

#dashboard #recent-activities.task-list li {
  min-height: 48px;
  display: flex;
  align-items: center;
  border: 1px solid var(--db-border-soft);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--db-text);
  font-size: 12px;
  line-height: 1.35;
}

#dashboard #recent-activities.task-list li:last-child {
  border-bottom: 1px solid var(--db-border-soft);
}

@media (max-width: 980px) {
  .fleet-kpi-grid,
  .fleet-layout,
  #dashboard #metrics.metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 950px) {
  #dashboard.view {
    padding: 10px 0 28px;
  }

  #dashboard .dashboard-grid .panel,
  #dashboard .dashboard-grid .panel[data-dashboard-widget="activity"] {
    flex-basis: 100%;
    width: 100%;
  }
}

@media (max-width: 700px) {
  #dashboard.view {
    padding: 8px 0 24px;
  }

  #dashboard .dashboard-toolbar,
  #dashboard .dashboard-toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  #dashboard .dashboard-title-block h2 {
    font-size: 28px;
  }

  #dashboard #metrics.metric-grid,
  .fleet-kpi-grid,
  .fleet-layout,
  .fleet-checklist,
  #dashboard [data-dashboard-widget="commercial"] .commercial-legend-list,
  #dashboard [data-dashboard-widget="financial"] #financial-snapshot {
    grid-template-columns: 1fr;
  }

  #dashboard [data-dashboard-widget="commercial"] .commercial-overview-body {
    grid-template-columns: 1fr;
  }

  #dashboard [data-dashboard-widget="commercial"] .commercial-status-chart {
    border-top: 1px solid var(--db-border-soft);
    border-left: 0;
    padding: 14px 0 0;
  }
}
