:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: rgba(148, 163, 184, .22);
  --text: #1e293b;
  --muted: #64748b;
  --primary: #4f8cff;
  --primary-2: #2f6df6;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --shadow: 0 8px 22px rgba(15, 23, 42, .06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, Segoe UI, Arial, sans-serif;
  background: linear-gradient(180deg, #ffffff, #f8fafc 50%, #eef2f7);
  color: var(--text);
  font-size: 14px;
}

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

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

h1,
h2,
h3 {
  margin: 0 0 8px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
}

p {
  margin: 0 0 10px;
}

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

.sidebar {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--line);
  padding: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  z-index: 30;
}

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

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

.sidebar-app-logo {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
  object-position: left center;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  font-weight: 800;
  color: #ffffff;
  font-size: 13px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu a,
.menu-root {
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--muted);
  transition: .15s ease;
  background: transparent;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.menu a:hover,
.menu a.active,
.menu-root:hover,
.menu-root.is-open {
  background: rgba(79, 140, 255, .12);
  color: #0f172a;
}

.menu .disabled-link {
  opacity: .45;
  pointer-events: none;
}

.menu-root {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: #334155;
  margin-top: 6px;
}

.menu-caret {
  font-size: 12px;
  transition: transform .18s ease;
}

.menu-root.is-open .menu-caret {
  transform: rotate(180deg);
}

.menu-submenu {
  display: none;
  padding-left: 8px;
  gap: 4px;
  flex-direction: column;
}

.menu-submenu.is-open {
  display: flex;
}

.menu a.menu-dashboard {
  font-weight: 600;
  font-size: 16px;
  color: #0f172a;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
}

.topbar h1 {
  margin: 0 0 4px;
  font-size: 24px;
  line-height: 1.15;
}

.topbar-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  min-width: 0;
}

.topbar-org {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.topbar-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar-org-name {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(79, 140, 255, .12), rgba(47, 109, 246, .06));
  border: 1px solid var(--line);
  border-radius: 16px;
  max-width: 100%;
}

.topbar-org-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(114, 177, 248, 0.3), rgba(47, 156, 246, 0.5));
  border: 1px solid var(--line);
  border-radius: 16px;
  max-width: 100%;
}

.topbar-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-weight: 800;
  letter-spacing: .04em;
  box-shadow: 0 8px 18px rgba(47, 109, 246, .18);
}

.topbar-user-meta {
  min-width: 0;
}

