/* InstaSpace ERP - styles
   Locked brand system: Aubergine #2A1240 / Orange #F2622E / Crimson #D11E4C
   / Cream #F5EFE8. Gold is banned. Urbanist only. No em-dashes in copy. */

:root {
  --aubergine: #2A1240;
  --orange: #F2622E;
  --crimson: #D11E4C;
  --cream: #F5EFE8;

  --ink: #2A1240;
  --ink-soft: #5a4d68;
  --muted: #9b90a6;
  --line: #e7ddd2;
  --surface: #ffffff;
  --surface-2: #fbf7f1;

  /* status (kept strictly within brand) */
  --st-notstarted: #b3a9bd;
  --st-progress: #F2622E;
  --st-blocked: #D11E4C;
  --st-done: #2A1240;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(42, 18, 64, 0.06), 0 8px 24px rgba(42, 18, 64, 0.06);
  --font: "Urbanist", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--ink);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: var(--orange); }
button { font-family: var(--font); cursor: pointer; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* ---------- Wordmark (locked spec) ---------- */
.wordmark { font-family: var(--font); white-space: nowrap; letter-spacing: -0.02em; }
.wordmark .insta { font-weight: 800; font-style: normal; }
.wordmark .space { font-weight: 600; font-style: italic; margin-left: -0.05em; }
.wordmark.sm { letter-spacing: 0; }

/* ---------- Layout ---------- */
.topbar {
  background: var(--aubergine);
  color: var(--cream);
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .brand { display: flex; align-items: center; gap: 12px; }
.topbar .icon { width: 30px; height: 30px; color: var(--cream); }
.topbar .wordmark { font-size: 24px; color: var(--cream); }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.who { text-align: right; line-height: 1.15; }
.who .name { font-weight: 700; font-size: 14px; }
.who .role { font-size: 12px; color: #c9bcd6; }
.badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; border: 1px solid currentColor;
}
.badge.admin { color: var(--orange); }
.badge.director { color: #ffd9c9; }
.badge.member { color: #c9bcd6; }

.container { max-width: 1180px; margin: 0 auto; padding: 26px 22px 80px; }

.tabs { display: flex; gap: 6px; margin: 0 0 22px; flex-wrap: wrap; }
.tab {
  background: transparent; border: 1px solid transparent; color: var(--ink-soft);
  padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 14px;
}
.tab.active { background: var(--aubergine); color: var(--cream); }
.tab:hover:not(.active) { background: var(--surface-2); }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .cols-4, .cols-3, .cols-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.section-title { font-size: 13px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-soft); margin: 28px 0 12px; }

/* stat tiles */
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); }
.stat .label { font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-soft); }
.stat .value { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin-top: 6px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.accent { background: var(--aubergine); color: var(--cream); border-color: var(--aubergine); }
.stat.accent .label, .stat.accent .sub { color: #c9bcd6; }
.stat.alert .value { color: var(--crimson); }

/* readiness strip (signature element) */
.readiness {
  background: linear-gradient(135deg, var(--aubergine), #3d1d5c);
  color: var(--cream); border-radius: var(--radius); padding: 22px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  box-shadow: var(--shadow); flex-wrap: wrap;
}
.readiness .headline { font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: #d9cbe6; }
.readiness .big { font-size: 44px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.readiness .meter { flex: 1; min-width: 240px; }
.meter-track { height: 12px; border-radius: 999px; background: rgba(255,255,255,0.16); overflow: hidden; }
.meter-fill { height: 100%; background: var(--orange); border-radius: 999px; transition: width .5s ease; }

/* ---------- Tasks ---------- */
.task {
  background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--st-notstarted);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 14px;
}
.task.s-progress { border-left-color: var(--st-progress); }
.task.s-blocked { border-left-color: var(--st-blocked); }
.task.s-done { border-left-color: var(--st-done); }
.task .head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.task .title { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.task .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); }
.pill.p0 { background: #fdeaef; color: var(--crimson); border-color: #f6c7d3; }
.pill.p1 { background: #fdeee7; color: var(--orange); border-color: #f8d2c2; }
.pill.dept { background: #efe9f3; color: var(--aubergine); border-color: #ddd0e6; }
.task .desc { font-size: 13.5px; color: var(--ink-soft); margin: 10px 0; }
.task .owners { font-size: 12px; color: var(--muted); }

.progress-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.progress { flex: 1; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--orange); border-radius: 999px; }
.progress.done > span { background: var(--aubergine); }
.progress-num { font-size: 12px; font-weight: 800; color: var(--ink-soft); min-width: 38px; text-align: right; }

.milestones { list-style: none; padding: 0; margin: 8px 0 0; }
.milestones li { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13.5px; }
.milestones input { width: 17px; height: 17px; accent-color: var(--aubergine); cursor: pointer; }
.milestones li.done span { text-decoration: line-through; color: var(--muted); }

.status-select { font-family: var(--font); font-weight: 700; font-size: 13px;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: var(--surface); color: var(--ink); }

.updates { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.update { font-size: 12.5px; color: var(--ink-soft); padding: 4px 0; }
.update .by { font-weight: 700; color: var(--ink); }
.update .at { color: var(--muted); }
.update-row { display: flex; gap: 8px; margin-top: 8px; }
.update-row input { flex: 1; }

/* inputs + buttons */
input[type=text], input[type=password], input[type=date], select, textarea {
  font-family: var(--font); font-size: 14px; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); width: 100%;
}
textarea { resize: vertical; min-height: 64px; }
label { font-size: 12px; font-weight: 700; color: var(--ink-soft); display: block; margin-bottom: 5px; }
.field { margin-bottom: 12px; }

.btn { border: none; border-radius: 999px; padding: 9px 18px; font-weight: 800; font-size: 14px; }
.btn.primary { background: var(--orange); color: #fff; }
.btn.primary:hover { background: #e0571f; }
.btn.dark { background: var(--aubergine); color: var(--cream); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--crimson); border: 1px solid #f6c7d3; }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }

/* table */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
tr:last-child td { border-bottom: none; }
.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; min-width: 90px; }
.bar > span { display: block; height: 100%; background: var(--orange); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 70% -10%, #3d1d5c, var(--aubergine)); }
.login-card { background: var(--surface); border-radius: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.35);
  width: 100%; max-width: 380px; padding: 34px 30px; }
.login-card .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.login-card .icon { width: 30px; height: 30px; color: var(--aubergine); }
.login-card .wordmark { font-size: 26px; color: var(--aubergine); }
.login-card .tag { font-size: 13px; color: var(--ink-soft); margin: 4px 0 22px; }
.login-card .btn { width: 100%; margin-top: 6px; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(42,18,64,.5); display: grid; place-items: center;
  padding: 20px; z-index: 50; }
.modal { background: var(--surface); border-radius: 18px; width: 100%; max-width: 520px;
  padding: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.3); max-height: 88vh; overflow: auto; }
.modal h3 { margin-top: 0; }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.cred {
  background: var(--surface-2); border: 1px dashed var(--orange); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-top: 12px; font-size: 14px;
}
.cred code { font-weight: 800; color: var(--aubergine); font-size: 15px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--aubergine); color: var(--cream); padding: 11px 18px; border-radius: 999px;
  font-weight: 700; font-size: 14px; box-shadow: var(--shadow); z-index: 60; }

.error { color: var(--crimson); font-size: 13px; font-weight: 700; margin-top: 8px; min-height: 18px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; font-weight: 600; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); margin-top: 10px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: -1px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
