:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #18212f;
  --muted: #5d6b7e;
  --line: #e1e6ed;
  --brand: #0f4c81;
  --brand-2: #1565c0;
  --accent: #f59e0b;
  --danger: #c62828;
  --ok: #2e7d32;
  --side: #0d1b2a;
  --side-ink: #c9d4e3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }

/* buttons & inputs */
button, .btn {
  font: inherit; font-size: 14px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { background: #f1f4f8; text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #0c3d68; }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea {
  font: inherit; font-size: 14px; width: 100%; padding: 9px 11px; border: 1px solid #cfd7e2; border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc3f0; border-color: var(--brand-2); }
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; color: #334155; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

/* login */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 20% 10%, #1b3a5c, #0d1b2a 60%); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 14px; padding: 32px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.login-card h1 { margin-bottom: 4px; }
.login-card button { width: 100%; justify-content: center; margin-top: 20px; padding: 11px; }
.error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #ef6c00); display: grid; place-items: center; color: #fff; font-weight: 800; }

/* app shell */
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100%; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side .logo { color: #fff; padding: 4px 8px 20px; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--side-ink); padding: 9px 12px; border-radius: 8px; font-size: 14.5px; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.side .me { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.side .me button { margin-top: 8px; background: transparent; color: var(--side-ink); border-color: rgba(255,255,255,.2); }
.main { padding: 28px 32px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.topbar-mobile { display: none; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 22px; }
.stat { padding: 16px 18px; }
.stat .n { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat .l { font-size: 13px; color: var(--muted); }
.two-col { grid-template-columns: 2fr 1fr; align-items: start; }

.projects { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.project-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; color: inherit; transition: border-color .15s, transform .15s; }
.project-card:hover { border-color: #9cc3f0; text-decoration: none; transform: translateY(-1px); }
.project-card .meta { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }

.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: #eef2f7; color: #475569; text-transform: capitalize; }
.badge.active { background: #e3f2e6; color: var(--ok); }
.badge.on_hold { background: #fff4e0; color: #b45309; }
.badge.complete { background: #e3eefc; color: var(--brand-2); }
.badge.archived { background: #eceff1; color: #607d8b; }
.badge.admin { background: #ede7f6; color: #5e35b1; }
.badge.lead { background: #e0f2f1; color: #00796b; }
.badge.live { background: #ffebee; color: var(--danger); }
.badge.live::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: 1px; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.avatars { display: flex; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 11.5px; font-weight: 700; border: 2px solid #fff; margin-left: -6px; flex: none; }
.avatars .avatar:first-child { margin-left: 0; }
.avatar.lg { width: 36px; height: 36px; font-size: 13px; margin: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #b0bec5; }
.dot.on { background: #43a047; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.inactive td { opacity: .55; }
.table-wrap { overflow-x: auto; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.feed li:last-child { border-bottom: 0; }
.feed .avatar { margin: 0; width: 26px; height: 26px; font-size: 10.5px; }

.drop { border: 2px dashed #b9c6d6; border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); cursor: pointer; transition: background .15s, border-color .15s; }
.drop.over { background: #eaf3fd; border-color: var(--brand-2); }
.progress { height: 6px; background: #e5eaf0; border-radius: 4px; overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; width: 0; background: var(--brand-2); transition: width .2s; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.checklist { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.checklist label { display: flex; align-items: center; gap: 10px; margin: 0; padding: 9px 12px; font-weight: 500; border-bottom: 1px solid var(--line); cursor: pointer; }
.checklist label:last-child { border-bottom: 0; }
.checklist input { width: auto; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(13, 27, 42, .5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow: auto; padding: 22px 24px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.toast { pointer-events: none; position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 100; box-shadow: var(--shadow); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 240px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .topbar-mobile { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--side); color: #fff; position: sticky; top: 0; z-index: 30; }
  .topbar-mobile button { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); }
  .main { padding: 18px 16px; }
  .two-col { grid-template-columns: 1fr; }
  .row { flex-direction: column; gap: 0; }
  .hide-sm { display: none; }
}