.topbar-user-name {
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-user-email {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.trial-chip {
  border: 1px solid rgba(185, 28, 28, .35);
  background: linear-gradient(180deg, #fff5f5, #fee2e2);
  color: #991b1b;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
  box-shadow: 0 8px 18px rgba(185, 28, 28, .16);
  cursor: pointer;
  white-space: nowrap;
}

.trial-chip:hover {
  background: #fecaca;
  border-color: rgba(185, 28, 28, .55);
}

.trial-info-summary {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.trial-info-summary h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--text);
}

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

.trial-limit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 10px;
  background: #f8fafc;
}

.trial-limit-item span {
  color: var(--muted);
  font-size: 13px;
}

.trial-limit-item strong {
  min-width: 62px;
  text-align: center;
  color: #991b1b;
  font-size: 18px;
  white-space: nowrap;
}

.trial-limit-item strong em {
  color: #15803d;
  font-style: normal;
}

.trial-feature-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.trial-feature-list > div {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(248, 250, 252, .82);
}

@media (max-width: 640px) {
  .trial-feature-list {
    grid-template-columns: 1fr;
  }
}

.sidebar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.main-content {
  padding: 20px;
}

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

.page-heading h1 {
  margin: 0 0 4px;
  font-size: 24px;
  line-height: 1.15;
}

.small {
  font-size: 11px;
}

.muted {
  color: var(--muted);
}

.card,
.guest-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(248, 250, 252, .98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card-subtle {
  background: rgba(15, 23, 42, .02);
}

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

.guest-card {
  width: min(520px, 100%);
}

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

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

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

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

.span-2 {
  grid-column: span 2;
}

.stack {
  display: flex;
  flex-direction: column;
}

.gap-sm {
  gap: 6px;
}

.gap-md {
  gap: 10px;
}

.gap-lg {
  gap: 16px;
}

.mt-md {
  margin-top: 10px;
  font-size: 11px;
}

.mt-lg {
  margin-top: 16px;
}

.mb-md {
  margin-bottom: 10px;
}

.input,
textarea,
select {
  width: 100%;
  padding: 6px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  outline: none;
  font: inherit;
}

.input:focus,
textarea:focus,
select:focus {
  border-color: rgba(79, 140, 255, .55);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, .14);
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #334155;
  font-size: 13px;
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap .input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  line-height: 1.1;
}

.btn.predlohy {
  background-color: #0e642ec4;
  color: #ffffff;
  border: none;
  font-weight: 400;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #ffffff;
  border: none;
  font-weight: 400;
}

.btn.import {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border-color: rgba(22, 163, 74, .28);
  color: #166534;
  font-weight: 400;
  border: 1px solid var(--line);
}

.btn.export {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border-color: rgba(220, 38, 38, .28);
  color: #991b1b;
  font-weight: 400;
  border: 1px solid var(--line);
}

.btn.generovat {
  background-color: #521a1ace;
  color: #ffffff;
  border: none;
  font-weight: 400;
}

.btn.mazat {
  min-width: 112px;
  padding: 8px 14px;
  border: 1px solid rgba(185, 28, 28, .28);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff1f2, #ffe4e6);
  color: #991b1b;
  font-weight: 600;
  letter-spacing: .01em;
  transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease, opacity .18s ease;
}

.btn.mazat:hover:not(:disabled) {
  background: linear-gradient(180deg, #fee2e2, #fecdd3);
  border-color: rgba(185, 28, 28, .42);
  color: #7f1d1d;
}

.btn.mazat:focus-visible {
  outline: none;
}

.btn.mazat:active:not(:disabled) {
  transform: translateY(1px);
}

.btn.mazat:disabled,
.btn.mazat[disabled] {
  background: linear-gradient(180deg, #f8fafc, #eef2f7);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, .32);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
  transform: none;
}


.btn.icon-btn {
  width: 26px;
  height: 26px;
  padding: 0;
}

.btn-danger {
  background: rgba(239, 68, 68, .1);
  border-color: rgba(239, 68, 68, .28);
  color: #b91c1c;
  font-weight: 700;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, .16);
}

.btn.icon-danger {
  color: var(--danger);
  border-color: rgba(239, 68, 68, .25);
  background: #fff;
}

.btn.icon-danger:hover {
  background: rgba(239, 68, 68, .08);
}

.asset-contract-card {
  border: 1px solid rgba(148, 163, 184, .35);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 0;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.asset-contract-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 10px;
  align-items: end;
}

.asset-contract-file-row {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 10px;
  align-items: end;
}

.asset-contract-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.contract-source-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contract-source-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  min-height: 18px;
}

.field-label {
  display: block;
  color: #334155;
  font-size: 13px;
  font-weight: 400;
}

.contract-source-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.contract-source-toggle .toggle-row {
  font-weight: 400;
}

.contract-new-note {
  color: #dc2626;
}

.contract-link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.contract-file-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(37, 99, 235, .22);
  border-radius: 10px;
  background: rgba(37, 99, 235, .06);
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 700;
}

.contract-file-preview[hidden] {
  display: none;
}

.contract-file-preview span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract-edit-panel {
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 12px;
  background: rgba(248, 250, 252, .82);
}

.toggle-row {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.toggle-row.compact {
  margin: 0;
}

.toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary-2);
}

.toggle-row input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-2);
}

