:root {
  --ink: #241b16;
  --paper: #f6f1ea;
  --panel: #fffaf2;
  --muted: #70665f;
  --line: rgba(36, 27, 22, .14);
  --signal: #dc4a28;
  --dark: #2b211b;
  --dark-soft: #352920;
  --good: #147a4a;
  --warn: #b26a00;
  --bad: #9d1d17;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  font-weight: 520;
}

button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 720;
  cursor: pointer;
}

button.primary, .primary {
  border-color: var(--signal);
  background: var(--signal);
  color: #fffaf2;
}

button.ghost {
  background: transparent;
}

button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

button.danger,
.danger {
  color: var(--bad);
  border-color: rgba(157, 29, 23, .24);
}

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

.demo-shell button:disabled {
  opacity: .58;
}

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  align-content: start;
  gap: 28px;
  height: 100vh;
  padding: 24px;
  background: var(--dark);
  color: #fffaf2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 840;
  text-transform: uppercase;
}

.brand-logo {
  display: block;
  width: 156px;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.brand-context {
  color: rgba(255, 250, 242, .72);
  font-size: 13px;
  font-weight: 760;
  letter-spacing: .04em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--signal);
  font-size: 24px;
}

.sidebar nav {
  display: grid;
  gap: 6px;
}

.sidebar nav a {
  padding: 12px 14px;
  border-radius: 6px;
  color: rgba(255, 250, 242, .72);
  text-decoration: none;
  font-weight: 680;
}

.sidebar nav a.active,
.sidebar nav a:hover {
  color: #fffaf2;
  background: rgba(255, 250, 242, .1);
}

.sidebar-note {
  display: grid;
  gap: 4px;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid rgba(255, 250, 242, .18);
  border-radius: 8px;
  min-width: 0;
}

.sidebar-note strong {
  line-height: 1.15;
}

.sidebar-note small {
  color: rgba(255, 250, 242, .48);
  font-size: 12px;
  font-weight: 680;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.sidebar-note span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(255, 250, 242, .68);
  white-space: nowrap;
}

.account-note {
  max-width: 100%;
}

.workspace {
  display: grid;
  gap: 24px;
  align-content: start;
  padding: 30px clamp(22px, 4vw, 52px) 52px;
}

.backend-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 10px 0 0;
  color: var(--muted);
  font-weight: 850;
}

.backend-footer a {
  color: inherit;
  text-decoration: none;
}

.contact-dialog {
  width: min(620px, calc(100vw - 32px));
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
}

.contact-dialog::backdrop {
  background: rgba(43, 33, 27, .56);
  backdrop-filter: blur(6px);
}

.contact-card {
  padding: clamp(24px, 4vw, 36px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .32);
}

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

.contact-head h2 {
  margin: 0;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1;
}

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

.contact-grid div {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.contact-grid strong,
.contact-grid span,
.contact-grid a {
  display: block;
}

.contact-grid strong {
  margin-bottom: 8px;
}

.contact-grid span,
.contact-grid a {
  color: var(--muted);
  font-weight: 740;
  line-height: 1.4;
}

.workspace-header,
.section-head,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.workspace-header h1,
.section-head h2,
.panel h2,
.hero-panel h2,
.emergency h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 58px);
  font-weight: 820;
  line-height: .96;
  letter-spacing: 0;
}

.panel h2,
.hero-panel h2,
.emergency h2 {
  font-size: clamp(26px, 3vw, 42px);
}

.section-note {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 560;
  line-height: 1.45;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--signal);
  font-size: 13px;
  font-weight: 780;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.header-actions,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-panel,
.emergency,
.panel,
.metric-grid article,
.vault-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 30px;
  align-items: center;
  padding: clamp(24px, 4vw, 44px);
  background:
    linear-gradient(90deg, rgba(255, 250, 242, .96), rgba(255, 250, 242, .84)),
    url("hero-digitaler-nachlass.png");
  background-size: cover;
  background-position: right center;
}

.hero-panel p,
.emergency p,
.vault-card p,
.support-grid p {
  color: var(--muted);
  line-height: 1.45;
}

.vault-card p {
  font-size: 15px;
}

