:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --ink: #1e293b;
  --muted: #475569;
  --line: #e2e8f0;
  --accent: #1ba1e2;
  --accent-hover: #1790cc;
  --accent-soft: rgba(27, 161, 226, 0.12);
  --accent-ring: rgba(27, 161, 226, 0.15);
  --sidebar: #1e293b;
  --sidebar-text: #cbd5e1;
  --danger: #dc2626;
  --ok: #059669;
  --warn: #b45309;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --font: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 1.15rem 1rem;
  flex-shrink: 0;
}
.sidebar .brand {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f8fafc;
  margin-bottom: .25rem;
}
.sidebar .brand-accent,
.brand-accent {
  color: var(--accent);
}
.sidebar .tenant {
  font-size: .85rem;
  color: #94a3b8;
  margin-bottom: 1.25rem;
}
.sidebar nav a {
  display: block;
  color: var(--sidebar-text);
  padding: .65rem .75rem;
  border-radius: 10px;
  margin-bottom: .25rem;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.sidebar nav a:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
  text-decoration: none;
}
.sidebar nav a.active {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}
.sidebar .nav-section {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  line-height: 1.3;
  color: #64748b;
  margin: 1rem 0 .4rem;
  padding: 0 .75rem;
}
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.25rem;
  min-height: 56px;
  background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #f1f5f9;
}
.topbar strong {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #0f172a;
}
.content { padding: 1.25rem; flex: 1; }
.topbar-start {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  flex: 0 1 auto;
}
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: .4rem;
  width: 40px;
  height: 40px;
  font: inherit;
  cursor: pointer;
  color: var(--ink);
  flex-shrink: 0;
}
.menu-toggle-icon { display: block; }
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1090;
  background: rgba(15, 23, 42, 0.45);
  border: 0;
  padding: 0;
  margin: 0;
}
body.nav-open .sidebar-backdrop {
  display: block;
}
.sidebar-brand-wrap {
  margin-bottom: 1.25rem;
}
.product-brand {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  white-space: nowrap;
}
.product-brand .iris-brand {
  font-size: 1em;
}
.product-brand--sidebar {
  color: #f8fafc;
  font-size: 1.35rem;
  font-weight: 600;
}
.product-brand--sidebar .iris-brand {
  color: var(--sidebar-text);
}
.product-brand--footer {
  font-size: inherit;
  font-weight: 400;
}
.auth-card-title {
  margin: 0 0 1.5rem;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
}
.auth-card-title .product-brand {
  font-size: 1.35rem;
}
.auth-card-footer {
  margin-top: 1.5rem;
  text-align: center;
}

