/* Kapitl Circle — brand tokens (paleta) + legacy alias pro existující třídy */
@import url("/kapitl-circle-colors.css");

:root {
  /* Legacy názvy → KC paleta */
  --bg-subtle: var(--kc-bg);
  --bg-base: var(--kc-surface);
  --bg-base-hover: rgba(255, 255, 255, 0.04);
  --bg-component: var(--kc-surface);
  --bg-field: rgba(255, 255, 255, 0.04);
  --bg-field-hover: rgba(255, 255, 255, 0.07);
  --bg-overlay: rgba(0, 0, 0, 0.62);

  --fg-base: var(--kc-text);
  --fg-subtle: var(--kc-text-muted);
  --fg-muted: color-mix(in srgb, var(--kc-text-muted) 88%, var(--kc-text));
  --fg-disabled: color-mix(in srgb, var(--kc-border) 70%, var(--kc-text-muted));

  --border-base: var(--kc-border);
  --border-strong: var(--kc-border-strong);
  --border-interactive: var(--kc-gold);

  --fg-interactive: var(--kc-green);
  --fg-interactive-hover: color-mix(in srgb, var(--kc-green) 82%, #000);
  --bg-interactive: var(--kc-green);
  --fg-on-color: var(--kc-text-on-green);
  --fg-error: var(--kc-error);
  --button-danger: var(--kc-error);

  --button-inverted: var(--kc-gold-dark);
  --button-inverted-hover: color-mix(in srgb, var(--kc-gold-dark) 88%, #000);

  --radius: var(--kc-radius);
  --radius-sm: 8px;
  --control-h: 36px;
  --control-h-lg: 42px;
  --sidebar-w: 248px;
  --topbar-h: 52px;
  --app-topbar-bg: var(--kc-bg);

  --font:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Topbar: tmavý chrome jako landing, logo (zelená+zlato) na něm čitelné */
  --app-topbar-fg: var(--kc-text);
  --app-topbar-muted: var(--kc-text-muted);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg-base);
  background: var(--bg-subtle);
  -webkit-font-smoothing: antialiased;
}

/* Aplikace — globální horní lišta (sticky), sidebar pod ní */
body.app-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-global-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) auto;
  align-items: center;
  min-height: var(--topbar-h);
  padding: 0 18px 0 0;
  border-bottom: 1px solid var(--kc-border);
  background: color-mix(in srgb, var(--kc-bg) 88%, transparent);
  backdrop-filter: blur(14px);
  color: var(--app-topbar-fg);
  box-shadow: none;
}

.app-global-lead {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0 12px 0 18px;
}

.sidebar-toggle {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: auto;
  min-width: 0;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--app-topbar-fg);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.sidebar-toggle:hover {
  color: var(--kc-gold-dark);
  background: transparent;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-lockup__img {
  display: block;
  height: 32px;
  width: auto;
  max-width: min(200px, 38vw);
  object-fit: contain;
}

.public-brand.brand-lockup {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.brand-lockup__img--public {
  height: 44px;
  max-width: 260px;
  mix-blend-mode: normal;
}

.app-global-brand {
  font-size: 14px;
  font-weight: 500;
  color: inherit;
  text-decoration: none;
  flex-shrink: 0;
}

.app-global-brand:hover {
  opacity: 0.92;
}

.app-global-heading {
  grid-column: 2;
  grid-row: 1;
  z-index: 1;
  margin: 0;
  padding: 0 16px 0 28px;
  min-width: 0;
  max-width: 100%;
  font-size: 13px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.2;
  color: var(--kc-gold-dark);
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-global-tagline {
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: center;
  align-self: center;
  z-index: 0;
  margin: 0;
  max-width: min(42vw, 420px);
  font-size: 12px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--kc-text-muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.app-global-user {
  grid-column: 3;
  grid-row: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--app-topbar-muted);
  z-index: 1;
}

.app-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid color-mix(in srgb, var(--kc-gold) 45%, transparent);
}

body.is-sidebar-collapsed .app-global-topbar {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

@media (max-width: 880px) {
  .app-global-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .app-global-heading {
    padding-left: 12px;
    font-size: 12px;
  }
}

@media (max-width: 640px) {
  .app-global-tagline {
    display: none;
  }

  .app-global-heading {
    font-size: 11px;
  }
}

.app-main-row {
  flex: 1;
  display: flex;
  min-height: 0;
  min-width: 0;
}

.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--kc-bg2);
  border-right: 1px solid var(--border-base);
  padding: 16px 12px;
  overflow-y: auto;
  max-height: calc(100vh - var(--topbar-h));
}

.app-sidebar.is-collapsed {
  width: 0;
  padding: 0;
  overflow: hidden;
  border-right: none;
}

.sidebar-tagline {
  display: none;
}

.app-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

body.simple {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* legacy — již se nepoužívá */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-base);
  border-right: 1px solid var(--border-base);
  padding: 16px 12px;
}

