:root {
  --bg: #0a0a0c;
  --bg-soft: #101013;
  --surface: #17171b;
  --surface-2: #1e1e24;
  --text: #f4f0e8;
  --text-soft: #b6b1a5;
  --text-mute: #7d786f;
  --rust: #89cff0;
  --rust-deep: #3e8fc0;
  --amber: #c9ecff;
  --line: rgba(244, 240, 232, 0.09);
  --line-strong: rgba(244, 240, 232, 0.18);
  --glass: rgba(244, 240, 232, 0.035);
  --grad: linear-gradient(100deg, var(--rust), var(--amber));
  --display: "Space Grotesk", "Arial Narrow", sans-serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --green: #6ee7a0;
  --red: #f28b82;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100svh;
}

a { color: inherit; }

.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 180px 180px;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 0 6vw; position: relative; z-index: 1; }

h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; }

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.mark-sq {
  width: 20px;
  height: 20px;
  background: var(--grad);
  border-radius: 5px;
  position: relative;
  box-shadow: 0 0 16px rgba(137, 207, 240, 0.4);
  display: inline-block;
  vertical-align: middle;
}
.mark-sq::after { content: ""; position: absolute; inset: 5px; background: var(--bg); border-radius: 2px; }

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.btn-primary { background: var(--grad); color: #0a0a0c; box-shadow: 0 4px 20px -4px rgba(137, 207, 240, 0.35); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 14px 40px -8px rgba(137, 207, 240, 0.6); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-outline { background: var(--glass); color: var(--text); border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--rust); background: rgba(137, 207, 240, 0.1); }

.btn-sm { padding: 0.55rem 1.1rem; font-size: 0.76rem; }

/* ---------- Login page ---------- */

.login-shell {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: radial-gradient(ellipse 60% 45% at 80% 10%, rgba(137, 207, 240, 0.1), transparent 60%), var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2.6rem;
  position: relative;
  z-index: 1;
}

.login-card .brand-lockup { justify-content: center; margin-bottom: 1.8rem; }

.login-card h1 { font-size: 1.4rem; text-align: center; margin-bottom: 0.4rem; }
.login-card .sub { text-align: center; color: var(--text-soft); font-size: 0.88rem; margin-bottom: 1.8rem; }

.field { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 1.1rem; }
.field label { font-size: 0.75rem; font-weight: 600; color: var(--text-soft); }
.field input {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(244, 240, 232, 0.04);
  padding: 0.75rem 0.9rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--text);
}
.field input:focus { outline: none; border-color: var(--rust); }

.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 0.4rem; }

.form-error {
  background: rgba(242, 139, 130, 0.1);
  border: 1px solid rgba(242, 139, 130, 0.3);
  color: var(--red);
  font-size: 0.85rem;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  margin-bottom: 1.1rem;
  display: none;
}
.form-error.show { display: block; }

.demo-note {
  margin-top: 1.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--text-mute);
  text-align: center;
  line-height: 1.7;
}
.demo-note code {
  background: rgba(244, 240, 232, 0.06);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  color: var(--amber);
}

/* ---------- Dashboard ---------- */

header.dash-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem 6vw;
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.dash-user { font-size: 0.85rem; color: var(--text-soft); }
.dash-user strong { color: var(--text); }

main { padding: 3rem 0 6rem; position: relative; z-index: 1; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 2rem;
  margin-bottom: 1.6rem;
}

.panel h2 { font-size: 1.15rem; margin-bottom: 1.4rem; }

.eyebrow {
  font-family: var(--display);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rust);
  font-weight: 600;
  display: block;
  margin-bottom: 0.5rem;
}

.project-title { font-size: 1.5rem; margin-bottom: 0.3rem; }
.project-meta { color: var(--text-soft); font-size: 0.9rem; margin-bottom: 2rem; }
.project-meta a { color: var(--amber); text-decoration: none; }
.project-meta a:hover { text-decoration: underline; }

/* Phase stepper */

.stepper { display: flex; gap: 0.6rem; }
.step {
  flex: 1;
  text-align: center;
  padding: 0.9rem 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  font-size: 0.8rem;
  color: var(--text-mute);
  position: relative;
}
.step .num {
  display: block;
  font-family: var(--display);
  font-size: 0.75rem;
  color: var(--text-mute);
  margin-bottom: 0.3rem;
}
.step.done { border-color: rgba(137, 207, 240, 0.35); color: var(--text-soft); }
.step.done .num { color: var(--rust); }
.step.current {
  border-color: var(--rust);
  background: linear-gradient(180deg, rgba(137, 207, 240, 0.1), var(--bg-soft));
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(137, 207, 240, 0.2);
}
.step.current .num { color: var(--rust); }

/* Change requests */

.cr-item {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}
.cr-item:last-of-type { border-bottom: none; }
.cr-item h4 { font-size: 0.95rem; margin-bottom: 0.3rem; }
.cr-item p { font-size: 0.85rem; color: var(--text-soft); }
.cr-item .date { font-size: 0.72rem; color: var(--text-mute); margin-top: 0.4rem; }

.badge {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-submitted { background: rgba(244, 240, 232, 0.08); color: var(--text-soft); }
.badge-review { background: rgba(201, 236, 255, 0.12); color: var(--amber); }
.badge-completed { background: rgba(110, 231, 160, 0.12); color: var(--green); }
.badge-paid { background: rgba(110, 231, 160, 0.12); color: var(--green); }
.badge-unpaid { background: rgba(242, 139, 130, 0.12); color: var(--red); }

.cr-form { margin-top: 1.6rem; padding-top: 1.6rem; border-top: 1px solid var(--line); }
.cr-form textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(244, 240, 232, 0.04);
  padding: 0.75rem 0.9rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--text);
  resize: vertical;
  min-height: 80px;
}
.cr-form input:focus, .cr-form textarea:focus { outline: none; border-color: var(--rust); }

.cr-form-msg { font-size: 0.82rem; color: var(--amber); margin-top: 0.8rem; min-height: 1.2em; }

/* Invoices */

.inv-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
}
.inv-item:last-of-type { border-bottom: none; }
.inv-item .desc { font-size: 0.92rem; }
.inv-item .due { font-size: 0.76rem; color: var(--text-mute); margin-top: 0.25rem; }
.inv-item .amount { font-family: var(--display); font-size: 1.1rem; margin-right: 1rem; }
.inv-right { display: flex; align-items: center; gap: 0.9rem; }

.pay-msg {
  font-size: 0.82rem;
  color: var(--amber);
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  background: rgba(201, 236, 255, 0.06);
  border: 1px solid rgba(201, 236, 255, 0.18);
  border-radius: 10px;
  display: none;
}
.pay-msg.show { display: block; }

.loading-state, .empty-state {
  color: var(--text-mute);
  font-size: 0.88rem;
  text-align: center;
  padding: 2rem 0;
}

@media (max-width: 640px) {
  .stepper { flex-direction: column; }
  .cr-item, .inv-item { flex-direction: column; align-items: flex-start; }
  .inv-right { width: 100%; justify-content: space-between; }
}
