:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e7edf5;
  --ink: #0b1220;
  --muted: #334155;
  --line: #d8e1ea;
  --line-strong: #b9c7d6;
  --teal: #0f9f91;
  --teal-strong: #08786e;
  --blue: #2563eb;
  --amber: #d97706;
  --red: #c2410c;
  --red-soft: #fff1ed;
  --green-soft: #e9fbf4;
  --blue-soft: #edf4ff;
  --amber-soft: #fff7e6;
  --purple-soft: #f3edff;
  --shadow: 0 18px 42px rgba(15, 23, 42, 0.09);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1720;
  --surface: #17212b;
  --surface-2: #1e2a36;
  --surface-3: #263342;
  --ink: #f8fafc;
  --muted: #cbd5e1;
  --line: rgba(226, 232, 240, 0.14);
  --line-strong: rgba(226, 232, 240, 0.24);
  --teal: #2dd4bf;
  --teal-strong: #14b8a6;
  --blue: #60a5fa;
  --amber: #fbbf24;
  --red: #fb923c;
  --red-soft: rgba(251, 146, 60, 0.15);
  --green-soft: rgba(34, 197, 94, 0.16);
  --blue-soft: rgba(96, 165, 250, 0.16);
  --amber-soft: rgba(251, 191, 36, 0.16);
  --purple-soft: rgba(167, 139, 250, 0.16);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

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

body.dashboard-page {
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(37, 99, 235, 0.08), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f6f8fb 54%, #eef3f8 100%);
}

button,
input,
select {
  font: inherit;
}

button,
.link-button {
  min-height: 40px;
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 9px 14px;
  cursor: pointer;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

button:hover,
.link-button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
  transform: none;
}

.link-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  text-decoration: none;
}

button.primary,
.primary-link {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
  font-weight: 800;
}

button.primary:hover,
.primary-link:hover {
  background: var(--teal-strong);
  border-color: var(--teal-strong);
}

button.ghost,
.link-button {
  background: #ffffff;
  border-color: var(--line-strong);
  color: var(--ink);
  font-weight: 750;
}

button.ghost:hover,
.link-button:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.theme-toggle {
  min-width: 104px;
  white-space: nowrap;
}

.theme-toggle[aria-pressed="true"] {
  background: #ecfeff;
  border-color: rgba(15, 159, 145, 0.42);
  color: #0f766e;
}

.link-button.primary-link {
  background: var(--teal);
  border-color: var(--teal);
  color: #ffffff;
  font-weight: 800;
}

.link-button.primary-link:hover {
  background: var(--teal-strong);
  border-color: var(--teal-strong);
}

button.danger {
  background: var(--red-soft);
  border-color: #fdba74;
  color: var(--red);
  font-weight: 800;
}

button.danger:hover {
  background: #ffedd5;
}

input {
  width: 100%;
  min-height: 42px;
  margin-top: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 650;
}

input::placeholder {
  color: #64748b;
}

input:focus {
  outline: 3px solid rgba(24, 183, 164, 0.18);
  border-color: rgba(24, 183, 164, 0.7);
}

label {
  display: block;
  min-width: 0;
}

label span,
.metric span,
.kv dt {
  display: block;
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.sidebar-brand,
.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: var(--radius);
  background: transparent;
  overflow: hidden;
}

.brand-mark img {
  display: block;
  width: 44px;
  height: 44px;
}

.eyebrow,
.topbar .eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 820;
  text-transform: uppercase;
}