.sidebar-brand .wordmark {
  font-size: 13px;
  font-weight: 500;
}

.sidebar-brand .tagline {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 4px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}

.nav-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 4px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--kc-gold);
}

.nav-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: color-mix(in srgb, var(--kc-gold) 28%, var(--kc-border));
}

a.nav-sep-add,
button.nav-sep-add {
  appearance: none;
  -webkit-appearance: none;
  order: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  color: var(--kc-gold);
  background: transparent;
  border: none;
  border-radius: 4px;
  box-shadow: none;
  font: inherit;
  line-height: 0;
  cursor: pointer;
}

a.nav-sep-add:hover,
button.nav-sep-add:hover {
  color: var(--kc-gold-dark);
  background: color-mix(in srgb, var(--kc-gold) 18%, transparent);
}

.sec-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 0 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--kc-gold);
}

.sec-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: color-mix(in srgb, var(--kc-gold) 28%, var(--kc-border));
}

.sec-sep:first-child,
.page-head .sec-sep {
  margin-top: 0;
}

.page-head .sec-sep {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-circle-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  cursor: pointer;
}

.nav-circle-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-caret {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  margin-right: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  opacity: 0.65;
  transition: transform 0.15s ease;
}

.nav-group.is-open > .nav-circle-toggle .nav-caret {
  transform: rotate(45deg);
}

.nav-group:not(.is-open) > .nav-sub {
  display: none;
}

.nav-item {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--fg-subtle);
  text-decoration: none;
  font-size: 13px;
}

.nav-item:hover {
  background: var(--bg-base-hover);
  color: var(--fg-base);
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.06);
  border-left: 3px solid var(--kc-gold);
  padding-left: 7px;
  color: var(--kc-text);
  font-weight: 600;
}

.nav-sub {
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--border-base);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-subitem {
  font-size: 12px;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 4px 0;
}

.nav-subitem:hover {
  color: var(--kc-gold-dark);
}

.nav-subitem.is-active {
  color: var(--kc-gold-dark);
  font-weight: 600;
}

.main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-base);
  background: var(--bg-base);
}

.topbar-title {
  font-size: 16px;
  font-weight: 500;
}

.topbar-user {
  font-size: 13px;
  color: var(--fg-muted);
}

.app-stage .content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 32px;
  max-width: 1200px;
  width: 100%;
}

.app-stage .content.content-wide {
  max-width: none;
}

.app-stage .content a:not(.btn):not(.nav-item):not(.nav-subitem):not(.brand-lockup):not(.circle-tab) {
  color: var(--kc-success);
  font-weight: 500;
  text-underline-offset: 2px;
}

.app-stage .content a:not(.btn):not(.nav-item):not(.nav-subitem):not(.brand-lockup):not(.circle-tab):hover {
  color: var(--kc-gold-dark);
}

.circle-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 4px 0 18px;
  padding: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--kc-gold) 45%, var(--kc-border));
}

.app-stage .content a.circle-tab {
  color: var(--kc-text-muted);
  font-weight: 400;
  font-size: 14px;
  text-decoration: none;
  border: 0;
  padding: 8px 16px 10px;
  margin-bottom: -1px;
  background: transparent;
}

.app-stage .content a.circle-tab:hover {
  color: var(--kc-gold);
  background: color-mix(in srgb, var(--kc-gold) 10%, transparent);
}

.app-stage .content a.circle-tab.is-active {
  color: var(--kc-bg);
  font-weight: 600;
  background: var(--kc-gold);
  border-bottom: 1px solid var(--kc-gold);
}

.circle-tabs-hint {
  margin: 0 0 16px;
}

.circle-tab-panel[hidden],
.circle-tabs-hint[hidden] {
  display: none !important;
}

.app-stage .footer {
  flex-shrink: 0;
}

.footer {
  padding: 12px 24px;
  font-size: 12px;
  font-style: italic;
  color: var(--fg-muted);
  border-top: 1px solid var(--border-base);
}

.page-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 16px;
}

.page-head-actions,
.page-head > .btn,
.page-head > a.btn {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  align-self: flex-end;
}

.page-head.graph-head {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.page-head.graph-head h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.app-stage .content h1,
.app-stage .content h2,
.app-stage .content h3,
.app-stage .content .section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 0 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--kc-gold);
}

.app-stage .content h1::after,
.app-stage .content h2::after,
.app-stage .content h3::after,
.app-stage .content .section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: color-mix(in srgb, var(--kc-gold) 28%, var(--kc-border));
}

.app-stage .content .page-head h1,
.app-stage .content .page-head h2,
.app-stage .content .page-head h3 {
  margin: 0;
  width: 100%;
}

.app-stage .content h1 .tag,
.app-stage .content h2 .tag {
  text-transform: none;
  letter-spacing: 0;
}