.card {
  background: var(--surface);
  border: 1px solid #f1f5f9;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
}
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.camera-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.camera-tile {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: #020617;
}
.camera-tile img,
.camera-tile video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #020617;
  vertical-align: top;
}
.camera-tile:fullscreen,
.camera-tile:-webkit-full-screen {
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: #000;
}
.camera-tile:fullscreen video,
.camera-tile:-webkit-full-screen video {
  height: 100%;
  aspect-ratio: auto;
}
.camera-tile-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: .7rem .85rem .6rem;
  background: linear-gradient(180deg, transparent, rgba(2, 6, 23, .88));
  color: #f8fafc;
  pointer-events: none;
}
.camera-tile-name {
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.camera-tile-nvr {
  margin-top: .1rem;
  font-size: .75rem;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.camera-live-restart,
.camera-live-sound {
  position: absolute;
  top: .55rem;
  z-index: 5;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(2, 6, 23, .72);
  color: #f8fafc;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.camera-live-restart {
  right: .55rem;
}
.camera-live-sound {
  right: 2.9rem;
}
.camera-live-quality {
  position: absolute;
  top: .55rem;
  right: 5.25rem;
  z-index: 5;
  min-width: 2.15rem;
  height: 2.15rem;
  padding: 0 .45rem;
  border: 0;
  border-radius: 999px;
  background: rgba(2, 6, 23, .72);
  color: #f8fafc;
  cursor: pointer;
  font: inherit;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.camera-live-quality:hover,
.camera-live-restart:hover,
.camera-live-sound:hover {
  background: rgba(2, 6, 23, .92);
}
.camera-live-poster {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #020617;
  pointer-events: none;
}
.camera-live-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  background: rgba(2, 6, 23, .55);
  color: #f8fafc;
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .02em;
  pointer-events: none;
}
.camera-live-restart svg,
.camera-live-sound svg {
  display: block;
  width: 1.15rem;
  height: 1.15rem;
}
.camera-live-talk {
  position: absolute;
  top: .55rem;
  left: .55rem;
  z-index: 5;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(2, 6, 23, .72);
  color: #f8fafc;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.camera-live-talk:hover {
  background: rgba(2, 6, 23, .92);
}
.camera-live-talk.is-on {
  background: #b91c1c;
}
.camera-live-talk svg {
  display: block;
  width: 1.15rem;
  height: 1.15rem;
}
.nvr-detail {
  font-size: 1rem;
  line-height: 1.5;
}
.nvr-detail .muted { margin-right: .35rem; }
.media-player,
.media-still {
  display: none;
  width: 100%;
  max-width: 100%;
  max-height: 420px;
  margin-top: 1rem;
  background: #020617;
}
.media-still { height: auto; }
@media (min-width: 700px) {
  .camera-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.stat { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; color: #0f172a; }
.muted { color: var(--muted); }
.h1 {
  margin: 0 0 1rem;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
}
.h2 {
  margin: 0 0 .75rem;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #0f172a;
}

table.data {
  width: 100%;
  border-collapse: collapse;
}
table.data th, table.data td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: .7rem .4rem;
  vertical-align: middle;
}
table.data th {
  font-size: .85rem;
  color: var(--muted);
  font-weight: 600;
}

table.data.energy-stats {
  table-layout: fixed;
  width: 28rem;
  max-width: 100%;
}
table.data.energy-stats .energy-stats-period { width: 12rem; }
table.data.energy-stats .energy-stats-kwh { width: 8rem; }
table.data.energy-stats .energy-stats-liters { width: 8rem; }
table.data.energy-stats th,
table.data.energy-stats td {
  padding: .55rem .5rem;
}
table.data.energy-stats th.num,
table.data.energy-stats td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
}

/* Wide tables scroll inside the card instead of breaking the layout */
.card:has(table.data),
.card:has(table.table),
.table-scroll,
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  max-width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  border: 0;
  border-radius: 10px;
  padding: .65rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
  color: #fff;
}
.btn-secondary {
  background: #0f172a;
}
.btn-secondary:hover {
  background: #1e293b;
}
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-sm {
  padding: .35rem .7rem;
  font-size: .85rem;
  font-weight: 500;
  border-radius: 8px;
}
.btn-ghost:hover {
  background: #f8fafc;
  color: var(--ink);
  border-color: #cbd5e1;
}
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
.ev-actions,
.rec-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}
.event-thumb-cell {
  width: 176px;
  text-align: center;
  vertical-align: middle;
}
.event-thumb {
  display: block;
  width: 160px;
  height: 90px;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 6px;
  background: #020617;
  cursor: pointer;
}

.input-with-action {
  display: flex;
  align-items: stretch;
  width: 100%;
  margin-bottom: .85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input-with-action:focus-within {
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, .25);
}
.input-with-action > input[type=text],
.input-with-action > input[type=number],
.input-with-action > input[type=url],
.input-with-action > input[type=tel] {
  flex: 1;
  min-width: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
.input-with-action > input:focus {
  outline: none;
  box-shadow: none;
}
.input-with-action-form {
  display: flex;
  margin: 0;
  flex-shrink: 0;
}
.input-with-action > .btn,
.input-with-action-form > .btn {
  margin: 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: #f8fafc;
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  padding: .7rem .9rem;
}
.input-with-action > .btn:hover:not(:disabled),
.input-with-action-form > .btn:hover:not(:disabled) {
  background: #f1f5f9;
  color: var(--ink);
}
.input-with-action > .btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

label { display: block; font-size: .9rem; margin-bottom: .3rem; color: var(--muted); font-weight: 500; }
label[hidden],
[data-income-wrap][hidden],
[data-expense-wrap][hidden] {
  display: none !important;
}
input[type=checkbox], input[type=radio] {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.control,
input.control[type=search],
input.control[type=time],
.field input:not([type=checkbox]):not([type=radio]),
.field select,
.field textarea,
label.field > input:not([type=checkbox]):not([type=radio]),
label.field > select,
label.field > textarea,
.form-grid > input:not([type=checkbox]):not([type=radio]),
.form-grid > input[type=search],
.form-grid > input[type=time],
.form-grid > select,
.form-grid > .control,
.form-grid textarea,
.line-row input:not([type=checkbox]):not([type=radio]),
.line-row select,
.line-row .control,
.auth-card .control,
.auth-card input:not([type=checkbox]),
.auth-card select,
.auth-card textarea,
.data-table td .control,
.data-table td input:not([type=checkbox]):not([type=radio]),
.data-table td select,
.cashflow-cell--editable input,
.template-article-row .control {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .7rem .75rem;
  font: inherit;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
  box-sizing: border-box;
}
.field input:not([type=checkbox]):not([type=radio]),
.field select,
.field textarea,
label.field > input:not([type=checkbox]):not([type=radio]),
label.field > select,
label.field > textarea,
.form-grid > input:not([type=checkbox]):not([type=radio]),
.form-grid > select,
.form-grid > .control,
.form-grid textarea,
.line-row input:not([type=checkbox]):not([type=radio]),
.line-row select,
.line-row .control,
.auth-card .control,
.auth-card input:not([type=checkbox]),
.auth-card select,
.auth-card textarea {
  width: 100%;
  margin-bottom: 0;
}
.field,
label.field { margin-bottom: .85rem; }
.field-label { display: block; font-size: .9rem; margin-bottom: .35rem; color: var(--muted); font-weight: 500; }
.field--check,
label.field--check {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: 0;
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
}
.field--check .field-label,
label.field--check .field-label { margin: 0; color: var(--ink); }
.control:focus,
.field input:focus, .field select:focus, .field textarea:focus,
label.field > input:focus, label.field > select:focus, label.field > textarea:focus,
.form-grid > input:focus, .form-grid > select:focus, .form-grid > .control:focus,
.line-row input:focus, .line-row select:focus,
.auth-card .control:focus, .auth-card input:focus, .auth-card select:focus,
.data-table td input:focus, .data-table td select:focus,
.cashflow-cell--editable input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
textarea.control, .field textarea, label.field textarea, .form-grid textarea {
  min-height: 120px;
  resize: vertical;
}
.form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .85rem;
  margin-bottom: .85rem;
}
.checkbox-row label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--ink);
  margin: 0;
}
.flash {
  padding: .8rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}
