:root {
  --bg: #07020a;
  --bg-2: #14040a;
  --panel: #160509;
  --panel-2: #1f070d;
  --panel-3: #2a0b13;
  --line: rgba(255, 90, 110, 0.14);
  --line-strong: rgba(255, 90, 110, 0.28);
  --muted: #b89aa1;
  --text: #fff5f6;
  --red: #e21d35;
  --red-2: #ff4b5f;
  --red-glow: rgba(226, 29, 53, 0.45);
  --red-soft: rgba(226, 29, 53, 0.12);
  --teal: #26d0ce;
  --green: #32d583;
  --amber: #fdb022;
  --blue: #70a7ff;
  --danger: #ff6b6b;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.55);
  --shadow-red: 0 22px 60px rgba(226, 29, 53, 0.18);
  --radius: 8px;
  --grid-line: rgba(255, 75, 95, 0.06);
  --grid-size: 56px;
  color-scheme: dark;
  font-family: "Montserrat", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "ss01", "cv11";
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: "Montserrat", ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(1100px 720px at 8% -10%, rgba(226, 29, 53, 0.32), transparent 60%),
    radial-gradient(900px 600px at 96% 110%, rgba(226, 29, 53, 0.22), transparent 55%),
    linear-gradient(160deg, #1a0309 0%, #0a0205 55%, #07020a 100%);
  color: var(--text);
  letter-spacing: 0.005em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 85%);
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 500px) 1fr;
  background: #101014;
}

.auth-brand {
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(150deg, rgba(226, 29, 53, 0.86), rgba(26, 26, 46, 0.94)),
    url("/assets/nodo-mark.svg") center 62% / 360px no-repeat;
}

.brand-row,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--panel);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
}

.brand-title {
  display: grid;
  gap: 2px;
}

.brand-title strong {
  font-size: 1.15rem;
  letter-spacing: 0;
}

.brand-title span,
.eyebrow,
.field span,
.table-caption,
.muted {
  color: var(--muted);
  font-size: 0.83rem;
}

.auth-copy h1 {
  font-size: clamp(2.2rem, 6vw, 4.6rem);
  line-height: 0.95;
  margin: 0 0 18px;
  letter-spacing: 0;
}

.auth-copy p {
  max-width: 540px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
}

.auth-panel {
  display: grid;
  align-content: center;
  padding: 32px;
}

.login-box {
  width: min(100%, 420px);
  margin: auto;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-box h2,
.view-title h1,
.section-title h2 {
  margin: 0;
  letter-spacing: 0;
}

.login-box form,
.quick-form,
.stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field input,
.field select,
.field textarea,
.search-box input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--radius);
  padding: 11px 12px;
  outline: none;
}

.field textarea {
  min-height: 86px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-box input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(38, 208, 206, 0.16);
}

.btn {
  border: 0;
  border-radius: var(--radius);
  padding: 10px 13px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: linear-gradient(135deg, var(--red), var(--red-2));
  border-color: transparent;
  color: white;
  font-weight: 700;
}

.btn.ghost {
  background: transparent;
}

.btn.icon {
  width: 40px;
  padding: 0;
  font-weight: 800;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 272px 1fr;
}

.sidebar {
  min-height: 100vh;
  padding: 18px;
  background: rgba(14, 15, 22, 0.82);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  backdrop-filter: blur(16px);
}

.sidebar nav {
  display: grid;
  gap: 6px;
  align-content: start;
}

.nav-link,
.bottom-link {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius);
  padding: 10px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link.active,
.nav-link:hover,
.bottom-link.active {
  background: rgba(226, 29, 53, 0.14);
  color: var(--text);
  border-color: rgba(226, 29, 53, 0.26);
}

.nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.07);
  font-size: 0.84rem;
  color: var(--teal);
}

.profile-card {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #071016;
  font-weight: 800;
}

.main {
  min-width: 0;
}

.topbar {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 16, 20, 0.72);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 5;
}


