:root {
  --indigo: #4f46e5;
  --indigo-soft: #e0e7ff;
  --indigo-text: #3730a3;
  --indigo-active: rgba(79, 70, 229, 0.25);
  --navy: #0f172a;
  --navy-line: rgba(255, 255, 255, 0.08);
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --green: #10b981;
  --green-bg: #d1fae5;
  --red: #ef4444;
  --red-bg: #fee2e2;
  --yellow: #f59e0b;
  --yellow-bg: #fef3c7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
  --sidebar-width: 220px;
  --sidebar-collapsed: 64px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--slate-50);
  color: var(--slate-700);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: var(--indigo);
  text-decoration: none;
}

a:hover {
  color: var(--indigo-text);
}

svg {
  display: block;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: var(--slate-50);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--navy);
  color: rgba(255, 255, 255, 0.72);
}

.sidebar-brand {
  min-height: 72px;
  display: flex;
  align-items: center;
  padding: 20px;
  border-bottom: 0.5px solid var(--navy-line);
}

.sidebar-brand img {
  width: 132px;
  height: 32px;
}

.sidebar-nav {
  display: grid;
  gap: 4px;
  padding: 16px 12px;
}

.sidebar-link {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.52);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.84);
}

.sidebar-link.active {
  background: var(--indigo-active);
  color: #a5b4fc;
}

.sidebar-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.sidebar-icon svg,
.mobile-menu-button svg,
.icon-button svg,
.delete-modal-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-label,
.user-email {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 14px 12px 16px;
  border-top: 0.5px solid var(--navy-line);
}

.user-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 8px;
}

.avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--indigo);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
}

.user-email {
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.logout-form {
  margin: 0;
}

.logout-link {
  width: 100%;
  color: rgba(255, 255, 255, 0.42);
}

.language-form {
  display: grid;
  gap: 6px;
}

.language-form label {
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 500;
}

.sidebar .language-form {
  padding: 0 8px;
}

.sidebar .language-form label {
  color: rgba(255, 255, 255, 0.38);
}

.sidebar .language-form select {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.78);
}

.sidebar .language-form select option {
  background: var(--white);
  color: var(--slate-900);
}

.app-main {
  min-width: 0;
  min-height: 100vh;
}

.page {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px;
}

.mobile-menu-button {
  display: none;
}

.mobile-overlay {
  display: none;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 56px;
  margin-bottom: 18px;
}

h1,
h2 {
  margin: 0;
  color: var(--slate-900);
  line-height: 1.2;
}

h1 {
  font-size: 20px;
  font-weight: 600;
}

h2 {
  font-size: 16px;
  font-weight: 500;
}

.page-head p,
.panel p {
  margin: 5px 0 0;
  color: var(--slate-500);
}

.panel {
  margin-bottom: 16px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.panel:not(.form-grid):not(.form-stack):not(.totals-panel) {
  padding: 16px;
}

.panel-head,
.head-actions,
.form-actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-head {
  justify-content: space-between;
  margin: -2px -2px 12px;
  padding-bottom: 12px;
  border-bottom: 0.5px solid var(--slate-200);
}

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

.metrics div,
.totals-panel div {
  position: relative;
  padding: 16px;
  border: 0.5px solid var(--slate-200);
  border-radius: 10px;
  background: var(--slate-50);
}

.metric-icon {
  width: 28px;
  height: 28px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  float: right;
  border-radius: 8px;
  background: var(--indigo-soft);
  color: var(--indigo);
}

.metric-icon svg,
.button-icon svg,
.search-field svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metrics span:not(.metric-icon) {
  display: block;
  color: var(--slate-900);
  font-size: 22px;
  font-weight: 600;
}

.metrics small,
.totals-panel span {
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 400;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.8fr);
  gap: 16px;
}

button,
.primary,
.secondary,
.danger {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 13px;
  border: 0.5px solid var(--slate-300);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--slate-900);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.primary {
  border-color: var(--indigo);
  background: var(--indigo);
  color: #ffffff;
}

.primary:hover {
  background: #4338ca;
  color: #ffffff;
}

.secondary {
  background: transparent;
  color: var(--slate-700);
}

.secondary:hover {
  border-color: var(--slate-400);
  color: var(--slate-900);
}

.button-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.danger {
  border-color: var(--red);
  background: var(--red);
  color: #ffffff;
}

.danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.link-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--indigo);
}

.icon-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--slate-500);
}

.icon-button:hover {
  background: var(--slate-100);
  color: var(--slate-900);
}

.icon-button.danger-icon:hover {
  background: var(--red-bg);
  color: var(--red);
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.inline-form {
  display: inline;
  margin: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0.5px solid var(--slate-300);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--slate-700);
  font: inherit;
  font-size: 14px;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  accent-color: var(--indigo);
}