.sidebar h1,
.topbar h1,
.topbar h2 {
  margin: 0;
  color: #020617;
  font-weight: 920;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.sidebar h1 {
  font-size: 21px;
  line-height: 1.1;
}

.sidebar-menu {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.sidebar-menu-title {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.sidebar-menu .menu-action {
  width: 100%;
  min-height: 54px;
  justify-content: flex-start;
  padding: 13px 15px;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.15;
  text-align: left;
}

.sidebar-menu .menu-primary {
  min-height: 64px;
  font-size: 21px;
}

.sidebar-menu .link-button.menu-action {
  display: flex;
}

.workspace {
  min-width: 0;
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px clamp(18px, 3vw, 38px);
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}

.topbar > div:first-child {
  min-width: 0;
}

.topbar h2 {
  font-size: 25px;
  line-height: 1.1;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.topbar-actions > * {
  min-width: 0;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  max-width: min(260px, 100%);
  padding: 8px 13px;
  border: 1px solid rgba(45, 212, 191, 0.36);
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.12);
  color: #0f766e;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

main {
  padding: 22px clamp(18px, 3vw, 38px) 44px;
  width: 100%;
}

.report-shell {
  width: 100%;
  max-width: none;
}

.command-strip,
.panel,
.metric,
.progress-panel,
.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: #0b1220;
  font-weight: 700;
}

.command-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 24px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #dbeafe 0%, #dcfce7 100%);
  border-color: #93c5fd;
}

.command-strip > div {
  min-width: 0;
}

.section-kicker {
  display: inline-flex;
  margin-bottom: 10px;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.command-strip h2 {
  margin: 0 0 7px;
  font-size: 29px;
  line-height: 1.12;
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.command-strip p,
.hero-report p,
.panel-copy {
  margin: 0;
  color: #111827;
  font-weight: 750;
  overflow-wrap: anywhere;
}

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

.report-metrics {
  margin-bottom: 16px;
}

.metric {
  min-height: 118px;
  padding: 17px;
  min-width: 0;
}

.metric:nth-child(1) {
  background: linear-gradient(135deg, #ecfdf5 0%, #d9f99d 100%);
  border-color: #86efac;
}

.metric:nth-child(2) {
  background: linear-gradient(135deg, #eff6ff 0%, #bfdbfe 100%);
  border-color: #93c5fd;
}

.metric:nth-child(3) {
  background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
  border-color: #fdba74;
}

.metric:nth-child(4) {
  background: linear-gradient(135deg, #f5f3ff 0%, #ddd6fe 100%);
  border-color: #c4b5fd;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 31px;
  line-height: 1;
  color: #020617;
  font-weight: 920;
  overflow-wrap: anywhere;
}

.metric small {
  display: block;
  margin-top: 10px;
  color: #111827;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.panel,
.progress-panel {
  padding: 20px;
  margin-bottom: 16px;
}

.progress-panel {
  background: linear-gradient(135deg, #fff7ed 0%, #fef9c3 100%);
  border-color: #fbbf24;
}

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

.panel-head > div {
  min-width: 0;
}

.panel-head h2,
.progress-head h2 {
  margin: 0;
  font-size: 18px;
  color: #020617;
  font-weight: 900;
}

.panel-copy {
  margin-top: 5px;
  font-size: 13px;
}

.filter-panel {
  background: linear-gradient(135deg, #fff7ed 0%, #ecfdf5 100%);
  border-color: #fdba74;
}

.panel:not(.filter-panel) {
  background: linear-gradient(135deg, #ffffff 0%, #e0f2fe 100%);
  border-color: #bae6fd;
}

.badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid #99f6e4;
  border-radius: 999px;
  background: #ccfbf1;
  color: #0f172a;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.badge.warn {
  background: #fef3c7;
  border-color: #fbbf24;
  color: #111827;
}

.badge.error {
  background: #ffedd5;
  border-color: #fb923c;
  color: #111827;
}

.badge.neutral {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #0f172a;
}

.filter-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(116px, auto);
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.date-filter-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr)) minmax(126px, 170px);
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.date-filter-form input {
  font-weight: 800;
}

.source-filter {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  padding-top: 4px;
}

.source-filter-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.source-filter h3 {
  margin: 0;
  color: #020617;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.2;
}

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

.source-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.source-group legend {
  margin-bottom: 8px;
  color: #020617;
  font-size: 13px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.source-options {
  display: grid;
  gap: 7px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.source-toggle,
.source-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  color: #0f172a;
  font-size: 13px;
  font-weight: 780;
  line-height: 1.35;
}

.source-toggle input,
.source-option input {
  width: 16px;
  min-width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 1px 0 0;
  padding: 0;
  accent-color: var(--teal);
}

.source-toggle span,
.source-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.group-toggle {
  margin-bottom: 8px;
}

.source-save {
  justify-self: start;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 8px 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  max-width: 100%;
  min-width: 0;
  color: #020617;
  font-weight: 800;
}

.date-chip {
  background: #fef3c7;
  border-color: #fbbf24;
}

.source-chip {
  background: #e0f2fe;
  border-color: #7dd3fc;
}

.active-tender-panel {
  background: linear-gradient(135deg, #ffffff 0%, #dff8ef 100%);
  border-color: #99f6e4;
}

.active-tender-list {
  display: grid;
  gap: 10px;
}

.active-tender-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(15, 159, 145, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.active-tender-main {
  min-width: 0;
}

.active-tender-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.active-tender-top strong {
  min-width: 0;
  color: #020617;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.active-tender-item p {
  margin: 8px 0 0;
  color: #111827;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.active-tender-item small {
  display: block;
  margin-top: 7px;
  color: #334155;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.active-date {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 900;
}

.active-tender-link {
  white-space: nowrap;
}

.empty-active,
.active-tender-more {
  margin: 0;
}

.chip button {
  min-height: 24px;
  width: 24px;
  padding: 0;
  border-radius: 999px;
}

.chip span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.empty-inline {
  margin: 0;
}

.progress-panel[hidden] {
  display: none;
}

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

.progress-head > div:first-child {
  min-width: 0;
}

.progress-head p,
.progress-panel p {
  margin: 5px 0 0;
  color: #111827;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.progress-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.progress-head strong {
  min-width: 56px;
  text-align: right;
  font-size: 23px;
  color: #020617;
  font-weight: 920;
}

.progress-track {
  width: 100%;
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  transition: width 240ms ease;
}

.progress-panel .muted {
  margin-top: 10px;
  font-size: 13px;
  color: #111827;
  font-weight: 750;
}

.kv {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 14px;
  margin: 0;
}

.kv dd {
  margin: 5px 0 0;
  color: #020617;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.table {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

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

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

th {
  background: #e0f2fe;
  color: #020617;
  font-size: 12px;
  font-weight: 850;
}

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

td.actions {
  width: 1%;
  white-space: nowrap;
}

.audit-shell .panel {
  overflow: hidden;
}

.audit-table table {
  min-width: 980px;
}

.audit-table th,
.audit-table td {
  vertical-align: top;
}

.stacked-cell {
  display: grid;
  gap: 5px;
}

.stacked-cell span {
  display: block;
  max-width: 360px;
  overflow-wrap: anywhere;
}

.audit-detail {
  max-width: 360px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.observation-shell {
  display: grid;
  gap: 20px;
}

.observation-filters {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(260px, 1fr) minmax(180px, auto);
  gap: 14px;
  align-items: end;
}

.observation-filters label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 900;
}

.observation-filters select,
.observation-filters input[type="search"] {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 850;
}

.observation-filters .check-row {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
}

.observation-filters .check-row input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--teal);
}

.observation-table td {
  vertical-align: top;
}

.module-shell {
  width: 100%;
  max-width: none;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  align-items: stretch;
}

.module-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 238px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff 0%, #e0f2fe 100%);
  color: #0b1220;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.module-card:hover {
  border-color: #93c5fd;
}

.module-card.disabled {
  background: linear-gradient(135deg, #ffffff 0%, #fff7ed 100%);
  border-color: #fdba74;
}

.module-card.management {
  background: linear-gradient(135deg, #ffffff 0%, #dcfce7 100%);
  border-color: #86efac;
}

.module-card strong {
  color: #020617;
  font-size: 25px;
  font-weight: 920;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.module-card p {
  margin: 0;
  color: #111827;
  font-size: 14px;
  font-weight: 760;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.module-card small {
  color: #334155;
  font-size: 12px;
  font-weight: 780;
  line-height: 1.35;
}

.module-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  min-height: 38px;
  min-width: 84px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  color: #0f172a;
  font-weight: 850;
}

.module-warning {
  margin-top: 16px;
  background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
  border-color: #fdba74;
}

.access-shell .panel {
  overflow: hidden;
}

.access-shell {
  width: 100%;
  max-width: none;
}

.access-table table {
  min-width: 1480px;
}

.module-access-cell {
  min-width: 350px;
}

.access-toggle {
  margin-bottom: 10px;
}

.access-date-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(118px, 1fr));
  gap: 8px;
}

.access-billing {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 8px 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.access-billing > strong {
  grid-column: 1 / -1;
  color: #020617;
  font-size: 12px;
  font-weight: 900;
}

.access-check {
  gap: 8px;
  min-height: 28px;
  font-size: 12px;
  font-weight: 850;
}

.access-check input {
  margin: 0;
}

.compact-label span {
  font-size: 11px;
}

.compact-label input {
  min-height: 38px;
  padding: 8px 10px;
}

.access-contracts {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.access-contracts > strong {
  color: #020617;
  font-size: 12px;
  font-weight: 900;
}

.contract-list {
  display: grid;
  gap: 7px;
}

.contract-item {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
}

.contract-item a {
  color: #0f172a;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.contract-item small,
.contract-empty {
  color: #334155;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.contract-upload {
  display: grid;
  gap: 5px;
}

.contract-upload input {
  min-height: 36px;
  margin-top: 0;
  padding: 7px 8px;
  font-size: 12px;
}

.invoice-shell {
  width: 100%;
  max-width: none;
}

.invoice-upload-panel {
  background: linear-gradient(135deg, #ffffff 0%, #eef6ff 100%);
  border-color: #bfdbfe;
}

.invoice-upload-grid {
  display: grid;
  grid-template-columns: minmax(280px, 720px);
  gap: 14px;
  align-items: stretch;
}

.file-drop {
  display: grid;
  align-content: center;
  gap: 10px;
  min-height: 220px;
  padding: 18px;
  border: 1px dashed #93c5fd;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.file-drop input {
  margin-top: 0;
}

.file-drop small {
  color: #334155;
  font-size: 12px;
  font-weight: 760;
}

.selected-file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.invoice-preview-table table {
  min-width: 1540px;
}

.invoice-preview-table th,
.invoice-preview-table td {
  font-size: 12px;
}

.invoice-preview-table td {
  padding: 7px;
}

.invoice-cell-input {
  width: 100%;
  min-width: 96px;
  min-height: 34px;
  margin: 0;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.78);
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.invoice-cell-input:focus {
  outline: 2px solid rgba(24, 183, 164, 0.22);
  border-color: rgba(24, 183, 164, 0.72);
  background: #ffffff;
}

.offer-shell {
  width: 100%;
  max-width: none;
}

.offer-form-panel,
.offer-preview-panel {
  overflow: hidden;
}

.offer-form {
  display: grid;
  gap: 14px;
  max-width: 980px;
}

.offer-mode-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.66);
}

.offer-mode-group legend {
  padding: 0 4px;
  color: #0f172a;
  font-size: 12px;
  font-weight: 900;
}

.offer-mode-group .check {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
}

.offer-mode-group .check span {
  color: #0f172a;
  font-size: 13px;
}

.offer-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
}

.offer-field-grid[hidden] {
  display: none;
}

.offer-items-panel {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.66);
}

.offer-items-panel legend {
  padding: 0 4px;
  color: #0f172a;
  font-size: 12px;
  font-weight: 900;
}

.offer-items-list {
  display: grid;
  gap: 10px;
}

.offer-item-row {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(90px, 0.7fr) minmax(90px, 0.7fr) minmax(130px, 1fr) auto;
  gap: 10px;
  align-items: end;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
}

.offer-item-field {
  min-width: 0;
}

.offer-item-remove {
  min-height: 44px;
  padding-inline: 12px;
}

#addOfferItemBtn {
  justify-self: start;
  min-height: 42px;
}

.offer-vat-input {
  max-width: 220px;
}

.offer-pdf-options-panel {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.66);
}

.offer-pdf-options-panel[hidden],
.offer-pdf-options-grid[hidden] {
  display: none;
}

.offer-pdf-options-panel legend {
  padding: 0 4px;
  color: #0f172a;
  font-size: 12px;
  font-weight: 900;
}

.offer-pdf-options-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 320px);
  gap: 12px;
  align-items: start;
}

.offer-signature-options {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.offer-signature-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
}

.offer-signature-card.selected {
  border-color: rgba(15, 159, 145, 0.55);
  background: #ecfdf5;
}

.offer-signature-card input {
  width: 17px;
  min-width: 17px;
  height: 17px;
  min-height: 17px;
  margin: 1px 0 0;
  padding: 0;
  accent-color: var(--teal);
}

.offer-signature-card span {
  min-width: 0;
}

.offer-signature-card strong,
.offer-signature-card small {
  display: block;
  overflow-wrap: anywhere;
}

.offer-signature-card strong {
  margin-bottom: 4px;
  color: #020617;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
}

.offer-signature-card small,
.offer-additional-note small,
.offer-stamp-preview figcaption {
  color: #334155;
  font-size: 11.5px;
  font-weight: 740;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.offer-stamp-preview {
  display: grid;
  gap: 7px;
  margin: 0;
}

.offer-stamp-preview img {
  display: block;
  width: 100%;
  max-height: 170px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.offer-additional-note {
  min-width: 0;
}

.offer-additional-note input {
  min-height: 38px;
  margin-top: 7px;
  font-size: 13px;
}

.offer-additional-note small {
  display: block;
  margin-top: 7px;
}

.offer-issuer-panel {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.66);
}

.offer-issuer-panel[hidden] {
  display: none;
}

.offer-issuer-panel legend {
  padding: 0 4px;
  color: #0f172a;
  font-size: 12px;
  font-weight: 900;
}

.offer-issuer-panel select {
  min-height: 44px;
  margin-top: 7px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  color: #0f172a;
  font: inherit;
  font-weight: 800;
}

.offer-issuer-grid {
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.offer-document-preview {
  display: grid;
  gap: 16px;
  min-height: 520px;
  padding: clamp(18px, 3vw, 34px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  color: #111827;
}

.offer-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.offer-preview-header strong {
  color: #111827;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.offer-document-preview h3 {
  margin: 80px 0 0;
  color: #111827;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
}

.offer-document-preview p {
  max-width: 820px;
  margin: 0 auto 56px;
  color: #111827;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.55;
  text-align: center;
  overflow-wrap: anywhere;
}

.offer-table {
  border-color: #111827;
  border-radius: 0;
}

.offer-table table {
  min-width: 720px;
}

.offer-table th,
.offer-table td {
  border-color: #111827;
  color: #111827;
  font-size: 13px;
}

.offer-table th {
  background: #f8fafc;
  color: #111827;
  text-align: center;
}

.offer-table td:first-child,
.offer-table td:nth-child(3),
.offer-table td:nth-child(4),
.offer-table td:nth-child(5) {
  text-align: center;
}

.offer-totals {
  display: grid;
  justify-self: end;
  width: min(100%, 360px);
  margin: 0;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  overflow: hidden;
}

.offer-totals div {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr);
  min-height: 38px;
}

.offer-totals div + div {
  border-top: 1px solid #cbd5e1;
}

.offer-totals dt,
.offer-totals dd {
  margin: 0;
  padding: 9px 11px;
  color: #111827;
  font-size: 13px;
  font-weight: 850;
}

.offer-totals dt {
  background: #f8fafc;
  border-right: 1px solid #cbd5e1;
}

.offer-totals dd {
  text-align: right;
}

.offer-preview-notes {
  display: grid;
  gap: 8px;
  margin-top: 6px;
  color: #111827;
}

.offer-preview-notes strong {
  color: #111827;
  font-size: 13px;
  font-weight: 900;
  text-decoration: underline;
  overflow-wrap: anywhere;
}

.offer-preview-notes ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 20px;
}

.offer-preview-notes li {
  color: #111827;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.offer-preview-issuer {
  display: grid;
  gap: 7px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #cbd5e1;
  text-align: center;
}

.offer-preview-issuer strong {
  color: #1e3a8a;
  font-size: 16px;
  font-weight: 920;
  overflow-wrap: anywhere;
}

.offer-preview-issuer p {
  max-width: 780px;
  margin: 0 auto;
  color: #1e3a8a;
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-line;
}

.warn-cell {
  color: #9a3412;
  font-weight: 850;
}

.muted {
  color: var(--muted);
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #f4f7fb;
  color: #09100f;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(130deg, rgba(15, 159, 145, 0.16), transparent 38%),
    linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
}

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

.login-panel {
  width: min(100%, 440px);
  padding: 24px;
  background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
  border-color: #bfdbfe;
}

.login-copy {
  margin-bottom: 18px;
}

.login-copy h1 {
  margin: 14px 0 6px;
  font-size: 28px;
  line-height: 1.1;
  color: #020617;
  font-weight: 920;
}

.login-copy p {
  margin: 0;
  color: #111827;
  font-weight: 750;
}

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

.login-form button {
  width: 100%;
  margin-top: 2px;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 750;
}

.tabs,
.view,
.form-row,
.settings-grid,
.inline-form,
.form-actions,
.check,
.wide,
.empty,
.hero-report,
.report-actions,
.token-field {
  /* Legacy admin/report helpers retained for older static views. */
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 12px clamp(16px, 3vw, 34px) 0;
  overflow-x: auto;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}

.tab.active {
  color: var(--ink);
  border-color: var(--teal);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

:root[data-theme="dark"] body {
  background: var(--bg);
  color: var(--ink);
}

:root[data-theme="dark"] body.dashboard-page {
  background:
    linear-gradient(120deg, rgba(45, 212, 191, 0.12), transparent 34%),
    linear-gradient(180deg, #111827 0%, #0f1720 58%, #0b1118 100%);
}

:root[data-theme="dark"] .login-page {
  background:
    linear-gradient(130deg, rgba(45, 212, 191, 0.14), transparent 38%),
    linear-gradient(180deg, #111827 0%, #0f1720 100%);
}

:root[data-theme="dark"] button.ghost,
:root[data-theme="dark"] .link-button {
  background: rgba(248, 250, 252, 0.06);
  border-color: var(--line-strong);
  color: var(--ink);
}

:root[data-theme="dark"] button.ghost:hover,
:root[data-theme="dark"] .link-button:hover {
  background: rgba(248, 250, 252, 0.1);
  border-color: rgba(226, 232, 240, 0.34);
}

:root[data-theme="dark"] .theme-toggle[aria-pressed="true"] {
  background: rgba(45, 212, 191, 0.16);
  border-color: rgba(94, 234, 212, 0.42);
  color: #ccfbf1;
}

:root[data-theme="dark"] .user-chip {
  background: rgba(45, 212, 191, 0.14);
  border-color: rgba(94, 234, 212, 0.34);
  color: #ccfbf1;
}

:root[data-theme="dark"] input {
  background: #111827;
  border-color: var(--line-strong);
  color: var(--ink);
}

:root[data-theme="dark"] select,
:root[data-theme="dark"] .observation-filters input[type="search"] {
  background: #111827;
  border-color: var(--line-strong);
  color: var(--ink);
}

:root[data-theme="dark"] .observation-filters .check-row {
  background: rgba(248, 250, 252, 0.06);
  border-color: var(--line-strong);
}

:root[data-theme="dark"] input::placeholder {
  color: #94a3b8;
}

:root[data-theme="dark"] label span,
:root[data-theme="dark"] .metric span,
:root[data-theme="dark"] .kv dt {
  color: #dbeafe;
}

:root[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #121c27 0%, #101820 100%);
}

:root[data-theme="dark"] .sidebar h1,
:root[data-theme="dark"] .topbar h1,
:root[data-theme="dark"] .topbar h2,
:root[data-theme="dark"] .command-strip h2,
:root[data-theme="dark"] .panel-head h2,
:root[data-theme="dark"] .progress-head h2,
:root[data-theme="dark"] .source-filter h3,
:root[data-theme="dark"] .source-group legend,
:root[data-theme="dark"] .metric strong,
:root[data-theme="dark"] .kv dd,
:root[data-theme="dark"] th {
  color: var(--ink);
}

:root[data-theme="dark"] .login-panel {
  background: linear-gradient(135deg, #17212b 0%, #1e2a36 100%);
  border-color: var(--line);
}

:root[data-theme="dark"] .topbar {
  background: rgba(15, 23, 32, 0.9);
}

:root[data-theme="dark"] .command-strip,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .metric,
:root[data-theme="dark"] .progress-panel,
:root[data-theme="dark"] .login-panel {
  color: var(--ink);
}

:root[data-theme="dark"] .command-strip {
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.13) 0%, rgba(96, 165, 250, 0.16) 100%);
  border-color: rgba(96, 165, 250, 0.34);
}

:root[data-theme="dark"] .section-kicker,
:root[data-theme="dark"] .eyebrow,
:root[data-theme="dark"] .topbar .eyebrow {
  color: #5eead4;
}

:root[data-theme="dark"] .command-strip p,
:root[data-theme="dark"] .hero-report p,
:root[data-theme="dark"] .panel-copy,
:root[data-theme="dark"] .metric small,
:root[data-theme="dark"] .progress-head p,
:root[data-theme="dark"] .progress-panel p,
:root[data-theme="dark"] .progress-panel .muted,
:root[data-theme="dark"] .login-copy p,
:root[data-theme="dark"] .topbar p,
:root[data-theme="dark"] .muted {
  color: #cbd5e1;
}

:root[data-theme="dark"] .metric:nth-child(1) {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(132, 204, 22, 0.16) 100%);
  border-color: rgba(74, 222, 128, 0.34);
}

:root[data-theme="dark"] .metric:nth-child(2) {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(96, 165, 250, 0.2) 100%);
  border-color: rgba(147, 197, 253, 0.34);
}

:root[data-theme="dark"] .metric:nth-child(3) {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(251, 146, 60, 0.18) 100%);
  border-color: rgba(251, 191, 36, 0.34);
}

:root[data-theme="dark"] .metric:nth-child(4) {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.16) 0%, rgba(167, 139, 250, 0.2) 100%);
  border-color: rgba(196, 181, 253, 0.34);
}

:root[data-theme="dark"] .progress-panel {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.14) 0%, rgba(45, 212, 191, 0.12) 100%);
  border-color: rgba(251, 191, 36, 0.34);
}

:root[data-theme="dark"] .filter-panel {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.13) 0%, rgba(45, 212, 191, 0.12) 100%);
  border-color: rgba(251, 191, 36, 0.34);
}

