:root {
  --bg: #f6f3ee;
  --panel: #fffdf9;
  --panel-strong: #ffffff;
  --ink: #202123;
  --muted: #6c6f75;
  --line: #ded8cf;
  --rose: #b55a66;
  --rose-dark: #883f4d;
  --sage: #6f846c;
  --gold: #b58945;
  --blue: #4f6f91;
  --danger: #ad3f38;
  --shadow: 0 18px 55px rgba(55, 42, 31, .12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(181, 90, 102, .08), transparent 34%),
    linear-gradient(315deg, rgba(111, 132, 108, .10), transparent 40%),
    var(--bg);
  font-family: Inter, Segoe UI, system-ui, -apple-system, sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, .92);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--rose-dark);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(32px, 7vw, 54px);
  line-height: 1;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 17px;
}

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

.login-hint {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f5ef;
  color: var(--muted);
  font-size: 14px;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 16px;
  color: #424348;
  font-size: 14px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  outline: 0;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(181, 90, 102, .14);
}

.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 9px 14px;
  background: #ebe6dc;
  color: var(--ink);
  font-weight: 750;
  white-space: nowrap;
}

.btn.primary {
  background: var(--rose-dark);
  color: #fff;
}

.btn.ghost {
  border: 1px solid var(--line);
  background: transparent;
}

.btn.danger {
  background: #f4d9d6;
  color: var(--danger);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 249, .84);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 5px;
}

.brand-title {
  font-size: 21px;
  font-weight: 850;
}

.brand-note {
  color: var(--muted);
  font-size: 13px;
}

.menu-toggle {
  display: none;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: #4a4d52;
  text-align: left;
  font-weight: 750;
}

.nav button.active {
  background: #efe4de;
  color: var(--rose-dark);
}

.user-panel {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.role-pill,
.status,
.priority {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
}

.role-pill {
  background: #edf1e8;
  color: var(--sage);
}

.main {
  min-width: 0;
  padding: 28px;
}

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.wedding-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.wedding-summary .eyebrow {
  margin-bottom: 6px;
}

.wedding-summary h2 {
  font-size: 28px;
}

.wedding-countdown {
  min-width: 136px;
  display: grid;
  justify-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf7f1;
  padding: 12px;
}

.wedding-countdown span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.wedding-countdown strong {
  font-size: 34px;
  line-height: 1;
}

.metric,
.panel,
.item-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 249, .88);
}

.metric {
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 25px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, .8fr);
  gap: 18px;
}

.attention-panel {
  margin-bottom: 20px;
}

.attention-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.attention-card {
  min-height: 88px;
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 13px;
  text-align: left;
}

.attention-card strong {
  font-size: 14px;
}

.attention-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.attention-card.danger {
  border-color: #edc6c1;
  background: #fff7f6;
}

.attention-card.warn {
  border-color: #ecd3a9;
  background: #fff9ed;
}

.attention-card.info {
  border-color: #cbd8e3;
  background: #f6f9fb;
}

.panel {
  min-width: 0;
  padding: 18px;
}

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

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #ece8e0;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  background: #faf7f1;
  color: #53565c;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.status.idea,
.status.new,
.status.draft {
  background: #eef2f6;
  color: var(--blue);
}

.status.chosen,
.status.progress,
.status.invited {
  background: #f7ead4;
  color: #8a642c;
}

.status.paid,
.status.done,
.status.approved,
.status.confirmed {
  background: #edf1e8;
  color: var(--sage);
}

.status.cancelled,
.status.blocked,
.status.rejected,
.status.declined {
  background: #f7dedb;
  color: var(--danger);
}

.priority.high {
  background: #f7dedb;
  color: var(--danger);
}

.priority.medium {
  background: #f7ead4;
  color: #8a642c;
}

.priority.low {
  background: #edf1e8;
  color: var(--sage);
}

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

.item-card {
  display: grid;
  gap: 8px;
  padding: 14px;
}

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

.item-meta {
  color: var(--muted);
  font-size: 13px;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.task-summary {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf7f1;
}

.task-summary p {
  margin: 8px 0 0;
}

.comments {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

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

.comment-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.comment-card p {
  margin: 0;
  color: #3f4248;
  line-height: 1.45;
}

.expense-details {
  margin-top: 4px;
}

.expense-details summary {
  cursor: pointer;
  color: var(--rose-dark);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 0;
  user-select: none;
  list-style: none;
}

.expense-details summary::before {
  content: "▶ ";
  font-size: 11px;
}

.expense-details[open] summary::before {
  content: "▼ ";
}

.details-inner {
  margin-top: 12px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(29, 27, 25, .42);
}

.modal {
  width: min(720px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  padding: 20px;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.error {
  min-height: 22px;
  color: var(--danger);
  font-size: 14px;
  font-weight: 700;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

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

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

  .user-panel {
    margin-top: 0;
  }

  .metrics,
  .filters,
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .main,
  .sidebar {
    padding: 14px;
  }

  .login-screen {
    padding: 14px;
  }

  .login-card {
    padding: 18px;
  }

  h1 {
    font-size: 34px;
    line-height: 1.05;
  }

  .topbar,
  .panel-head,
  .item-row {
    display: grid;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 16px;
  }

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

  .nav button {
    min-height: 40px;
    justify-content: center;
    padding: 9px 8px;
    text-align: center;
  }

  .brand-title {
    font-size: 19px;
  }

  .brand {
    align-items: center;
  }

  .menu-toggle {
    display: inline-flex;
    min-height: 36px;
    padding: 7px 11px;
  }

  .sidebar .nav,
  .sidebar .user-panel {
    display: none;
  }

  .sidebar .nav.open {
    display: grid;
  }

  .sidebar.menu-open .user-panel {
    display: grid;
  }

  .toolbar,
  .row-actions,
  .actions {
    width: 100%;
  }

  .toolbar .btn,
  .actions .btn {
    flex: 1 1 140px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .metric,
  .panel {
    padding: 14px;
  }

  .wedding-summary {
    display: grid;
  }

  .wedding-summary h2 {
    font-size: 23px;
  }

  .wedding-countdown {
    width: 100%;
    justify-items: start;
  }

  .metric strong {
    font-size: 22px;
  }

  .filters {
    gap: 8px;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 10px 12px;
  }

  td {
    display: grid;
    grid-template-columns: minmax(108px, .45fr) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    min-height: 34px;
    padding: 8px 0;
    border-bottom: 1px solid #f0ece5;
    overflow-wrap: anywhere;
  }

  td:last-child {
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
  }

  td[colspan] {
    display: block;
  }

  td[colspan]::before {
    display: none;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    padding: 16px;
  }
}

@media (max-width: 420px) {
  .nav {
    grid-template-columns: 1fr;
  }

  td {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .btn {
    width: 100%;
  }
}