.search-box {
  position: relative;
}

.search-box input {
  padding-left: 42px;
}

.search-box::before {
  content: "⌕";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-52%);
  color: var(--muted);
  font-size: 1.3rem;
}

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

.content {
  padding: 24px;
  padding-bottom: 96px;
}

.view-title,
.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.view-title p,
.section-title p {
  margin: 6px 0 0;
  color: var(--muted);
}

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

.grid.kpis {
  grid-template-columns: repeat(6, minmax(150px, 1fr));
}

.grid.two {
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
}

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

.panel,
.kpi,
.table-wrap,
.form-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 60%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  position: relative;
}

.panel::before,
.form-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background-image:
    linear-gradient(rgba(255, 75, 95, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 75, 95, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at top right, black 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at top right, black 0%, transparent 70%);
  pointer-events: none;
}

.panel > *,
.form-panel > * {
  position: relative;
  z-index: 1;
}

.panel,
.form-panel {
  padding: 18px;
}

.kpi {
  padding: 16px;
  min-height: 138px;
  display: grid;
  gap: 12px;
  align-content: space-between;
  overflow: hidden;
}

.kpi .label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.kpi .value {
  font-size: clamp(1.1rem, 2.2vw, 1.8rem);
  font-weight: 800;
  line-height: 1.05;
  word-break: break-word;
}

.kpi .hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  margin-top: 3px;
  background: var(--green);
}

.danger .status-dot,
.badge.danger {
  background: var(--danger);
}

.warning .status-dot,
.badge.warning {
  background: var(--amber);
  color: #211600;
}

.info .status-dot,
.badge.info {
  background: var(--blue);
}

.sparkline {
  height: 34px;
  display: flex;
  align-items: end;
  gap: 5px;
}

.sparkline span {
  flex: 1;
  min-width: 8px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--teal), rgba(38, 208, 206, 0.18));
}

.chart {
  height: 290px;
  display: flex;
  align-items: end;
  gap: 12px;
  padding-top: 16px;
}

.bar-group {
  flex: 1;
  min-width: 44px;
  display: grid;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
}

.bar {
  height: 220px;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  align-items: end;
  overflow: hidden;
  background: var(--panel-2);
}

.bar span {
  width: 100%;
  min-height: 3px;
  display: block;
}

.bar .public {
  background: var(--red);
}

.bar .private {
  background: var(--teal);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0;
  background: rgba(255, 255, 255, 0.03);
  position: sticky;
  top: 0;
}

td strong {
  display: block;
  margin-bottom: 3px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
}

.badge.green {
  background: rgba(50, 213, 131, 0.16);
  color: var(--green);
}

.badge.red {
  background: rgba(226, 29, 53, 0.16);
  color: var(--red-2);
}

.badge.teal {
  background: rgba(38, 208, 206, 0.16);
  color: var(--teal);
}

.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 360px;
}

.kanban-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 10px;
}

.kanban-card strong {
  display: block;
  margin-bottom: 6px;
}

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

.activity-list,
.alert-list {
  display: grid;
  gap: 10px;
}

.activity-item,
.alert-item {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.alert-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.error {
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.28);
  color: #ffd5d5;
  border-radius: var(--radius);
  padding: 11px 12px;
  margin: 12px 0;
}

.success {
  background: rgba(50, 213, 131, 0.12);
  border: 1px solid rgba(50, 213, 131, 0.28);
  color: #c6f6d5;
  border-radius: var(--radius);
  padding: 11px 12px;
  margin: 12px 0;
}

.quick-action-menu {
  position: absolute;
  right: 24px;
  top: 64px;
  width: min(92vw, 320px);
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
  z-index: 20;
}

.quick-action-menu a {
  text-decoration: none;
  padding: 10px;
  border-radius: var(--radius);
  color: var(--muted);
}

.quick-action-menu a:hover {
  color: var(--text);
  background: var(--panel-2);
}

.bottom-nav {
  display: none;
}