.flash-success { background: #ecfdf5; color: var(--ok); }
.flash-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.flash-warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.rschs-banner {
  margin-bottom: 1rem;
  display: block;
  align-items: stretch;
}
.rschs-banner.flash-warn,
.rschs-banner.flash-error {
  display: block;
}
.rschs-banner.flash-error,
.rschs-banner.flash-error strong,
.rschs-banner.flash-error li {
  color: var(--danger);
}
.rschs-status { margin: .5rem 0 0; padding-left: 1.1rem; }
.rschs-status li { margin: .2rem 0; }
.badge {
  display: inline-block;
  padding: .2rem .5rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 500;
  background: #f1f5f9;
  color: var(--muted);
}
.badge[hidden] { display: none !important; }
.badge-ok { background: #ecfdf5; color: var(--ok); }
.badge-bad, .badge-fail { background: #fef2f2; color: var(--danger); }
.badge-warn, .badge-skipped { background: #fffbeb; color: var(--warn); }
.badge-info { background: var(--accent-soft); color: var(--accent); }

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75rem 1rem;
}
.filters .actions { margin-top: .25rem; }
.house-chat-msg {
  padding: .65rem 0;
  border-bottom: 1px solid var(--line);
  white-space: pre-wrap;
}
.house-chat-msg:last-child { border-bottom: 0; }
.log-context {
  margin: .5rem 0 0;
  padding: .75rem;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .78rem;
  max-width: 420px;
  overflow: auto;
  white-space: pre-wrap;
}
.tiny { font-size: .75rem; }
.nowrap { white-space: nowrap; }
.linkish { cursor: pointer; color: var(--accent); font-size: .85rem; }
details summary.linkish { list-style: none; }
details summary.linkish::-webkit-details-marker { display: none; }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.auth-card { width: min(420px, 100%); }
.auth-card .h1 { margin-bottom: .35rem; }
.auth-version {
  margin: 1rem 0 0;
  font-size: .8rem;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: auto;
  padding: .75rem 1.25rem 1rem;
  border-top: 1px solid #f1f5f9;
  color: var(--muted);
  font-size: .8rem;
  background: rgba(255, 255, 255, .55);
}
.app-footer .footer-left {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.app-footer .version {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.iris-brand {
  font-family: "Open Sans", system-ui, sans-serif;
  font-weight: 300;
  color: rgb(102, 102, 102);
  text-decoration: none;
  white-space: nowrap;
}
.iris-brand span {
  color: rgb(27, 161, 226);
}
.iris-brand:hover,
.iris-brand:hover span {
  text-decoration: none;
}
.iris-brand:hover {
  color: rgb(102, 102, 102);
}
.iris-brand:hover span {
  color: rgb(27, 161, 226);
}
.auth-iris {
  margin: .65rem 0 0;
  width: 100%;
  text-align: center;
  font-size: .85rem;
}
.auth-iris .iris-brand {
  display: inline-block;
}

.topbar {
  flex-wrap: nowrap;
  min-height: 56px;
}
.topbar-title {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-user {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: .5rem;
  flex: 0 0 auto;
  max-width: 100%;
}
.user-menu {
  position: relative;
}
.user-menu-toggle.user-chip {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0;
  padding: 0;
  max-width: 240px;
  overflow: hidden;
}
.user-menu-toggle::-webkit-details-marker { display: none; }
.user-chip-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  min-width: 0;
  flex: 1 1 auto;
  padding: .3rem .55rem .3rem .7rem;
}
.user-menu-caret {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 .55rem;
  border-left: 1px solid var(--line);
}
.user-menu-caret::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #64748b;
}
.user-menu .user-menu-panel,
.user-menu .action-menu-panel {
  position: absolute;
  right: 0;
  left: auto;
  top: calc(100% + 4px);
  z-index: 50;
  min-width: 180px;
}
.user-menu[open] .user-menu-toggle.user-chip {
  background: #f8fafc;
}
.user-chip {
  line-height: 1.15;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  min-width: 0;
  min-height: 38px;
  box-sizing: border-box;
}
.user-chip-name {
  font-size: .9rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip-role {
  font-size: .72rem;
  color: var(--muted);
  white-space: nowrap;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-toggle-sized {
  padding: .45rem .7rem;
  min-height: 38px;
  height: 38px;
  box-sizing: border-box;
  flex-shrink: 0;
  white-space: nowrap;
}
.flash-warn {
  background: #fffbeb;
  color: var(--warn);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.impersonation-banner { font-weight: 500; }

.btn-group {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.btn-group .btn { margin: 0; }
.btn-group form { display: inline; margin: 0; }

.action-menu {
  position: relative;
  display: inline-block;
}
.action-menu:not(.user-menu) {
  display: inline-flex;
  align-items: stretch;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.2;
  vertical-align: middle;
}
.action-menu-primary-form {
  display: inline-flex;
  margin: 0;
}
.action-menu-primary {
  display: inline-flex;
  align-items: center;
  padding: .45rem .8rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.action-menu:has(.action-menu-more) .action-menu-primary,
.action-menu:has(.action-menu-more) .action-menu-primary-form .action-menu-primary {
  border-radius: 8px 0 0 8px;
}
.action-menu-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}
.action-menu-more {
  display: inline-flex;
  position: relative;
  margin: 0;
}
.action-menu-caret {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 .55rem;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, .35);
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: inherit;
  height: 100%;
  user-select: none;
}
.action-menu-caret::-webkit-details-marker { display: none; }
.action-menu-caret::marker { content: ""; }
.action-menu-caret span {
  display: block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}
.action-menu-more[open] > .action-menu-caret {
  background: var(--accent-hover);
}
.action-menu-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 40;
  min-width: 168px;
  width: max-content;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: .25rem 0;
  overflow: hidden;
}
.action-menu-panel form { margin: 0; }
.action-menu-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: .55rem .9rem;
  border: 0;
  border-bottom: 1px solid #f1f5f9;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: .875rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.action-menu-item:last-child { border-bottom: 0; }
.action-menu-item:hover {
  background: #f8fafc;
  color: var(--ink);
  text-decoration: none;
}
.action-menu-item.is-danger { color: var(--danger); }
.action-menu-item.is-danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}
table.data td .action-menu { vertical-align: middle; }

.switch-row {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem 1.25rem;
  margin-bottom: .85rem;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  cursor: pointer;
  color: var(--ink);
  margin: 0;
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch .slider {
  position: relative;
  width: 42px;
  height: 24px;
  background: #cbd5e1;
  border-radius: 999px;
  flex-shrink: 0;
  transition: background .15s ease;
}
.switch .slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .2);
}
.switch input:checked + .slider {
  background: var(--accent);
}
.switch input:checked + .slider::after {
  transform: translateX(18px);
}
.switch input:focus-visible + .slider {
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.apartments-toolbar {
  display: flex;
  gap: .5rem;
  margin-bottom: .65rem;
}
.apartments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: .4rem;
  margin-bottom: .85rem;
}
.apt-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: .9rem;
  color: var(--ink);
  user-select: none;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.apt-cell.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.apt-cell.is-taken,
.apt-cell:disabled {
  opacity: .4;
  cursor: not-allowed;
  background: #f3f4f6;
}
.mkd-multi {
  display: grid;
  gap: .35rem;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .65rem .75rem;
  margin-bottom: .85rem;
  background: #fff;
}
.mkd-multi label {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin: 0;
  color: var(--ink);
}
.logo-preview {
  max-height: 64px;
  max-width: 160px;
  margin-bottom: .75rem;
  display: block;
}
.logo-upload {
  margin: .35rem 0 1rem;
}
.logo-upload-label {
  display: block;
  margin: .55rem 0 .4rem;
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink);
}
.logo-upload-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  max-width: 240px;
  max-height: 120px;
  margin-bottom: .65rem;
  padding: .5rem .65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
}
.logo-upload-current[hidden] {
  display: none !important;
}
.logo-upload-current img,
.logo-upload-current [data-logo-img] {
  max-width: 220px !important;
  max-height: 96px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  display: block;
}
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .88);
  padding: 2.5rem;
}
.image-lightbox[hidden] {
  display: none !important;
}
.image-lightbox img,
.image-lightbox video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.image-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #f8fafc;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease;
}
.image-lightbox-close:hover {
  background: rgba(255, 255, 255, .22);
}
.app-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, .56);
}
.app-modal-backdrop[hidden] {
  display: none !important;
}
.app-modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .24);
  padding: 1rem 1rem 1.1rem;
}
.app-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem;
}
.app-modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}
.app-modal-close {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.app-modal-body .muted {
  margin-top: 0;
}
.operations-rules-list {
  margin: 0;
  padding-left: 1.25rem;
  line-height: 1.55;
}
.operations-rules-list li + li {
  margin-top: 0.65rem;
}
.app-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin-top: 1rem;
}
.logo-upload-drop {
  display: block;
  cursor: pointer;
  margin: 0;
  color: inherit;
  font-weight: inherit;
  font-size: inherit;
}
.logo-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.logo-upload-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 132px;
  padding: 1rem;
  border: 1.5px dashed #cbd5e1;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, #ffffff, #f8fafc);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.logo-upload-drop:hover .logo-upload-preview,
