:root {
  --green: #00C853; --green-dark: #00A844; --bg: #f4f6f5; --card: #fff;
  --ink: #0e1a12; --muted: #67756b; --line: #e3e9e4;
  --amber: #f5a623; --red: #e53935; --blue: #1e88e5;
  --shadow: 0 10px 34px rgba(14, 40, 22, .08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Poppins', system-ui, sans-serif; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }

/* ---- login ---- */
.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; position: relative; padding: 20px; }
.login-bg { position: absolute; inset: 0; background: radial-gradient(1200px 600px at 20% -10%, #d2f7e0, transparent), radial-gradient(900px 500px at 110% 110%, #cfe8ff, transparent), #0b2a14; }
.login-card { position: relative; background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 36px 32px; width: 100%; max-width: 400px; }
.login-logo { display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; margin-bottom: 4px; }
.login-logo h1 { font-size: 26px; font-weight: 800; color: var(--ink); }
.login-logo h1 em { color: var(--green); font-style: normal; }
.login-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 26px; font-weight: 500; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input { width: 100%; padding: 13px 14px; border: 2px solid var(--line); border-radius: 12px; font-size: 15px; font-family: inherit; outline: none; transition: border .2s; }
.field input:focus { border-color: var(--green); }
.btn { border: none; border-radius: 12px; padding: 12px 18px; font-weight: 700; font-family: inherit; font-size: 15px; cursor: pointer; transition: .18s; }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.ghost { background: #eef2ee; color: var(--ink); }
.btn.ghost:hover { background: #e2e8e2; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.compact { padding: 8px 14px; font-size: 13px; }
.error-text { color: var(--red); font-size: 13px; margin-top: 8px; font-weight: 600; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
.login-foot a { color: var(--green-dark); font-weight: 700; text-decoration: none; }

/* ---- layout ---- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: #0b2a14; color: #eafff2; display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.sidebar-head { display: flex; align-items: center; gap: 9px; padding: 0 6px 20px; }
.sidebar-brand { font-weight: 800; font-size: 19px; }
.sidebar-brand em { color: var(--green); font-style: normal; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-nav a { padding: 11px 14px; border-radius: 11px; color: #cfe6d8; text-decoration: none; font-weight: 600; font-size: 14px; cursor: pointer; transition: .15s; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: var(--green); color: #06230f; }
.sidebar-org { border-top: 1px solid rgba(255,255,255,.12); padding: 14px 6px 0; display: flex; flex-direction: column; gap: 3px; }
.sidebar-org #org-name { font-weight: 700; font-size: 13px; }
.sidebar-org #org-balance { color: #9cc7a9; font-weight: 500; font-size: 12px; }
.main { flex: 1; padding: 22px 26px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.topbar h2 { font-size: 22px; font-weight: 800; }
.top-user { display: flex; align-items: center; gap: 12px; }
.pill { background: #c7e6d2; color: #0b5d2b; font-weight: 800; font-size: 11px; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; }
#user-name { color: var(--muted); font-weight: 600; font-size: 14px; }

/* ---- stats / cards ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--card); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.stat .num { font-size: 26px; font-weight: 800; color: var(--green-dark); }
.stat .lbl { color: var(--muted); font-size: 13px; font-weight: 500; }
.panel-title { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 12px; }
.panel-title h3 { font-weight: 800; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--card); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); border-left: 4px solid var(--line); }
.item.done { border-left-color: var(--green); }
.item.active { border-left-color: var(--amber); }
.item.terminal { border-left-color: var(--red); }
.item .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.item .track { font-weight: 800; letter-spacing: .4px; }
.item .route { color: var(--muted); font-size: 13px; margin: 4px 0; }
.item .meta { color: var(--muted); font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.badge { padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.badge.done { background: #e6f7ec; color: var(--green-dark); }
.badge.idle, .badge.assigned { background: #e3f2fd; color: var(--blue); }
.badge.active { background: #fff7e0; color: var(--amber); }
.badge.terminal { background: #fdecea; color: var(--red); }
.actions { display: flex; gap: 8px; margin-top: 10px; }
.actions button, .actions a { border: none; background: #eef2ee; padding: 7px 12px; border-radius: 10px; font-weight: 700; font-family: inherit; font-size: 12px; color: var(--ink); text-decoration: none; cursor: pointer; }
.actions button:hover, .actions a:hover { background: #e2e8e2; }

/* ---- form ---- */
.form-card { background: var(--card); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); max-width: 760px; }
.form-card h3 { font-weight: 800; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.quote-row { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.quote-result { font-weight: 800; color: var(--green-dark); font-size: 18px; }

/* ---- finance ---- */
.finance-card { background: var(--card); border-radius: 18px; padding: 26px; box-shadow: var(--shadow); max-width: 620px; }
.finance-card h3 { font-weight: 800; }
.big-balance { font-size: 34px; font-weight: 800; color: var(--green-dark); margin: 10px 0 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---- toast ---- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); padding: 12px 20px; border-radius: 12px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow); z-index: 50; }
.toast.ok { background: #0b5d2b; color: #fff; }
.toast.err { background: var(--red); color: #fff; }