.panel {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 22px;
  box-shadow: none;
}

form.stack.panel,
form.panel.max-form {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
}

.panel-warn {
  border-color: rgba(210, 180, 114, 0.35);
  background: rgba(174, 139, 75, 0.1);
  color: var(--kc-gold-dark);
}

.empty-state {
  text-align: center;
  padding: 32px;
}

.max-form {
  max-width: 640px;
}

.format-picker {
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
}

.format-picker legend {
  font-size: 11px;
  font-weight: 600;
  color: var(--kc-gold);
  margin: 0 0 8px;
  padding: 0;
}

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

.format-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 12px 14px 14px;
  border: 1px solid var(--kc-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  min-width: 0;
}

.format-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.format-card:focus-within {
  outline: 2px solid color-mix(in srgb, var(--kc-gold) 70%, transparent);
  outline-offset: 2px;
}

.format-card:has(input:checked) {
  border-color: var(--kc-gold);
  background: rgba(174, 139, 75, 0.12);
}

.format-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--kc-text);
}

.format-card-desc {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--kc-text-muted);
}

.format-picker .muted {
  margin: 8px 0 0;
}

form:has([name="format"]:checked):not(:has([name="format"][value="blank"]:checked)) .circle-vis-fields {
  display: none;
}

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

.section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--kc-gold);
  margin: 16px 0 8px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stack label {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inline {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
}

.input,
input.input {
  min-height: var(--control-h);
  padding: 0 10px;
  background: var(--bg-field);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-sm);
  color: var(--fg-base);
  font-size: 13px;
  font-family: inherit;
}

textarea.input {
  min-height: 80px;
  padding: 8px 10px;
}

select.input,
select {
  color-scheme: dark;
  appearance: none;
  -webkit-appearance: none;
  min-height: var(--control-h);
  padding: 0 32px 0 12px;
  background-color: #161817;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1.5L6 6.5L11 1.5' fill='none' stroke='%23ae8b4b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  border: 1px solid color-mix(in srgb, var(--kc-gold) 28%, var(--kc-border));
  border-radius: var(--radius-sm);
  color: var(--kc-text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

select option {
  background-color: #111312;
  color: #f5f5f2;
}

select:focus {
  outline: none;
  border-color: var(--kc-green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--kc-gold) 35%, transparent);
}

.input:focus {
  outline: none;
  border-color: var(--kc-green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--kc-gold) 35%, transparent);
}

/* Neplatné pole po odeslání formuláře */
.input.input-invalid,
input.input.input-invalid {
  border-color: var(--kc-error);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--kc-error) 45%, transparent);
}

.input.input-invalid:focus {
  border-color: var(--kc-error);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--kc-error) 22%, transparent);
}

label.field-invalid > .input,
label.field-invalid > input.input,
label.field-invalid > select,
label.field-invalid > textarea,
.field-invalid-wrap .input,
.field-invalid-wrap input.input {
  border-color: var(--kc-error);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--kc-error) 40%, transparent);
}

.form-alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-base);
  background: var(--kc-surface);
  margin-bottom: 16px;
}

.form-alert.form-alert--error {
  border-color: rgba(224, 112, 112, 0.4);
  background: rgba(224, 112, 112, 0.1);
  color: #f0b4b4;
}

.form-alert.form-alert--warn {
  border-color: rgba(210, 180, 114, 0.4);
  background: rgba(174, 139, 75, 0.1);
  color: var(--kc-gold-dark);
}

.input.inline {
  display: inline-block;
  width: 120px;
}

.mono {
  font-family: var(--font-mono);
}

.inline-form {
  display: inline;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-h);
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-base);
  background: transparent;
  color: var(--fg-base);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.btn:hover {
  background: var(--bg-field-hover);
}

.btn-primary {
  background: var(--kc-text);
  border-color: transparent;
  color: #0b0b0a;
  font-weight: 600;
}

.btn-primary:hover {
  background: #fff;
  border-color: transparent;
  color: #0b0b0a;
}

.btn-secondary {
  border-color: var(--kc-border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--kc-text);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.09);
}

.btn-gold {
  background: var(--kc-gold);
  border-color: transparent;
  color: var(--kc-text-on-gold);
  font-weight: 600;
}

.btn-gold:hover {
  background: var(--kc-gold-dark);
  color: var(--kc-text-on-gold);
}

.btn-danger {
  background: var(--kc-error);
  border-color: var(--kc-error);
  color: #fff;
}