:root[data-theme="dark"] .panel:not(.filter-panel) {
  background: linear-gradient(135deg, #17212b 0%, rgba(96, 165, 250, 0.13) 100%);
  border-color: var(--line-strong);
}

:root[data-theme="dark"] .badge {
  background: rgba(45, 212, 191, 0.14);
  border-color: rgba(94, 234, 212, 0.34);
  color: #ccfbf1;
}

:root[data-theme="dark"] .badge.warn,
:root[data-theme="dark"] .date-chip {
  background: rgba(251, 191, 36, 0.16);
  border-color: rgba(251, 191, 36, 0.42);
  color: #fde68a;
}

:root[data-theme="dark"] .badge.error {
  background: rgba(251, 146, 60, 0.16);
  border-color: rgba(251, 146, 60, 0.42);
  color: #fed7aa;
}

:root[data-theme="dark"] .badge.neutral {
  background: rgba(148, 163, 184, 0.13);
  border-color: rgba(148, 163, 184, 0.28);
  color: #e2e8f0;
}

:root[data-theme="dark"] .source-toggle,
:root[data-theme="dark"] .source-option,
:root[data-theme="dark"] .chip,
:root[data-theme="dark"] td {
  color: var(--ink);
}

:root[data-theme="dark"] .chip {
  background: rgba(248, 250, 252, 0.07);
  border-color: var(--line-strong);
}

:root[data-theme="dark"] .source-chip,
:root[data-theme="dark"] th {
  background: rgba(96, 165, 250, 0.16);
  border-color: rgba(125, 211, 252, 0.32);
}

:root[data-theme="dark"] .active-tender-panel {
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.14) 0%, rgba(34, 197, 94, 0.11) 100%);
  border-color: rgba(94, 234, 212, 0.34);
}

