:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  --bg: #eef3f8;
  --panel: #ffffff;
  --soft: #f7fafc;
  --text: #172033;
  --muted: #657287;
  --line: #d9e2ee;
  --blue: #315df4;
  --blue-soft: #e8eeff;
  --green: #15835f;
  --green-soft: #ddf8eb;
  --amber: #9a6400;
  --amber-soft: #fff1cf;
  --red: #c53b3b;
  --red-soft: #ffe3e3;
}

* { box-sizing: border-box; }

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

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

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 10%, rgba(49, 93, 244, 0.14), transparent 34%),
    linear-gradient(135deg, #f9fbfd, #e8eef6);
}

.login-card {
  width: 100%;
  position: relative;
  overflow: hidden;
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 24px 80px rgba(28, 44, 73, 0.15);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--blue), #7ca3ff);
}

.login-wrap {
  width: min(1320px, 100%);
}

.login-wrap > .brand {
  margin-bottom: 18px;
}

.login-choice {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  align-items: stretch;
  margin-top: 20px;
}

.login-choice .login-card {
  width: 100%;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  padding: 32px;
}

.login-choice .login-card .grid {
  margin-top: 30px !important;
}

.login-version-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid #cbd8ec;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 850;
  letter-spacing: 0;
  box-shadow: 0 12px 28px rgba(28, 44, 73, 0.08);
}

.login-version-badge.production {
  color: #123aaf;
  background: #e8eeff;
}

.login-version-badge.demo {
  color: #7a4b00;
  background: #fff1cf;
  border-color: #f3d58d;
}

.login-version-badge.test {
  color: #0f5f74;
  background: #e4f8ff;
  border-color: #b8e8f6;
}

