/* ──────────────────────────────────────────────────────────────
   Ceahlau 43 ap 2 · 2026 redesign - drop-in replacement for static/app.css
   Targets the existing class names emitted by app.py.
   No Python changes required.
   ────────────────────────────────────────────────────────────── */

@import url("https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap");

:root {
  color-scheme: light;
  /* paper / ink */
  --paper:   #FAFAF7;
  --paper-2: #F3F2EC;
  --paper-3: #EAE8DF;
  --ink:     #14140F;
  --ink-2:   #2A2A23;
  --muted:   #7A776B;
  --muted-2: #9C998E;
  --line:    rgba(20, 20, 15, 0.09);
  --line-2:  rgba(20, 20, 15, 0.16);
  /* signal */
  --accent:     #2F5D4B;   /* moss green */
  --accent-2:   #1F4233;
  --accent-soft:#DCE7DF;
  --warn:       #B0501C;   /* warm amber */
  --warn-soft:  #F4E0CE;
  --ok:         #2F5D4B;
  --ok-soft:    #DCE7DF;
  /* shapes */
  --radius:    10px;
  --radius-sm: 6px;
  --r-pill:    999px;
  --shadow-1:  0 1px 0 rgba(20, 20, 15, 0.04);
  --shadow-2:  0 8px 24px rgba(20, 20, 15, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
}

body {
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

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

/* numeric / tabular helper */
.amount,
.compact-list dd,
.stat strong,
.tabular {
  font-variant-numeric: tabular-nums;
}

/* ─── buttons ──────────────────────────────────────────────── */
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.12s ease, border-color 0.12s ease;
  box-shadow: none;
}

button:hover,
.button:hover {
  transform: translateY(-1px);
  background: var(--ink-2);
}

button:disabled,
.button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.secondary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.secondary:hover { background: var(--accent-2); border-color: var(--accent-2); }

.danger {
  background: var(--warn-soft);
  border-color: transparent;
  color: var(--warn);
}
.danger:hover {
  background: var(--warn);
  border-color: var(--warn);
  color: #fff;
}

.ghost {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line-2);
}
.ghost:hover { background: var(--paper-2); border-color: var(--line-2); }

.small {
  min-height: 28px;
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 6px;
}

.full { width: 100%; }

/* ─── shell ─────────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.guest-shell { min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px 18px;
  border-right: 1px solid var(--line);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 0;
}
.brand strong {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.brand small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}
.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.02em;
}
.brand-mark.large {
  width: 36px;
  height: 36px;
  font-size: 16px;
  border-radius: 9px;
}

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

.nav-link {
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 400;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-link:hover { background: var(--paper-2); color: var(--ink-2); }
.nav-link.active {
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 500;
}

.logout {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.main {
  padding: 32px 36px 80px;
  max-width: 1240px;
  width: 100%;
}

.guest-main { min-height: 100vh; }

/* ─── page header ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.page-header h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.page-header p {
  max-width: 56ch;
  color: var(--muted);
  margin: 6px 0 0;
  font-size: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── stat cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.stat,
.panel,
.item-card,
.empty,
.month-panel,
.insight-card,
.table-wrap {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-1);
}

.stat {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat span {
  color: var(--muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}
.stat strong {
  font-family: "Geist", sans-serif;
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 4px 0 0;
}
.stat small {
  color: var(--muted);
  font-size: 12.5px;
}

/* highlight the first ("currently due") stat */
.stats-grid .stat:first-child {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.stats-grid .stat:first-child span,
.stats-grid .stat:first-child small {
  color: rgba(250, 250, 247, 0.65);
}
.stats-grid .stat:first-child strong { color: var(--paper); }

/* ─── section heading ────────────────────────────────────────── */
.section-block { margin-top: 32px; }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.section-title h2,
.panel h2,
.login-card h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.section-title p {
  color: var(--muted);
  margin: 0;
  font-size: 12.5px;
}
.compact-title h2 { font-size: 15px; }

/* ─── dashboard layout ───────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  gap: 20px;
  align-items: start;
}
.dashboard-grid .section-block { margin-top: 0; }
.primary-section { min-width: 0; }

.month-panel {
  padding: 18px;
  background: var(--paper-2);
  border-color: var(--line);
}

/* ─── cards grids ────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 12px;
}
.due-grid { grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }

.mini-list { display: grid; gap: 10px; }
.mini-list .item-card {
  padding: 14px;
  box-shadow: none;
  background: var(--paper);
}
.mini-list .compact-list { grid-template-columns: 1fr 1fr; }

/* ─── item cards ─────────────────────────────────────────────── */
.item-card {
  padding: 18px 20px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.item-card:hover { border-color: var(--line-2); }

.item-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}
.item-top h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.item-top p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

/* ─── pills ──────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--paper-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.pill.paid { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.due  { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.role { background: var(--paper-2); color: var(--ink-2); }

.tenant-chip {
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-pill);
  padding: 3px 9px;
  background: var(--paper-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 500;
}

/* ─── compact list ───────────────────────────────────────────── */
.compact-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.compact-list div { min-width: 0; }
dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
dd {
  margin: 4px 0 0;
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

/* meta lines & file lists */
.meta-line,
.files,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}
.card-actions { margin-top: 14px; }
.meta-line span:not(:last-child)::after {
  content: "·";
  margin-left: 8px;
  color: var(--muted-2);
}

.file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 9px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.file-link:hover { background: var(--paper-3); }

.muted,
.subtle,
.hint {
  color: var(--muted);
}
.subtle {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}

.empty {
  padding: 36px 24px;
  grid-column: 1 / -1;
  color: var(--muted);
  text-align: center;
}
.empty strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}
.empty span {
  display: block;
  font-size: 12.5px;
}