.btn-sm {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.link-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.app-global-user .link-btn {
  color: var(--kc-gold);
}

.app-global-user .link-btn:hover {
  color: color-mix(in srgb, var(--kc-gold) 85%, #fff);
}

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

.help-term {
  border-bottom: 1px dashed var(--fg-muted);
  cursor: help;
  text-decoration: none;
  width: fit-content;
  max-width: 100%;
}

.small {
  font-size: 12px;
}

.flash {
  color: var(--kc-success);
}

.flash-err {
  color: var(--kc-error);
}

.flash-warn {
  color: var(--kc-warning);
}

.circle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.circle-card {
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.circle-card:hover {
  background: var(--bg-base-hover);
}

.circle-card-title {
  font-weight: 500;
  margin-bottom: 8px;
}

.login-card {
  max-width: 360px;
}

.login-title {
  font-size: 28px;
  font-weight: 500;
  margin: 0 0 8px;
}

.tbl {
  width: 100%;
  border-collapse: collapse;
}

.tbl th {
  font-size: 12px;
  font-weight: 500;
  color: var(--kc-text-muted);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--kc-border);
  background: var(--kc-bg2);
}

.tbl td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--kc-border);
  vertical-align: middle;
}

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

.tbl tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.tbl .num {
  text-align: right;
  font-family: var(--font-mono);
  color: var(--kc-gold-dark);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.tbl-wrap {
  overflow-x: auto;
  border: 1px solid var(--kc-border);
  border-radius: 10px;
  background: var(--kc-bg2);
}

.tbl-wrap .tbl th:first-child,
.tbl-wrap .tbl td:first-child {
  padding-left: 16px;
}

.ledger-tbl th:last-child,
.ledger-tbl td.ledger-status {
  text-align: right;
}

.ledger-tbl .ledger-status .inline-form {
  display: inline-flex;
  margin-left: 6px;
}

.ledger-tbl .input {
  width: 100%;
  min-width: 0;
}

.ledger-amt {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.ledger-amt .input:first-child {
  flex: 1;
  min-width: 72px;
  text-align: right;
}

.ledger-add-row {
  display: flex;
  justify-content: flex-start;
  padding: 8px 2px 0;
}

.ledger-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--kc-gold);
  cursor: pointer;
}

.ledger-add svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
}

.ledger-add:hover {
  color: var(--kc-text);
}

.ledger-composer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
}

.ledger-composer-grid > label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--kc-text-muted);
}

.ledger-composer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  grid-column: 1 / -1;
}

@media (max-width: 860px) {
  .ledger-composer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

pre.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  overflow: auto;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid;
}

.tag-neutral {
  background: color-mix(in srgb, var(--kc-text) 6%, var(--kc-surface));
  color: var(--kc-text-muted);
  border-color: var(--kc-border);
}

.tag-blue {
  background: color-mix(in srgb, var(--kc-green) 12%, var(--kc-surface));
  color: var(--kc-green);
  border-color: color-mix(in srgb, var(--kc-green) 28%, var(--kc-border));
}

.tag-green {
  background: color-mix(in srgb, var(--kc-success) 14%, var(--kc-surface));
  color: var(--kc-success);
  border-color: color-mix(in srgb, var(--kc-success) 35%, var(--kc-border));
}

.tag-orange {
  background: rgba(174, 139, 75, 0.12);
  color: var(--kc-gold-dark);
  border-color: rgba(174, 139, 75, 0.3);
}

.tag-red {
  background: color-mix(in srgb, var(--kc-error) 12%, var(--kc-surface));
  color: var(--kc-error);
  border-color: color-mix(in srgb, var(--kc-error) 35%, var(--kc-border));
}

.tag-purple {
  background: color-mix(in srgb, var(--kc-gold) 18%, var(--kc-surface));
  color: var(--kc-gold-dark);
  border-color: color-mix(in srgb, var(--kc-gold) 40%, var(--kc-border));
}

.plain {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Modal (Zaplaceno) */
.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--kc-bg2);
  border: 1px solid color-mix(in srgb, var(--kc-gold) 22%, var(--kc-border));
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  box-shadow: 0 24px 60px -28px #000;
}

.modal-panel .sec-sep {
  margin-top: 0;
}

.popup-choice {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 4px;
  margin: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid color-mix(in srgb, var(--kc-gold) 22%, var(--kc-border));
  color: var(--kc-text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.popup-choice:last-of-type {
  border-bottom: none;
}

.popup-choice:hover {
  color: var(--kc-gold-dark);
}

.form-more {
  border-top: 1px solid color-mix(in srgb, var(--kc-gold) 18%, var(--kc-border));
  padding-top: 8px;
}

.form-more > summary {
  cursor: pointer;
  color: var(--kc-gold);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  list-style: none;
}

.form-more > summary::-webkit-details-marker {
  display: none;
}

.form-more[open] > summary {
  margin-bottom: 10px;
}

@media (max-width: 880px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-base);
  }

  .app-main-row {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border-base);
  }

  .app-sidebar.is-collapsed {
    display: none;
  }
}

/* Veřejné stránky (úvod, login) */
body.public-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg-base);
  background: var(--bg-subtle);
}