.logo-upload.is-dragover .logo-upload-preview {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.logo-upload-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}
.logo-upload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: .25rem;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}
.logo-upload-title {
  font-size: .95rem;
  font-weight: 600;
  color: #0f172a;
}
.logo-upload-sub {
  font-size: .82rem;
  color: var(--muted);
}
.logo-upload-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
  margin-top: .65rem;
}
.logo-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .45rem .85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: .875rem;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.logo-upload-drop:hover .logo-upload-btn {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
}
.logo-upload-filename {
  font-size: .82rem;
  min-width: 0;
}
.air-datepicker-global-container {
  z-index: 1200;
}
.air-datepicker {
  --adp-z-index: 1200;
  z-index: 1200;
}
.air-datepicker-overlay {
  --adp-overlay-z-index: 1190;
  z-index: 1190;
}
.air-datepicker {
  --adp-color: var(--accent);
  --adp-color-current-date: var(--accent);
  --adp-btn-color: var(--accent);
  --adp-btn-background-color-hover: var(--accent-soft);
}
.air-datepicker-cell.-current- {
  color: var(--accent);
  border: 1px solid var(--accent);
}
.air-datepicker-cell.-selected-,
.air-datepicker-cell.-selected-.-focus- {
  background: var(--accent);
  color: #fff;
}
.air-datepicker-cell.-in-range- {
  background: var(--accent-soft);
  color: var(--ink);
}
.air-datepicker-cell:hover:not(.-disabled-):not(.-selected-) {
  background: var(--accent-soft);
}