@media (max-width: 1180px) {
  .grid.kpis {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .grid.two,
  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    min-height: 320px;
    padding: 28px;
  }

  .auth-panel {
    padding: 20px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    grid-template-columns: 1fr auto;
    padding: 12px;
  }

  .content {
    padding: 14px;
    padding-bottom: 92px;
  }

  .grid.kpis,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .view-title,
  .section-title {
    align-items: start;
    flex-direction: column;
  }

  .bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    height: 66px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 6px;
    background: rgba(16, 16, 20, 0.92);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
    z-index: 40;
  }

  .bottom-link {
    justify-content: center;
    padding: 8px 4px;
    font-size: 0.72rem;
  }

  .bottom-link .nav-icon {
    display: none;
  }

  .kanban {
    grid-template-columns: repeat(5, 82vw);
  }
}

/* NODO v2 interface pass */
:root {
  --ink: #07080d;
  --surface-glass: rgba(29, 31, 42, 0.72);
  --surface-strong: #202232;
  --ring: rgba(226, 29, 53, 0.36);
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.brand-logo img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.brand-logo .logo-day {
  display: none;
}

.brand-logo.wide {
  width: min(360px, 78vw);
  filter: drop-shadow(0 20px 28px rgba(0, 0, 0, 0.32));
}

.sidebar-logo {
  width: 172px;
}

.nodo-pill {
  flex: 0 0 auto;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.auth-page {
  background:
    linear-gradient(90deg, rgba(16, 16, 20, 0.95), rgba(16, 16, 20, 0.76)),
    url("/assets/logo-blanco.svg") right -18vw bottom -28vh / min(980px, 86vw) auto no-repeat,
    #101014;
}

.auth-brand {
  background:
    linear-gradient(150deg, rgba(226, 29, 53, 0.72), rgba(26, 26, 46, 0.9) 54%, rgba(16, 16, 20, 0.98)),
    linear-gradient(45deg, rgba(255, 255, 255, 0.08) 25%, transparent 25% 50%, rgba(255, 255, 255, 0.06) 50% 75%, transparent 75%);
  background-size: auto, 26px 26px;
}

.hero-logo {
  align-items: flex-start;
}

.auth-copy {
  max-width: 620px;
}

.auth-copy h1 {
  max-width: 720px;
  font-size: clamp(2.45rem, 6.6vw, 5.4rem);
}

.auth-metrics {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-metrics span {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 700;
  font-size: 0.82rem;
}

.login-box,
.panel,
.form-panel,
.kpi,
.table-wrap {
  backdrop-filter: blur(18px);
}

.login-box {
  width: min(100%, 440px);
  border-color: rgba(255, 255, 255, 0.14);
}

.app-shell {
  grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(226, 29, 53, 0.12), transparent 34%),
    var(--surface-glass);
}

.sidebar-brand {
  justify-content: space-between;
  min-height: 52px;
}

.nav-link {
  min-height: 44px;
  position: relative;
}

.nav-link::before {
  content: "";
  position: absolute;
  left: -18px;
  width: 4px;
  height: 24px;
  border-radius: 0 6px 6px 0;
  background: transparent;
}

.nav-link.active::before {
  background: var(--red);
}

.nav-icon {
  background: rgba(226, 29, 53, 0.1);
  color: var(--red-2);
  font-weight: 900;
}

.profile-card {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.topbar {
  min-height: 78px;
  background: var(--surface-glass);
}

.date-chip {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 8px;
  padding: 9px 10px;
  font-weight: 700;
  text-transform: capitalize;
}

.search-box input {
  min-height: 44px;
}

.btn {
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.btn.primary {
  box-shadow: 0 10px 22px rgba(226, 29, 53, 0.28);
}

.content {
  max-width: 1680px;
  margin: 0 auto;
  width: 100%;
}

.dashboard-hero {
  min-height: 250px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(226, 29, 53, 0.26), rgba(38, 208, 206, 0.11)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.dashboard-hero::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -120px;
  width: 420px;
  height: 420px;
  background: url("/assets/logo-blanco.svg") center / contain no-repeat;
  opacity: 0.06;
  pointer-events: none;
}

.dashboard-hero h1 {
  margin: 8px 0 10px;
  max-width: 820px;
  font-size: clamp(2rem, 4.3vw, 4rem);
  line-height: 0.98;
}

.dashboard-hero p {
  max-width: 680px;
  color: var(--muted);
  line-height: 1.55;
}

.hero-action-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--line);
}

.hero-action-panel strong {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.grid.kpis {
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.kpi {
  min-height: 156px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent),
    var(--panel);
  position: relative;
}

.kpi::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  border-top: 3px solid rgba(50, 213, 131, 0.7);
  pointer-events: none;
}

.kpi.warning::after {
  border-top-color: rgba(253, 176, 34, 0.85);
}

.kpi.danger::after {
  border-top-color: rgba(226, 29, 53, 0.9);
}

.kpi .value {
  font-size: clamp(1.35rem, 2.7vw, 2.25rem);
}

.micro-meter,
.ratio-meter {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.micro-meter span,
.ratio-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--teal));
}