.public-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--topbar-h);
  padding: 0 22px;
  border-bottom: 1px solid var(--kc-border);
  background: color-mix(in srgb, var(--kc-bg) 88%, transparent);
  backdrop-filter: blur(14px);
  color: var(--app-topbar-fg);
  flex-shrink: 0;
}

.public-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: inherit;
}

.public-tagline {
  font-size: 11px;
  color: var(--app-topbar-muted);
  max-width: 280px;
  line-height: 1.4;
}

.public-topnav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.public-topnav .login {
  font-size: 14px;
  font-weight: 500;
  color: var(--app-topbar-muted);
  text-decoration: none;
  padding: 6px 12px;
}

.public-topnav .login:hover {
  color: var(--app-topbar-fg);
}

.public-main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 40px;
}

.public-main--login {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.public-main--login .login-card {
  width: 100%;
}

.public-landing h1 {
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.public-lead {
  color: var(--fg-subtle);
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.55;
}

.public-list {
  margin: 0 0 24px;
  padding-left: 20px;
  color: var(--fg-subtle);
  line-height: 1.55;
}

.public-list li {
  margin-bottom: 8px;
}

.public-cta {
  margin: 8px 0 0;
}

.public-footer {
  padding: 14px 20px;
  font-size: 12px;
  font-style: italic;
  line-height: 1.45;
  color: var(--fg-muted);
  border-top: 1px solid var(--border-base);
  background: var(--kc-surface);
  flex-shrink: 0;
}

.row-flagged td {
  background: color-mix(in srgb, var(--kc-warning) 10%, transparent);
}

.row-pending td {
  background: color-mix(in srgb, var(--kc-gold) 10%, transparent);
}

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

.kpi-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 92px;
  padding: 16px 18px 14px;
  border-radius: 14px;
  border: 1px solid var(--kc-border);
  background: color-mix(in srgb, var(--kc-surface) 88%, #050505);
}

.kpi-card strong {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--kc-text);
}

.kpi-card span {
  font-size: 12px;
  color: var(--kc-text-muted);
}

.kpi-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  color: var(--kc-gold);
  opacity: 0.9;
}

.graph-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 28%);
  gap: 16px;
  align-items: stretch;
  overflow: visible;
}

.graph-stage-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.graph-dock {
  min-width: 0;
  border-radius: 16px;
  border: 1px solid var(--kc-border);
  background: color-mix(in srgb, var(--kc-surface) 90%, #050505);
  padding: 18px 16px 16px;
  min-height: 420px;
}

.graph-dock-empty {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 280px;
  text-align: center;
  gap: 6px;
  padding: 12px;
}

.graph-dock-empty p {
  margin: 0;
}

.graph-dock-profile {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.graph-dock-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.graph-dock-avatar {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  color: var(--kc-gold-dark);
  background: color-mix(in srgb, var(--kc-green) 72%, #050505);
  border: 2px solid var(--kc-gold);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--kc-gold) 18%, transparent);
}

.graph-dock-avatar.is-person {
  border-radius: 50%;
  overflow: hidden;
}

.graph-dock-avatar.is-co,
.graph-dock-avatar.is-entity {
  border-radius: 12px;
}

.graph-dock-meta {
  min-width: 0;
  flex: 1;
}

.app-stage .content .graph-dock-meta h3 {
  display: block;
  margin: 0 0 4px;
  font-size: 16px;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
  color: var(--kc-text);
}

.app-stage .content .graph-dock-meta h3::after {
  display: none;
}

.graph-dock-meta p {
  margin: 0;
  font-size: 12px;
  color: var(--kc-text-muted);
}

.graph-dock-close {
  margin-left: auto;
  font-size: 18px;
  line-height: 1;
}

.graph-dock-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.graph-dock-actions .btn {
  justify-content: center;
  width: 100%;
}

.graph-panel {
  overflow: hidden;
}

.graph-stage.graph-panel {
  overflow: visible;
}

.graph-head {
  margin-bottom: 12px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  min-height: var(--control-h);
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--kc-border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--kc-text-muted);
  cursor: pointer;
}

.btn-icon:hover {
  color: var(--kc-text);
  background: rgba(255, 255, 255, 0.09);
}

.graph-panel.is-editing .btn-icon.js-graph-edit {
  color: var(--kc-text-on-gold);
  background: var(--kc-gold);
  border-color: transparent;
}