.test-login-card {
  background: linear-gradient(180deg, #ffffff, #f2fbff);
}

.test-login-card::before {
  background: linear-gradient(90deg, #0891b2, #67e8f9);
}

.demo-login-card {
  background: linear-gradient(180deg, #ffffff, #fffaf0);
}

.demo-login-card::before {
  background: linear-gradient(90deg, #d89200, #f6c75b);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.product-brand {
  gap: 0;
}

.product-logo {
  display: block;
  width: 218px;
  max-width: 100%;
  height: auto;
}

.login-product-brand .product-logo {
  width: 360px;
}

.brand-logo {
  width: 86px;
  height: 40px;
  object-fit: contain;
  padding: 4px 8px;
  border-radius: 12px;
  background: #07090f;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
}

.brand strong {
  display: inline-block;
  max-width: 142px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.18;
}

.brand small,
.muted {
  color: var(--muted);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(18px);
}

.nav {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.nav-group {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #d9e3f0;
  border-radius: 14px;
  background: rgba(248, 251, 255, 0.72);
}

.nav-group > span {
  padding: 0 6px 4px;
  color: #66758c;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #263349;
  font-weight: 700;
}

.nav a:hover,
.nav a.active {
  border-color: #cbd8ec;
  background: var(--blue-soft);
  color: #123aaf;
}

.content {
  min-width: 0;
  padding: 28px 34px 44px;
}

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

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 32px; letter-spacing: 0; margin-bottom: 6px; }
h2 { font-size: 22px; margin-bottom: 8px; }
h3 { font-size: 17px; margin-bottom: 6px; }

.grid {
  display: grid;
  gap: 16px;
}

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

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 16px 46px rgba(37, 48, 73, 0.07);
}

.card-pad { padding: 20px; }

.report-tabs-card {
  margin-bottom: 16px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

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

.report-tab {
  display: grid;
  gap: 5px;
  min-height: 76px;
  padding: 13px 14px;
  border: 1px solid #d7e2f1;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 10px 24px rgba(38, 54, 83, 0.04);
}

.report-tab strong {
  font-size: 14px;
}

.report-tab span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.report-tab:hover,
.report-tab.active {
  border-color: #9bb8ff;
  background: #edf4ff;
  box-shadow: inset 3px 0 0 var(--blue), 0 14px 28px rgba(49, 93, 244, 0.12);
}

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

.report-view-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.report-view-link {
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid #d7e2f1;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

.report-view-link strong {
  font-size: 15px;
}

.report-view-link span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-view-link:hover,
.report-view-link.active {
  border-color: #9bb8ff;
  background: #edf4ff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.monthly-detail-list {
  display: grid;
  gap: 14px;
}

.monthly-detail-card .topbar {
  margin-bottom: 14px;
}

.monthly-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.monthly-detail-summary div {
  padding: 12px;
  border: 1px solid #dbe5f2;
  border-radius: 12px;
  background: #f8fbff;
}

.monthly-detail-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.monthly-detail-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
}

.monthly-event-row {
  border-left: 3px solid #dbeafe;
}

.metric {
  display: grid;
  gap: 6px;
  padding: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

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

.tax-profile-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

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

.tax-profile-grid div {
  min-height: 82px;
  padding: 14px;
  border: 1px solid #dbe5f2;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(38, 54, 83, 0.04);
}

.tax-profile-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.tax-profile-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
  line-height: 1.2;
}

.table-card {
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 14px 16px;
  border-bottom: 1px solid #e7edf5;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

tr.clickable {
  cursor: pointer;
}

tr.clickable:hover {
  background: #edf4ff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.action-row {
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.action-row:hover {
  border-color: #9bb8ff;
  background: #edf4ff;
  transform: translateY(-1px);
}

.action-note {
  padding: 14px 16px;
  border: 1px solid #f2c96b;
  border-radius: 12px;
  background: #fff8e6;
  color: #5e3d00;
  font-weight: 800;
}

.focus-target {
  position: relative;
  border-color: #f2b84b !important;
  background: #fff9ea !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16), 0 16px 38px rgba(154, 100, 0, 0.08) !important;
}

.focus-target input,
.focus-target select,
.focus-target textarea {
  border-color: #e8a322;
  background: #fffdf6;
}

.focus-pulse {
  animation: focusPulse 1.7s ease-in-out 2;
}

@keyframes focusPulse {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16), 0 16px 38px rgba(154, 100, 0, 0.08);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(245, 158, 11, 0.28), 0 20px 44px rgba(154, 100, 0, 0.12);
  }
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.ok { color: var(--green); background: var(--green-soft); }
.pill.warn { color: var(--amber); background: var(--amber-soft); }
.pill.bad { color: var(--red); background: var(--red-soft); }
.pill.info { color: #2341b2; background: var(--blue-soft); }
.pill.gray { color: #64748b; background: #eef2f7; }

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

.actions form {
  margin: 0;
}

.work-priority-item {
  color: inherit;
  text-decoration: none;
}

.inline-decision-form {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(170px, 1.2fr) auto;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.inline-decision-form select,
.inline-decision-form input {
  min-height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

.inline-decision-form button {
  min-height: 36px;
}

.ksef-received-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.ksef-received-summary span {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid #dbe5f2;
  border-radius: 12px;
  background: #f8fbff;
}

.ksef-received-summary strong {
  font-size: 22px;
}

.ksef-received-summary small {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.ksef-result-grid {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr);
  gap: 16px;
  align-items: stretch;
  margin: 16px 0;
}

.ksef-result-card {
  display: grid;
  gap: 9px;
  align-content: start;
  min-height: 180px;
  padding: 18px;
  border: 1px solid #dbe5f2;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.ksef-result-card.ok {
  border-color: #a6e6c4;
  background: linear-gradient(180deg, #ffffff, #f0fff7);
}

.ksef-result-card.warn {
  border-color: #f5d17e;
  background: linear-gradient(180deg, #ffffff, #fff9e8);
}

.ksef-result-card.bad {
  border-color: #f0b5b5;
  background: linear-gradient(180deg, #ffffff, #fff4f4);
}

.ksef-result-card.gray {
  background: #f8fbff;
}

.ksef-result-card span:first-child {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.ksef-result-card h3 {
  margin: 0;
  font-size: 21px;
}

.ksef-result-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.ksef-action-log .status-row {
  align-items: start;
}

.ksef-document {
  position: relative;
  overflow: hidden;
  border: 1px solid #d9e5f4;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 20px 48px rgba(24, 42, 74, 0.08);
}

.ksef-document::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: var(--blue);
}

.ksef-document.purchase::before {
  background: #f59e0b;
}

.ksef-document-head,
.ksef-number-strip,
.ksef-parties,
.ksef-document-amounts,
.ksef-document .invoice-notes {
  margin: 0 26px;
}

.ksef-document-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 0 18px;
  border-bottom: 1px solid #e6edf7;
}

.ksef-document-status {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: flex-end;
  gap: 8px;
}

.ksef-number-strip {
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr;
  gap: 10px;
  padding: 16px 0;
}

.ksef-number-strip span,
.ksef-document-amounts div {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid #dbe5f2;
  border-radius: 12px;
  background: #fff;
}

.ksef-number-strip strong,
.ksef-document-amounts span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.ksef-parties {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 4px 0 16px;
}

.ksef-parties > div {
  padding: 18px;
  border: 1px solid #dbe5f2;
  border-radius: 14px;
  background: #fff;
}

.ksef-document-amounts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-bottom: 18px;
}

.ksef-document-amounts .total {
  border-color: #bed0ff;
  background: #f2f6ff;
}

.ksef-document-amounts strong {
  font-size: 22px;
}

.ksef-document .invoice-notes {
  padding: 18px 0 24px;
  border-top: 1px solid #e6edf7;
}

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--blue);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(49, 93, 244, 0.18);
}

button:hover, .button:hover { background: #244cd2; }
.button.secondary, button.secondary {
  color: #23304a;
  background: #e7edf5;
  box-shadow: none;
}

.button.secondary:hover, button.secondary:hover { background: #d8e2ef; }

button:disabled, .button.disabled {
  cursor: not-allowed;
  opacity: .48;
  box-shadow: none;
}

button:disabled:hover {
  background: #e7edf5;
}

form { margin: 0; }

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

.invoice-filter-card {
  margin: 14px 0 18px;
  padding: 14px;
  border: 1px solid #d7e2f1;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.invoice-filter-grid {
  display: grid;
  grid-template-columns: 1.15fr 1.55fr .95fr .7fr .9fr auto;
  gap: 12px;
  align-items: end;
}

.invoice-filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

label {
  display: grid;
  gap: 7px;
  color: #4b5870;
  font-size: 13px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd8e8;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f9fbfd;
  color: var(--text);
  font: inherit;
}

.lookup-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.lookup-line button {
  min-width: 142px;
  white-space: nowrap;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

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

.check-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid #cbd8e8;
  border-radius: 10px;
  background: #f9fbfd;
  color: #263349;
}

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

.month-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.month-switch a {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #cbd8e8;
  border-radius: 9px;
  background: #fff;
  font-weight: 800;
  color: #2c3950;
}

.month-switch a.active,
.month-switch a:hover {
  color: #123aaf;
  background: var(--blue-soft);
}

.notice {
  padding: 13px 15px;
  border: 1px solid #cbd8e8;
  border-radius: 12px;
  background: #f7fbff;
  color: #2c3950;
}

.notice.warn {
  border-color: #f5d17e;
  background: #fff8e6;
}

.notice.ok {
  border-color: #a6e6c4;
  background: #effcf5;
}

.notice.bad {
  border-color: #f0b5b5;
  background: #fff1f1;
}

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

.user-access-list {
  display: grid;
  gap: 14px;
}

.user-access-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #d7e2f1;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.user-access-main,
.user-access-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.user-access-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.user-access-actions {
  align-items: stretch;
}

.user-access-actions form {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 12px;
  border: 1px solid #e1e9f4;
  border-radius: 12px;
  background: #fff;
}

.status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e2e9f2;
  border-radius: 12px;
  background: #fff;
}

.zus-card .status-list {
  margin-top: 12px;
}

.zus-timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--zus-steps), minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 14px;
  padding: 8px 10px 2px;
}

.zus-timeline::before {
  content: "";
  position: absolute;
  top: 18px;
  left: calc(50% / var(--zus-steps));
  right: calc(50% / var(--zus-steps));
  height: 4px;
  border-radius: 999px;
  background: #dce6f2;
}

.zus-stage {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
  color: #64748b;
}

.zus-dot {
  width: 22px;
  height: 22px;
  border: 4px solid #fff;
  border-radius: 999px;
  background: #dbe5ef;
  box-shadow: 0 0 0 1px #c9d6e6, 0 10px 24px rgba(37, 48, 73, 0.08);
}

.zus-stage strong {
  font-size: 12px;
  line-height: 1.15;
}

.zus-stage small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.zus-stage.done .zus-dot {
  background: #19a974;
}

.zus-stage.done strong {
  color: #15775b;
}

.zus-stage.active .zus-dot {
  width: 26px;
  height: 26px;
  background: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft), 0 16px 30px rgba(49, 93, 244, 0.22);
}

.zus-stage.active strong {
  color: #123aaf;
}

.zus-stage.next .zus-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 4px #fff1cf, 0 16px 30px rgba(245, 158, 11, 0.18);
}

.zus-stage.next strong {
  color: #9a6400;
}

.zus-timeline.compact {
  min-width: 230px;
  margin: 0 0 8px;
  padding: 5px 6px 0;
}

.zus-timeline.compact::before {
  top: 13px;
  height: 3px;
}

.zus-timeline.compact .zus-dot {
  width: 16px;
  height: 16px;
  border-width: 3px;
}

.zus-timeline.compact .zus-stage.active .zus-dot {
  width: 18px;
  height: 18px;
}

.zus-timeline.compact .zus-stage strong {
  font-size: 10px;
}

.zus-timeline.compact .zus-stage small {
  display: none;
}

.alert-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.alert-chip-row.compact {
  margin: 4px 0 0;
  gap: 5px;
}

.alert-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
}

.alert-chip.ok { color: var(--green); background: var(--green-soft); }
.alert-chip.warn { color: var(--amber); background: var(--amber-soft); }
.alert-chip.bad { color: var(--red); background: var(--red-soft); }
.alert-chip.info { color: #2341b2; background: var(--blue-soft); }
.alert-chip.gray { color: #64748b; background: #eef2f7; }

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

.setting-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid #d8e3f0;
  border-radius: 12px;
  background: #fbfdff;
  cursor: pointer;
}

.setting-toggle:hover {
  border-color: #b9c9e3;
  background: #edf4ff;
}

.setting-toggle input {
  width: 20px;
  min-height: 20px;
}

.setting-toggle small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.step-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.step {
  min-height: 36px;
  padding: 9px 10px;
  border: 1px solid #d8e3f0;
  border-radius: 10px;
  background: #f8fbfe;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.step.done {
  border-color: #b9c7ff;
  background: var(--blue-soft);
  color: #123aaf;
}

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

.invoice-items-editor input,
.invoice-items-editor select {
  min-height: 38px;
  padding: 8px 10px;
}

.invoice-items-editor th:first-child,
.invoice-items-editor td:first-child {
  width: 20%;
}

.invoice-items-editor th:nth-child(2),
.invoice-items-editor td:nth-child(2) {
  width: 32%;
}

.invoice-items-editor th:nth-child(3),
.invoice-items-editor td:nth-child(3) {
  width: 7%;
}

.invoice-items-editor th:nth-child(4),
.invoice-items-editor td:nth-child(4),
.invoice-items-editor th:nth-child(7),
.invoice-items-editor td:nth-child(7) {
  width: 12%;
}

.invoice-items-editor th:nth-child(5),
.invoice-items-editor td:nth-child(5),
.invoice-items-editor th:nth-child(6),
.invoice-items-editor td:nth-child(6) {
  width: 8.5%;
}

.invoice-catalog-select {
  min-width: 180px;
}

.invoice-contractor-action {
  display: flex;
  align-items: end;
}

.invoice-contractor-action .button {
  width: 100%;
}

.invoice-document {
  position: relative;
  overflow: hidden;
  padding: 34px;
  border: 1px solid #c9d7ea;
  border-radius: 22px;
  background:
    radial-gradient(circle at 92% 5%, rgba(49, 93, 244, 0.10), transparent 28%),
    linear-gradient(135deg, rgba(49, 93, 244, 0.060), transparent 36%),
    #fff;
  box-shadow: 0 28px 80px rgba(28, 44, 73, 0.13);
}

.invoice-accent {
  position: absolute;
  inset: 0 0 auto;
  height: 10px;
  background: linear-gradient(90deg, #1f49d8, #6f92ff 42%, #bbf7d0 100%);
}

.invoice-watermark {
  position: absolute;
  right: 28px;
  top: 38px;
  color: rgba(49, 93, 244, 0.055);
  font-size: 168px;
  font-weight: 950;
  line-height: 1;
  pointer-events: none;
}

.invoice-header,
.invoice-parties,
.invoice-summary {
  display: grid;
  gap: 18px;
}

.invoice-header {
  position: relative;
  z-index: 1;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  padding-top: 10px;
  margin-bottom: 30px;
}

.invoice-kicker,
.invoice-label {
  margin: 0 0 5px;
  color: #315df4;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.invoice-header h2 {
  margin: 0;
  font-size: 38px;
  letter-spacing: 0;
}

.invoice-subtitle {
  margin: 8px 0 0;
  color: #43536a;
  font-size: 14px;
  font-weight: 700;
}

.invoice-date-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.invoice-date-strip span {
  display: grid;
  min-width: 138px;
  padding: 10px 12px;
  border: 1px solid #d7e2f0;
  border-radius: 12px;
  background: rgba(255,255,255,0.78);
  color: #172033;
  box-shadow: 0 10px 28px rgba(28, 44, 73, 0.06);
}

.invoice-date-strip strong {
  margin-bottom: 3px;
  color: #657287;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.invoice-brand {
  display: grid;
  justify-items: end;
  gap: 3px;
  color: #172033;
}

.invoice-brand-logo {
  width: 84px;
  height: 38px;
  object-fit: contain;
  padding: 4px 8px;
  border-radius: 10px;
  background: #07090f;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
}

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

.invoice-parties {
  position: relative;
  z-index: 1;
  grid-template-columns: 1.08fr 1.08fr .84fr;
  margin-bottom: 26px;
}

.invoice-parties > div {
  min-height: 156px;
  padding: 20px;
  border: 1px solid #d5e0ee;
  border-radius: 16px;
  background: rgba(251,253,255,0.92);
  box-shadow: 0 14px 34px rgba(28, 44, 73, 0.06);
}

.invoice-parties h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.invoice-parties p {
  margin: 4px 0;
  color: #43536a;
  line-height: 1.45;
}

.invoice-ksef-marks {
  position: relative;
  z-index: 1;
  margin: -8px 0 24px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid #bdd0eb;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(238, 245, 255, .98), rgba(255,255,255,.98) 58%, rgba(244, 249, 255, .98)),
    #fff;
  box-shadow: 0 16px 38px rgba(28, 44, 73, 0.08);
}

.invoice-ksef-marks::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 5px;
  height: 100%;
  background: linear-gradient(180deg, #315df4, #1fb981);
}

.invoice-ksef-premium {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 152px;
  gap: 16px;
  align-items: stretch;
}

.invoice-ksef-main {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.invoice-ksef-title {
  margin: 0;
}

.invoice-ksef-eyebrow,
.invoice-ksef-marker span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.invoice-ksef-title h3 {
  margin: 4px 0 4px;
  font-size: 20px;
  letter-spacing: 0;
}

.invoice-ksef-title p {
  margin: 0;
  max-width: 760px;
  color: #52627a;
  font-size: 13px;
  line-height: 1.45;
}

.invoice-ksef-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.invoice-ksef-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: stretch;
}

.invoice-ksef-marker {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid #d7e2f0;
  border-radius: 12px;
  background: rgba(255,255,255,.9);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.94);
}

.invoice-ksef-marker strong {
  display: block;
  margin-top: 5px;
  color: #0f172a;
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.invoice-ksef-qr {
  width: 152px;
  min-height: 166px;
  padding: 12px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  border: 1px solid #d7e2f0;
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 12px 26px rgba(30, 58, 138, .08), inset 0 1px 0 rgba(255,255,255,.9);
}

.invoice-ksef-qr img {
  width: 112px;
  height: 112px;
  display: block;
}

.invoice-ksef-qr span {
  max-width: 128px;
  color: #25344b;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

.invoice-ksef-qr-placeholder {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border: 1px dashed #bccce0;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 900;
  letter-spacing: .12em;
}

.invoice-ksef-link {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid #cfe0f6;
  border-radius: 14px;
  background: rgba(255,255,255,.78);
}

.invoice-ksef-link strong,
.invoice-ksef-link span,
.invoice-ksef-link a,
.invoice-ksef-link em {
  display: block;
}

.invoice-ksef-link strong {
  margin-bottom: 4px;
  color: #0f172a;
  font-size: 14px;
}

.invoice-ksef-link span {
  color: #52627a;
  font-size: 12.5px;
  line-height: 1.4;
}

.invoice-ksef-link a {
  margin-top: 8px;
  color: #2455e6;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.invoice-ksef-link em {
  margin-top: 7px;
  color: #25344b;
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.invoice-ksef-note {
  margin-top: 12px;
}

.invoice-payment {
  display: grid;
  gap: 9px;
}

.invoice-payment p {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  margin: 0;
}

.invoice-payment span:first-child,
.invoice-total span,
.invoice-rate-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.invoice-table table {
  table-layout: fixed;
}

.invoice-col-description { width: 49%; }
.invoice-col-qty { width: 8%; }
.invoice-col-price { width: 13%; }
.invoice-col-rate { width: 10%; }
.invoice-col-vat { width: 8%; }
.invoice-col-value { width: 12%; }

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

.invoice-table th:last-child,
.invoice-number-cell {
  text-align: right;
}

.invoice-center-cell {
  text-align: center;
}

.invoice-item-description {
  white-space: normal;
  line-height: 1.45;
}

.invoice-item-description strong {
  display: block;
  font-size: 14px;
}

.invoice-summary {
  grid-template-columns: minmax(0, 1fr) 330px;
  align-items: stretch;
  margin-top: 24px;
}

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

.invoice-rate-summary div,
.invoice-total,
.invoice-notes {
  padding: 18px;
  border: 1px solid #d5e0ee;
  border-radius: 16px;
  background: rgba(251,253,255,0.96);
}

.invoice-rate-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.invoice-total {
  display: grid;
  align-content: center;
  justify-items: end;
  background:
    linear-gradient(135deg, #172033, #243553);
  color: #fff;
  border-color: #172033;
  box-shadow: 0 18px 42px rgba(23, 32, 51, 0.18);
}

.invoice-total span {
  color: #c9d5e6;
}

.invoice-total strong {
  margin-top: 6px;
  font-size: 30px;
}

.invoice-notes {
  margin-top: 18px;
}

.invoice-notes p {
  margin-bottom: 0;
  color: #43536a;
}

.invoice-print-page {
  min-height: 100vh;
  padding: 28px;
  background: #eef3f8;
}

.invoice-print-shell {
  width: min(1040px, 100%);
  margin: 0 auto;
}

.invoice-print-actions {
  justify-content: flex-end;
  margin-bottom: 16px;
}

.footer-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.print-footer {
  display: none;
}

@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.cols-4, .grid.cols-3, .grid.cols-2, .form-grid, .invoice-filter-grid, .tax-profile-grid { grid-template-columns: 1fr; }
  .settings-grid, .step-strip { grid-template-columns: 1fr; }
  .report-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-header, .invoice-parties, .invoice-summary, .invoice-rate-summary, .invoice-ksef-grid, .invoice-ksef-body, .invoice-ksef-premium { grid-template-columns: 1fr; }
  .invoice-ksef-qr { width: 100%; }
  .ksef-received-summary, .ksef-result-grid, .ksef-number-strip, .ksef-parties, .ksef-document-amounts, .inline-decision-form { grid-template-columns: 1fr; }
  .invoice-brand { justify-items: start; }
  .content { padding: 22px 16px 34px; }
}

@media (max-width: 760px) {
  .login-choice { grid-template-columns: 1fr; }
  .login-card { padding: 24px; }
}

@media print {
  @page {
    size: A4;
    margin: 9mm 9mm 17mm;
  }

  * {
    box-shadow: none !important;
  }

  html {
    font-size: 10px;
  }

  body {
    background: #fff !important;
    color: #111827;
    font-size: 10px;
    line-height: 1.25;
  }

  .shell {
    display: block;
    min-height: 0;
  }

  .sidebar,
  .print-hide,
  .report-tabs-card,
  main.content > .topbar .actions {
    display: none !important;
  }

  .content {
    padding: 0 !important;
  }

  main.content > .topbar {
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid #d9e2ee;
  }

  main.content > .topbar p {
    display: none;
  }

  h1 {
    font-size: 18px;
    margin-bottom: 0;
  }

  h2 {
    font-size: 13px;
    margin-bottom: 4px;
  }

  h3 {
    font-size: 11px;
    margin-bottom: 3px;
  }

  p {
    margin-bottom: 5px;
  }

  .grid {
    gap: 6px;
  }

  .grid.cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .grid.cols-2,
  .grid.cols-3 {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .card {
    border-color: #cfd8e6;
    border-radius: 6px;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .card-pad,
  .metric {
    padding: 6px;
  }

  .report-intro {
    margin-bottom: 6px;
  }

  .report-intro .topbar {
    display: block;
    margin-bottom: 0 !important;
  }

  .monthly-detail-list {
    gap: 6px;
  }

  .monthly-detail-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 6px;
  }

  .monthly-detail-summary div {
    padding: 4px 5px;
    border-radius: 6px;
  }

  .monthly-detail-summary span {
    font-size: 7px;
  }

  .monthly-detail-summary strong {
    font-size: 10px;
    margin-top: 1px;
  }

  .company-report-hero {
    margin-bottom: 6px;
  }

  .metric strong {
    font-size: 14px;
    line-height: 1.05;
  }

  .metric span,
  .pill {
    font-size: 8px;
  }

  .metric {
    gap: 2px;
  }

  .muted {
    color: #4b5563 !important;
    font-size: 8.5px;
  }

  .table-card {
    overflow: visible;
  }

  table {
    table-layout: fixed;
    font-size: 8.8px;
  }

  th,
  td {
    padding: 4px 5px;
    border-bottom: 1px solid #dce5f0;
    vertical-align: top;
    word-break: break-word;
  }

  th {
    font-size: 7.5px;
    letter-spacing: .02em;
  }

  .pill {
    min-height: 16px;
    padding: 0 6px;
    border-radius: 8px;
    line-height: 1.15;
  }

  .status-list {
    gap: 4px;
  }

  .status-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    padding: 5px 6px;
    border-radius: 6px;
  }

  .zus-timeline {
    margin: 4px 0 5px;
    padding: 3px 4px 0;
    gap: 3px;
  }

  .zus-timeline::before {
    top: 10px;
    height: 2px;
  }

  .zus-dot,
  .zus-timeline.compact .zus-dot {
    width: 12px;
    height: 12px;
    border-width: 2px;
  }

  .zus-stage.active .zus-dot,
  .zus-timeline.compact .zus-stage.active .zus-dot {
    width: 14px;
    height: 14px;
  }

  .zus-stage strong,
  .zus-timeline.compact .zus-stage strong {
    font-size: 7px;
  }

  .zus-stage small {
    display: none;
  }

  .alert-chip-row,
  .alert-chip-row.compact {
    gap: 3px;
    margin: 3px 0 5px;
  }

  .alert-chip {
    min-height: 15px;
    padding: 0 5px;
    font-size: 7.5px;
  }

  .notice {
    padding: 6px 7px;
    border-radius: 6px;
    font-size: 9px;
  }

  .action-note {
    padding: 6px 7px;
    border-radius: 6px;
    font-size: 9px;
  }

  .focus-target {
    border-color: #cfd8e6 !important;
    background: #fff !important;
    box-shadow: none !important;
  }

  .topbar {
    gap: 8px;
  }

  .invoice-print-page {
    padding: 0;
    background: #fff !important;
  }

  .invoice-print-shell {
    width: 100%;
  }

  .invoice-document {
    padding: 10mm 8mm 7mm;
    border: 0;
    border-radius: 0;
    box-shadow: none !important;
    background: #fff !important;
  }

  .invoice-accent {
    height: 3mm;
  }

  .invoice-watermark {
    right: 8mm;
    top: 12mm;
    font-size: 95px;
    color: rgba(49, 93, 244, 0.045);
  }

  .invoice-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8mm;
    margin-bottom: 6mm;
  }

  .invoice-header h2 {
    font-size: 22px;
  }

  .invoice-subtitle {
    font-size: 9px;
    margin-top: 2mm;
  }

  .invoice-date-strip {
    gap: 2mm;
    margin-top: 4mm;
  }

  .invoice-date-strip span {
    min-width: 28mm;
    padding: 2mm;
    border-radius: 5px;
  }

  .invoice-date-strip strong {
    font-size: 6.5px;
    margin-bottom: 1mm;
  }

  .invoice-brand span {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .invoice-parties {
    grid-template-columns: 1fr 1fr .8fr;
    gap: 5mm;
    margin-bottom: 6mm;
  }

  .invoice-ksef-marks {
    margin: -2mm 0 5mm;
    padding: 3mm;
    border-radius: 5px;
    box-shadow: none !important;
  }

  .invoice-ksef-marks::before {
    width: 1.2mm;
  }

  .invoice-ksef-premium {
    grid-template-columns: minmax(0, 1fr) 29mm;
    gap: 3mm;
  }

  .invoice-ksef-main {
    gap: 2mm;
  }

  .invoice-ksef-title h3 {
    font-size: 12px;
    margin: 1mm 0;
  }

  .invoice-ksef-title p {
    font-size: 8px;
    line-height: 1.25;
  }

  .invoice-ksef-eyebrow {
    font-size: 6.5px;
  }

  .invoice-ksef-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2mm;
  }

  .invoice-ksef-marker {
    padding: 2mm;
    border-radius: 5px;
  }

  .invoice-ksef-marker strong {
    font-size: 8px;
  }

  .invoice-ksef-qr {
    width: 29mm;
    min-height: 31mm;
    padding: 1.5mm;
    border-radius: 4px;
    box-shadow: none !important;
  }

  .invoice-ksef-qr img,
  .invoice-ksef-qr-placeholder {
    width: 23mm;
    height: 23mm;
  }

  .invoice-ksef-qr span {
    max-width: 26mm;
    font-size: 6px;
  }

  .invoice-ksef-link {
    padding: 2mm;
    border-radius: 5px;
  }

  .invoice-ksef-link strong {
    font-size: 8px;
    margin-bottom: 1mm;
  }

  .invoice-ksef-link span,
  .invoice-ksef-link a,
  .invoice-ksef-link em {
    font-size: 6.8px;
    line-height: 1.25;
    margin-top: 1mm;
  }

  .invoice-parties > div {
    min-height: 0;
    padding: 4mm;
    border-radius: 5px;
    box-shadow: none !important;
  }

  .invoice-parties h3 {
    font-size: 12px;
    margin-bottom: 3mm;
  }

  .invoice-parties p,
  .invoice-notes p {
    font-size: 9px;
  }

  .invoice-kicker,
  .invoice-label,
  .invoice-payment span:first-child,
  .invoice-total span,
  .invoice-rate-summary span {
    font-size: 7px;
  }

  .invoice-summary {
    grid-template-columns: minmax(0, 1fr) 55mm;
    gap: 5mm;
    margin-top: 5mm;
  }

  .invoice-rate-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3mm;
  }

  .invoice-rate-summary div,
  .invoice-total,
  .invoice-notes {
    padding: 3mm;
    border-radius: 5px;
  }

  .invoice-rate-summary strong {
    font-size: 11px;
  }

  .invoice-total strong {
    font-size: 18px;
  }

  .invoice-item-description strong {
    font-size: 9.5px;
  }

  .invoice-table table {
    table-layout: fixed;
  }

  .invoice-col-description { width: 51%; }
  .invoice-col-qty { width: 7%; }
  .invoice-col-price { width: 13%; }
  .invoice-col-rate { width: 9%; }
  .invoice-col-vat { width: 7%; }
  .invoice-col-value { width: 13%; }

  .print-footer {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-top: 7px;
    padding-top: 4px;
    border-top: 1px solid #cfd8e6;
    color: #475569;
    font-size: 8px;
    line-height: 1.2;
    background: #fff;
    break-inside: avoid;
  }

  a,
  tr.clickable,
  .status-row.clickable {
    cursor: default;
  }
}
