:root {
  --ink: #1c1228;
  --muted: #5c5670;
  --line: #e0d9ce;
  --paper: #f3eee6;
  --card: #fffdf9;
  --navy: #280848;
  --navy-2: #1a062e;
  --accent: #e85a38;
  --accent-hover: #d14c2d;
  --ok: #2f7d4a;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
}

a { color: var(--navy); }
h1 { margin: 0 0 0.3rem; font-size: 1.5rem; font-weight: 650; }
h2 { font-weight: 650; }

.brand-logo { display: block; height: auto; }
.brand-logo-nav { width: 168px; }
.brand-logo-login { width: 220px; }

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.nav {
  background: var(--navy-2);
  color: #f4efe8;
  padding: 1.35rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.4rem;
  text-decoration: none;
  color: inherit;
}
.brand-name {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #cbb8a2;
  font-weight: 600;
}
.nav-link {
  color: #e8e0d4;
  text-decoration: none;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
}
.nav-link.is-active, .nav-link:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-foot { margin-top: auto; padding-top: 1.5rem; font-size: 0.85rem; }
.nav-foot a, .link-btn { color: #d9cfc2; }
.who { display: flex; flex-direction: column; margin-bottom: 0.75rem; }
.who span { color: #b5a394; font-size: 0.8rem; }
.link-btn {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline;
}

.main { padding: 1.75rem 2rem 3rem; }
.page { max-width: 72rem; }
.page-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  margin-bottom: 1.35rem;
}
.lede { margin: 0; color: var(--muted); max-width: 42rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: 0.58rem 1.05rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--accent-hover); }
.btn-ghost {
  background: #fff; color: var(--navy); border: 1px solid var(--line);
}
.btn-ghost:hover { background: #f7f1e8; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.card, .table-wrap, .filters, .inline-add {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card { padding: 1.2rem 1.25rem; }

.filters, .inline-add {
  display: flex; gap: 0.65rem; flex-wrap: wrap; padding: 0.85rem;
  margin-bottom: 1rem; align-items: center;
}
.inline-add input {
  flex: 1;
  min-width: 16rem;
  width: auto;
}
.filters input, .filters select,
label input, label select, label textarea {
  width: 100%;
  font: inherit;
  padding: 0.52rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.filters input[type="search"] { min-width: 16rem; flex: 1; width: auto; }
.filters select { min-width: 10rem; width: auto; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(232, 90, 56, 0.35);
  border-color: var(--accent);
}

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.cell-link {
  display: block;
  margin: -0.75rem -0.9rem;
  padding: 0.75rem 0.9rem;
  color: inherit;
  text-decoration: none;
}
tbody tr:hover { background: #f8f3ea; }
.issue { max-width: 28rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
.empty { color: var(--muted); padding: 0.4rem 0; }

.pri {
  display: inline-block; min-width: 3.4rem; text-align: center;
  font-size: 0.75rem; font-weight: 700; padding: 0.18rem 0.45rem; border-radius: 999px;
  background: #ececec;
}
.pri-high { background: #f4d0c4; color: #8a2b12; }
.pri-medium { background: #f6e3b8; color: #7a5208; }
.pri-low { background: #d5eadc; color: #215c35; }

.stage { font-weight: 600; font-size: 0.9rem; }

.form-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.95rem 1.1rem;
}
.span-2 { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.88rem; font-weight: 600; }
.steps {
  border: 1px dashed var(--line); border-radius: 8px; padding: 0.85rem 1rem;
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem;
}
.steps legend { padding: 0 0.35rem; color: var(--muted); }
.check { flex-direction: row; align-items: center; font-weight: 500; gap: 0.45rem; }
.check input { width: auto; }
.form-actions { display: flex; align-items: center; gap: 1rem; margin-top: 0.35rem; }

.flash {
  padding: 0.75rem 0.95rem; border-radius: 8px; margin: 0 0 1rem;
}
.flash-ok { background: #dcefe3; color: #215c35; }
.flash-alert, .alert { background: #f8e1db; color: #7a2a18; padding: 0.75rem 0.95rem; border-radius: 8px; }

.section-title { font-size: 1.08rem; margin: 1.5rem 0 0.65rem; }
.action-panel h2, .card > h2 { margin: 0 0 0.45rem; font-size: 1.08rem; }
.action-panel p { color: var(--muted); }
.action-panel .btn { margin: 0.4rem 0.45rem 0 0; }
.action-panel form { display: inline; }
.note-list { margin: 0.75rem 0 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.9rem; }

.queue-box {
  background: #f7f1e6;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.95rem;
}
.queue-list { margin: 0.35rem 0 0; padding-left: 1.25rem; }

.stepper {
  list-style: none;
  margin: 0 0 1.35rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  gap: 0.55rem;
}
.stepper li {
  padding: 0;
  min-height: 4.6rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.step-card {
  display: flex; gap: 0.55rem; align-items: flex-start;
  padding: 0.7rem 0.75rem; min-height: 4.6rem; width: 100%;
  color: inherit; text-decoration: none;
}
a.step-card:hover { background: #f8f3ea; }
.stepper em { display: block; font-style: normal; color: var(--muted); font-size: 0.78rem; font-weight: 500; }
.step-owner { display: block; margin-top: 0.2rem; font-size: 0.72rem; font-weight: 600; color: var(--navy); }
.stepper .is-todo { opacity: 0.55; }
.stepper .is-todo .step-owner { color: var(--muted); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem 1rem; }
.facts div { margin: 0; }
.facts dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.facts dd { margin: 0.2rem 0 0; }
.created-user code {
  font-size: 1.05rem; background: #fff; padding: 0.15rem 0.4rem; border-radius: 4px;
}
.step-num {
  flex: none; width: 1.45rem; height: 1.45rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.75rem; font-weight: 700;
  background: #d5dde6; color: var(--ink);
}
.stepper .is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.stepper .is-current .step-num { background: var(--accent); color: #fff; }
.stepper .is-done .step-num { background: var(--ok); color: #fff; }
.findings-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.findings-head .section-title { margin: 1.25rem 0; }
.finding-card { margin-bottom: 0.75rem; }
.finding-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }
.photo-row, .photo-keep { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.photo-row img, .keep-photo img { width: 7.5rem; height: 7.5rem; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.keep-photo { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; font-weight: 500; font-size: 0.75rem; }

.cost-table td { padding: 0.45rem 0.5rem; }
.cost-table input { width: 100%; font: inherit; padding: 0.45rem 0.5rem; border: 1px solid var(--line); border-radius: 6px; }
.cost-table td:nth-child(2),
.cost-table td:nth-child(3),
.cost-table td:nth-child(4),
.cost-table td:nth-child(5) { width: 7.2rem; }
.cost-table tfoot td { font-weight: 700; padding: 0.8rem 0.9rem; }
.finding-read p { margin: 0.25rem 0; }

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: linear-gradient(165deg, var(--navy-2), #3a1766);
}
.login-card {
  width: min(26rem, 100%);
  background: var(--card);
  padding: 1.8rem 1.6rem;
  border-radius: 14px;
  display: flex; flex-direction: column; gap: 0.9rem;
  box-shadow: 0 18px 40px rgba(26, 6, 46, 0.28);
}
.login-brand { margin-bottom: 0.15rem; }
.login-brand .brand-name { color: var(--muted); }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .form-grid, .steps, .facts { grid-template-columns: 1fr; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .brand { width: 100%; margin-bottom: 0.5rem; }
  .nav-foot { width: 100%; }
  .main { padding: 1.2rem 1rem 2rem; }
}