.contract-frequency-control {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 14px;
  align-items: end;
}

.contract-frequency-units {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 7px;
}

.btn.icon-copy {
  color: #2563eb;
  border-color: rgba(37, 99, 235, .22);
  background: #fff;
}

.btn.icon-copy:hover {
  background: rgba(37, 99, 235, .08);
}

.button-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.button-row.wrap {
  flex-wrap: wrap;
}

.button-row.between {
  justify-content: space-between;
}

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

.flash {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 12px;
  font-size: 13px;
}

.flash.success {
  background: rgba(34, 197, 94, .10);
  border-color: rgba(34, 197, 94, .28);
}

.flash.error {
  background: rgba(239, 68, 68, .10);
  border-color: rgba(239, 68, 68, .28);
}

.flash.info {
  background: rgba(79, 140, 255, .10);
  border-color: rgba(79, 140, 255, .28);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.table th {
  padding: 0 8px 6px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  text-align: left;
}

.table td {
  padding: 10px 8px;
  background: rgba(255, 255, 255, .98);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 13px;
}

.table tr td:first-child {
  border-left: 1px solid var(--line);
  border-radius: 12px 0 0 12px;
}

.table tr td:last-child {
  border-right: 1px solid var(--line);
  border-radius: 0 12px 12px 0;
}

.table thead .table-filter-row th {
  padding: 0 0 8px;
  text-transform: none;
  letter-spacing: normal;
}

.table-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: end;
  padding: 8px 10px;
  background: rgba(248, 250, 252, .95);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.table-toolbar .input,
.table-toolbar select {
  min-width: 160px;
}

.filter-bar,
.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: end;
}

.inline-form .input {
  min-width: 180px;
}

.selection-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.selection-item {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .92);
}

.selection-item.active {
  background: rgba(79, 140, 255, .14);
  
  border: 2px dotted rgba(37, 38, 41, 0.767);
}

.static-item {
  opacity: .85;
}

.stat-card {
  text-align: center;
}

.stat-number {
  font-size: 28px;
  font-weight: 800;
}

.badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
}

.badge.success {
  background: rgba(34, 197, 94, .12);
}

.badge.warning {
  background: rgba(245, 158, 11, .14);
}

.badge.danger {
  background: rgba(239, 68, 68, .12);
}

.badge.info {
  background: rgba(79, 140, 255, .12);
}

.badge.muted {
  background: rgba(148, 163, 184, .12);
}

.checkbox-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.checkbox-row label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.chip-picker-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  background: #ffffff;
}

.chip-picker-wrap input {
  width: 100%;
  margin-bottom: 8px;
}

.chip-results,
.chip-selected {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(79, 140, 255, .12);
  border: 1px solid rgba(79, 140, 255, .25);
  font-size: 12px;
}

.chip button {
  all: unset;
  cursor: pointer;
  font-weight: 700;
}

.chip-result {
  padding: 7px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  cursor: pointer;
  background: rgba(255, 255, 255, .96);
  font-size: 12px;
}

.chip-result:hover {
  background: rgba(79, 140, 255, .10);
}

.chip-result-disabled,
.chip-result-disabled:hover,
.chip-result:disabled {
  cursor: not-allowed;
  opacity: .55;
  background: #f8fafc;
  border-style: dashed;
}

.analysis-grid-row {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr .65fr .65fr .9fr .9fr 1.3fr auto auto;
  gap: 8px;
  align-items: start;
}

.analysis-inline-form {
  width: 100%;
}

.autosave-state {
  font-size: 11px;
  white-space: nowrap;
  align-self: center;
}

.formula-block {
  background: #f8fafc;
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 12px;
  white-space: pre-wrap;
  font-size: 13px;
}

.clean-list {
  margin: 0;
  padding-left: 18px;
}