:root[data-theme="dark"] .active-tender-item {
  background: rgba(15, 23, 32, 0.54);
  border-color: rgba(94, 234, 212, 0.24);
}

:root[data-theme="dark"] .active-tender-top strong,
:root[data-theme="dark"] .active-tender-item p {
  color: var(--ink);
}

:root[data-theme="dark"] .active-tender-item small {
  color: #cbd5e1;
}

:root[data-theme="dark"] .module-card {
  background: linear-gradient(135deg, #17212b 0%, rgba(96, 165, 250, 0.13) 100%);
  border-color: var(--line-strong);
  color: var(--ink);
}

:root[data-theme="dark"] .module-card.disabled {
  background: linear-gradient(135deg, #17212b 0%, rgba(251, 191, 36, 0.13) 100%);
  border-color: rgba(251, 191, 36, 0.34);
}

:root[data-theme="dark"] .module-card.management {
  background: linear-gradient(135deg, #17212b 0%, rgba(45, 212, 191, 0.13) 100%);
  border-color: rgba(94, 234, 212, 0.34);
}

:root[data-theme="dark"] .module-card strong,
:root[data-theme="dark"] .module-card p {
  color: var(--ink);
}

:root[data-theme="dark"] .module-card small {
  color: #cbd5e1;
}

:root[data-theme="dark"] .access-billing > strong,
:root[data-theme="dark"] .access-contracts > strong,
:root[data-theme="dark"] .contract-item a {
  color: var(--ink);
}

:root[data-theme="dark"] .contract-item {
  background: rgba(248, 250, 252, 0.06);
  border-color: var(--line-strong);
}

:root[data-theme="dark"] .contract-item small,
:root[data-theme="dark"] .contract-empty {
  color: #cbd5e1;
}

:root[data-theme="dark"] .module-action {
  background: rgba(248, 250, 252, 0.06);
  border-color: var(--line-strong);
  color: var(--ink);
}

:root[data-theme="dark"] .module-warning {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.14) 0%, rgba(251, 146, 60, 0.12) 100%);
  border-color: rgba(251, 191, 36, 0.34);
}

:root[data-theme="dark"] .invoice-upload-panel {
  background: linear-gradient(135deg, #17212b 0%, rgba(96, 165, 250, 0.13) 100%);
  border-color: var(--line-strong);
}

:root[data-theme="dark"] .file-drop {
  background: rgba(248, 250, 252, 0.06);
  border-color: rgba(147, 197, 253, 0.34);
}

:root[data-theme="dark"] .file-drop small {
  color: #cbd5e1;
}

:root[data-theme="dark"] .invoice-cell-input {
  background: rgba(15, 23, 42, 0.62);
  border-color: rgba(148, 163, 184, 0.2);
  color: var(--ink);
}

:root[data-theme="dark"] .invoice-cell-input:focus {
  background: #111827;
}

:root[data-theme="dark"] .offer-mode-group {
  background: rgba(15, 23, 42, 0.36);
  border-color: var(--line-strong);
}

:root[data-theme="dark"] .offer-mode-group legend,
:root[data-theme="dark"] .offer-mode-group .check span {
  color: var(--ink);
}

:root[data-theme="dark"] .offer-mode-group .check {
  background: rgba(248, 250, 252, 0.06);
  border-color: var(--line-strong);
}

:root[data-theme="dark"] .offer-items-panel {
  background: rgba(15, 23, 42, 0.36);
  border-color: var(--line-strong);
}

:root[data-theme="dark"] .offer-items-panel legend {
  color: var(--ink);
}

:root[data-theme="dark"] .offer-item-row {
  background: rgba(248, 250, 252, 0.06);
  border-color: var(--line-strong);
}

:root[data-theme="dark"] .offer-pdf-options-panel {
  background: rgba(15, 23, 42, 0.36);
  border-color: var(--line-strong);
}

:root[data-theme="dark"] .offer-pdf-options-panel legend,
:root[data-theme="dark"] .offer-signature-card strong {
  color: var(--ink);
}

:root[data-theme="dark"] .offer-signature-card {
  background: rgba(248, 250, 252, 0.06);
  border-color: var(--line-strong);
}

:root[data-theme="dark"] .offer-signature-card.selected {
  background: rgba(15, 159, 145, 0.16);
  border-color: rgba(45, 212, 191, 0.52);
}

:root[data-theme="dark"] .offer-signature-card small,
:root[data-theme="dark"] .offer-additional-note small,
:root[data-theme="dark"] .offer-stamp-preview figcaption {
  color: var(--muted);
}

:root[data-theme="dark"] .offer-stamp-preview img {
  background: #ffffff;
  border-color: var(--line-strong);
}

:root[data-theme="dark"] .offer-issuer-panel {
  background: rgba(15, 23, 42, 0.36);
  border-color: var(--line-strong);
}

:root[data-theme="dark"] .offer-issuer-panel legend {
  color: var(--ink);
}

:root[data-theme="dark"] .offer-issuer-panel select {
  background: #111827;
  border-color: var(--line-strong);
  color: var(--ink);
}

:root[data-theme="dark"] .offer-document-preview {
  background: #f8fafc;
  color: #111827;
}

:root[data-theme="dark"] .offer-document-preview .muted {
  color: #475569;
}

:root[data-theme="dark"] .warn-cell {
  color: #fed7aa;
}

:root[data-theme="dark"] .progress-track {
  background: rgba(15, 23, 42, 0.72);
  border-color: var(--line);
}

:root[data-theme="dark"] .table {
  border-color: var(--line);
}

:root[data-theme="dark"] .toast {
  background: #17212b;
  border-color: var(--line-strong);
  color: var(--ink);
}

:root[data-theme="dark"] .login-copy h1 {
  color: var(--ink);
}

.form-row,
.settings-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(220px, 2fr) auto auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

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

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.check input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

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

.inline-form,
.form-actions {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.inline-form {
  max-width: 620px;
  margin-bottom: 14px;
}

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

  .sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
    gap: 16px;
    padding: 18px;
  }

  .sidebar-menu {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(160px, 1fr));
    margin-top: 0;
  }

  .sidebar-menu-title {
    grid-column: 1 / -1;
  }

  .sidebar-menu .menu-action,
  .sidebar-menu .menu-primary {
    min-height: 52px;
    font-size: 16px;
  }

  .topbar {
    top: 0;
  }

  .access-table,
  .invoice-preview-table,
  .offer-table,
  .audit-table {
    max-width: calc(100vw - 36px);
  }
}