.checklist-grid td, .checklist-grid th { text-align: center; }
.checklist-grid input[type=checkbox] { width: 22px; height: 22px; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1100;
    width: min(280px, 85vw);
    height: 100%;
    max-height: 100dvh;
    overflow-y: auto;
    margin: 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(15, 23, 42, 0.2);
  }
  .menu-toggle { display: inline-flex; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topbar {
    flex-wrap: nowrap;
    gap: .4rem;
    padding: .55rem .75rem;
    min-height: 48px;
  }
  .topbar-title {
    display: none;
    flex: 1;
    min-width: 0;
  }
  .topbar-start { flex: 1; min-width: 0; }
  .topbar-actions { flex-shrink: 0; }
  body.nav-open { overflow: hidden; }
  .user-chip {
    min-height: 36px;
  }
  .user-chip-text {
    padding: .25rem .5rem .25rem .55rem;
  }
  .user-chip-name { max-width: 110px; font-size: .85rem; }
  .user-chip-role { max-width: 110px; }
  .menu-toggle-sized {
    min-height: 36px;
    height: 36px;
    padding: .35rem .55rem;
  }
  .app-footer { flex-direction: column; align-items: center; }
  table.data,
  table.table {
    width: max-content;
    min-width: 100%;
  }
  table.data th,
  table.data td,
  table.table th,
  table.table td {
    white-space: nowrap;
  }
}