.form-stack p:has(input[type="checkbox"]),
.form-grid p:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-stack p:has(input[type="checkbox"]) label,
.form-grid p:has(input[type="checkbox"]) label {
  margin: 0;
}

textarea {
  resize: vertical;
}

.textarea-compact {
  min-height: 36px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--slate-400);
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-grid,
.form-stack {
  padding: 18px;
}

.form-stack p,
.form-grid p {
  margin: 0 0 14px;
}

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

.form-grid > p,
.form-stack > p,
.form-section-grid > p {
  display: flex;
  flex-direction: column;
}

.form-grid > p > input,
.form-grid > p > select,
.form-grid > p > textarea,
.form-stack > p > input,
.form-stack > p > select,
.form-stack > p > textarea,
.form-section-grid > p > input,
.form-section-grid > p > select,
.form-section-grid > p > textarea {
  flex: 1 1 auto;
}

.form-grid h2,
.form-grid .form-section,
.form-grid .form-actions,
.form-grid .errorlist {
  grid-column: 1 / -1;
}

.form-section {
  padding-bottom: 18px;
  border-bottom: 0.5px solid var(--slate-100);
}

.form-section:last-of-type {
  padding-bottom: 0;
  border-bottom: 0;
}

.form-section h2 {
  margin: 0 0 14px;
  color: var(--slate-900);
  font-size: 15px;
  font-weight: 600;
}

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

.form-section-grid p {
  margin: 0;
}

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

.field-with-reference {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.field-with-reference .field-main,
.field-with-reference .field-reference {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.field-with-reference .field-main > textarea,
.field-with-reference .field-reference > select {
  flex: 1 1 auto;
}

.irpf-control {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.irpf-control > select {
  flex: 1 1 auto;
}

.irpf-custom-wrap {
  flex: 0 0 140px;
  display: flex;
}

.irpf-custom-wrap input {
  height: 100%;
}

.form-grid label,
.form-stack label {
  display: block;
  margin-bottom: 6px;
  color: var(--slate-700);
  font-size: 13px;
  font-weight: 500;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-field input {
  width: auto;
  min-height: 0;
  flex: 0 0 auto;
}

.checkbox-field label {
  margin: 0;
}

.required-field label::after {
  content: " *";
  color: var(--red);
}

.required-field input,
.required-field select,
.required-field textarea {
  border-left-color: var(--red);
  border-left-width: 3px;
}

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

.toolbar {
  margin-bottom: 16px;
  padding: 12px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius);
  background: var(--white);
}

.search-field {
  position: relative;
  min-width: min(100%, 280px);
  margin: 0;
}

.search-field span {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 16px;
  height: 16px;
  color: var(--slate-400);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-field input {
  padding-left: 34px;
}

.toolbar input,
.toolbar select {
  max-width: 280px;
}

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

.data-table th,
.data-table td {
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--slate-100);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--slate-500);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.data-table td {
  color: var(--slate-700);
  font-size: 14px;
}

.data-table tbody tr {
  transition: background 150ms ease;
}

.data-table tbody tr:hover {
  background: var(--slate-50);
}

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

.asset-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--slate-100);
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 500;
}

.asset-status.active {
  background: var(--green-bg);
  color: #065f46;
}

.data-table .actions {
  width: 1%;
  min-width: 104px;
  padding-top: 6px;
  padding-right: 14px;
  padding-bottom: 6px;
  padding-left: 8px;
  text-align: right;
  white-space: nowrap;
  vertical-align: middle;
  opacity: 0;
  transition: opacity 150ms ease;
}

.data-table .actions-col {
  width: 104px;
  min-width: 104px;
}

.data-table tr:hover .actions,
.data-table tr:focus-within .actions {
  opacity: 1;
}

.invoice-table .actions,
.client-table .actions,
.asset-table .actions {
  opacity: 1;
}

.data-table .actions form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.row-actions {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
  vertical-align: middle;
  white-space: nowrap;
}

.row-actions a,
.row-actions button,
.row-actions form {
  flex: 0 0 auto;
}

.invoice-table .actions {
  min-width: 104px;
}

.client-table .actions {
  min-width: 48px;
}

.num {
  text-align: right !important;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--slate-100);
  color: var(--slate-600);
  font-size: 11px;
  font-weight: 500;
}

.status-draft {
  background: #f1f5f9;
  color: #475569;
}

.status-issued,
.status-sent {
  background: #eff6ff;
  color: #1d4ed8;
}

.status-paid {
  background: var(--green-bg);
  color: #065f46;
}

.status-overdue {
  background: var(--yellow-bg);
  color: #92400e;
}

.status-cancelled,
.status-rectified {
  background: var(--red-bg);
  color: #991b1b;
}