.score {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 10px solid var(--signal);
  border-radius: 50%;
  background: #fff;
}

.score span {
  font-size: 46px;
  font-weight: 950;
}

.score small {
  color: var(--muted);
  font-weight: 800;
}

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

.metric-grid article {
  display: grid;
  gap: 8px;
  padding: 20px;
}

.metric-grid strong {
  font-size: 32px;
}

.metric-grid span {
  color: var(--muted);
  font-weight: 560;
}

.upgrade-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, .28fr);
  gap: 18px;
  align-items: center;
  padding: 18px;
  background: var(--dark);
  border: 1px solid rgba(255, 250, 242, .14);
  border-radius: 8px;
  color: #fffaf2;
}

.upgrade-panel.is-hidden {
  display: none;
}

.upgrade-panel h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 820;
  line-height: 1;
}

.upgrade-panel p:not(.eyebrow) {
  max-width: 760px;
  margin: 14px 0 0;
  color: rgba(255, 250, 242, .76);
  line-height: 1.45;
  font-weight: 560;
}

.upgrade-action {
  display: grid;
  gap: 10px;
  padding: 18px;
  background: rgba(255, 250, 242, .08);
  border: 1px solid rgba(255, 250, 242, .16);
  border-radius: 8px;
}

.upgrade-action strong {
  font-size: clamp(42px, 6vw, 68px);
  line-height: .92;
}

.upgrade-action span,
.upgrade-action .form-response {
  color: rgba(255, 250, 242, .74);
  font-weight: 560;
}

.compact-upgrade {
  color: var(--ink);
  background: #fff4e3;
  border-color: rgba(220, 74, 40, .18);
}

.compact-upgrade > div:first-child {
  display: grid;
  gap: 4px;
}

.compact-upgrade strong {
  font-size: 18px;
  line-height: 1.2;
}

.compact-upgrade span {
  color: var(--muted);
  font-weight: 560;
  line-height: 1.35;
}

.compact-upgrade .upgrade-action {
  padding: 0;
  background: transparent;
  border: 0;
}

.compact-upgrade .upgrade-action span {
  font-weight: 720;
}

.security-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .8fr);
  gap: clamp(22px, 4vw, 42px);
  padding: clamp(24px, 4vw, 38px);
  background: #fff4e3;
  border: 1px solid rgba(226, 68, 31, .2);
  border-radius: 8px;
}

.demo-return {
  display: flex;
  justify-content: flex-start;
}

.demo-return a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  color: var(--ink);
  background: #fffaf2;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 720;
}

.demo-cta,
.demo-lock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .42fr);
  gap: clamp(22px, 4vw, 42px);
  align-items: center;
  padding: clamp(24px, 4vw, 44px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.demo-cta {
  background:
    linear-gradient(90deg, rgba(255, 250, 242, .96), rgba(255, 250, 242, .86)),
    url("hero-digitaler-nachlass.png");
  background-position: right center;
  background-size: cover;
}

.demo-cta h1,
.demo-lock h2 {
  margin: 0;
  font-size: clamp(34px, 5vw, 64px);
  font-weight: 820;
  line-height: .96;
}

.demo-cta p,
.demo-lock p {
  max-width: 820px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.42;
}

.demo-price {
  display: grid;
  gap: 12px;
  padding: 20px;
  color: #fffaf2;
  background: var(--dark);
  border-radius: 8px;
}

.demo-price strong {
  font-size: clamp(44px, 6vw, 72px);
  line-height: .9;
}

.demo-price span {
  color: rgba(255, 250, 242, .78);
  line-height: 1.35;
}

.demo-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 6px;
  color: #fffaf2;
  text-decoration: none;
  font-weight: 720;
}

.demo-vault-grid {
  position: relative;
}

.demo-lock {
  color: #fffaf2;
  background: var(--dark);
}

.demo-lock .eyebrow {
  color: #ffb39f;
}

.demo-lock p {
  color: rgba(255, 250, 242, .78);
}

.security-panel h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1;
}

.security-panel p {
  margin: 16px 0 0;
  color: var(--muted);
  font-weight: 540;
  line-height: 1.48;
}

