/* SACCO OS — base stylesheet. All styling lives here (no inline styles in pages). */
:root {
  --primary: #1a3c5e;
  --secondary: #c9a84c;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1f2733;
  --muted: #6b7787;
  --border: #e2e7ee;
  --danger: #c0392b;
  --warn: #e08e0b;
  --ok: #1e8449;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.06);
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; background: var(--primary); color: #fff;
  display: flex; flex-direction: column; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-logo { width: 32px; height: 32px; object-fit: contain; border-radius: 6px; background: #fff; }
.brand-name { font-weight: 700; font-size: 1.02rem; }
.nav { display: flex; flex-direction: column; padding: .5rem 0; }
.nav-link { color: rgba(255,255,255,.82); padding: .55rem 1.1rem; font-size: .94rem; }
.nav-link:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.nav-link.active { background: rgba(255,255,255,.16); color: #fff; border-left: 3px solid var(--secondary); }

.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.4rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.page-title { font-size: 1.2rem; margin: 0; }
.topbar-user { display: flex; align-items: center; gap: .7rem; font-size: .9rem; }
.user-role { color: var(--muted); }
.page-body { padding: 1.4rem; flex: 1; }
.footer { padding: .8rem 1.4rem; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--border); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-bottom: 1.1rem; }
.card-title { font-size: 1rem; font-weight: 600; margin: 0 0 .8rem; }
.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }

/* Stat tiles */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.stat-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.stat-value { font-size: 1.5rem; font-weight: 700; margin-top: .25rem; }

/* Tables */
table.data { width: 100%; border-collapse: collapse; background: var(--surface); }
table.data th, table.data td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--border); font-size: .9rem; }
table.data th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: .76rem; letter-spacing: .03em; }
table.data tbody tr:hover { background: #fafbfc; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Buttons */
.btn { display: inline-block; padding: .5rem .9rem; border-radius: 6px; border: 1px solid transparent; font-size: .9rem; cursor: pointer; background: var(--primary); color: #fff; }
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn-secondary { background: var(--secondary); color: #1f2733; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-sm { padding: .3rem .6rem; font-size: .82rem; }

/* Badges */
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.badge-ok { background: #e7f6ee; color: var(--ok); }
.badge-warn { background: #fdf3e3; color: var(--warn); }
.badge-danger { background: #fdecea; color: var(--danger); }
.badge-muted { background: #eef1f5; color: var(--muted); }

/* Forms */
.form-row { margin-bottom: .9rem; }
.form-row label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
.input, select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--border);
  border-radius: 6px; font-size: .92rem; font-family: inherit; background: #fff;
}
.input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

/* Progress (member limit) */
.progress { height: 10px; background: #eef1f5; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--ok); }
.progress-bar.amber { background: var(--warn); }
.progress-bar.orange { background: #d35400; }
.progress-bar.red { background: var(--danger); }

/* Alerts */
.alert { padding: .7rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: .9rem; }
.alert-warn { background: #fdf3e3; color: #8a5a00; border: 1px solid #f3d79b; }
.alert-danger { background: #fdecea; color: #8a211a; border: 1px solid #f3b6b0; }
.alert-ok { background: #e7f6ee; color: #155e36; border: 1px solid #aadcc0; }

/* Login */
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--primary); }
.auth-card { background: #fff; border-radius: 12px; padding: 2rem; width: 360px; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.auth-card h1 { font-size: 1.25rem; margin: 0 0 1.2rem; text-align: center; }
.muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap { gap: .6rem; }
.mt { margin-top: 1rem; }
