/* ProjectMoosed Ops Portal — design system.
   Clean, dense, phone-first. Dark mode via prefers-color-scheme. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --text: #1a1d21;
  --muted: #6b7280;
  --border: #e2e5ea;
  --accent: #b45309;          /* amber — the company color */
  --accent-soft: #fef3e2;
  --accent-text: #92400e;
  --ok: #15803d; --ok-soft: #e7f6ec;
  --warn: #b45309; --warn-soft: #fef3e2;
  --danger: #b91c1c; --danger-soft: #fdecec;
  --info: #1d4ed8; --info-soft: #e8effd;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318;
    --surface: #1a1d24;
    --surface-2: #23262f;
    --text: #e8eaed;
    --muted: #9aa0ad;
    --border: #2e323c;
    --accent: #f59e0b;
    --accent-soft: #2c2314;
    --accent-text: #fbbf24;
    --ok: #4ade80; --ok-soft: #14291c;
    --warn: #fbbf24; --warn-soft: #2c2314;
    --danger: #f87171; --danger-soft: #2e1a1a;
    --info: #93c5fd; --info-soft: #17233a;
    --shadow: 0 1px 3px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 10px 16px; box-shadow: var(--shadow);
}
.brand { font-weight: 800; font-size: 16px; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav a {
  padding: 7px 12px; border-radius: 8px; color: var(--muted);
  font-weight: 600; font-size: 14px; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.userbox { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.uname { font-size: 13px; font-weight: 600; }
.uname em { font-style: normal; color: var(--muted); font-weight: 400; }
.logout { font-size: 13px; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; font-size: 18px; padding: 4px 10px; color: var(--text); cursor: pointer; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }

h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 24px 0 10px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

/* ---------- cards & grids ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px;
}
.grid { display: grid; gap: 14px; }
.grid.stats { grid-template-columns: repeat(4, 1fr); }
.grid.two { grid-template-columns: 1fr 1fr; }
.stat .num { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat .delta { font-size: 12px; margin-top: 6px; }

/* ---------- progress bars ---------- */
.pbar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.pbar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.prow { display: flex; align-items: center; gap: 10px; }
.prow .pbar { flex: 1; }
.prow .pct { font-size: 13px; font-weight: 700; min-width: 44px; text-align: right; }

/* ---------- pills / badges ---------- */
.pill {
  display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px;
  border-radius: 99px; white-space: nowrap;
}
.pill.todo    { background: var(--surface-2); color: var(--muted); }
.pill.doing   { background: var(--info-soft); color: var(--info); }
.pill.done    { background: var(--ok-soft); color: var(--ok); }
.pill.blocked { background: var(--danger-soft); color: var(--danger); }
.pill.active  { background: var(--ok-soft); color: var(--ok); }
.pill.on_hold { background: var(--warn-soft); color: var(--warn); }
.pill.high    { background: var(--danger-soft); color: var(--danger); }
.pill.medium  { background: var(--warn-soft); color: var(--warn); }
.pill.low     { background: var(--surface-2); color: var(--muted); }
.pill.admin   { background: #ede9fe; color: #6d28d9; }
.pill.board   { background: var(--info-soft); color: var(--info); }
.pill.vp      { background: var(--accent-soft); color: var(--accent-text); }
.pill.employee{ background: var(--surface-2); color: var(--muted); }
@media (prefers-color-scheme: dark) { .pill.admin { background: #2a2140; color: #c4b5fd; } }

/* ---------- tables ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl .r { text-align: right; }

/* ---------- lists ---------- */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: none; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 600; font-size: 14.5px; }
.row .m { color: var(--muted); font-size: 13px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent-text);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
}

/* ---------- forms ---------- */
form.f { display: grid; gap: 12px; max-width: 640px; }
label.fl { display: grid; gap: 5px; font-size: 13px; font-weight: 600; }
input[type=text], input[type=password], input[type=email], input[type=date],
input[type=datetime-local], input[type=number], select, textarea {
  font: inherit; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text); width: 100%;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.btn {
  display: inline-block; font: inherit; font-weight: 700; font-size: 14px;
  padding: 9px 18px; border-radius: 8px; border: 1px solid transparent; cursor: pointer;
  background: var(--accent); color: #fff; text-align: center;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn.ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--border); }
.btn.small { padding: 5px 12px; font-size: 13px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select, .filters input { width: auto; }

/* ---------- thread / notes ---------- */
.msg { border-left: 3px solid var(--border); padding: 8px 0 8px 14px; margin: 10px 0; }
.msg .who { font-size: 13px; font-weight: 700; }
.msg .when { font-size: 12px; color: var(--muted); margin-left: 8px; font-weight: 400; }
.msg .body { margin-top: 4px; font-size: 14.5px; white-space: pre-wrap; }
.msg .replies { margin-left: 8px; }
.note-body { white-space: pre-wrap; font-size: 14.5px; }

/* ---------- misc ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--danger-soft); color: var(--danger); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); flex: none; }
.dep-warn { background: var(--warn-soft); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; margin: 10px 0; }

/* login */
.loginwrap { max-width: 380px; margin: 8vh auto 0; }
.loginwrap .card { padding: 28px; }
.loginwrap h1 { text-align: center; margin-bottom: 4px; }
.loginwrap .sub { text-align: center; }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .grid.stats { grid-template-columns: repeat(2, 1fr); }
  .grid.two { grid-template-columns: 1fr; }
  .nav-toggle { display: block; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); flex-direction: column; padding: 8px; border-bottom: 1px solid var(--border); }
  .nav.open { display: flex; }
  .topbar { position: sticky; flex-wrap: nowrap; }
  .userbox .uname { display: none; }
  h1 { font-size: 21px; }
  .tbl th:nth-child(n+4), .tbl td:nth-child(n+4) { display: none; } /* keep tables readable on phones */
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dt { margin-top: 8px; }
}