.security-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.security-list span {
  padding: 12px 14px;
  background: #fffaf2;
  border: 1px solid rgba(36, 27, 22, .12);
  border-radius: 8px;
  font-weight: 640;
}

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

.vault-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 330px;
  padding: 20px;
}

.vault-card span {
  color: var(--signal);
  font-weight: 950;
}

.vault-card h3 {
  margin: 0;
  font-size: 23px;
  line-height: 1.05;
}

.vault-card button {
  align-self: end;
  width: fit-content;
}

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

.card-actions button,
.inline-actions button {
  min-height: 36px;
  padding: 0 12px;
}

.vault-entry-list {
  display: grid;
  gap: 8px;
  margin: 2px 0;
}

.vault-entry {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(23, 18, 15, .1);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
}

.vault-entry strong {
  display: block;
  margin-bottom: 3px;
  font-size: 15px;
  line-height: 1.2;
}

.vault-entry span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 520;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vault-card.done {
  box-shadow: inset 4px 0 0 var(--good);
}

.vault-card.custom-card {
  background: #fff4e3;
  border-color: rgba(226, 68, 31, .22);
}

.vault-card.custom-card span {
  color: var(--warn);
}

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

.panel {
  padding: 24px;
}

.person-list,
.risk-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.person-list div,
.risk-list div {
  display: grid;
  gap: 3px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.person-list span,
.risk-list span {
  color: var(--muted);
}

.check-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  padding: 12px 14px;
  border-radius: 6px;
  font-weight: 800;
}

.check-list .ok {
  color: var(--good);
  background: rgba(20, 122, 74, .1);
}

.check-list .warn {
  color: var(--warn);
  background: rgba(178, 106, 0, .12);
}

.emergency {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: clamp(24px, 4vw, 42px);
}

.admin-table {
  display: grid;
  margin-top: 18px;
  overflow: auto;
}

.table-row {
  display: grid;
  grid-template-columns: 1.2fr .7fr 1fr .5fr auto;
  gap: 12px;
  align-items: center;
  min-width: 820px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.table-head {
  color: var(--muted);
  font-size: 13px;
  font-weight: 950;
  text-transform: uppercase;
}

.pill {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.pill.ok { color: var(--good); background: rgba(20, 122, 74, .1); }
.pill.warn { color: var(--warn); background: rgba(178, 106, 0, .12); }
.pill.bad { color: var(--bad); background: rgba(157, 29, 23, .1); }

.support-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.support-grid article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.modal {
  width: min(760px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

.modal::backdrop {
  background: rgba(43, 33, 27, .56);
  backdrop-filter: blur(4px);
}

.modal-card {
  display: grid;
  gap: 18px;
  padding: clamp(22px, 4vw, 34px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 28px 80px rgba(0,0,0,.28);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.modal-head h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  line-height: 1;
}

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

.form-grid label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 690;
}

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

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  line-height: 1.35;
}

.form-grid textarea {
  min-height: 108px;
  resize: vertical;
  font-size: 16px;
}

.form-response {
  min-height: 22px;
  margin: 0;
  color: var(--signal);
  font-weight: 720;
}

.modal-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-weight: 560;
}

.vault-card strong {
  color: var(--ink);
}

@media print {
  .sidebar,
  .header-actions,
  .vault-grid,
  .two-col,
  .modal {
    display: none !important;
  }
  .app-shell {
    display: block;
  }
  .workspace {
    padding: 0;
  }
}

@media (max-width: 1040px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
  }
  .sidebar nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .metric-grid,
  .vault-grid,
  .support-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .workspace-header,
  .section-head,
  .panel-head,
  .hero-panel,
  .security-panel,
  .upgrade-panel,
  .demo-cta,
  .demo-lock,
  .emergency,
  .two-col {
    grid-template-columns: 1fr;
  }
  .workspace-header,
  .section-head,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .metric-grid,
  .vault-grid,
  .support-grid,
  .form-grid,
  .contact-grid,
  .sidebar nav {
    grid-template-columns: 1fr;
  }
  .form-grid .wide {
    grid-column: auto;
  }
}