.health-panel {
  overflow: hidden;
}

.ratio-meter {
  height: 14px;
  margin: 4px 0 12px;
}

.ratio-meter span {
  background: linear-gradient(90deg, var(--red), var(--red-2));
}

.ratio-labels {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 0.88rem;
}

.chart {
  align-items: stretch;
  padding-bottom: 4px;
}

.bar {
  height: 230px;
  align-items: flex-end;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.bar-group:hover .bar {
  border-color: var(--ring);
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.045);
}

.click-row {
  cursor: pointer;
}

.crm-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  gap: 6px;
}

.stat-card span,
.stat-card small {
  color: var(--muted);
  font-size: 0.78rem;
}

.stat-card strong {
  font-size: 1.55rem;
}

.crm-filters select {
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 0 10px;
}

.stage-pill {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 0.78rem;
}

.kanban-col {
  background:
    linear-gradient(180deg, rgba(226, 29, 53, 0.08), transparent 58%),
    var(--panel);
}

.kanban-card {
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease;
}

.kanban-card:hover {
  transform: translateY(-2px);
  border-color: var(--ring);
}

.drawer {
  position: fixed;
  top: 88px;
  right: 22px;
  bottom: 22px;
  width: min(420px, calc(100vw - 32px));
  z-index: 30;
  padding: 18px;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.38);
  animation: drawer-in 180ms ease-out;
}

@keyframes drawer-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.drawer-head h2 {
  margin: 4px 0 5px;
}

.drawer-head p {
  margin: 0;
  color: var(--muted);
}

.drawer-score {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.drawer-score div,
.drawer-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 12px;
}

.drawer-score span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 6px;
}

.drawer-score strong {
  font-size: 1.35rem;
}

.drawer-block {
  margin-bottom: 12px;
}

.drawer-block h3 {
  margin: 0 0 8px;
  font-size: 0.92rem;
}

.drawer-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.48;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.cashflow-hero {
  min-height: 320px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 28px;
  align-items: stretch;
  margin-bottom: 20px;
  padding: 36px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(640px 420px at 92% 12%, rgba(226, 29, 53, 0.55), transparent 55%),
    linear-gradient(135deg, #2c060f 0%, #14040a 55%, #050102 100%);
  box-shadow: var(--shadow-red), var(--shadow);
  overflow: hidden;
  position: relative;
  font-family: "Montserrat", sans-serif;
}

.cashflow-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 75, 95, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 75, 95, 0.07) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(120deg, black 30%, transparent 95%);
  -webkit-mask-image: linear-gradient(120deg, black 30%, transparent 95%);
  pointer-events: none;
}