@media (max-width: 1200px) {
  .cols-4,
  .cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analysis-grid-row {
    grid-template-columns: 1fr 1fr 1fr 1fr;
  }
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

  .main {
    height: auto;
    overflow: visible;
  }

  .main-content {
    padding: 16px;
  }

  .cols-2,
  .cols-3,
  .cols-4 {
    grid-template-columns: 1fr;
  }

  .asset-contract-row,
  .asset-contract-file-row,
  .contract-frequency-control {
    grid-template-columns: 1fr;
  }

  .contract-frequency-units {
    padding-bottom: 0;
  }

  .span-2 {
    grid-column: auto;
  }

  .topbar,
  .page-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    padding: 14px 16px;
  }

  .topbar-identity {
    align-items: stretch;
  }

  .topbar-org-name,
  .topbar-user-name,
  .topbar-user-email {
    white-space: normal;
  }

  .analysis-grid-row {
    grid-template-columns: 1fr 1fr;
  }

  .table {
    display: block;
    overflow: auto;
  }
}

.force-password-banner {
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(239, 68, 68, .28);
  background: rgba(254, 226, 226, .75);
  color: #991b1b;
  font-weight: 700;
}

.context-banner {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(37, 99, 235, .18);
  background: linear-gradient(135deg, rgba(219, 234, 254, .95), rgba(239, 246, 255, .98));
}

.field-error {
  min-height: 18px;
  margin-top: 6px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
}

.input-invalid {
  border-color: rgba(239, 68, 68, .7) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .12);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(148, 163, 184, .14);
  color: #334155;
}

.status-pill.success { background: rgba(34, 197, 94, .14); color: #166534; }
.status-pill.warning { background: rgba(245, 158, 11, .18); color: #92400e; }
.status-pill.info { background: rgba(59, 130, 246, .14); color: #1d4ed8; }
.status-pill.muted { background: rgba(148, 163, 184, .14); color: #475569; }

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

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

.stat-card {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.98));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 10px;
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
}

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

.mail-preview-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #ffffff;
}

.mail-preview-meta {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, .95);
}

.mail-preview-body {
  padding: 0;
  max-height: 360px;
  overflow: auto;
  background: #ffffff;
}

.mail-preview-body > * {
  margin: 0;
}

.card-head-between {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.section-divider {
  height: 1px;
  background: var(--line);
  margin: 2px 0 0;
}

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

.info-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(248, 250, 252, .9);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.icon-btn.success {
  color: #166534;
}

.icon-btn[disabled] {
  opacity: .45;
  cursor: not-allowed;
}

.nowrap-actions {
  white-space: nowrap;
}

.sidebar-superadmin .brand-mark {
  background: linear-gradient(135deg, #0f172a, #334155);
}

.superadmin-zone-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, .96), rgba(51, 65, 85, .9));
  color: #ffffff;
}

.superadmin-zone-card .topbar-kicker,
.superadmin-zone-card .topbar-org-name {
  color: #ffffff;
}

@media (max-width: 1200px) {
  .stats-grid-4,
  .mail-preview-grid,
  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .stats-grid-4,
  .mail-preview-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }
}

.guest-shell {
  min-height: 100dvh;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  padding: 0 24px;
  background:
    radial-gradient(circle at top left, rgba(79, 140, 255, .22), transparent 30%),
    radial-gradient(circle at bottom right, rgba(47, 109, 246, .16), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
}

.guest-layout {
  width: min(860px, 100%);
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(320px, 540px) minmax(360px, 500px);
  gap: 5px;
  align-items: center;
}

.guest-hero {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: clamp(24px, 4vw, 40px);
}

.guest-hero-inner {
  width: min(520px, 100%);
  display: grid;
  gap: 12px;
}

.guest-app-logo {
  display: block;
  width: auto;
  max-width: min(100%, 360px);
  max-height: 150px;
  object-fit: contain;
  object-position: left center;
}

.branding-preview {
  position: relative;
  min-height: 170px;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 1px dashed rgba(148, 163, 184, .55);
  border-radius: 14px;
  background: #f8fafc;
}

.branding-preview.is-pending {
  border-color: rgba(47, 109, 246, .7);
  background: rgba(239, 246, 255, .82);
}

.branding-preview-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
  border: 1px solid rgba(239, 68, 68, .25);
  border-radius: 50%;
  background: #fff;
  color: #dc2626;
  box-shadow: 0 5px 14px rgba(15, 23, 42, .12);
  font: 700 22px/1 Arial, sans-serif;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}