.graph-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.graph-chrome {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.graph-panel:not(.is-editing) .graph-chrome {
  display: none;
}

.graph-panel:not(.is-editing) .graph-port,
.graph-panel:not(.is-editing) .graph-cat-port,
.graph-panel:not(.is-editing) .graph-order {
  display: none;
}

.graph-panel:not(.is-editing) .graph-node {
  cursor: pointer;
}

.graph-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.graph-add-rel {
  flex-wrap: wrap;
  align-items: center;
}

.circle-graph {
  position: relative;
  width: 100%;
  min-height: min(52vh, 560px);
  background:
    radial-gradient(1200px 420px at 50% -10%, color-mix(in srgb, var(--kc-gold) 8%, transparent), transparent 70%),
    var(--kc-bg2);
  border: 1px solid color-mix(in srgb, var(--kc-gold) 22%, var(--kc-border));
  border-radius: 16px;
  overflow: visible;
  touch-action: none;
  padding: 28px 24px 32px;
}

.graph-flow {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  gap: 48px;
  flex-wrap: wrap;
  min-height: 360px;
  pointer-events: none;
}

.graph-cat,
.graph-node {
  pointer-events: auto;
}

.graph-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 22px;
  min-width: 220px;
  flex: 1 1 220px;
}

.graph-cat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  width: 100%;
  min-width: 168px;
  box-sizing: border-box;
  border-radius: 10px;
}

.graph-cat:not(.is-m2m) .graph-cat-body {
  width: 100%;
}

.graph-cat.has-rel {
  border: 1px solid color-mix(in srgb, var(--kc-gold) 48%, var(--kc-border));
  padding: 8px 10px 10px;
}

.graph-cat-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--kc-text-muted);
  line-height: 1.3;
  min-height: 14px;
  padding: 2px 16px 2px 16px;
  width: max-content;
  max-width: 100%;
}

.graph-panel:not(.is-editing) .graph-cat-label {
  padding-left: 0;
  padding-right: 0;
}

.graph-cat-name {
  display: inline-block;
}

.graph-cat-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start;
  min-height: 28px;
}

.graph-cat.is-m2m .graph-cat-ring {
  position: relative;
  display: block;
  flex: none;
}

.graph-cat.is-m2m .graph-cat-ring .graph-node {
  z-index: 2;
}

.graph-flow-arrow {
  color: var(--kc-gold);
  font-size: 18px;
  line-height: 1;
  user-select: none;
  flex-shrink: 0;
}

.graph-cat-port,
.graph-port {
  position: absolute;
  top: -6px;
  right: -7px;
  width: 14px;
  height: 14px;
  margin: 0;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--kc-gold);
  cursor: crosshair;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.graph-cat-port svg,
.graph-port svg {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
}

.graph-order {
  position: absolute;
  top: -6px;
  left: -7px;
  width: 14px;
  height: 14px;
  border-radius: 0;
  background: transparent;
  border: none;
  color: var(--kc-gold);
  cursor: grab;
  z-index: 3;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.graph-order svg {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.graph-order:active {
  cursor: grabbing;
}

.graph-panel.is-editing .graph-cat-label {
  cursor: grab;
}

.graph-node.is-ordering {
  opacity: 0.55;
  cursor: grabbing;
  z-index: 8;
  transition: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.graph-cat.is-ordering,
.graph-cat.is-linking,
.graph-node.is-linking {
  outline: 1px dashed var(--kc-gold);
  outline-offset: 4px;
  background: color-mix(in srgb, var(--kc-gold) 9%, transparent);
  box-shadow: none;
}

.graph-cat.is-ordering {
  cursor: grabbing;
  z-index: 8;
  opacity: 1;
  transition: none;
}

.graph-node.is-linking {
  outline-offset: 3px;
}

.graph-cat.is-placeholder,
.graph-node.is-placeholder {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

.graph-cat.is-placeholder.is-slot {
  visibility: visible;
  opacity: 1;
  pointer-events: none;
  background: transparent;
  border: 1px dashed color-mix(in srgb, var(--kc-gold) 45%, var(--kc-border));
  border-radius: 10px;
}

.graph-cat {
  transition: transform 200ms ease-out;
}

.graph-cat.is-ordering,
.graph-cat.is-placeholder {
  transition: none;
}

.graph-node.is-drop,
.graph-cat.is-drop {
  outline: 1px dashed var(--kc-gold);
  outline-offset: 2px;
}

.graph-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.graph-edge {
  stroke: var(--kc-gold);
  stroke-width: 2.2;
  stroke-opacity: 0.9;
}

.graph-arrow {
  fill: var(--kc-gold);
  fill-opacity: 0.95;
}

.graph-edge-label {
  font-size: 10px;
  fill: var(--fg-muted);
  text-anchor: middle;
}

.graph-draft {
  stroke: var(--kc-gold);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.graph-draft-arrow {
  fill: var(--kc-gold);
}

.graph-node {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--kc-surface) 82%, #000);
  border: 1px solid var(--kc-border);
  color: var(--kc-text);
  white-space: nowrap;
  max-width: 280px;
  user-select: none;
}

.graph-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--kc-gold-dark);
  background: color-mix(in srgb, var(--kc-green) 78%, #050505);
  border: 2px solid color-mix(in srgb, var(--kc-gold) 45%, transparent);
}

.graph-node.is-person {
  flex-direction: column;
  gap: 6px;
  padding: 4px 8px 8px;
  background: transparent;
  border: none;
  max-width: 104px;
  white-space: normal;
  text-align: center;
}

.graph-node.is-person .graph-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 15px;
  overflow: hidden;
}

.graph-node.is-person .graph-label {
  font-size: 12px;
  line-height: 1.25;
  max-width: 96px;
}

.graph-node.is-co,
.graph-node.is-entity {
  padding: 8px 12px 8px 8px;
  border-radius: 14px;
}

.graph-node.is-co .graph-avatar,
.graph-node.is-entity .graph-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 13px;
  overflow: hidden;
}

.graph-avatar-img,
.graph-dock-avatar .graph-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.graph-panel.is-editing .graph-node {
  padding-left: 16px;
  padding-right: 16px;
  cursor: grab;
}

.graph-panel.is-editing .graph-node.is-person {
  padding-left: 8px;
  padding-right: 8px;
}

.graph-node.is-self .graph-avatar {
  border-color: var(--kc-gold);
}

.graph-node.is-selected .graph-avatar {
  border-color: var(--kc-gold);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--kc-gold) 55%, transparent);
}