.cashflow-hero::after {
  content: "";
  position: absolute;
  right: -120px;
  top: -80px;
  width: 360px;
  height: 360px;
  background: radial-gradient(closest-side, rgba(226, 29, 53, 0.55), transparent 70%);
  filter: blur(2px);
  pointer-events: none;
}

.cashflow-hero > * {
  position: relative;
  z-index: 1;
}

.cashflow-hero .eyebrow {
  color: var(--red-2);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 700;
  font-size: 0.72rem;
}

.cashflow-hero h1 {
  max-width: 920px;
  margin: 12px 0 14px;
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
  font-size: clamp(2.4rem, 5vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: -0.01em;
  background: linear-gradient(120deg, #fff 0%, #ffd1d6 60%, #ff4b5f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.cashflow-hero p {
  max-width: 740px;
  color: rgba(255, 220, 224, 0.78);
  line-height: 1.6;
  font-weight: 400;
}

.cashflow-current {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background:
    linear-gradient(160deg, rgba(226, 29, 53, 0.22), rgba(0, 0, 0, 0.55));
  backdrop-filter: blur(12px);
}

.cashflow-current strong {
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: -0.02em;
  color: #fff;
}

.cashflow-current .badge {
  justify-self: start;
}

.cashflow-balance-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.cashflow-balance-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(165deg, rgba(226, 29, 53, 0.12), rgba(0, 0, 0, 0.5));
  display: grid;
  gap: 6px;
}

.cashflow-balance-card .label {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--red-2);
  font-weight: 700;
}

.cashflow-balance-card strong {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
}

.cashflow-balance-card small {
  color: var(--muted);
}

.cashflow-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  margin-top: 16px;
}

.cashflow-chart-panel {
  overflow: hidden;
}