.device-plaques {
  margin-bottom: 1rem;
}
.device-plaque {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid #f1f5f9;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.25rem;
}
.device-plaque > * {
  position: relative;
  z-index: 1;
}
.device-plaque.is-alarm {
  background: #fef2f2;
  border-color: #fecaca;
}
.device-plaque[data-pump].is-active::before,
.device-plaque[data-pump].is-active::after {
  content: "";
  position: absolute;
  left: -100%;
  width: 300%;
  bottom: -10%;
  pointer-events: none;
  z-index: 0;
  background-repeat: repeat-x;
  background-size: 480px 100%;
}
.device-plaque[data-pump].is-active::before {
  height: 62%;
  opacity: .72;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 480 120' preserveAspectRatio='none'%3E%3Cpath fill='rgba(37,99,235,.55)' d='M0 72C80 108 160 36 240 72C320 108 400 36 480 72V120H0Z'/%3E%3C/svg%3E");
  animation: device-pump-wave 12s ease-in-out infinite alternate;
}
.device-plaque[data-pump].is-active::after {
  height: 48%;
  opacity: .58;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 480 120' preserveAspectRatio='none'%3E%3Cpath fill='rgba(59,130,246,.48)' d='M0 80C90 40 150 110 240 80C330 50 390 110 480 80V120H0Z'/%3E%3C/svg%3E");
  animation: device-pump-wave 8s ease-in-out infinite alternate-reverse;
}
@keyframes device-pump-wave {
  from { transform: translateX(-8%); }
  to { transform: translateX(8%); }
}
@media (prefers-reduced-motion: reduce) {
  .device-plaque[data-pump].is-active::before,
  .device-plaque[data-pump].is-active::after {
    animation: none;
  }
}
.device-plaque[hidden] {
  display: none !important;
}
.device-plaque-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .35rem;
}
.device-plaque-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  justify-content: flex-end;
}
.device-plaque-address {
  margin-bottom: .5rem;
  color: var(--ink);
  font-size: 1rem;
}
.device-plaque-fields {
  margin: .5rem 0;
  padding-left: 1.1rem;
}
.device-plaque-dates {
  margin-top: .75rem;
  font-size: .85rem;
}
.device-volume {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
  margin: .75rem 0;
}
.device-live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.device-live-list {
  margin: .5rem 0 1rem;
  padding-left: 1.1rem;
}

.budget-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.budget-section-row td { font-weight: 700; }
.budget-total-row td { font-weight: 700; }
table.data th.num,
table.data td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.budget-suggest { position: relative; }
.budget-suggest-list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  margin: 0;
  padding: .25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
  max-height: 16rem;
  overflow: auto;
}
.budget-suggest-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .15rem;
  width: 100%;
  margin: 0;
  padding: .45rem .75rem;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.budget-suggest-item:hover,
.budget-suggest-item:focus {
  background: #f8fafc;
}
table.data td.statement-purpose {
  max-width: 18rem;
  white-space: normal;
  font-size: .85rem;
  color: var(--muted);
}
table.data.statement-ops {
  table-layout: fixed;
  font-size: .8rem;
}
table.data.statement-ops th,
table.data.statement-ops td {
  padding: .4rem .35rem;
  vertical-align: top;
}
table.data.statement-ops th {
  font-size: .72rem;
}
table.data.statement-ops .col-date { width: 6.1rem; white-space: nowrap; }
table.data.statement-ops .col-id { width: 5.2rem; white-space: nowrap; }
table.data.statement-ops .col-dir { width: 6.5rem; }
table.data.statement-ops .col-kind { width: 10.5rem; }
table.data.statement-ops .col-sum { width: 5.4rem; white-space: nowrap; }
table.data.statement-ops .col-cp { width: 12rem; }
table.data.statement-ops .col-purpose { width: 14rem; }
table.data.statement-ops .col-action { width: 7.2rem; }
table.data.statement-ops td.col-date,
table.data.statement-ops td.col-id,
table.data.statement-ops td.num {
  white-space: nowrap;
  vertical-align: middle;
}
table.data.statement-ops td.statement-counterparty {
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.3;
}
table.data.statement-ops td.statement-lines {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
table.data.statement-ops td.statement-purpose {
  max-width: none;
  font-size: inherit;
  color: var(--muted);
}
table.data.statement-ops td.statement-purpose span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.3;
}
table.data.statement-ops td .action-menu {
  font-size: .78rem;
}
table.data.statement-ops td .action-menu-primary {
  padding: .32rem .65rem;
}
.statement-purpose-full {
  max-width: 48rem;
  white-space: pre-wrap;
}
.statement-line {
  padding-bottom: .35rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.statement-line:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}
