:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-soft: #eef3ef;
  --surface-warn: #fdf6e8;
  --text: #17211c;
  --muted: #65736b;
  --border: #d9e0dc;
  --border-strong: #b8c4bd;
  --accent: #276b52;
  --accent-dark: #184a38;
  --danger: #9a3412;
  --danger-soft: #fdecdf;
  --pending: #8a5a00;
  --shadow: 0 6px 18px rgba(26, 43, 34, 0.06);
  --shadow-strong: 0 10px 26px rgba(26, 43, 34, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-header {
  align-items: center;
  background: rgba(245, 247, 246, 0.94);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.brand {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  gap: 12px;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-weight: 700;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.brand strong {
  font-weight: 600;
}

.brand small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  line-height: 1.25;
}

nav {
  align-items: center;
  display: flex;
  gap: 18px;
}

nav a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

nav a.active {
  color: var(--text);
}

.auth-controls,
.auth-state {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.auth-user {
  color: var(--muted);
  font-size: 12px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main {
  flex: 1 0 auto;
  padding: 36px 20px 56px;
}

.app-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  padding: 18px 28px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.app-footer a {
  color: var(--muted);
  margin-right: 16px;
}

.workspace {
  display: grid;
  gap: 22px;
  margin: 0 auto;
  max-width: 1080px;
  min-width: 0;
  width: 100%;
}

.workspace.narrow {
  max-width: 760px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  min-width: 0;
  padding: 24px;
  width: 100%;
}

.hero-panel,
.split {
  align-items: start;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
}

.section-label {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(26px, 3.4vw, 36px);
  font-weight: 600;
  line-height: 1.1;
  max-width: 720px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}

.lede {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
  margin: 12px 0 0;
  max-width: 680px;
}

.trust-box,
.confirm-box,
.not-shared,
.sender-box,
.report-box {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.trust-box strong,
.confirm-box strong,
.not-shared strong,
.sender-box strong,
.report-box strong {
  font-weight: 600;
}

.trust-box p,
.confirm-box p,
.sender-box p,
.report-box p {
  color: var(--muted);
  line-height: 1.5;
  margin: 6px 0 0;
}

.report-box {
  background: var(--danger-soft);
  border-color: #f1c8b1;
}

.report-box a {
  color: var(--danger);
  font-weight: 600;
}

.inline-report {
  margin-top: 10px;
}

.sender-box dl {
  margin: 10px 0 0;
  display: grid;
  gap: 6px;
}

.sender-box dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.sender-box dd {
  margin: 0;
  font-size: 14px;
}

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

.span-2 {
  grid-column: span 2;
}

label {
  align-content: start;
  color: var(--text);
  display: grid;
  font-size: 13px;
  font-weight: 600;
  gap: 6px;
}

input,
textarea,
select {
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  min-height: 42px;
  padding: 9px 12px;
  width: 100%;
}

textarea {
  line-height: 1.45;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(39, 107, 82, 0.15);
  outline: none;
}

.hint,
.field-note,
.muted {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.hint {
  font-weight: 500;
}

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

.actions .spacer {
  flex: 1 0 auto;
}

button,
.button-link {
  align-items: center;
  background: var(--accent);
  border: 0;
  border-radius: 7px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 600;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
}

.small-button {
  min-height: 32px;
  padding: 7px 11px;
}

button:hover,
.button-link:hover {
  background: var(--accent-dark);
  text-decoration: none;
}

button.secondary,
.button-link.secondary {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}

button.secondary:hover,
.button-link.secondary:hover {
  background: var(--surface-soft);
}

button.danger-link,
.button-link.danger-link {
  background: transparent;
  border: 1px solid #f1c8b1;
  color: var(--danger);
}

button.danger-link:hover,
.button-link.danger-link:hover {
  background: var(--danger-soft);
}

button.copy-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  min-height: 32px;
  padding: 4px 10px;
}

button.copy-btn:hover {
  background: var(--surface-soft);
}

button.copy-btn.copied {
  color: var(--accent);
  border-color: var(--accent);
}

.section-heading {
  align-items: end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-heading p {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
}

.table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-top: 1px solid var(--border);
  padding: 12px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

td small {
  color: var(--muted);
  display: block;
  margin-top: 2px;
  font-size: 12px;
}

.empty {
  color: var(--muted);
  padding: 18px 12px;
}

.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.summary-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.summary-list div {
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.summary-list div:last-child {
  border-bottom: 0;
}

.summary-list dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.summary-list dd {
  margin: 0;
  font-size: 14px;
}

.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 4px 9px;
}

.status.ok {
  background: #e3f5ec;
  color: var(--accent-dark);
}

.status.pending {
  background: #fff4d8;
  color: var(--pending);
}

.status.declined {
  background: var(--danger-soft);
  color: var(--danger);
}

.invite-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 240px;
}

.invite-cell .copy-row {
  align-items: center;
  display: flex;
  gap: 8px;
}

.invite-cell .reveal {
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 0;
  text-decoration: underline;
  text-align: left;
  min-height: 0;
  font-weight: 500;
}

.invite-cell .reveal:hover {
  color: var(--text);
  background: transparent;
}

.invite-cell code {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: block;
  font-size: 11px;
  margin-top: 6px;
  max-width: 100%;
  overflow: hidden;
  padding: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.owner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.owner-actions button {
  font-size: 12px;
  min-height: 30px;
  padding: 4px 10px;
}

.secondary-link,
.back-link {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
}

.candidate-grid {
  display: grid;
  gap: 12px;
}

.candidate {
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 14px 16px;
}

.candidate strong {
  font-weight: 600;
}

.candidate span {
  color: var(--muted);
  font-size: 13px;
}

.compact-list {
  margin: 0;
  padding-left: 18px;
}

.compact-list li {
  font-size: 13px;
}

.not-shared ul,
.receipt ul {
  color: var(--muted);
  line-height: 1.6;
  margin: 8px 0 0;
  padding-left: 18px;
}

.not-shared ul li,
.receipt ul li {
  font-size: 14px;
}

.window-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.preset-chip {
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  min-height: 0;
  padding: 6px 12px;
}

.preset-chip:hover {
  background: #e1e9e3;
  border-color: var(--accent);
}

.add-window-link {
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  min-height: 0;
  padding: 0;
  text-align: left;
}

.add-window-link:hover {
  background: transparent;
  text-decoration: underline;
}

.window-2 {
  display: contents;
}

.window-2[hidden] {
  display: none;
}

.receipt-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 22px 0;
}

.receipt h2 {
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.receipt-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.demo-link {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  min-height: 0;
  padding: 4px 0;
  text-decoration: underline;
}

.demo-link:hover {
  background: transparent;
  color: var(--text);
}

.tz-line {
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

@media (max-width: 780px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 16px 20px;
  }

  main {
    padding: 24px 14px 40px;
  }

  .hero-panel,
  .split,
  .form-grid,
  .receipt-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  h1 {
    font-size: 26px;
  }

  .invite-cell {
    max-width: 100%;
  }
}
