:root {
  --blue-900: #0b2f63;
  --blue-800: #10447f;
  --blue-700: #1459a6;
  --blue-600: #1e6bc3;
  --blue-500: #2f7ed8;
  --blue-100: #eaf3ff;
  --blue-50: #f5f9ff;
  --ink: #19324d;
  --muted: #63788e;
  --line: #dbe5ef;
  --surface: #ffffff;
  --bg: #f3f7fb;
  --danger: #c73c4c;
  --danger-bg: #fff0f2;
  --success: #1c7a55;
  --shadow: 0 14px 40px rgba(29, 64, 103, .10);
}

* { box-sizing: border-box; }
html { font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--ink); }
body { margin: 0; min-height: 100vh; background: var(--bg); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(47,126,216,.18), transparent 35%),
    linear-gradient(135deg, #f8fbff, #edf5ff);
}

.login-card {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid rgba(30,107,195,.10);
  border-radius: 22px;
  padding: 34px;
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  color: #fff; font-weight: 800; letter-spacing: -.04em;
  background: linear-gradient(135deg, var(--blue-700), var(--blue-500));
}
.brand strong, .brand span { display: block; }
.brand strong { font-size: 14px; }
.brand span { margin-top: 2px; font-size: 12px; color: var(--muted); }
.brand-login { margin-bottom: 36px; }
.login-copy h1 { margin: 0 0 10px; font-size: 28px; }
.login-copy p { margin: 0 0 26px; color: var(--muted); line-height: 1.6; }

.form-stack { display: grid; gap: 18px; }
.form-stack label, .form-field { display: grid; gap: 8px; }
.form-stack label > span, .form-field > span { font-size: 13px; font-weight: 600; }
.form-field b, legend b { color: var(--danger); }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 13px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(47,126,216,.12);
}
textarea { resize: vertical; line-height: 1.5; }
small { color: var(--muted); }
.prototype-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.btn {
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 700;
  transition: .2s ease;
}
.btn-primary { background: var(--blue-700); color: #fff; }
.btn-primary:hover { background: var(--blue-800); transform: translateY(-1px); }
.btn-secondary { background: var(--blue-100); color: var(--blue-800); }
.btn-secondary:hover { background: #dcecff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--blue-50); color: var(--blue-800); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-full { width: 100%; }

.topbar {
  height: 72px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip strong, .user-chip span { display: block; }
.user-chip strong { font-size: 13px; }
.user-chip span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  color: var(--blue-800); background: var(--blue-100); font-size: 12px; font-weight: 800;
}

.main-content { width: min(1240px, calc(100% - 40px)); margin: 32px auto 60px; }
.page-heading { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 24px; }
.page-heading h1 { font-size: 30px; margin: 3px 0 8px; letter-spacing: -.03em; }
.page-heading p:not(.eyebrow) { margin: 0; color: var(--muted); }
.eyebrow { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--blue-600); font-weight: 800; }
.summary-card {
  min-width: 155px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); box-shadow: 0 8px 22px rgba(29,64,103,.06);
}
.summary-card span { color: var(--muted); display: block; font-size: 12px; }
.summary-card strong { margin-top: 5px; display: block; font-size: 28px; color: var(--blue-800); }

