/* Revenue Analytics — shared design system (see spec/layout.md) */
:root {
  --off-white: #F4F4F2;
  --dark: #1E2022;
  --text: #212529;
  --accent: #0A5C36;       /* accent & positive change */
  --accent-soft: #0a5c361a;
  --neg: #991B1B;          /* negative change */
  --border: #e6e6e3;
  --muted: #6b7178;
  --card: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(30, 32, 34, 0.05), 0 1px 3px rgba(30, 32, 34, 0.06);
  --nav-w: 240px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--off-white);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.45;
}

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

/* ---------- Layout shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--nav-w);
  flex: 0 0 var(--nav-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; bottom: 0; left: 0;
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--dark);
  padding: 0 8px 18px;
  letter-spacing: -0.01em;
}
.brand .dot {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 800;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav a .ico { width: 18px; text-align: center; opacity: 0.7; font-size: 15px; }
.nav a:hover { background: #f2f2ef; text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.active .ico { opacity: 1; }
.nav-foot { margin-top: auto; padding: 8px; font-size: 12px; color: var(--muted); }

.main {
  margin-left: var(--nav-w);
  flex: 1;
  min-width: 0;
  padding: 30px 36px 60px;
  max-width: 1500px;
}
.page-head { margin-bottom: 22px; }
.page-head h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: var(--dark);
}
.page-head .sub { color: var(--muted); font-size: 14px; margin: 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 22px;
}
.card h2 { font-size: 16px; font-weight: 650; margin: 0 0 4px; color: var(--dark); }
.card .hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.card-head h2 { margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: filter 0.12s ease, background 0.12s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { background: #aab0ab; border-color: #aab0ab; cursor: not-allowed; filter: none; }
.btn.secondary { background: #fff; color: var(--accent); }
.btn.secondary:hover { background: var(--accent-soft); filter: none; }
.btn.secondary:disabled { color: #aab0ab; border-color: var(--border); background: #fff; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: #f2f2ef; }

/* ---------- Forms ---------- */
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], select {
  font-family: var(--font);
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }

/* ---------- Status text ---------- */
.status { font-size: 13px; margin-top: 8px; min-height: 1em; }
.status.success { color: var(--accent); }
.status.error { color: var(--neg); }

/* ---------- Progress bar ---------- */
.progress {
  height: 8px; width: 100%;
  background: #ececeb; border-radius: 999px; overflow: hidden;
  margin: 10px 0 6px; display: none;
}
.progress.show { display: block; }
.progress > span {
  display: block; height: 100%; width: 0%;
  background: var(--accent); border-radius: 999px;
  transition: width 0.25s ease;
}

/* ---------- Chips / pills ---------- */
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: #fdecec; color: var(--neg); }

.pos { color: var(--accent); }
.neg { color: var(--neg); }

/* ---------- Tables (generic) ---------- */
table.data { border-collapse: collapse; width: 100%; font-size: 14px; }
table.data th, table.data td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: right; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { background: #fafaf8; font-weight: 600; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .sidebar {
    position: static; width: 100%; flex: none; flex-direction: row; flex-wrap: wrap;
    align-items: center; padding: 12px 14px; gap: 6px;
  }
  .brand { padding: 0 10px 0 0; border: none; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-foot { display: none; }
  .main { margin-left: 0; padding: 20px 16px 50px; }
  .app { flex-direction: column; }
}
