:root {
  --bg: #f5f7f4;
  --panel: #ffffff;
  --panel-2: #eef3f1;
  --line: #d8dfdc;
  --ink: #263238;
  --muted: #66756f;
  --teal: #087f7a;
  --teal-weak: #d9eeee;
  --blue: #2764a7;
  --blue-weak: #dbe8f6;
  --coral: #b55353;
  --coral-weak: #f3dfdc;
  --amber: #ba7c14;
  --amber-weak: #f4e8cf;
  --green: #2f7d4f;
  --shadow: 0 14px 34px rgba(38, 50, 56, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0) 240px),
    var(--bg);
}

.public-site {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(8, 127, 122, 0.12), rgba(39, 100, 167, 0.1)),
    var(--bg);
}

.public-hero {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.public-panel {
  width: min(560px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(28px, 5vw, 44px);
}

.public-panel h1,
.public-panel p {
  margin: 0;
}

.public-panel .brand-mark {
  margin-bottom: 22px;
}

.public-panel h1 {
  font-size: clamp(2.3rem, 7vw, 4rem);
  line-height: 1;
  margin-bottom: 14px;
}

.public-panel > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.45;
  max-width: 28rem;
}

.public-cta {
  margin-top: 28px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--blue);
}

[hidden] {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(8, 127, 122, 0.12), rgba(39, 100, 167, 0.08)),
    var(--bg);
}

.login-panel {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-panel h1,
.login-panel p {
  margin: 0;
}

.login-panel h1 {
  font-size: 2rem;
  line-height: 1.1;
  margin-top: 16px;
}

.login-panel p {
  color: var(--muted);
  margin-top: 8px;
  margin-bottom: 22px;
}

.login-panel label,
.field label,
.field-full label {
  color: var(--muted);
  display: grid;
  gap: 7px;
  font-size: 0.85rem;
  font-weight: 700;
}

.login-panel input,
.field input,
.field select,
.field textarea,
.field-full input,
.field-full select,
.field-full textarea,
.search-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  min-height: 42px;
  padding: 10px 12px;
  outline: none;
}

.login-panel input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus,
.field-full input:focus,
.field-full select:focus,
.field-full textarea:focus,
.search-field input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 127, 122, 0.14);
}

.login-panel label + label {
  margin-top: 14px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border: 1px solid rgba(8, 127, 122, 0.24);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--teal);
  background: var(--teal-weak);
}

.brand-mark svg {
  width: 32px;
  height: 32px;
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
}

.brand-mark.small svg {
  width: 26px;
  height: 26px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  padding: 20px 16px;
  background: #fbfcfb;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 0;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px;
}

.brand-row strong,
.brand-row span {
  display: block;
}

.brand-row strong {
  font-size: 1rem;
}

.brand-row span {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  padding: 9px 11px;
  text-align: left;
}

.nav-button:hover {
  background: var(--panel-2);
  color: var(--ink);
}

.nav-button.active {
  background: var(--ink);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}

.main {
  min-width: 0;
  padding: 24px clamp(16px, 3vw, 34px) 42px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.topbar h2,
.project-strip h3,
.modal h3 {
  margin: 0;
}

.topbar h2 {
  font-size: 1.75rem;
  line-height: 1.15;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.search-field {
  min-width: 250px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 0 12px;
}

.search-field input {
  min-height: 40px;
  border: 0;
  padding-left: 0;
  box-shadow: none !important;
}

.search-field svg,
.nav-button svg,
.button svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button,
.icon-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  min-height: 40px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 13px;
  font-weight: 750;
}

.button:hover,
.icon-button:hover {
  border-color: #b7c4be;
  background: #f9fbfa;
}

.button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.button.primary:hover {
  background: #076b66;
}

.button.subtle {
  background: var(--panel-2);
}

.button.danger {
  color: var(--coral);
}

.icon-button {
  width: 40px;
  display: grid;
  place-items: center;
  padding: 0;
}

.project-strip {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 104px;
  padding: 12px 16px 12px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 6px 18px rgba(38, 50, 56, 0.05);
  margin-bottom: 18px;
}

.project-strip h3 {
  font-size: 1.1rem;
  line-height: 1.25;
}

.blueprint-card {
  width: 80px;
  height: 80px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--blue-weak);
  border: 1px solid #c6d8eb;
}

.blueprint-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.focus-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
  white-space: nowrap;
}

.pill.high {
  background: var(--coral-weak);
  color: var(--coral);
}

.pill.medium {
  background: var(--amber-weak);
  color: var(--amber);
}

.pill.ok {
  background: var(--teal-weak);
  color: var(--teal);
}

.content {
  min-width: 0;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.item-card,
.detail-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel {
  padding: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-header h3,
.panel-header h4,
.stat-card h3,
.item-card h4,
.detail-panel h3 {
  margin: 0;
}

.panel-header h3 {
  font-size: 1.05rem;
}

.stat-card {
  min-height: 112px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  align-content: space-between;
}

.stat-card strong {
  font-size: 2rem;
  line-height: 1;
}

.stat-card span {
  color: var(--muted);
  font-weight: 700;
}

.stat-card.teal {
  border-color: #b8d8d5;
  background: var(--teal-weak);
}

.stat-card.blue {
  border-color: #bed2eb;
  background: var(--blue-weak);
}

.stat-card.amber {
  border-color: #ead5ac;
  background: var(--amber-weak);
}

.stat-card.coral {
  border-color: #e2bdb8;
  background: var(--coral-weak);
}

.list {
  display: grid;
  gap: 10px;
}

.item-card {
  padding: 12px;
  display: grid;
  gap: 9px;
}

.item-card.clickable {
  appearance: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  width: 100%;
}

.item-card.clickable:hover {
  border-color: #b7c4be;
  background: #fbfcfb;
}

.item-card.clickable:focus-visible {
  outline: 3px solid rgba(8, 127, 122, 0.2);
  outline-offset: 2px;
}

.item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.item-card h4 {
  font-size: 0.98rem;
  line-height: 1.25;
}

.muted {
  color: var(--muted);
}

.meta-row,
.card-actions,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.meta-row {
  color: var(--muted);
  font-size: 0.86rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  background: var(--panel-2);
  color: var(--muted);
}

.tag.open {
  background: var(--blue-weak);
  color: var(--blue);
}

.tag.done {
  background: var(--teal-weak);
  color: var(--teal);
}

.tag.high {
  background: var(--coral-weak);
  color: var(--coral);
}

.tag.waiting {
  background: var(--amber-weak);
  color: var(--amber);
}

.party-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal);
  flex: 0 0 auto;
}