.cashflow-bars {
  min-height: 360px;
  display: grid;
  grid-template-columns: repeat(13, minmax(72px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.cash-month {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(226, 29, 53, 0.06), rgba(0, 0, 0, 0.55));
  color: var(--text);
  border-radius: 10px;
  padding: 12px 8px;
  min-height: 320px;
  display: grid;
  grid-template-rows: 1fr auto auto;
  align-items: end;
  gap: 8px;
  position: relative;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.cash-month:hover {
  border-color: var(--red);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(226, 29, 53, 0.22);
}

.cash-month.active {
  border-color: var(--red);
  background:
    linear-gradient(180deg, rgba(226, 29, 53, 0.32), rgba(0, 0, 0, 0.6));
  box-shadow: 0 0 0 2px rgba(226, 29, 53, 0.5), 0 18px 40px rgba(226, 29, 53, 0.32);
}

.cash-month span {
  width: 46%;
  min-height: 5px;
  border-radius: 7px 7px 0 0;
  display: inline-block;
  align-self: end;
}

.cash-month .cash-positive {
  justify-self: start;
  background: linear-gradient(180deg, var(--green), rgba(50, 213, 131, 0.2));
}

.cash-month .cash-negative {
  justify-self: end;
  margin-top: -100%;
  background: linear-gradient(180deg, var(--red), rgba(226, 29, 53, 0.2));
}

.cash-month strong,
.cash-month em {
  font-style: normal;
  text-align: center;
  font-size: 0.76rem;
}

.cash-month em.pos {
  color: var(--green);
}

.cash-month em.neg {
  color: var(--red-2);
}

.cashflow-form {
  position: sticky;
  top: 96px;
  align-self: start;
}

.mini-category-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.cashflow-matrix-panel {
  margin-top: 16px;
  overflow: hidden;
}

.matrix-wrap {
  overflow: auto;
  overscroll-behavior-x: contain;
  max-height: 540px;
  border: 1px solid var(--line);
  border-radius: 8px;
  position: relative;
  isolation: isolate;
}

.cashflow-matrix {
  width: 100%;
  min-width: 1120px;
  border-collapse: separate;
  border-spacing: 0;
}

.cashflow-matrix th,
.cashflow-matrix td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
  font-size: 0.86rem;
  position: relative;
  z-index: 1;
  background: var(--panel);
}

.cashflow-matrix th:first-child,
.cashflow-matrix td:first-child {
  position: sticky;
  left: 0;
  z-index: 6;
  width: 360px;
  min-width: 360px;
  max-width: 360px;
  text-align: left;
  background: var(--panel);
  background-clip: padding-box;
  box-shadow: 16px 0 24px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.cashflow-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.76rem;
}

.cashflow-matrix thead th:first-child {
  z-index: 8;
}

.cashflow-matrix tbody tr:hover td {
  background: rgba(226, 29, 53, 0.07);
}

.cashflow-matrix td:first-child {
  padding-left: calc(12px + var(--level, 0) * 18px);
}

.cashflow-matrix td:first-child strong {
  display: block;
  max-width: 270px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cashflow-matrix td:first-child small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
}

.matrix-code {
  display: inline-block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.74rem;
}

.cashflow-matrix .parent-row td {
  font-weight: 800;
  background: linear-gradient(180deg, rgba(226, 29, 53, 0.16), rgba(226, 29, 53, 0.04));
}

.cashflow-matrix tbody td:first-child,
.cashflow-matrix .parent-row td:first-child {
  background: var(--panel);
}

.cashflow-matrix .income-row td:not(:first-child):not(.zero) {
  color: var(--green);
}

.cashflow-matrix .expense-row td:not(:first-child):not(.zero) {
  color: var(--red-2);
}

.cashflow-matrix .zero {
  color: color-mix(in srgb, var(--muted) 62%, transparent);
}

.rule-stack {
  display: grid;
  gap: 10px;
}

.rule-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(165deg, rgba(226, 29, 53, 0.08), rgba(0, 0, 0, 0.45));
  padding: 14px;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.rule-card:hover {
  border-color: var(--line-strong);
  transform: translateX(2px);
}

.rule-progress {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
}

.rule-progress-bar {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.rule-progress-bar span {
  position: absolute;
  inset: 0;
  width: var(--progress, 0%);
  background: linear-gradient(90deg, var(--red), var(--red-2));
  border-radius: 999px;
}

.rule-progress small {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.72rem;
}

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

.depleting-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(160deg, rgba(226, 29, 53, 0.18), rgba(0, 0, 0, 0.55));
  position: relative;
  overflow: hidden;
}

.depleting-card::before {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(closest-side, rgba(226, 29, 53, 0.4), transparent 70%);
  pointer-events: none;
}

.depleting-card strong {
  font-size: 1rem;
}

.depleting-card .meta {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 4px;
}

.depleting-card .ends {
  display: grid;
  justify-items: end;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--muted);
}

.depleting-card .ends strong {
  color: var(--red-2);
  font-size: 1.05rem;
}

.matrix-filters {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.matrix-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.matrix-filters-row select,
.matrix-filters-row input[type="search"] {
  min-height: 36px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  outline: none;
}

.matrix-filters-row input[type="search"] {
  flex: 1;
  min-width: 180px;
}

.matrix-filters-row select:focus,
.matrix-filters-row input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(226, 29, 53, 0.18);
}

.cell-editable {
  cursor: pointer;
  transition: background 0.12s ease;
}

.cell-editable:hover {
  background: rgba(226, 29, 53, 0.18) !important;
  color: #fff !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 1, 3, 0.78);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: min(720px, 100%);
  max-height: 88vh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(600px 360px at 90% 0%, rgba(226, 29, 53, 0.32), transparent 60%),
    linear-gradient(160deg, #1a0309 0%, #07020a 100%);
  box-shadow: var(--shadow-red), 0 40px 80px rgba(0, 0, 0, 0.7);
  animation: modalIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modalIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 6px 0 4px;
  font-family: "Montserrat", sans-serif;
  font-weight: 800;
}

.modal-body {
  padding: 18px 24px 22px;
  overflow-y: auto;
  display: grid;
  gap: 14px;
}

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

.modal-entry {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(226, 29, 53, 0.08), rgba(0, 0, 0, 0.45));
  padding: 12px;
}

.modal-entry.focused {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(226, 29, 53, 0.4);
}

.modal-entry-form {
  gap: 8px;
}

.modal-entry-head {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 8px;
}

.modal-entry-head input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
  outline: none;
}

