:root {
  --ink: #243143;
  --muted: #6f7787;
  --line: #eadfdc;
  --paper: #fff6ee;
  --coral: #e84f45;
  --blue: #4d97e8;
  --gold: #f2b84b;
  --green: #5ba875;
  --pink: #ffe0e8;
  --cream: #fff1cf;
  --shadow: 0 20px 40px rgba(94, 70, 58, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(77, 151, 232, .16), transparent 34%),
    linear-gradient(315deg, rgba(232, 79, 69, .16), transparent 42%),
    var(--paper);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow);
}
.login-card form, .form-grid { display: grid; gap: 12px; }
.form-error {
  min-height: 20px;
  margin: 0;
  color: #b42318;
  font-size: 13px;
  font-weight: 800;
}
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 800; }
input, select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
}
input[type="file"] {
  padding: 14px;
  border-style: dashed;
  background: #fffdf9;
}
textarea { min-height: 96px; resize: vertical; }
button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, var(--coral), #d9743f);
  font-weight: 900;
  pointer-events: auto;
}

button:disabled {
  cursor: wait;
  opacity: .72;
}
.ghost {
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
}

.danger {
  color: #b42318;
  border-color: #ffd1ca;
  background: #fff5f2;
}
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, var(--coral), var(--blue));
}
.shell { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 100vh; }
aside {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: rgba(255,250,244,.9);
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); margin-top: 3px; }
nav { display: grid; gap: 7px; margin-bottom: 18px; }
nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}
nav button.active {
  color: var(--ink);
  background: linear-gradient(90deg, white, var(--cream));
  box-shadow: 0 8px 20px rgba(217, 116, 63, .14);
}
main { min-width: 0; }
header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 24px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,246,238,.9);
  backdrop-filter: blur(16px);
}
.eyebrow {
  margin: 0 0 5px;
  color: #d9743f;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 4vw, 44px); }
#content { padding: 28px 32px 48px; }
.grid { display: grid; gap: 16px; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel, .card, .metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow);
}
.panel { padding: 18px; }
.card, .metric { padding: 14px; box-shadow: none; }
.metric strong { display: block; margin-top: 8px; font-size: 30px; }
.muted, .card p, .metric span, .metric small { color: var(--muted); }
.pill, .tag {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  color: #236544;
  background: #def5e6;
}
.tag.review { color: #405f83; background: #dcecff; }
.tag.risk { color: #8a3d31; background: #ffe0e8; }
.list { display: grid; gap: 10px; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-heading h2 { margin: 0; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.day {
  min-height: 130px;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 0;
  text-align: left;
  font-weight: 500;
  cursor: pointer;
}
.day-number {
  min-height: 24px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  text-align: left;
}

.day.selected {
  box-shadow: inset 0 0 0 2px var(--coral);
  background: #fffafa;
}
.event-card {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 7px;
  border: 1px solid #e7ebf0;
  border-radius: 6px;
  background: linear-gradient(135deg, white, #edf6ff);
  color: var(--ink);
  font-size: 12px;
  text-align: left;
  font-weight: 500;
}
.workflow { display: flex; gap: 8px; overflow-x: auto; }
.workflow span,
.workflow button { white-space: nowrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: 999px; background: white; font-size: 12px; font-weight: 900; color: var(--ink); min-height: 34px; }
.inline-form,
.edit-form,
.subpanel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, white, rgba(220, 236, 255, .42));
}

.action-card {
  display: grid;
  gap: 10px;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.row-actions button,
.action-card button {
  min-height: 34px;
  padding: 0 10px;
}
.clickable-panel {
  cursor: pointer;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.clickable-panel:hover {
  border-color: rgba(107, 92, 231, .35);
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(44, 51, 71, .10);
}
.detail-panel {
  margin-top: 16px;
  border-color: rgba(107, 92, 231, .24);
}
.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar label {
  min-width: min(320px, 100%);
  flex: 1;
}
.summary-box {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid rgba(91, 168, 117, .24);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #f0fbf5);
}
.summary-box h3 { margin-bottom: 8px; }
.summary-box p { margin: 0; color: var(--ink); line-height: 1.55; }
.score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}
.check-row input {
  width: auto;
  min-height: auto;
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  aside { position: static; height: auto; }
  .two, .three, .calendar, .score-grid, .check-grid { grid-template-columns: 1fr; }
  header { flex-direction: column; align-items: stretch; }
}