.calendar-card, .day-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(29,64,103,.07);
}
.calendar-card { padding: 22px; }
.calendar-toolbar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 12px; margin-bottom: 20px; }
.calendar-title { display: flex; align-items: center; justify-content: center; gap: 14px; }
.calendar-title h2 { margin: 0; font-size: 20px; text-transform: capitalize; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--blue-800); font-size: 28px; line-height: 1;
}
.icon-btn:hover { background: var(--blue-50); }
.weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays { border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; overflow: hidden; background: var(--blue-50); }
.weekdays span { padding: 11px 8px; text-align: center; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.calendar-grid { border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.calendar-day {
  min-height: 116px;
  padding: 10px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  text-align: left;
  position: relative;
  color: var(--ink);
  transition: background .18s;
}
.calendar-day:hover { background: var(--blue-50); }
.calendar-day.other-month { background: #fbfcfd; color: #9ba9b7; }
.calendar-day.today .day-number { background: var(--blue-700); color: #fff; }
.calendar-day.selected { outline: 2px solid var(--blue-500); outline-offset: -2px; z-index: 2; }
.day-number {
  width: 29px; height: 29px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}
.day-status { margin-top: 16px; display: grid; gap: 5px; }
.status-pill {
  width: fit-content; max-width: 100%; padding: 5px 7px; border-radius: 6px;
  background: var(--blue-100); color: var(--blue-800); font-size: 10px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.evidence-dot { font-size: 10px; color: var(--muted); }

.day-panel { margin-top: 24px; padding: 24px; }
.empty-state-panel { text-align: center; padding: 46px 24px; }
.empty-icon { width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-100); color: var(--blue-700); font-weight: 800; }
.empty-state-panel h2 { margin: 0 0 7px; font-size: 18px; }
.empty-state-panel p { margin: 0; color: var(--muted); }
.day-panel-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 18px; }
.day-panel-header h2 { margin: 4px 0 0; font-size: 21px; }
.activity-box { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--blue-50); }
.activity-box p { margin: 0; line-height: 1.7; white-space: pre-wrap; }
.activity-actions { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 12px; }
.mini-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 10px;
  color: var(--blue-800); font-weight: 700; font-size: 12px;
}
.mini-btn.danger { color: var(--danger); }
.mini-btn:disabled { opacity: .45; cursor: not-allowed; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 24px 0 12px; }
.section-title-row h3 { margin: 0; font-size: 16px; }
.evidence-list { display: grid; gap: 10px; }
.evidence-item {
  border: 1px solid var(--line); border-radius: 12px; padding: 15px;
  display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start;
}
.evidence-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.meta-tag { font-size: 10px; padding: 4px 7px; border-radius: 999px; background: var(--blue-100); color: var(--blue-800); font-weight: 700; }
.evidence-item p { margin: 0 0 8px; line-height: 1.55; }
.evidence-source { color: var(--muted); font-size: 12px; word-break: break-word; }
.evidence-source a { color: var(--blue-700); text-decoration: none; }
.item-actions { display: flex; gap: 6px; }
.empty-evidence { padding: 22px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; font-size: 13px; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(11,47,99,.42);
  padding: 22px; display: grid; place-items: center; backdrop-filter: blur(3px);
}
.modal {
  width: min(620px, 100%); max-height: calc(100vh - 44px); overflow: auto;
  background: #fff; border-radius: 18px; padding: 24px; box-shadow: 0 25px 70px rgba(11,47,99,.25);
}
.modal-large { width: min(760px, 100%); }
.modal-header { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.modal-header h2 { margin: 3px 0 5px; }
.modal-date { margin: 0; color: var(--muted); font-size: 13px; }
.modal-close { border: 0; background: var(--blue-50); width: 38px; height: 38px; border-radius: 10px; font-size: 24px; color: var(--blue-800); }
.form-grid { display: grid; gap: 14px; }
.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-field { margin-bottom: 18px; }
.form-field small { font-size: 11px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.split-actions { justify-content: space-between; }
.source-selector { border: 0; padding: 0; margin: 0 0 18px; }
.source-selector legend { margin-bottom: 9px; font-size: 13px; font-weight: 600; }
.radio-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.radio-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 13px; display: flex; align-items: flex-start; gap: 9px; cursor: pointer;
}
.radio-card:has(input:checked) { border-color: var(--blue-500); background: var(--blue-50); }
.radio-card input { width: auto; margin-top: 3px; }
.radio-card strong, .radio-card small { display: block; }
.radio-card strong { font-size: 13px; }
.radio-card small { margin-top: 3px; font-size: 11px; }
.upload-box {
  border: 1px dashed #9eb9d7; border-radius: 12px; background: var(--blue-50);
  min-height: 120px; display: grid; place-items: center; align-content: center; gap: 4px; text-align: center; padding: 20px; cursor: pointer;
}
.upload-box input { display: none; }
.upload-icon { font-size: 22px; color: var(--blue-700); }
.upload-box strong { color: var(--blue-800); font-size: 13px; }
.upload-box small { font-size: 11px; }
.source-area .prototype-note { margin-top: 8px; }

.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 300;
  transform: translateY(30px); opacity: 0; pointer-events: none;
  background: #163c63; color: #fff; border-radius: 10px; padding: 12px 16px;
  box-shadow: var(--shadow); font-size: 13px; transition: .25s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--danger); }

@media (max-width: 820px) {
  .topbar { height: auto; padding: 14px 18px; gap: 16px; align-items: flex-start; }
  .topbar-actions { gap: 8px; }
  .user-chip { display: none; }
  .main-content { width: min(100% - 24px, 1240px); margin-top: 22px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .summary-card { min-width: 0; width: 100%; }
  .calendar-card { padding: 12px; overflow-x: auto; }
  .weekdays, .calendar-grid { min-width: 700px; }
  .calendar-day { min-height: 98px; }
  .two-columns, .radio-cards { grid-template-columns: 1fr; }
  .split-actions { flex-direction: column; }
  .split-actions .btn { width: 100%; }
  .day-panel-header { align-items: stretch; flex-direction: column; }
  .evidence-item { grid-template-columns: 1fr; }
  .item-actions { justify-content: flex-end; }
}