.progress {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel-2);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.checklist {
  display: grid;
  gap: 7px;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--ink);
  font-size: 0.92rem;
}

.check-item input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--teal);
}

.check-item.done span {
  color: var(--muted);
  text-decoration: line-through;
}

.linked-documents {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.linked-document-list {
  display: grid;
  gap: 8px;
}

.linked-document {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
}

.linked-document strong,
.linked-document span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.linked-document span {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.calendar-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.calendar-title {
  font-size: 1.12rem;
  font-weight: 850;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.weekday,
.day-cell {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.weekday:nth-child(7n),
.day-cell:nth-child(7n) {
  border-right: 0;
}

.weekday {
  min-height: 34px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
}

.day-cell {
  min-height: 118px;
  padding: 8px;
  border-top: 1px solid var(--line);
  display: grid;
  align-content: start;
  gap: 6px;
}

.day-cell.outside {
  background: #f9faf9;
  color: #9aa6a1;
}

.day-number {
  font-weight: 850;
  font-size: 0.82rem;
}

.calendar-event {
  display: grid;
  gap: 2px;
  width: 100%;
  border: 0;
  border-left: 3px solid var(--teal);
  border-radius: 6px;
  background: var(--teal-weak);
  color: var(--ink);
  padding: 5px 6px;
  text-align: left;
  font-size: 0.76rem;
  line-height: 1.2;
}

.calendar-event.appointment {
  border-left-color: var(--blue);
  background: var(--blue-weak);
}

.calendar-event.deadline.high {
  border-left-color: var(--coral);
  background: var(--coral-weak);
}

.calendar-event strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.split-view {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
}

.party-list {
  display: grid;
  gap: 8px;
}

.party-button {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  min-height: 58px;
  padding: 10px;
}

.party-button.active,
.party-button:hover {
  border-color: #b7c4be;
  background: var(--panel-2);
}

.party-button strong,
.party-button span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-button span {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.detail-panel {
  padding: 18px;
}

.record-detail {
  display: grid;
  gap: 14px;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.detail-title {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}

.detail-title h3 {
  overflow-wrap: anywhere;
}

.detail-title .party-dot {
  width: 14px;
  height: 14px;
  margin-top: 13px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.info-box {
  min-height: 66px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfb;
}

.info-box span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.detail-section {
  display: grid;
  gap: 10px;
}

.detail-section .panel-header {
  margin-bottom: 0;
}

.text-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  display: inline;
  font: inherit;
  font-weight: 750;
  padding: 0;
  text-align: left;
}

.text-button:hover {
  text-decoration: underline;
}

.table-like {
  display: grid;
  gap: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.3fr) minmax(100px, 0.8fr) minmax(120px, 0.8fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.table-row:last-child {
  border-bottom: 0;
}

.table-row strong,
.table-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.empty-state {
  border: 1px dashed #b9c5c0;
  border-radius: var(--radius);
  padding: 18px;
  color: var(--muted);
  background: #fbfcfb;
  text-align: center;
}

.modal {
  width: min(720px, calc(100% - 28px));
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(24, 33, 37, 0.42);
}

.modal-panel {
  background: #fff;
  border: 1px solid var(--line);
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
}

.modal-header {
  border-bottom: 1px solid var(--line);
}

.modal-actions {
  border-top: 1px solid var(--line);
  justify-content: space-between;
}

.modal-save-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.modal-delete[hidden] {
  display: none;
}

.modal-body {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-full {
  grid-column: 1 / -1;
}

textarea {
  resize: vertical;
  min-height: 92px;
}

.form-help {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.form-error {
  min-height: 20px;
  color: var(--coral);
  font-weight: 750;
  margin: 10px 18px 0;
}

.login-panel .form-error {
  margin: 12px 0 0;
}

.inline-message {
  margin: 8px 0 0;
}

.inline-message.success {
  color: var(--green);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1120px) {
  .grid.stats,
  .grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid.two,
  .split-view {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .search-field {
    flex: 1;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-button {
    justify-content: center;
    text-align: center;
  }

  .sidebar-footer {
    display: none;
  }

  .project-strip {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .focus-pills {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .blueprint-card {
    width: 64px;
    height: 64px;
  }

  .calendar-grid {
    min-width: 720px;
  }

  .panel.calendar-panel {
    overflow-x: auto;
  }

  .table-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

@media (max-width: 620px) {
  .main {
    padding-inline: 12px;
  }

  .topbar-actions,
  .quick-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .search-field {
    min-width: 0;
  }

  .grid.stats,
  .grid.three,
  .form-grid,
  .info-grid,
  .linked-document {
    grid-template-columns: 1fr;
  }

  .detail-header {
    flex-direction: column;
  }

  .detail-header .inline-actions {
    width: 100%;
  }

  .detail-header .inline-actions .button {
    flex: 1;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