.modal-entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
}

.modal-add summary {
  cursor: pointer;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--red-2);
  font-weight: 600;
  list-style: none;
}

.modal-add summary::-webkit-details-marker { display: none; }

.modal-add[open] summary {
  margin-bottom: 12px;
}

.reconcile-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}

.reconcile-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.reconcile-row.already-real {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.reconcile-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.reconcile-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

.hero-sync-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(226, 29, 53, 0.18);
  border: 1px solid rgba(226, 29, 53, 0.32);
  color: #ffd1d6;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.card-stack {
  display: grid;
  gap: 10px;
}

.card-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(226, 29, 53, 0.10), rgba(0, 0, 0, 0.45));
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.card-item:hover {
  border-color: var(--line-strong);
  transform: translateX(2px);
}

.card-item strong {
  font-size: 1rem;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.card-meta strong {
  color: var(--text);
}

.btn.mini {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 0.72rem;
  border-radius: 6px;
}

.btn.danger {
  color: var(--red-2);
  border-color: rgba(226, 29, 53, 0.4);
}

.btn.danger:hover {
  background: rgba(226, 29, 53, 0.12);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.grid.two-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.card-form {
  max-width: 720px;
}

.depleting-empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.rule-card strong,
.rule-card span {
  display: block;
}

.rule-card > div:first-child strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-card > div:first-child span {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 4px;
}

.rule-meta {
  display: grid;
  justify-items: end;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.rule-meta strong {
  color: var(--text);
}

.rule-actions {
  display: flex;
  gap: 6px;
  justify-content: end;
  flex-wrap: wrap;
}

.rule-actions .btn {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 0.76rem;
}

.cashflow-audit {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 9px;
}

.mini-title {
  display: grid;
  gap: 3px;
}

.mini-title span {
  color: var(--muted);
  font-size: 0.78rem;
}

.audit-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 11px;
  display: grid;
  gap: 4px;
}

.audit-card span,
.audit-card small,
.audit-card em {
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
}

.audit-card strong {
  font-size: 1.05rem;
}

.audit-card em.pos {
  color: var(--green);
}

.audit-card em.neg {
  color: var(--red-2);
}

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

.insight-list div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 12px;
  display: grid;
  gap: 5px;
}

.insight-list span {
  color: var(--muted);
  font-size: 0.78rem;
}

.switch-line {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.9rem;
}

.switch-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--red);
}

.quick-action-menu {
  top: 68px;
}

.quick-action-menu a {
  font-weight: 700;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
}

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

  .cashflow-hero,
  .cashflow-board {
    grid-template-columns: 1fr;
  }

  .cashflow-form {
    position: static;
  }

  .rule-card {
    grid-template-columns: 1fr;
  }

  .rule-meta {
    justify-items: start;
  }

  .crm-overview {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 860px) {
  .auth-page {
    background-position: right -52vw bottom -14vh;
  }

  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    display: none;
  }

  .main {
    width: 100%;
    min-width: 0;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px;
  }

  .content {
    max-width: none;
    padding: 14px;
    padding-bottom: 92px;
  }

  .brand-logo.wide {
    width: min(300px, 74vw);
  }

  .dashboard-hero {
    min-height: auto;
    padding: 18px;
  }

  .cashflow-hero {
    min-height: auto;
    padding: 18px;
  }

  .cashflow-bars {
    grid-template-columns: repeat(13, 82px);
  }

  .grid.kpis,
  .crm-overview {
    grid-template-columns: 1fr;
  }

  .date-chip {
    display: none;
  }

  .drawer {
    top: 70px;
    left: 10px;
    right: 10px;
    bottom: 86px;
    width: auto;
  }
}