tr.overdue-row {
  background: rgba(245, 158, 11, 0.08);
}

.messages {
  margin-bottom: 16px;
}

.message {
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius);
  background: #ffffff;
}

.message.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.message.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.message.info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.table-scroll {
  overflow-x: auto;
}

.item-table {
  min-width: 900px;
}

.item-table textarea {
  min-width: 280px;
}

.item-table input {
  min-width: 88px;
}

.table-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 12px;
}

.totals-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.totals-panel strong {
  display: block;
  margin-top: 4px;
  color: var(--slate-900);
  font-size: 16px;
  font-weight: 600;
}

.facts {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 12px;
}

.facts dt {
  color: var(--slate-500);
  font-weight: 500;
}

.facts dd {
  margin: 0;
}

.hash {
  overflow-wrap: anywhere;
  font-family: Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.asset-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.asset-cell img {
  width: 56px;
  height: 36px;
  object-fit: contain;
  border: 0.5px solid var(--slate-200);
  border-radius: 6px;
  background: #fff;
}

.errorlist {
  margin: 4px 0;
  padding-left: 18px;
  color: #b91c1c;
}

.profile-progress {
  padding: 16px;
}

.profile-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: var(--slate-500);
  font-size: 12px;
}

.profile-progress-head strong {
  color: var(--slate-900);
  font-size: 13px;
  font-weight: 600;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--slate-100);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--indigo);
}

.toggle-switch {
  width: 38px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.toggle-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-switch span {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--slate-300);
  transition: background 150ms ease;
}

.toggle-switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
  transition: transform 150ms ease;
}

.toggle-switch input:checked + span {
  background: var(--indigo);
}

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

.asset-toggle {
  vertical-align: middle;
}

.toggle-switch-row {
  min-height: 36px;
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  margin: 0 !important;
  color: var(--slate-700);
  font-size: 13px;
  font-weight: 500;
}

.toggle-switch-row > span:first-child {
  white-space: nowrap;
}

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

.numbering-form .numbering-default-field {
  align-self: end;
  min-height: 36px;
  display: flex !important;
  align-items: center;
  margin-bottom: 14px;
}

.numbering-form .numbering-default-field .toggle-switch {
  flex: 0 0 auto;
}

.numbering-form .form-actions {
  align-self: end;
  min-height: 36px;
  margin-bottom: 14px;
}

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.1fr);
  background: #ffffff;
}

.auth-brand-panel {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
  padding: 56px;
  background: var(--indigo);
  color: #ffffff;
}

.auth-brand-panel img {
  width: 160px;
  height: auto;
}

.auth-brand-panel h1 {
  max-width: 520px;
  color: #ffffff;
  font-size: 30px;
  font-weight: 600;
}

.auth-brand-panel p {
  max-width: 520px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 15px;
}

.auth-benefits {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-benefits li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.86);
}

.benefit-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 12px;
  font-weight: 600;
}

.auth-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.auth-language {
  position: absolute;
  top: 22px;
  right: 24px;
  width: 140px;
}

.auth-shell {
  width: 100%;
  max-width: 380px;
}

.auth-shell h1 {
  margin-bottom: 18px;
}

.auth-shell .panel {
  padding: 22px;
  box-shadow: var(--shadow);
}

.auth-shell .primary {
  width: 100%;
}

.invoice-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
}

.invoice-preview,
.invoice-inspector {
  border: 0.5px solid var(--slate-200);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.invoice-preview {
  min-height: calc(100vh - 56px);
  padding: 28px;
}

.invoice-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 26px;
  border-bottom: 0.5px solid var(--slate-200);
}

.seller-lockup h1 {
  max-width: 620px;
  font-size: 22px;
  font-weight: 600;
}

.seller-lockup p {
  margin: 4px 0 0;
  color: var(--slate-500);
}

.document-number {
  min-width: 180px;
  text-align: right;
}

.document-number span {
  display: block;
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 500;
}

.document-number strong {
  display: block;
  margin-top: 5px;
  color: var(--slate-900);
  font-size: 18px;
}

.invoice-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  margin: 28px 0;
}

.invoice-summary h2,
.invoice-lines-preview th {
  color: var(--slate-500);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.invoice-summary p {
  margin: 3px 0;
  color: var(--slate-500);
}

.summary-name {
  color: var(--slate-700) !important;
  font-size: 21px;
  font-weight: 600 !important;
}

.summary-total {
  min-width: 230px;
  text-align: right;
}

.summary-total strong {
  display: block;
  margin-top: 6px;
  color: var(--slate-900);
  font-size: 32px;
  font-weight: 600;
}

.invoice-lines-preview {
  border-top: 0.5px solid var(--slate-200);
  border-bottom: 0.5px solid var(--slate-200);
}

.invoice-lines-preview table {
  width: 100%;
  border-collapse: collapse;
}

.invoice-lines-preview th,
.invoice-lines-preview td {
  padding: 16px 2px;
  border-bottom: 0.5px solid var(--slate-100);
}

.invoice-lines-preview tbody tr:last-child td {
  border-bottom: 0;
}

.invoice-lines-preview td span {
  display: block;
  margin-top: 4px;
  color: var(--slate-500);
  font-size: 12px;
}

.invoice-preview-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 28px;
  align-items: end;
  padding-top: 28px;
}

