/* Northstar Rewards Portal — hand-rolled, no external dependencies */
:root {
  --navy: #1e3a5f;
  --navy-dark: #152a46;
  --blue: #2b6cb0;
  --blue-light: #ebf4ff;
  --bg: #f2f5f9;
  --card: #ffffff;
  --text: #1a202c;
  --muted: #718096;
  --border: #e2e8f0;
  --green: #2f855a;
  --red: #c53030;
  --amber: #b7791f;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* top bar */
.topbar { background: var(--navy); color: #fff; padding: 0; position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: 16px; padding: 10px 16px; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }
.brand-logo { height: 44px; width: auto; display: block; border-radius: 8px; }
.brand-logo-login { height: 52px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; background: #fff; color: var(--navy);
  font-weight: 800;
}
.brand-sub { font-weight: 400; opacity: .75; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; }
.nav a { color: #dbe7f5; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: .92rem; }
.nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-sep { width: 1px; background: rgba(255,255,255,.25); margin: 4px 6px; }
.userchip { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.chip-role { background: rgba(255,255,255,.18); padding: 2px 8px; border-radius: 20px; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.chip-points { background: #fff; color: var(--navy); padding: 2px 10px; border-radius: 20px; font-weight: 700; }
.chip-logout { color: #dbe7f5; }
main { padding: 24px 0 40px; }
.footer { padding: 18px 0; color: var(--muted); font-size: .85rem; text-align: center; }

/* cards, stats */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 16px 0; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
h1 { font-size: 1.6rem; margin: .4em 0 .6em; }
h2 { font-size: 1.15rem; margin: 0 0 .8em; }
h3 { margin: .4em 0; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; }
a.stat:hover { border-color: var(--blue); }
.stat-num { font-size: 1.7rem; font-weight: 800; color: var(--navy); }
.stat-label { color: var(--muted); font-size: .85rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

/* forms */
label { display: block; margin: 10px 0; font-weight: 600; font-size: .92rem; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 7px; font-size: 1rem; background: #fff;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue-light); border-color: var(--blue); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: auto; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-form .span-all { grid-column: 1 / -1; }
@media (max-width: 600px) { .grid-form { grid-template-columns: 1fr; } }
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 7px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font-size: .95rem; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--blue); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn-primary:hover { background: #245e9b; }
.btn-danger { background: #fff5f5; border-color: #feb2b2; color: var(--red); }
.btn-danger:hover { border-color: var(--red); }
.btn-small { padding: 5px 10px; font-size: .85rem; }
.btn-block { width: 100%; text-align: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 2px 4px 2px 0; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; margin: 0; padding: 5px 8px; font-size: .85rem; }
.stack-form input[type=text] { margin-bottom: 6px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }
.pos { color: var(--green); font-weight: 700; }
.neg { color: var(--red); font-weight: 700; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; vertical-align: middle; margin-right: 8px; }

/* badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: .78rem; font-weight: 600; text-transform: capitalize; }
.badge-pending { background: #fefcbf; color: #744210; }
.badge-approved { background: #c6f6d5; color: #22543d; }
.badge-denied { background: #fed7d7; color: #742a2a; }
.badge-needs_info { background: #feebc8; color: #7b341e; }
.badge-queued { background: #e9d8fd; color: #553c9a; }
.badge-sent { background: #c6f6d5; color: #22543d; }
.badge-failed { background: #fed7d7; color: #742a2a; }
.badge-open { background: #c6f6d5; color: #22543d; }
.badge-closed { background: #e2e8f0; color: #4a5568; }
.badge-new { background: #bee3f8; color: #2a4365; }
.badge-reviewed { background: #e9d8fd; color: #553c9a; }
.badge-contacted { background: #c6f6d5; color: #22543d; }
.badge-archived { background: #e2e8f0; color: #4a5568; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.badge-role-admin { background: #2b6cb0; color: #fff; }
.badge-role-manager { background: #6b46c1; color: #fff; }
.badge-role-user { background: #e2e8f0; color: #4a5568; }

/* catalog grid */
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.item-card { margin: 0; display: flex; flex-direction: column; }
.item-img { width: 100%; height: 160px; object-fit: cover; border-radius: 7px; margin-bottom: 10px; }

/* lists */
.ledger-list { list-style: none; padding: 0; margin: 0; }
.ledger-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.ledger-list li:last-child { border-bottom: none; }

/* flash */
.flash { padding: 12px 16px; border-radius: 8px; margin: 12px 0; font-weight: 500; }
.flash-success { background: #c6f6d5; color: #22543d; }
.flash-error { background: #fed7d7; color: #742a2a; }

/* login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy-dark); padding: 16px; }
.login-card { background: #fff; border-radius: 12px; padding: 32px; width: 100%; max-width: 380px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 1.2rem; margin-bottom: 20px; background: var(--navy); border-radius: 10px; padding: 16px 12px; }
.login-card h1 { margin-top: 0; }
.narrow { max-width: 560px; }