/* ─── two-column layouts ─────────────────────────────────────── */
.two-column {
  display: grid;
  grid-template-columns: minmax(18rem, 26rem) 1fr;
  gap: 20px;
  align-items: start;
}
.settings-layout { grid-template-columns: minmax(18rem, 28rem) 1fr; }

.panel { padding: 22px 24px; }
.panel h2 { margin-bottom: 14px; }

.wide-form { max-width: 760px; }

.explain-panel {
  background: var(--paper-2);
  border-color: var(--line);
}

.feature-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
}
.feature-list li { margin-bottom: 4px; }

/* ─── forms ──────────────────────────────────────────────────── */
form label {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  font-weight: 500;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
}
.checkbox-row input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.form-note {
  color: var(--muted);
  line-height: 1.55;
  font-size: 12.5px;
  margin: 0 0 14px;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--ink);
  padding: 9px 11px;
  font: inherit;
  font-size: 13.5px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ink-2);
  background: var(--paper);
}
input::placeholder,
textarea::placeholder { color: var(--muted-2); }

textarea { resize: vertical; min-height: 80px; font-family: inherit; }

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

.existing-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 14px;
}

/* ─── tables ─────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  padding: 0;
}

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

th, td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}
th {
  background: var(--paper-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
td strong {
  font-weight: 500;
  font-size: 13.5px;
  color: var(--ink);
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--paper-2); }

/* ─── insights / trends ──────────────────────────────────────── */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 12px;
}

.insight-card {
  padding: 18px 20px;
}
.insight-top,
.insight-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.insight-top h3 {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.insight-top > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trend {
  color: var(--muted);
  font-family: "Geist Mono", ui-monospace, Menlo, monospace;
  font-size: 11.5px;
  font-weight: 500;
  text-align: right;
}
.trend.up   { color: var(--warn); }
.trend.down { color: var(--ok); }

.utility-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
  background: var(--accent);
}
.utility-dot.gas      { background: var(--warn); }
.utility-dot.common   { background: #3B6F8F; }
.utility-dot.internet { background: #6D5BD0; }

.sparkline {
  width: 100%;
  height: 64px;
  margin: 12px 0 8px;
  overflow: visible;
  display: block;
}
.sparkline path {
  stroke: var(--line-2);
  stroke-width: 1;
  fill: none;
}
.sparkline polyline {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.spark-empty {
  display: grid;
  place-items: center;
  min-height: 64px;
  margin: 12px 0 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted-2);
  font-size: 12px;
}

.insight-meta {
  color: var(--muted);
  font-size: 11.5px;
  font-family: "Geist Mono", ui-monospace, Menlo, monospace;
  margin-top: 8px;
}

/* ─── login ──────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(60rem 40rem at 18% 0%, rgba(47, 93, 75, 0.05), transparent 60%),
    radial-gradient(40rem 30rem at 100% 100%, rgba(176, 80, 28, 0.04), transparent 60%),
    var(--paper);
}

.login-panel {
  width: min(64rem, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(22rem, 0.9fr);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(20, 20, 15, 0.06);
  overflow: hidden;
}

.login-copy {
  min-height: 30rem;
  padding: 44px 40px;
  background: var(--paper-2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
  font-size: 14px;
  font-weight: 500;
}

.login-copy h1 {
  margin: 8px 0 14px;
  font-size: clamp(36px, 4.5vw, 56px);
  font-weight: 500;
  line-height: 1.0;
  letter-spacing: -0.03em;
  max-width: 14ch;
}

.login-copy p {
  max-width: 36ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
}

.login-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 24px;
}
.login-proof span {
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--paper);
  color: var(--ink-2);
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 500;
}

.login-card {
  padding: 44px 40px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-card h2 {
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.login-card .hint {
  margin-top: 14px;
  font-size: 12px;
  text-align: center;
}

/* ─── flash ──────────────────────────────────────────────────── */
.flash {
  padding: 10px 12px;
  border-radius: 8px;
  margin: 8px 0 14px;
  font-weight: 500;
  font-size: 13px;
  border: 1px solid transparent;
}
.flash.error {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: transparent;
}
.flash.ok {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: transparent;
}

code {
  font-family: "Geist Mono", ui-monospace, Menlo, monospace;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  background: var(--paper-2);
  font-size: 12px;
}

/* ─── responsive ─────────────────────────────────────────────── */
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px;
  }
  nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: 4px;
  }
  .logout {
    margin-top: 0;
    border-top: 0;
    padding-top: 0;
  }
  .page-header,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }
  .stats-grid,
  .two-column,
  .dashboard-grid,
  .settings-layout,
  .login-panel {
    grid-template-columns: 1fr;
  }
  .login-copy {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    min-height: auto;
    padding: 28px;
  }
  .login-card { padding: 28px; }
  .main { padding: 20px 18px 60px; }
}

@media (max-width: 560px) {
  .form-grid,
  .compact-list,
  .mini-list .compact-list {
    grid-template-columns: 1fr;
  }
}