.branding-preview-remove:hover,
.branding-preview-remove:focus-visible {
  background: #dc2626;
  color: #fff;
  transform: scale(1.05);
  outline: none;
}

.branding-preview-remove[hidden] {
  display: none;
}

.branding-preview img {
  display: block;
  max-width: 100%;
  max-height: 130px;
  object-fit: contain;
}

.branding-preview.favicon-preview img {
  width: 64px;
  height: 64px;
}

.guest-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  width: fit-content;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 18px 40px rgba(15, 23, 42, .08);
}

.guest-hero-copy {
  display: grid;
  gap: 14px;
}

.guest-eyebrow {
  
  font-weight: 600;
  color: var(--primary-2);
}

.guest-hero-title {
  margin: 0;
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1.02;
}

.guest-hero-copy p {
  max-width: 56ch;
  margin: 0;
  line-height: 1.5;
  color: #475569;
}

.guest-main {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 100dvh;
  padding: clamp(24px, 4vw, 40px);
}

.guest-main-inner {
  width: min(460px, 100%);
}

.guest-card {
  width: 100%;
  max-width: 460px;
  margin: 0;
}

@media (max-width: 900px) {
  .guest-layout {
    width: 100%;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .guest-hero {
    justify-content: center;
    padding-bottom: 8px;
  }

  .guest-main {
    justify-content: center;
    min-height: auto;
    padding-top: 8px;
    padding-bottom: 28px;
  }

  .guest-card {
    margin: 0 auto;
  }

  .guest-hero-title {
    font-size: clamp(28px, 10vw, 42px);
  }
}


.btn.generovat-bulk {
  min-width: 214px;
  padding: 8px 14px;
  border: 1px solid rgba(21, 128, 61, .26);
  border-radius: 12px;
  background: linear-gradient(180deg, #ecfdf5, #dcfce7);
  color: #166534;
  font-weight: 500;
  transition: background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease, opacity .18s ease;
}

.btn.generovat-bulk:hover:not(:disabled) {
  background: linear-gradient(180deg, #dcfce7, #bbf7d0);
  border-color: rgba(21, 128, 61, .4);
  color: #14532d;
}

.btn.generovat-bulk:focus-visible {
  outline: none;
}

.btn.generovat-bulk:active:not(:disabled) {
  transform: translateY(1px);
}

.btn.generovat-bulk:disabled,
.btn.generovat-bulk[disabled] {
  background: linear-gradient(180deg, #f8fafc, #eef2f7);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, .32);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
  transform: none;
}

.table tr.scenario-template-generated-row td {
  background: linear-gradient(180deg, rgba(236, 253, 245, .98), rgba(220, 252, 231, .98));
  border-top-color: rgba(34, 197, 94, .28);
  border-bottom-color: rgba(34, 197, 94, .28);
}

.table tr.scenario-template-generated-row td:first-child {
  border-left-color: rgba(34, 197, 94, .28);
}

.table tr.scenario-template-generated-row td:last-child {
  border-right-color: rgba(34, 197, 94, .28);
}

/* Sidebar bottom logout + app version */
.sidebar {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar .menu {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  padding-bottom: 12px;
}

.sidebar-bottom {
  flex: 0 0 auto;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.96));
}

.sidebar-leave-form {
  margin: 0 0 10px;
  width: 100%;
}

.sidebar-leave-form .btn {
  width: 100%;
}

.sidebar-bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
}

.sidebar-logout-form {
  margin: 0;
  min-width: 0;
}

.sidebar-logout-btn {
  width: 100%;
  height: 100%;
  min-height: 38px;
  padding-left: 8px;
  padding-right: 8px;
  white-space: nowrap;
}

.sidebar-version-btn {
  min-width: 0;
  min-height: 38px;
  padding: 7px 8px;
  border: 1px solid rgba(79, 140, 255, .24);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #eef5ff);
  color: #1e3a8a;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 8px 18px rgba(47, 109, 246, .08), inset 0 1px 0 rgba(255,255,255,.95);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.sidebar-version-btn span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.sidebar-version-btn strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-version-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #f8fbff, #dbeafe);
  border-color: rgba(47, 109, 246, .38);
  box-shadow: 0 10px 22px rgba(47, 109, 246, .14), inset 0 1px 0 rgba(255,255,255,.96);
}

.sidebar-version-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.sidebar-version-btn:disabled {
  cursor: default;
  opacity: .65;
  box-shadow: none;
}

/* App version modal */
.app-version-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.app-version-modal.is-visible {
  display: flex;
}

.app-version-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(8px);
}

.app-version-dialog {
  position: relative;
  width: min(760px, 100%);
  max-height: min(78vh, 720px);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(148, 163, 184, .35);
  border-radius: 24px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
  overflow: hidden;
}

.app-version-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(79,140,255,.13), rgba(16,185,129,.09));
}