.statement-line [data-remove-line] {
  width: auto;
  margin-bottom: .85rem;
}
table.data tr.statement-row-open td {
  background: #fffbeb;
}
.statement-kind-cell {
  white-space: normal;
}
.statement-kind-cell .badge {
  margin-left: .35rem;
  vertical-align: middle;
}
.statement-apply-form label {
  display: block;
  margin: .35rem 0;
}

@media print {
  .sidebar, .topbar, .no-print, .menu-toggle, .app-footer { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}

/* Iris IT Finances */
.app-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.content { padding: 1rem 1.25rem 2rem; flex: 1; }
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.toolbar .field { margin-bottom: 0; }
.toolbar .control,
.toolbar select,
.toolbar input:not([type=checkbox]) {
  width: auto;
  min-width: 8rem;
  max-width: 100%;
  margin-bottom: 0;
  padding: .5rem .65rem;
}
.toolbar .input--compact { min-width: 6rem; max-width: 10rem; }
.toolbar input[type=search],
.toolbar input[type=text]:not([type=checkbox]) {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .5rem .65rem;
  font: inherit;
  background: #fff;
  color: var(--ink);
  width: auto;
  min-width: 12rem;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.toolbar input[type=search]:focus,
.toolbar input[type=text]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.inline-form {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  align-items: flex-end;
}
.inline-form .field { margin-bottom: 0; }
.inline-form .control,
.inline-form input:not([type=checkbox]),
.inline-form select {
  width: auto;
  min-width: 10rem;
  max-width: 16rem;
  margin-bottom: 0;
  padding: .55rem .65rem;
}
.data-table td input:not([type=checkbox]),
.data-table td select,
.data-table td .control {
  padding: .35rem .5rem;
  font-size: .85rem;
  margin: 0;
  width: 100%;
  max-width: 20rem;
}
.input--amount { text-align: right; font-variant-numeric: tabular-nums; min-width: 8rem; }
.input--cell { width: 100%; padding: .25rem .4rem; font-size: .85rem; margin: 0; }
.data-table, .cashflow-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td, .cashflow-table th, .cashflow-table td {
  border: 1px solid var(--line);
  padding: .4rem .5rem;
}
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-card { background: var(--surface); padding: 2rem; border-radius: var(--radius); box-shadow: var(--shadow); width: min(100%, 380px); }
.auth-card .field { margin-bottom: 1rem; }
.auth-card .btn { width: 100%; margin-top: .25rem; }
.template-section { margin-bottom: 1.25rem; }
.template-section h2 {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 0 0 .75rem;
}
.template-article-row {
  display: grid;
  grid-template-columns: 1fr minmax(8rem, 10rem);
  gap: .75rem 1rem;
  align-items: center;
  padding: .35rem 0;
  border-bottom: 1px solid #f1f5f9;
}
.template-article-row:last-child { border-bottom: 0; }
.template-hint { font-size: .85rem; color: var(--muted); margin: 0 0 1rem; max-width: 42rem; }
.cashflow-wrap { overflow: auto; max-height: calc(100vh - 200px); }
.cashflow-table .sticky-col, .cashflow-table .sticky-corner { position: sticky; left: 0; z-index: 2; background: var(--surface); min-width: 12rem; text-align: left; }
.cashflow-table thead th { position: sticky; top: 0; z-index: 3; background: #f1f5f9; }
.cashflow-table .sticky-corner { z-index: 4; }
.month-head--verified { background: #d1fae5 !important; }
.month-col--verified { background: rgba(5, 150, 105, .06); }
.month-col--cash-gap { background: rgba(220, 38, 38, .08); }
.month-head.month-col--cash-gap { background: #fecaca !important; }
.month-badge.month-col--cash-gap { background: #fee2e2; }
.cashflow-manual th,
.cashflow-manual td { font-weight: 400; }
.cashflow-computed th { font-weight: 400; }
.cashflow-cell--over-plan {
  background: rgba(245, 158, 11, .14) !important;
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, .35);
}
.month-col--open.month-col--over-plan .month-head,
.month-col--open.month-col--over-plan.month-badge {
  box-shadow: inset 0 -2px 0 #f59e0b;
}
.cf-fact-tooltip {
  position: fixed;
  z-index: 20;
  max-width: 16rem;
  padding: .5rem .65rem;
  font-size: .85rem;
  line-height: 1.45;
  background: #1e293b;
  color: #f8fafc;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .25);
  pointer-events: none;
}
.cf-fact-tooltip-warn {
  color: #fbbf24;
  font-weight: 600;
}
.cashflow-total th, .cashflow-total td { font-weight: 700; background: var(--accent-soft); }
.cashflow-computed td { font-style: italic; color: var(--muted); }
.cashflow-section th { text-transform: uppercase; font-size: .75rem; color: var(--muted); background: #f8fafc; }
.cashflow-cell--editable { cursor: pointer; }
.cashflow-cell--editable:hover { outline: 1px dashed var(--accent); }
.badge-plan { background: var(--accent-soft); color: var(--accent); padding: .1rem .35rem; border-radius: 6px; font-size: .7rem; }
.badge-fact { background: #e2e8f0; color: #334155; padding: .1rem .35rem; border-radius: 6px; font-size: .7rem; }
.badge { display: inline-block; }
.btn-link { background: none; border: none; color: var(--accent); cursor: pointer; font-size: inherit; padding: 0; }
.tiny-form { font-size: .7rem; }
.flash.ok { background: #d1fae5; padding: .5rem .75rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.error { background: #fee2e2; padding: .5rem .75rem; border-radius: 8px; margin-bottom: 1rem; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
  align-items: end;
}
.form-grid > .btn { align-self: end; }
.line-row {
  border: 1px solid var(--line);
  padding: .75rem;
  border-radius: 10px;
  margin-bottom: .5rem;
  background: #fafbfc;
}
.op-lines-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem .75rem;
  margin-bottom: .35rem;
}
.op-lines-header h3 { margin: 0; }
.article-row--inactive td {
  opacity: 0.55;
}
.article-list-toolbar { margin-bottom: .75rem; }
.operation-line {
  padding-bottom: .75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.operation-line:last-child { border-bottom: 0; margin-bottom: 0; }
.operation-line .field { margin-bottom: .65rem; }
.operation-line .checkbox-row {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin: .5rem 0 .65rem;
}
.operation-line .checkbox-row label {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin: 0;
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
}
.operation-line .checkbox-row input[type=checkbox] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}
.operation-line [data-remove-line] {
  width: auto;
  margin-bottom: .5rem;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  margin-top: 1rem;
}
.operation-form-actions .btn-primary { margin-left: auto; }
.operations-table th.op-amount,
.operations-table td.op-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.operations-table td.op-date {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.operations-table .op-accounts,
.operations-table .op-lines-cell,
.operations-table .op-comment {
  white-space: normal;
  max-width: 14rem;
}
.operations-table .op-comment {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 10rem;
}
.operations-table .op-actions {
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
  width: 1%;
}
.op-actions-group {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .15rem .35rem;
}
.op-action {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: .2rem .45rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: .85rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}
a.op-action:hover {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}
button.op-action:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.op-action--danger {
  color: var(--muted);
}
.op-action--danger:hover {
  background: #fef2f2;
  color: var(--danger);
}
.operations-table .op-delete-form {
  display: inline-flex;
  margin: 0;
}
.op-lines-list {
  margin: 0;
  padding-left: 1.1rem;
  list-style: disc;
  font-size: .85rem;
  line-height: 1.45;
}
.op-account-flow {
  font-size: .85rem;
  line-height: 1.4;
}
.badge-op {
  display: inline-block;
  padding: .15rem .45rem;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-op--expense {
  background: var(--line);
  color: var(--ink);
}
.badge-op--income {
  background: var(--accent-soft);
  color: var(--accent);
}
.badge-op--transfer {
  background: #f1f5f9;
  color: var(--muted);
}
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}
.form-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .5rem;
  align-items: end;
}
.tax-edit-form .btn-sm {
  grid-column: 1 / -1;
  justify-self: start;
}
.topbar-title { flex: 1; min-width: 0; }
@media (max-width: 900px) {
  .content { padding: .75rem; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid--compact { grid-template-columns: 1fr; }
  .bank-account-edit .form-grid,
  .cf-opening-form .form-grid { display: flex; flex-direction: column; align-items: stretch; }
  .bank-account-edit .control,
  .cf-opening-form .control { width: 100%; max-width: none; }
  .template-article-row { grid-template-columns: 1fr; }
  .cashflow-wrap { max-height: calc(100dvh - 11rem); }
  .cashflow-table .sticky-col,
  .cashflow-table .sticky-corner { min-width: 9rem; font-size: .85rem; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .field { width: 100%; }
  .operations-table td { white-space: normal; }
  .control, .field input:not([type=checkbox]), .field select, .field textarea { font-size: 16px; }
  .operation-form-actions { flex-direction: row; flex-wrap: wrap; }
  .operation-form-actions .btn-primary { margin-left: auto; }
  .btn, .operation-line [data-remove-line], #add-line { min-height: 44px; }
  .operations-table .op-action,
  .operations-table .op-actions-group .btn { min-height: auto; padding-top: .35rem; padding-bottom: .35rem; }
}
@media (min-width: 901px) {
  .topbar-title { display: block; }
}