.preview-totals {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 18px;
  margin: 0;
}

.preview-totals dt {
  color: var(--slate-500);
  font-weight: 500;
  text-transform: uppercase;
}

.preview-totals dd {
  margin: 0;
  text-align: right;
  color: var(--slate-700);
  font-weight: 500;
}

.preview-totals dt:last-of-type,
.preview-totals dd:last-of-type {
  padding-top: 10px;
  border-top: 0.5px solid var(--slate-200);
  color: var(--slate-900);
  font-size: 18px;
  font-weight: 600;
}

.invoice-inspector {
  position: sticky;
  top: 24px;
  padding: 20px;
}

.inspector-section h2 {
  margin-bottom: 14px;
}

.inspector-facts {
  display: grid;
  grid-template-columns: minmax(120px, 0.75fr) minmax(0, 1fr);
  gap: 12px 16px;
  margin: 0 0 20px;
  padding-bottom: 20px;
  border-bottom: 0.5px solid var(--slate-200);
}

.inspector-facts dt {
  color: var(--slate-500);
  font-size: 13px;
  font-weight: 500;
}

.inspector-facts dd {
  min-width: 0;
  margin: 0;
  color: var(--slate-900);
  text-align: right;
  font-weight: 500;
}

.inspector-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

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

.delete-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.delete-modal.open {
  display: flex;
}

.delete-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.delete-modal-card {
  position: relative;
  width: min(100%, 420px);
  padding: 24px;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.delete-modal-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border-radius: 999px;
  background: var(--red-bg);
  color: var(--red);
}

.delete-modal-icon svg {
  width: 24px;
  height: 24px;
}

.delete-modal-card h2 {
  font-size: 16px;
  font-weight: 600;
}

.delete-modal-card p {
  margin: 8px 0 0;
  color: var(--slate-500);
}

.delete-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

@media (max-width: 1180px) {
  .invoice-workspace {
    grid-template-columns: 1fr;
  }

  .invoice-inspector {
    position: static;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .app-shell {
    grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr);
  }

  .sidebar-brand {
    padding: 18px 16px;
  }

  .sidebar-brand img {
    width: 32px;
    max-width: 32px;
    object-fit: cover;
    object-position: left center;
  }

  .sidebar-label,
  .user-email,
  .sidebar .language-form label,
  .sidebar .language-form select {
    display: none;
  }

  .sidebar-link {
    justify-content: center;
    padding: 8px;
  }

  .user-strip {
    justify-content: center;
    padding: 0;
  }
}

@media (max-width: 820px) {
  .metrics,
  .split,
  .form-grid,
  .form-section-grid,
  .field-with-reference,
  .compact,
  .totals-panel,
  .invoice-preview-foot,
  .invoice-summary {
    grid-template-columns: 1fr;
  }

  .toolbar input,
  .toolbar select {
    max-width: none;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

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

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 60;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    background: rgba(15, 23, 42, 0.45);
  }

  .app-shell.sidebar-open .mobile-overlay {
    display: block;
  }

  .mobile-menu-button {
    position: sticky;
    top: 0;
    z-index: 30;
    width: 100%;
    height: 50px;
    display: flex;
    justify-content: flex-start;
    padding: 0 16px;
    border: 0;
    border-bottom: 0.5px solid var(--slate-200);
    border-radius: 0;
    background: #ffffff;
    color: var(--slate-700);
  }

  .mobile-menu-button svg {
    width: 22px;
    height: 22px;
  }

  .page {
    padding: 16px;
  }

  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-brand-panel {
    min-height: auto;
    padding: 32px 24px;
  }

  .auth-content {
    padding: 64px 16px 24px;
  }

  .auth-language {
    top: 14px;
    right: 16px;
  }

  .invoice-preview {
    min-height: 0;
    padding: 18px;
  }

  .invoice-preview-head {
    flex-direction: column;
  }

  .document-number,
  .summary-total,
  .inspector-facts dd {
    min-width: 0;
    text-align: left;
  }

  .invoice-lines-preview {
    overflow-x: auto;
  }

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

  .inspector-facts {
    grid-template-columns: 1fr;
  }
}
