:root {
  --ink: #1f2528;
  --muted: #667075;
  --line: #d7dddf;
  --panel: #ffffff;
  --page: #f4f6f3;
  --brand: #23645a;
  --brand-2: #8a552e;
  --accent: #d1a953;
  --danger: #a33b36;
  --ok: #24734f;
  --shadow: 0 12px 30px rgba(31, 37, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 18px;
  color: #f8fbf7;
  background: #24302e;
}

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

.brand strong {
  font-size: 20px;
}

.brand span,
.scope-label,
.user-meta,
.small {
  color: var(--muted);
  font-size: 12px;
}

.sidebar .brand span,
.sidebar .scope-label,
.sidebar .user-meta {
  color: rgba(248, 251, 247, 0.68);
}

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

.scope select,
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
}

.sidebar select {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

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

.nav button,
.nav summary {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 42px;
  border-radius: 6px;
  padding: 0 10px;
  color: rgba(248, 251, 247, 0.82);
  background: transparent;
  text-align: left;
}

.nav summary {
  cursor: pointer;
  list-style: none;
  font-weight: 800;
}

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

.nav button.active,
.nav summary.active {
  color: #fff;
  background: var(--brand);
}

.nav button.locked {
  color: rgba(248, 251, 247, 0.35);
}

.nav-domain {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.nav-domain[open] {
  padding-bottom: 7px;
}

.nav-domain .chevron {
  font-size: 12px;
  transition: transform 0.18s ease;
}

.nav-domain[open] .chevron {
  transform: rotate(180deg);
}

.nav-submenu {
  display: grid;
  gap: 4px;
  padding: 6px 7px 0 12px;
}

.nav button.subitem {
  min-height: 36px;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  padding-left: 9px;
  font-size: 13px;
  color: rgba(248, 251, 247, 0.74);
}

.nav button.subitem.active {
  color: #fff;
}

.nav button.domain-single {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  font-weight: 800;
}

.nav button.domain-single.active {
  background: var(--brand);
}

.lock {
  font-size: 11px;
}

.main {
  min-width: 0;
  padding: 24px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background-color: #e8ece6;
  background-image:
    linear-gradient(90deg, rgba(35, 100, 90, 0.09) 1px, transparent 1px),
    linear-gradient(rgba(35, 100, 90, 0.09) 1px, transparent 1px);
  background-size: 34px 34px;
}

.login-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-brand {
  padding: 0;
  border: 0;
}

.login-form,
.login-users {
  display: grid;
  gap: 10px;
}

.login-demo {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

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

.login-error {
  border-radius: 6px;
  padding: 10px;
  color: var(--danger);
  background: #f4e3e1;
  font-size: 13px;
}

.login-info {
  border-radius: 6px;
  padding: 10px;
  color: #1f3d33;
  background: #eef5f2;
  font-size: 13px;
}

.logout-btn {
  width: 100%;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

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

h1 {
  margin: 0 0 5px;
  font-size: 26px;
  line-height: 1.16;
}

h2 {
  margin: 0;
  font-size: 17px;
}

h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.btn {
  min-height: 38px;
  border-radius: 6px;
  padding: 0 12px;
  color: #fff;
  background: var(--brand);
}

.btn.secondary {
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
}

.btn.warn {
  background: var(--brand-2);
}


.home-block {
  display: grid;
  gap: 12px;
}

.home-block-title {
  align-items: baseline;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.home-block-title h2 {
  font-size: 20px;
  margin: 0;
}

.home-block-title span {
  color: var(--muted);
  font-size: 13px;
}

.home-separator {
  border-top: 1px solid var(--line);
  margin: 6px 0 22px;
}

.training-home-block .grid {
  margin-bottom: 20px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

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

.kpi {
  position: relative;
  overflow: hidden;
  min-height: 156px;
  border: 1px solid rgba(31, 37, 40, 0.08);
  border-radius: 8px;
  padding: 16px;
  color: #17201e;
  background: #fff;
  box-shadow: 0 16px 36px rgba(31, 37, 40, 0.1);
  isolation: isolate;
}

.kpi::before {
  content: "";
  position: absolute;
  inset: auto -34px -48px auto;
  width: 132px;
  height: 132px;
  border-radius: 32px;
  transform: rotate(18deg);
  background: rgba(255, 255, 255, 0.38);
  z-index: -1;
}

.kpi::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.62;
  z-index: -2;
}

.kpi.clients {
  background: linear-gradient(135deg, #f8d66d, #f1a252);
}

.kpi.projects {
  background: linear-gradient(135deg, #8ad0c2, #4f9e8f);
}

.kpi.quotes {
  background: linear-gradient(135deg, #c6d66a, #7dac58);
}

.kpi.invoices {
  background: linear-gradient(135deg, #ef9f8f, #c9615d);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #fff;
  background: rgba(31, 37, 40, 0.74);
  font-size: 21px;
  font-weight: 800;
}

.kpi-spark {
  width: 56px;
  height: 26px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 15px 13px, rgba(255, 255, 255, 0.95) 0 4px, transparent 5px),
    radial-gradient(circle at 31px 9px, rgba(255, 255, 255, 0.72) 0 3px, transparent 4px),
    radial-gradient(circle at 43px 16px, rgba(255, 255, 255, 0.82) 0 4px, transparent 5px),
    rgba(31, 37, 40, 0.16);
}

.kpi-value {
  font-size: 38px;
  line-height: 1;
  font-weight: 850;
}

.kpi-label {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 750;
}

.kpi-detail {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-top: 12px;
  border-radius: 999px;
  padding: 0 10px;
  color: rgba(23, 32, 30, 0.78);
  background: rgba(255, 255, 255, 0.52);
  font-size: 12px;
  font-weight: 650;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 16px;
  margin: 0 0 20px;
}

.chart-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.chart-card::after {
  content: "";
  position: absolute;
  inset: auto -48px -62px auto;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(35, 100, 90, 0.07);
}

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

.chart-head h2 {
  font-size: 14px;
}

.pie-layout {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  align-items: center;
}

.pie {
  display: grid;
  place-items: center;
  width: 112px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--pie));
  box-shadow: inset 0 0 0 1px rgba(31, 37, 40, 0.08);
}

.pie span {
  display: grid;
  place-items: center;
  width: 58px;
  aspect-ratio: 1;
  border-radius: 50%;
  color: var(--ink);
  background: #fff;
  font-weight: 850;
}

.legend {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.legend-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  font-size: 12px;
}

.legend-row span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.empty.mini {
  padding: 12px;
  font-size: 12px;
}

.grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
}

.panel {
  padding: 16px;
  min-width: 0;
}

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

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

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

th {
  color: var(--muted);
  font-weight: 650;
  background: #f8faf7;
}

.status,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  background: #eef2ef;
}

.status.ok {
  color: var(--ok);
  background: #e8f2ec;
}

.status.warn {
  color: #82520f;
  background: #f5ebd3;
}

.status.danger {
  color: var(--danger);
  background: #f4e3e1;
}

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

.card {
  padding: 14px;
}

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

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

.field {
  display: grid;
  gap: 5px;
}

.field.full {
  grid-column: 1 / -1;
}

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

.right-grid {
  display: grid;
  gap: 10px;
}

.right-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.row-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}

.icon-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.icon-btn.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.icon-btn.media:hover {
  border-color: var(--accent);
  color: var(--brand-2);
}

.media-workspace {
  display: grid;
  grid-template-columns: minmax(220px, 310px) minmax(0, 1fr);
  gap: 14px;
  min-height: 520px;
}

.media-list,
.media-viewer {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

.media-list {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
}

.upload-drop {
  display: grid;
  gap: 5px;
  border: 1px dashed rgba(35, 100, 90, 0.52);
  border-radius: 8px;
  padding: 14px;
  color: var(--brand);
  background: #eef6f1;
  cursor: pointer;
}

.upload-drop span,
.media-item small {
  color: var(--muted);
  font-size: 12px;
}

.upload-drop input {
  display: none;
}

.media-items {
  display: grid;
  gap: 8px;
}

.media-item {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.media-item.active {
  border-color: var(--brand);
  background: #eaf4ef;
}

.media-kind,
.preview-icon {
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
}

.media-kind {
  width: 38px;
  height: 38px;
}

.media-viewer {
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 12px;
  background:
    linear-gradient(90deg, rgba(35, 100, 90, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(35, 100, 90, 0.07) 1px, transparent 1px),
    #fff;
  background-size: 24px 24px;
}

.media-preview-image,
.media-preview-video,
.media-preview-frame {
  width: 100%;
  max-height: 68vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.media-preview-image {
  object-fit: contain;
}

.media-preview-video {
  background: #121617;
}

.media-preview-frame {
  min-height: 520px;
}

.preview-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  max-width: 360px;
  text-align: center;
}

.preview-icon {
  width: 58px;
  height: 58px;
  font-size: 28px;
}

.preview {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 12px;
}

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

.modal {
  width: min(760px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

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

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

.modal-body {
  padding: 16px;
}

.empty {
  padding: 30px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.62);
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
  }

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

  .nav button,
  .nav summary {
    grid-template-columns: 1fr auto;
    min-height: 38px;
    justify-items: start;
  }

  .nav .ico,
  .nav .lock {
    display: none;
  }

  .nav-domain,
  .nav button.domain-single {
    min-width: 0;
  }

  .nav-submenu {
    padding-left: 7px;
  }

  .kpis,
  .charts-grid,
  .grid,
  .cards,
  .media-workspace {
    grid-template-columns: 1fr;
  }

  .media-workspace {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .main {
    padding: 16px;
  }

  .topbar,
  .preview-head {
    flex-direction: column;
  }

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

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

  .pie-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .legend {
    width: 100%;
  }
}


.client-context-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 220px;
}

.client-context-actions .btn {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.lines-editor {
  display: grid;
  gap: 8px;
  width: 100%;
}

.line-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 90px 110px 34px;
  gap: 8px;
  align-items: center;
}

.line-row input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  background: #fff;
}

@media (max-width: 620px) {
  .line-row {
    grid-template-columns: 1fr;
  }
}


.agenda-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
}

.agenda-day {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.agenda-day h2 {
  margin-bottom: 12px;
}

.agenda-task {
  display: grid;
  gap: 4px;
  border-left: 4px solid var(--brand);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
  background: #f8faf7;
}

.agenda-task.warn {
  border-left-color: var(--accent);
  background: #fff7df;
}

.agenda-task.danger {
  border-left-color: var(--danger);
  background: #f8e8e5;
}

.alert-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
  z-index: 40;
}

.task-alert {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(31, 37, 40, 0.18);
}

.task-alert.danger {
  border-left-color: var(--danger);
}

.task-alert.ok {
  border-left-color: var(--ok);
}

@media (max-width: 980px) {
  .agenda-board {
    grid-template-columns: 1fr;
  }
}

.company-command {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(35, 100, 90, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(35, 100, 90, 0.08) 1px, transparent 1px),
    #ffffff;
  background-size: 22px 22px;
  box-shadow: var(--shadow);
}

.company-command h2 {
  margin: 4px 0 6px;
  font-size: 24px;
}

.company-command p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.eyebrow {
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.company-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.company-hero {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  color: #f8fbf7;
  background:
    linear-gradient(135deg, rgba(31, 37, 40, 0.94), rgba(35, 100, 90, 0.94)),
    #24302e;
}

.company-logo {
  width: 78px;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.46);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.company-logo.fallback {
  display: grid;
  place-items: center;
  color: #17201e;
  background: linear-gradient(135deg, #f8d66d, #8ad0c2);
  font-size: 24px;
  font-weight: 900;
}

.company-title {
  min-width: 0;
}

.company-title .eyebrow {
  color: #f8d66d;
}

.company-title h2 {
  margin: 4px 0;
  overflow-wrap: anywhere;
  font-size: 20px;
}

.company-title p {
  margin: 0;
  color: rgba(248, 251, 247, 0.72);
  font-size: 13px;
}

.company-actions .icon-btn {
  background: rgba(255, 255, 255, 0.96);
}

.company-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8faf7;
}

.company-card-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.company-block {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.company-block h3 {
  margin-bottom: 8px;
  color: var(--brand);
}

.company-block p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.company-contact,
.company-timeline {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--ink);
  font-size: 12px;
}

.legal-list {
  display: grid;
  gap: 7px;
  margin: 0;
}

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

.legal-list dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.legal-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

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

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

.company-form-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.company-form-section span {
  color: var(--brand);
  font-weight: 700;
}

.company-form-section p {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 0;
}

@media (max-width: 1120px) {
  .company-grid,
  .company-card-body {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .company-command,
  .company-hero {
    grid-template-columns: 1fr;
  }

  .company-command {
    flex-direction: column;
  }

  .company-command-actions {
    justify-content: flex-start;
  }

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


.directory-command {
  margin-bottom: 14px;
}

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

.directory-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.directory-hero {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  color: #f8fbf7;
  background: linear-gradient(135deg, #24302e, #23645a);
}

.third-hero {
  background: linear-gradient(135deg, #26343a, #4f729e);
}

.directory-hero .company-logo {
  width: 62px;
}

.directory-title {
  min-width: 0;
}

.directory-title .eyebrow {
  color: #f8d66d;
}

.directory-title h2 {
  margin: 3px 0;
  overflow-wrap: anywhere;
  font-size: 17px;
}

.directory-title p {
  margin: 0;
  color: rgba(248, 251, 247, 0.72);
  font-size: 12px;
}

.directory-actions .icon-btn {
  background: rgba(255, 255, 255, 0.96);
}

.directory-strip,
.directory-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8faf7;
}

.directory-footer {
  justify-content: space-between;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.directory-summary {
  display: grid;
  gap: 7px;
  min-height: 112px;
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
}

.directory-summary strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.party-avatar {
  display: grid;
  place-items: center;
  width: 62px;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.46);
  border-radius: 8px;
  color: #17201e;
  background: linear-gradient(135deg, #f8d66d, #8ad0c2);
  font-weight: 900;
}

.logo-upload {
  position: relative;
  overflow: hidden;
}

.logo-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.detail-card {
  box-shadow: none;
}

@media (max-width: 1180px) {
  .directory-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

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

  .directory-hero {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .directory-actions {
    grid-column: 1 / -1;
  }
}


.rights-matrix {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) repeat(6, minmax(110px, 1fr));
  gap: 1px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.rights-head,
.rights-code,
.right-toggle {
  min-height: 52px;
  padding: 10px;
  background: #fff;
}

.rights-head {
  color: var(--brand);
  font-weight: 800;
}

.rights-code {
  display: grid;
  gap: 3px;
}

.rights-code span {
  color: var(--muted);
  font-size: 11px;
}

.right-toggle {
  display: grid;
  place-items: center;
}

.right-toggle input {
  position: absolute;
  opacity: 0;
}

.right-toggle span {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #dfe5e2;
  box-shadow: inset 0 0 0 1px rgba(31, 37, 40, 0.12);
}

.right-toggle span::after {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.16s ease;
}

.right-toggle input:checked + span {
  background: var(--brand);
}

.right-toggle input:checked + span::after {
  transform: translateX(18px);
}

.grouped-rights-editor {
  display: grid;
  gap: 14px;
}

.rights-groups {
  display: grid;
  gap: 10px;
}

.rights-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.rights-group summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.rights-group summary::-webkit-details-marker {
  display: none;
}

.rights-group summary span:first-child {
  display: grid;
  gap: 2px;
}

.rights-group summary strong {
  color: var(--brand);
  font-size: 15px;
}

.rights-group summary small {
  color: var(--muted);
  font-size: 12px;
}

.rights-group summary::before {
  content: "›";
  color: var(--brand);
  font-size: 20px;
  font-weight: 800;
  transform: rotate(0deg);
  transition: transform 0.16s ease;
}

.rights-group[open] summary::before {
  transform: rotate(90deg);
}

.grouped-rights-matrix {
  grid-template-columns: minmax(220px, 1.2fr) repeat(var(--rights-role-count), minmax(110px, 1fr));
  border-width: 1px 0 0;
  border-radius: 0;
}

.accounting-page {
  display: grid;
  gap: 14px;
}

.accounting-tabs {
  margin-bottom: 0;
}

.compact-command {
  margin-bottom: 10px;
}

.accounting-checks {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  display: grid;
  gap: 8px;
}

.accounting-checks li::marker {
  color: var(--brand);
}

.accounting-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.accounting-bank-settings {
  display: grid;
  gap: 12px;
}

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

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
  min-width: 0;
}

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

.detail-grid strong {
  color: var(--text);
  display: block;
  overflow-wrap: anywhere;
}

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

.accounting-sections {
  display: grid;
  gap: 10px;
}

.accounting-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.accounting-section summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.accounting-section summary::-webkit-details-marker {
  display: none;
}

.accounting-section summary strong {
  color: var(--brand);
}

.accounting-section summary small {
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.accounting-section-body {
  border-top: 1px solid var(--line);
  padding: 14px;
  display: grid;
  gap: 14px;
}

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

.purchase-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.purchase-card header {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  color: #f8fbf7;
  background: linear-gradient(135deg, #26343a, #8a552e);
}

.purchase-card header h2 {
  margin: 3px 0;
}

.purchase-card header p {
  margin: 0;
  color: rgba(248, 251, 247, 0.72);
  font-size: 12px;
}

.purchase-lines {
  display: grid;
}

.purchase-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.purchase-row div:first-child {
  display: grid;
  gap: 3px;
}

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

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 10px;
}

.calendar-day {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.calendar-day.today {
  border-color: var(--brand);
}

.calendar-day header {
  display: grid;
  gap: 3px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f8faf7;
}

.calendar-day header span {
  color: var(--muted);
  font-size: 12px;
}

.calendar-tasks {
  display: grid;
  gap: 8px;
  min-height: 220px;
  padding: 10px;
}

.calendar-task {
  display: grid;
  gap: 4px;
  border-left: 4px solid var(--brand);
  border-radius: 6px;
  padding: 9px;
  background: #f8faf7;
  font-size: 12px;
}

.calendar-task.warn {
  border-left-color: var(--accent);
  background: #fff7df;
}

.calendar-task.danger {
  border-left-color: var(--danger);
  background: #f8e8e5;
}

.calendar-task.ok {
  border-left-color: var(--ok);
}

.gantt-board {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.gantt-scale {
  display: flex;
  justify-content: space-between;
  min-width: 760px;
  padding: 10px 16px 10px 240px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: #f8faf7;
  font-size: 12px;
}

.gantt-row {
  display: grid;
  grid-template-columns: 240px minmax(520px, 1fr);
  min-width: 760px;
  border-bottom: 1px solid var(--line);
}

.gantt-row aside {
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.gantt-row aside span {
  color: var(--muted);
  font-size: 12px;
}

.gantt-lane {
  position: relative;
  min-height: 88px;
  padding: 12px;
  background:
    linear-gradient(90deg, rgba(35, 100, 90, 0.08) 1px, transparent 1px),
    #fff;
  background-size: 10% 100%;
}

.gantt-bar {
  position: absolute;
  top: 14px;
  display: grid;
  gap: 2px;
  min-width: 130px;
  max-width: 260px;
  border-radius: 8px;
  padding: 8px;
  color: #fff;
  background: var(--brand);
  box-shadow: 0 10px 22px rgba(31, 37, 40, 0.18);
  font-size: 12px;
}

.gantt-bar.warn {
  background: #b98324;
}

.gantt-bar.danger {
  background: var(--danger);
}

.gantt-bar.ok {
  background: var(--ok);
}

.gantt-bar span {
  color: rgba(255, 255, 255, 0.78);
}

.gantt-empty {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 980px) {
  .purchase-grid,
  .calendar-grid {
    grid-template-columns: 1fr;
  }

  .rights-matrix {
    grid-template-columns: minmax(180px, 1fr) repeat(6, 100px);
  }
}


.wide-calendar .company-command {
  margin-bottom: 10px;
}

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

.segmented,
.calendar-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.segmented button.active {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.time-calendar {
  display: grid;
  grid-template-columns: 72px repeat(var(--day-count), minmax(190px, 1fr));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.time-head,
.time-hour,
.time-cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.time-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 10px;
  background: #f8faf7;
}

.time-head.today {
  color: var(--brand);
  background: #eaf4ef;
}

.time-head span,
.time-hour {
  color: var(--muted);
  font-size: 12px;
}

.time-hour {
  display: grid;
  place-items: start center;
  min-height: 92px;
  padding-top: 10px;
  background: #f8faf7;
}

.time-cell {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 92px;
  padding: 7px;
}

.month-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  gap: 8px;
}

.month-day {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #fff;
  box-shadow: var(--shadow);
}

.month-day.today {
  border-color: var(--brand);
}

.month-day.muted-day {
  opacity: 0.52;
}

.month-day header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
}

.month-task {
  overflow: hidden;
  margin-bottom: 5px;
  border-left: 3px solid var(--brand);
  border-radius: 5px;
  padding: 5px;
  background: #f8faf7;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-task.warn {
  border-left-color: var(--accent);
}

.month-task.danger {
  border-left-color: var(--danger);
}

.dependency-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 160px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8faf7;
}

.dependency-list label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 12px;
}

.gantt-shell {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.gantt-header,
.gantt-task-row {
  display: grid;
  grid-template-columns: 320px minmax(780px, 1fr);
  min-width: 1100px;
}

.gantt-left-head,
.gantt-time-head,
.gantt-task-name,
.gantt-task-lane,
.gantt-project-title {
  border-bottom: 1px solid var(--line);
}

.gantt-left-head,
.gantt-time-head {
  padding: 12px;
  color: var(--brand);
  background: #f8faf7;
  font-weight: 800;
}

.gantt-time-head {
  position: relative;
  min-height: 46px;
  background:
    linear-gradient(90deg, rgba(35, 100, 90, 0.12) 1px, transparent 1px),
    #f8faf7;
  background-size: 10% 100%;
}

.gantt-time-head span {
  position: absolute;
  top: 12px;
  color: var(--muted);
  font-size: 11px;
}

.gantt-project-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-width: 1100px;
  padding: 12px;
  background: #eef5f1;
}

.gantt-project-title span {
  color: var(--muted);
  font-size: 12px;
}

.gantt-task-name {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-height: 58px;
  padding: 9px 9px 9px calc(10px + var(--depth) * 24px);
  border-right: 1px solid var(--line);
  background: #fff;
}

.gantt-task-name small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.tree-line {
  color: var(--brand);
  margin-right: 5px;
}

.gantt-task-lane {
  position: relative;
  min-height: 58px;
  background:
    linear-gradient(90deg, rgba(35, 100, 90, 0.08) 1px, transparent 1px),
    #fff;
  background-size: 5% 100%;
}

.true-gantt-bar {
  position: absolute;
  top: 10px;
  display: grid;
  gap: 2px;
  min-width: 100px;
  overflow: hidden;
  border-radius: 7px;
  padding: 7px;
  color: #fff;
  background: var(--brand);
  box-shadow: 0 10px 22px rgba(31, 37, 40, 0.16);
  font-size: 12px;
}

.true-gantt-bar.warn {
  background: #b98324;
}

.true-gantt-bar.danger {
  background: var(--danger);
}

.true-gantt-bar.ok {
  background: var(--ok);
}

.true-gantt-bar span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
}

.true-gantt-bar i {
  position: absolute;
  inset: auto 0 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.72);
}

.dependency-chip {
  position: absolute;
  right: 8px;
  z-index: 1;
  border-radius: 999px;
  padding: 3px 7px;
  color: #82520f;
  background: #f5ebd3;
  font-size: 10px;
}

@media (max-width: 820px) {
  .month-calendar {
    grid-template-columns: 1fr;
  }

  .dependency-list {
    grid-template-columns: 1fr;
  }
}


.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.settings-tabs button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
}

.settings-tabs button.active {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  gap: 14px;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.settings-card.primary {
  color: #f8fbf7;
  background: linear-gradient(135deg, #24302e, #23645a);
}

.settings-card.primary p {
  color: rgba(248, 251, 247, 0.72);
}

.settings-card.full {
  grid-column: 1 / -1;
}

.settings-card h2,
.settings-card h3 {
  margin-bottom: 8px;
}

.settings-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.settings-status {
  display: inline-flex;
  margin-top: 12px;
  border-radius: 999px;
  padding: 7px 10px;
  color: #17201e;
  background: #f5ebd3;
  font-size: 12px;
  font-weight: 750;
}

.settings-status.ok {
  color: #0d4d32;
  background: #dff1e6;
}

.settings-status.danger {
  color: var(--danger);
  background: #f4e3e1;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

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


.help-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #111827, #0f766e);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 18px 40px rgba(15, 23, 42, .24);
  cursor: pointer;
}

.help-content {
  display: grid;
  gap: 18px;
}

.help-content p,
.help-content li,
.db-banner span {
  color: #475569;
  line-height: 1.55;
}

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

.help-grid section,
.db-banner {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  background: #f8fafc;
}

.help-grid h4 {
  margin: 0 0 10px;
  color: #0f172a;
}

.help-grid ul {
  margin: 0;
  padding-left: 18px;
}

.db-banner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-color: #99f6e4;
  background: #f0fdfa;
}

@media (max-width: 780px) {
  .help-grid,
  .db-banner {
    grid-template-columns: 1fr;
  }

  .help-fab {
    right: 16px;
    bottom: 16px;
  }
}


.finance-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.finance-kpis.compact {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.finance-widget {
  display: grid;
  gap: 6px;
  min-height: 104px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  padding: 13px;
  background: #fff;
  box-shadow: var(--shadow);
}

.finance-widget.ok {
  border-left-color: var(--ok);
}

.finance-widget.danger {
  border-left-color: var(--danger);
}

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

.finance-widget strong {
  font-size: 22px;
  line-height: 1.1;
}

.payment-history {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.payment-chip {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #f8faf7;
}

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

.official-doc {
  width: min(980px, 100%);
  margin: 0 auto;
  border: 1px solid #c9d1d3;
  border-radius: 8px;
  padding: 30px;
  color: #17201e;
  background: #fff;
  box-shadow: 0 18px 50px rgba(31, 37, 40, 0.12);
}

.official-head,
.official-parties,
.official-meta,
.official-bottom,
.official-footer {
  display: grid;
  gap: 16px;
}

.official-head {
  grid-template-columns: minmax(0, 1fr) 240px;
  align-items: start;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 18px;
}

.official-company {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.official-company .company-logo,
.official-company .company-logo.fallback {
  width: 72px;
}

.official-company h2,
.official-title strong {
  font-size: 24px;
}

.official-company p,
.official-parties p,
.official-footer,
.official-terms p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.official-title {
  display: grid;
  justify-items: end;
  gap: 5px;
  text-align: right;
}

.official-title span {
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
}

.official-parties {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 20px;
}

.official-parties > div,
.official-meta > div,
.official-terms,
.official-totals {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfcfa;
}

.official-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 16px 0;
}

.official-meta span,
.official-totals span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.official-lines {
  min-width: 0;
  margin-top: 10px;
}

.official-bottom {
  grid-template-columns: minmax(0, 1fr) 280px;
  align-items: start;
  margin-top: 18px;
}

.official-totals {
  display: grid;
  gap: 8px;
}

.official-totals div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.official-totals .grand {
  border-top: 2px solid var(--ink);
  padding-top: 10px;
  font-size: 18px;
}

.official-footer {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.admin-tabs {
  margin-bottom: 14px;
}

.admin-panel > .company-command:first-child {
  display: none;
}

@media print {
  body.print-body,
  body.print-body .official-doc {
    margin: 0;
    background: #fff;
  }

  body.print-body .official-doc,
  .official-doc {
    width: 100%;
    border: 0;
    box-shadow: none;
  }
}

@media (max-width: 980px) {
  .finance-kpis,
  .finance-kpis.compact,
  .official-head,
  .official-parties,
  .official-meta,
  .official-bottom {
    grid-template-columns: 1fr;
  }

  .official-title {
    justify-items: start;
    text-align: left;
  }
}


.modal:has(.official-doc) {
  width: min(1180px, calc(100vw - 28px));
  max-height: min(94vh, 980px);
}

.modal:has(.official-doc) .modal-body {
  padding: 18px;
  background: #eef2ef;
}

.modal:has(.mail-attachment-workspace) {
  width: min(1040px, calc(100vw - 28px));
  max-height: min(92vh, 900px);
}

.official-doc {
  width: min(1080px, 100%);
}

.mail-form textarea {
  min-height: 150px;
}

.mail-upload {
  margin-bottom: 10px;
}

.mail-attachments {
  display: grid;
  gap: 8px;
}

.mail-attachments.compact {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.mail-attachment {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.mail-attachment span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-size: 12px;
  font-weight: 900;
  grid-row: span 2;
}

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

.mail-attachment small {
  color: var(--muted);
  font-size: 11px;
}

.mail-attachment:hover {
  border-color: var(--brand);
  background: #f3f8f5;
}

.mail-attachment-workspace {
  display: grid;
  grid-template-columns: minmax(240px, 330px) minmax(0, 1fr);
  gap: 14px;
  min-height: 620px;
}

.mail-attachment-workspace aside,
.mail-attachment-viewer {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8faf7;
}

.mail-attachment-viewer {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
}

@media (max-width: 820px) {
  .mail-attachments.compact,
  .mail-attachment-workspace {
    grid-template-columns: 1fr;
  }
}


.suite-panel {
  margin-top: 16px;
}

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

.export-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

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

.status:not(.ok):not(.warn):not(.danger) {
  color: var(--ink);
}

@media (max-width: 980px) {
  .export-grid {
    grid-template-columns: repeat(2, minmax(190px, 1fr));
  }
}

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


.document-attachment.active {
  border-color: var(--brand);
  background: #eef7f1;
  box-shadow: 0 0 0 2px rgba(45, 106, 79, 0.12);
}

.document-preview-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-height: 560px;
}

.document-preview-shell header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.document-preview-shell h3 {
  margin: 2px 0 8px;
  font-size: 20px;
}

.document-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.document-preview-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: #f8faf7;
  color: var(--muted);
  font-size: 12px;
}

.document-preview-stage {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
}

.document-viewer .media-preview-image,
.document-viewer .media-preview-video,
.document-viewer .media-preview-frame {
  max-height: 100%;
}


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

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

.security-card {
  display: grid;
  gap: 10px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.security-card h3 {
  margin: 0;
  font-size: 16px;
}

.security-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.security-card > span {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: var(--brand);
}

.security-card.locked > span {
  background: #8a5a44;
}

.security-notice {
  display: grid;
  gap: 4px;
  border: 1px solid #d8c7a6;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff9ec;
  color: var(--ink);
}

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

.rgpd-page {
  gap: 18px;
}

.rgpd-section {
  display: grid;
  gap: 12px;
}

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

.rgpd-section textarea,
.rgpd-section input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
  background: #fff;
  color: var(--text);
}

.rgpd-section textarea {
  min-height: 62px;
  resize: vertical;
}

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

.rgpd-inline-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.rgpd-procedure-form .field.full {
  grid-column: 1 / -1;
}

.policy-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.policy-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8faf7;
}

.policy-item strong,
.policy-item span {
  display: block;
}

.policy-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.toolbar-search {
  min-width: min(320px, 48vw);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}

@media (max-width: 980px) {
  .security-grid,
  .policy-list {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 640px) {
  .security-grid,
  .policy-list,
  .rgpd-procedure-form {
    grid-template-columns: 1fr;
  }
}


/* Optional Centre de formation module */
.training-hero {
  border-left: 4px solid var(--brand);
}

.training-tabs {
  margin-top: 14px;
  margin-bottom: 16px;
}

.training-tabs .tab {
  min-height: 38px;
}


.activity-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.activity-filter .chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.activity-filter .chip.active {
  border-color: var(--green);
  background: #e8f3ee;
  color: var(--green-dark);
  font-weight: 700;
}


.admin-edit-panel {
  margin-top: 16px;
}

.admin-edit-panel input,
.admin-edit-panel select,
.admin-edit-panel textarea {
  width: 100%;
  min-width: 150px;
}

.admin-tabs {
  gap: 6px;
}


.admin-inline-note {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--muted);
  background: #f8faf7;
  font-size: 12px;
}

.admin-edit-panel .table-wrap {
  overflow-x: auto;
}

.admin-edit-panel table {
  min-width: 920px;
}

.admin-edit-panel td {
  vertical-align: top;
}


.category-subtabs {
  margin: 12px 0 16px;
}

.admin-pdp-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8faf7;
}

.admin-pdp-summary div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-pdp-summary span {
  color: var(--muted);
  font-size: 12px;
}

.admin-pdp-summary strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.admin-pdp-summary p {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 980px) {
  .admin-pdp-summary {
    grid-template-columns: 1fr;
  }
}