.graph-node.is-person.is-selected .graph-avatar {
  outline: 2px solid var(--kc-gold);
  outline-offset: 3px;
}

.graph-node.is-co.is-selected,
.graph-node.is-entity.is-selected {
  outline: 2px solid var(--kc-gold);
  outline-offset: 2px;
  border-color: var(--kc-gold);
}

.graph-node.is-co {
  border-radius: 14px;
}

.graph-node.is-self {
  border-color: color-mix(in srgb, var(--kc-gold) 55%, var(--kc-border));
}

.graph-hover {
  position: fixed;
  z-index: 40;
  min-width: 180px;
  max-width: 260px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--kc-gold) 35%, var(--kc-border));
  background: color-mix(in srgb, var(--kc-surface) 92%, #000);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.graph-hover strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.graph-hover span {
  display: block;
  font-size: 11px;
  color: var(--kc-text-muted);
  margin-top: 2px;
}

.graph-panel.is-editing .graph-hover {
  display: none !important;
}

.graph-node.is-unclaimed {
  border-style: dashed;
  color: var(--kc-text-muted);
}

.graph-node.is-inactive {
  opacity: 0.45;
}

.graph-label {
  font-size: 12.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

.graph-edge-intra {
  stroke: color-mix(in srgb, var(--kc-text-muted) 55%, var(--kc-border));
  stroke-width: 1.6;
  stroke-opacity: 0.9;
}

.graph-edge-intra.is-tx {
  stroke: color-mix(in srgb, var(--kc-text) 72%, var(--kc-gold));
  stroke-width: 2.1;
  stroke-opacity: 0.95;
}

.graph-panel.is-editing .graph-edge-intra.is-pinned {
  stroke: color-mix(in srgb, var(--kc-gold) 78%, var(--kc-text-muted));
  stroke-width: 1.45;
}

.graph-pin-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.graph-pin-btn {
  position: absolute;
  pointer-events: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 18px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;
}

.graph-pin-btn:hover,
.graph-pin-btn.is-pinned {
  opacity: 1;
}

.graph-panel:not(.is-editing) .graph-pin-layer {
  display: none;
}

.graph-pin-tick {
  display: block;
  width: 2px;
  height: 12px;
  border-radius: 1px;
  background: var(--kc-text-muted);
  flex-shrink: 0;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--kc-bg) 70%, transparent);
}

.graph-pin-btn.is-pinned {
  cursor: pointer;
}

.graph-pin-btn.is-pinned .graph-pin-tick {
  background: var(--kc-gold);
  width: 3px;
  height: 14px;
}

.rel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
}

.rel-list li {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
}

.sign-panel {
  padding: 16px 16px 8px;
}

.sign-frame {
  display: block;
  width: 100%;
  min-height: 720px;
  border: 0;
  border-radius: 10px;
  background: var(--kc-bg2);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--kc-border);
  border: 1px solid var(--kc-border);
  border-radius: 10px;
  overflow: hidden;
  margin: 14px 0 16px;
}

.stats-grid > div {
  background: var(--kc-bg2);
  padding: 14px 16px;
}

.stats-grid small {
  display: block;
  color: var(--kc-text-muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.stats-grid span {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--kc-gold-dark);
}

.pay-instr {
  border: 1px solid rgba(79, 166, 125, 0.3);
  background: rgba(79, 166, 125, 0.06);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 0 0 16px;
}

.pay-instr h4 {
  font-size: 13px;
  font-weight: 600;
  color: #7fd1a8;
  margin: 0 0 6px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pay-instr h4 span {
  color: var(--kc-text-muted);
  font-weight: 400;
}

.pay-instr .pay {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--kc-border);
  font-size: 14px;
}

.pay-instr .pay small {
  color: var(--kc-text-muted);
}

.pay-instr .pay.t {
  font-weight: 600;
}

.pay-instr .pay b {
  font-weight: 600;
  color: var(--kc-gold-dark);
}

.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--kc-border-strong);
  border-radius: 10px;
  background: var(--kc-bg2);
  gap: 0;
}