.app-version-kicker {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.app-version-head h2 {
  margin: 0;
  color: #0f172a;
  font-size: 22px;
}

.app-version-close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(148, 163, 184, .36);
  border-radius: 12px;
  background: rgba(255,255,255,.86);
  color: #334155;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.app-version-close:hover {
  background: #fff;
  color: #b91c1c;
  border-color: rgba(239, 68, 68, .26);
}

.app-version-body {
  padding: 18px 24px 24px;
  overflow-y: auto;
}

.contract-due-subtitle {
  margin: 5px 0 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.4;
}

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

.contract-due-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  border: 1px solid rgba(148, 163, 184, .26);
  border-radius: 14px;
  background: #ffffff;
  color: inherit;
  text-decoration: none;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.contract-due-item.is-expired {
  border-color: rgba(239, 68, 68, .28);
  background: linear-gradient(180deg, #fff7f7, #ffffff);
}

.contract-due-item:hover,
.contract-due-item:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, .34);
  box-shadow: 0 12px 28px rgba(15, 23, 42, .10);
  outline: none;
}

.contract-due-item div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.contract-due-item strong {
  color: #0f172a;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.contract-due-item span {
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.contract-due-open {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, .10);
  color: #1d4ed8 !important;
  font-weight: 800;
  white-space: nowrap;
}

.app-version-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.app-version-table th {
  position: sticky;
  top: -18px;
  z-index: 1;
  padding: 10px 12px;
  background: rgba(248, 250, 252, .96);
  color: #475569;
  font-size: 12px;
  letter-spacing: .04em;
  text-align: left;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.app-version-table td {
  padding: 13px 12px;
  background: #fff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.app-version-table td:first-child {
  width: 150px;
  border-left: 1px solid var(--line);
  border-radius: 14px 0 0 14px;
  color: #1d4ed8;
}

.app-version-table td:last-child {
  border-right: 1px solid var(--line);
  border-radius: 0 14px 14px 0;
  color: #334155;
  line-height: 1.45;
}

body.app-version-modal-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .sidebar {
    display: block;
    overflow: visible;
  }

  .sidebar .menu {
    overflow: visible;
  }

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

  .app-version-modal {
    padding: 14px;
  }

  .app-version-dialog {
    max-height: 86vh;
    border-radius: 20px;
  }

  .app-version-head,
  .app-version-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .contract-due-item {
    align-items: flex-start;
    flex-direction: column;
  }
}