@media (max-width: 860px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .command-strip {
    grid-template-columns: 1fr;
  }

  .metric-grid,
  .kv,
  .source-groups,
  .settings-grid,
  .observation-filters {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .form-row,
  .filter-form,
  .date-filter-form,
  .invoice-upload-grid,
  .offer-field-grid,
  .offer-pdf-options-grid,
  .offer-item-row,
  .active-tender-item {
    grid-template-columns: 1fr;
  }

  .observation-filters .check-row {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid,
  .kv,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  main {
    padding: 16px 14px 32px;
  }

  .topbar {
    padding: 18px 14px;
  }

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

  .sidebar-menu,
  .metric-grid,
  .kv,
  .source-groups,
  .settings-grid,
  .observation-filters {
    grid-template-columns: 1fr;
  }

  .filter-form button,
  .date-filter-form button,
  .source-save,
  .command-strip .link-button,
  .topbar-actions button,
  .topbar-actions .link-button {
    width: 100%;
  }

  .access-table,
  .invoice-preview-table,
  .offer-table,
  .audit-table {
    max-width: calc(100vw - 28px);
  }

  .offer-document-preview {
    min-height: 420px;
    padding: 16px;
  }

  .offer-preview-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .offer-document-preview h3 {
    margin-top: 36px;
  }

  .progress-head,
  .progress-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .progress-actions button {
    width: 100%;
  }

  .command-strip h2 {
    font-size: 24px;
  }
}