.seg-btn {
  font-size: 13px;
  font-weight: 500;
  color: var(--kc-text-muted) !important;
  background: none;
  border: 0;
  padding: 6px 14px;
  border-radius: 7px;
  text-decoration: none !important;
  cursor: pointer;
}

.seg-btn:hover {
  color: var(--kc-text) !important;
}

.seg-btn.on {
  background: rgba(255, 255, 255, 0.1);
  color: var(--kc-text) !important;
  font-weight: 600;
}

.tbl tr.is-past td {
  background: color-mix(in srgb, var(--kc-success) 6%, transparent);
}

.tbl tr.is-today td {
  background: rgba(79, 166, 125, 0.14);
  color: var(--kc-text);
}

.tbl tr.is-future td {
  color: var(--kc-text-muted);
  background: color-mix(in srgb, var(--kc-gold) 9%, transparent);
}

.tbl tr.ledger-split td {
  padding: 14px 8px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--kc-gold-dark);
  background: transparent;
  border-top: 1px solid color-mix(in srgb, var(--kc-gold) 55%, var(--kc-border));
  border-bottom: 1px solid color-mix(in srgb, var(--kc-gold) 22%, transparent);
}

.adhoc-form {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--kc-border);
}

@media (max-width: 800px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.note-missing {
  margin: 4px 0 0;
  color: var(--kc-error);
  font-size: 12px;
  font-style: italic;
  max-width: 28ch;
}

.who-pair {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  min-width: 12rem;
}

.who-arrow {
  color: var(--kc-gold);
  font-weight: 600;
}

.pay-ctas {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 12rem;
}

.pay-cta-k {
  display: block;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--kc-text-muted);
}

.account-rail {
  border: 1px solid color-mix(in srgb, var(--kc-gold) 18%, var(--kc-border));
  border-radius: var(--radius-sm);
  padding: 10px 12px 4px;
  margin: 0;
}

.account-rail legend {
  padding: 0 6px;
  color: var(--kc-gold-dark);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pay-pop {
  position: fixed;
  z-index: 240;
  background: var(--kc-bg2);
  border: 1px solid color-mix(in srgb, var(--kc-gold) 40%, var(--kc-border));
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -24px #000;
  padding: 16px 18px 14px;
  color: var(--kc-text);
}

.pay-pop[hidden] {
  display: none !important;
}

.pay-pop h3 {
  margin: 0 0 4px;
}

.pay-pop h4 {
  margin: 12px 0 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--kc-gold-dark);
}

.pay-pop-x {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: none;
  color: var(--kc-text-muted);
  font-size: 18px;
  cursor: pointer;
}

.pay-pop-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  color: var(--kc-text-muted);
  font-style: italic;
}

.pay-spin {
  width: 22px;
  height: 22px;
  border: 2px solid color-mix(in srgb, var(--kc-gold) 25%, transparent);
  border-top-color: var(--kc-gold);
  border-radius: 50%;
  animation: payspin 0.7s linear infinite;
}

@keyframes payspin {
  to { transform: rotate(360deg); }
}

.pay-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  font-size: 13px;
  padding: 3px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--kc-gold) 10%, var(--kc-border));
}

.pay-row.is-missing b {
  color: var(--kc-error);
}

.pay-qr {
  display: flex;
  justify-content: center;
  margin: 10px 0;
  background: #fff;
  border-radius: 8px;
  padding: 10px;
}

.pay-kicker {
  margin: 0 28px 6px 0;
  font-size: 12px;
  color: var(--kc-text-muted);
}

.pay-spd {
  word-break: break-all;
  margin: 10px 0;
}

.connection-add {
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid var(--kc-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--kc-surface) 90%, #050505);
}

.app-stage .content .connection-add h3 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.home-entity-bar {
  margin: 0 0 14px;
  max-width: 320px;
}

.graph-dock-move {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--kc-border);
}

@media (max-width: 960px) {
  .circle-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .graph-stage {
    grid-template-columns: 1fr;
  }

  .graph-dock {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .circle-kpis {
    grid-template-columns: 1fr;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.avatar-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
}

.avatar-preview {
  width: 96px;
  height: 96px;
}

.avatar-preview-img,
.avatar-face {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid color-mix(in srgb, var(--kc-gold) 50%, transparent);
  background: color-mix(in srgb, var(--kc-green) 72%, #050505);
}

.avatar-face--initials {
  font-weight: 600;
  font-size: 28px;
  color: var(--kc-gold-dark);
}

.avatar-prompt {
  min-height: 96px;
  resize: vertical;
}

.avatar-editor .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
