body {
  margin: 0;
  min-height: 100vh;
  padding: 32px 16px 48px;
  box-sizing: border-box;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 214, 214, 0.95), transparent 32%),
    radial-gradient(circle at top right, rgba(255, 233, 190, 0.75), transparent 28%),
    linear-gradient(160deg, #fff7f4 0%, #ffe8df 45%, #f8d9d7 100%);
  color: #402f30;
}

#wrapper {
  width: min(760px, 100%);
  background: linear-gradient(180deg, rgba(255, 251, 249, 0.98) 0%, rgba(255, 245, 241, 0.96) 100%);
  border: 1px solid rgba(157, 74, 73, 0.18);
  border-radius: 28px;
  margin: 8px auto 0;
  box-sizing: border-box;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(111, 53, 52, 0.16);
}

body.worksheet-page #wrapper {
  width: min(1180px, 100%);
}

#navbar {
  width: 100%;
  min-height: 112px;
  background: linear-gradient(135deg, #a94a47 0%, #8a2f35 100%);
  display: flex;
  align-items: stretch;
  position: relative;
}

#logo {
  width: 220px;
  height: 112px;
  background-image: url('./logo.png');
  background-repeat: no-repeat;
  background-position: center left 18px;
  background-size: 78%;
  flex-shrink: 0;
}

#title {
  flex: 1;
  height: 112px;
  display: flex;
  flex-direction: column;
  color: #ffffff;
  text-align: center;
  padding-right: 20px;
}

#title h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  letter-spacing: 0.03em;
  text-shadow: 0 3px 10px rgba(66, 16, 18, 0.2);
}

#title-top {
  height: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#title-bottom {
  height: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#title-bottom p {
  margin: 0;
  padding: 0 12px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: rgba(255, 246, 244, 0.94);
}

.content-section {
  padding: 10px 28px 30px;
}

.login-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 22px;
  align-items: start;
}

.login-form {
  margin-top: 18px;
  padding: 24px;
  background: linear-gradient(180deg, #fffefe 0%, #fff6f3 100%);
  border: 1px solid rgba(193, 136, 128, 0.28);
  border-radius: 22px;
  box-shadow: 0 16px 36px rgba(157, 84, 74, 0.12);
}

.login-form h2 {
  margin: 0 0 16px;
  color: #963634;
  font-size: 1.45rem;
}

.login-copy {
  margin: 0 0 18px;
  color: #704241;
  line-height: 1.55;
}

.login-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
  color: #6d3735;
}

.login-form input {
  width: 100%;
  margin-bottom: 16px;
  padding: 12px 14px;
  box-sizing: border-box;
  border: 1px solid #d8bbb4;
  border-radius: 14px;
  background-color: rgba(255, 255, 255, 0.95);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.login-form input:focus {
  outline: none;
  border-color: #b14f4b;
  box-shadow: 0 0 0 4px rgba(177, 79, 75, 0.12);
  transform: translateY(-1px);
}

.login-form button {
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #b44d48 0%, #8b3032 100%);
  color: #ffffff;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(149, 54, 52, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(149, 54, 52, 0.28);
}

.login-form button:active {
  transform: translateY(0);
}

.form-actions,
.session-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.secondary-button {
  padding: 11px 18px;
  border: 1px solid rgba(151, 83, 75, 0.32);
  border-radius: 999px;
  background: rgba(255, 250, 248, 0.92);
  color: #7e3535;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.secondary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(149, 54, 52, 0.12);
  border-color: rgba(151, 83, 75, 0.48);
}

.secondary-button:disabled,
.login-form button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.form-hint {
  margin: 16px 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #7b5550;
}

.form-message {
  min-height: 22px;
  margin: 14px 0 0;
  font-weight: 700;
}

.form-message[data-state="success"] {
  color: #256d3c;
}

.form-message[data-state="warning"] {
  color: #8a5b00;
}

.form-message[data-state="error"] {
  color: #9d2020;
}

.form-message[data-state="pending"] {
  color: #7b3e3a;
}

.session-card,
.security-note {
  margin-top: 18px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(255, 252, 251, 0.98) 0%, rgba(255, 244, 239, 0.92) 100%);
  border: 1px solid rgba(193, 136, 128, 0.26);
  border-radius: 22px;
  box-shadow: 0 16px 36px rgba(157, 84, 74, 0.1);
}

.session-card h3,
.security-note h3 {
  margin: 0 0 14px;
  color: #8f3534;
  font-size: 1.18rem;
}

.session-summary {
  margin: 0 0 18px;
  color: #6f4340;
  line-height: 1.5;
}

.session-details {
  margin: 0 0 22px;
}

.session-details div {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(196, 155, 148, 0.28);
}

.session-details dt {
  font-weight: 700;
  color: #733937;
}

.session-details dd {
  margin: 0;
  color: #573f3e;
  line-height: 1.45;
  word-break: break-word;
}

#tokenPreview {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.82rem;
}

.security-note {
  margin-bottom: 8px;
}

.security-note ul {
  margin: 0;
  padding-left: 18px;
  color: #664847;
  line-height: 1.55;
}

.dashboard-content {
  padding-top: 22px;
}

.welcome-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto;
  gap: 20px;
  align-items: center;
  padding: 28px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(255, 210, 166, 0.9), transparent 28%),
    linear-gradient(145deg, #8c2f35 0%, #b34d45 48%, #db8a59 100%);
  color: #fffaf7;
  box-shadow: 0 24px 54px rgba(126, 46, 45, 0.22);
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 243, 239, 0.82);
}

.welcome-panel h2 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
}

.welcome-panel p {
  margin: 0;
}

.welcome-copy {
  display: grid;
  gap: 12px;
}

.welcome-copy #greetingText {
  max-width: 60ch;
  font-size: 1rem;
  line-height: 1.7;
  color: rgba(255, 247, 243, 0.94);
}

.welcome-meta {
  color: rgba(255, 238, 230, 0.82);
  font-weight: 700;
}

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

.primary-link-button,
.form-tile-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 20px;
  border-radius: 999px;
  box-sizing: border-box;
  text-decoration: none;
  font-weight: 800;
}

.primary-link-button {
  background: linear-gradient(135deg, #fff4dd 0%, #ffd985 100%);
  color: #6e3500;
  box-shadow: 0 12px 28px rgba(82, 34, 0, 0.18);
}

.board-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.metric-card {
  display: grid;
  gap: 10px;
  padding: 20px 22px;
  border: 1px solid rgba(190, 135, 124, 0.24);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 252, 250, 0.98) 0%, rgba(255, 244, 239, 0.94) 100%);
  box-shadow: 0 14px 30px rgba(157, 84, 74, 0.1);
}

.metric-card-wide {
  background: linear-gradient(180deg, rgba(255, 247, 236, 0.98) 0%, rgba(255, 235, 214, 0.95) 100%);
}

.metric-value {
  font-size: clamp(2rem, 3.2vw, 2.8rem);
  font-weight: 800;
  line-height: 1;
  color: #8b3135;
}

.metric-value-small {
  font-size: 1.1rem;
  line-height: 1.35;
}

.metric-label {
  color: #75504b;
  font-weight: 700;
}

.forms-board {
  margin-top: 22px;
  padding: 24px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255, 253, 251, 0.98) 0%, rgba(255, 246, 241, 0.96) 100%);
  border: 1px solid rgba(190, 135, 124, 0.24);
  box-shadow: 0 20px 42px rgba(157, 84, 74, 0.12);
}

.forms-board-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: 18px;
  align-items: end;
  margin-bottom: 20px;
}

.forms-board-header h3 {
  margin: 0;
  font-size: 1.55rem;
  color: #8d3435;
}

.board-copy {
  color: #71504b;
  line-height: 1.6;
}

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

.form-tile {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(192, 143, 132, 0.26);
  background: rgba(255, 255, 255, 0.88);
  min-height: 210px;
}

.form-tile.is-live {
  background: linear-gradient(180deg, rgba(255, 248, 231, 0.98) 0%, rgba(255, 238, 204, 0.98) 100%);
  border-color: rgba(196, 138, 53, 0.34);
  box-shadow: 0 16px 30px rgba(181, 125, 35, 0.14);
}

.form-tile.is-planned {
  background: linear-gradient(180deg, rgba(255, 252, 251, 0.98) 0%, rgba(248, 239, 236, 0.94) 100%);
}

.form-tile-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-slot,
.form-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.form-slot {
  background: rgba(139, 49, 53, 0.08);
  color: #8b3135;
}

.form-status.live {
  background: rgba(165, 111, 17, 0.12);
  color: #8c5700;
}

.form-status.planned {
  background: rgba(121, 76, 74, 0.1);
  color: #744846;
}

.form-tile h3 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.3;
  color: #6d3535;
}

.form-tile p {
  margin: 0;
  color: #71504b;
  line-height: 1.55;
}

.form-tile-link {
  align-self: end;
  width: fit-content;
  background: linear-gradient(135deg, #b54d48 0%, #8b3032 100%);
  color: #ffffff;
}

.form-tile-link.is-disabled {
  background: rgba(124, 88, 83, 0.1);
  color: #80524f;
}

@media (max-width: 720px) {
  body {
    padding: 18px 12px 28px;
  }

  #navbar {
    flex-direction: column;
    align-items: center;
    padding: 16px 12px 18px;
  }

  #logo {
    width: 180px;
    height: 84px;
    background-position: center;
    background-size: contain;
  }

  #title {
    height: auto;
    padding: 8px 0 0;
  }

  #title-top,
  #title-bottom {
    height: auto;
  }

  #title h1 {
    font-size: 1.55rem;
  }

  .content-section {
    padding: 8px 18px 22px;
  }

  .login-form {
    padding: 20px;
  }

  .login-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .session-card,
  .security-note {
    padding: 20px;
  }

  .session-details div {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .welcome-panel,
  .forms-board-header,
  .board-overview,
  .forms-grid {
    grid-template-columns: 1fr;
  }

  .welcome-panel {
    padding: 22px;
  }

  .welcome-actions {
    justify-content: flex-start;
  }

  .forms-board {
    padding: 20px;
  }
}

#seperator {
  width: 100%;
  min-height: 42px;
  padding: 0 18px;
  box-sizing: border-box;
  background: linear-gradient(135deg, #fff97c 0%, #ffe04f 52%, #ffcb3a 100%);
  border-top: 1px solid rgba(120, 82, 0, 0.15);
  border-bottom: 1px solid rgba(120, 82, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
}

#seperator p {
  margin: 0;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6e4800;
}

#seperator-white {
  width: 100%;
  height: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 247, 242, 0) 100%);
}

#seperator-left {
  width: calc(100% - 48px);
  min-height: 40px;
  margin: 0 24px 14px;
  padding: 0 18px;
  box-sizing: border-box;
  background: linear-gradient(135deg, #fff97c 0%, #ffe45d 45%, #ffd155 100%);
  border: 1px solid rgba(120, 82, 0, 0.16);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(176, 130, 27, 0.14);
  font-weight: 700;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

#seperator-left p {
  margin: 0;
  color: #6e4800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#decedent-form table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

#decedent-form {
  padding: 0 24px 28px;
}

#decedent-form form {
  padding: 0;
}

#decedent-form .form-card {
  padding: 18px 20px 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 247, 244, 0.92) 100%);
  border: 1px solid rgba(193, 136, 128, 0.22);
  border-radius: 24px;
  box-shadow: 0 18px 42px rgba(157, 84, 74, 0.1);
}

#decedent-form .vital-stats-table {
  table-layout: auto;
}

#decedent-form td {
  padding: 7px 10px 7px 0;
  vertical-align: middle;
}

#decedent-form .label-cell {
  white-space: nowrap;
}

#decedent-form label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  color: #6d3735;
  font-weight: 700;
  font-size: 0.94rem;
}

#decedent-form .deceased-address-label {
  width: 1%;
}

#decedent-form .place-of-death-city-label {
  width: 1%;
}

#decedent-form input[type="text"],
#decedent-form input[type="date"],
#decedent-form input[type="time"],
#decedent-form input[type="number"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 11px 13px;
  box-sizing: border-box;
  border: 1px solid #d8bbb4;
  border-radius: 14px;
  background-color: rgba(255, 255, 255, 0.95);
  color: #402f30;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

#decedent-form input[type="checkbox"] {
  width: auto;
  margin-right: 4px;
  accent-color: #a94a47;
}

#decedent-form select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 11px 13px;
  box-sizing: border-box;
  border: 1px solid #d8bbb4;
  border-radius: 14px;
  background-color: rgba(255, 255, 255, 0.95);
  color: #402f30;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

#decedent-form .stretch-cell input {
  width: 100%;
  box-sizing: border-box;
}

#decedent-form input[type="text"]:focus,
#decedent-form input[type="date"]:focus,
#decedent-form input[type="time"]:focus,
#decedent-form input[type="number"]:focus,
#decedent-form select:focus {
  outline: none;
  border-color: #b14f4b;
  box-shadow: 0 0 0 4px rgba(177, 79, 75, 0.12);
  transform: translateY(-1px);
}

body.worksheet-page #decedent-form table + #seperator-left {
  margin-top: 18px;
}

@media (max-width: 960px) {
  body.worksheet-page #wrapper {
    width: 100%;
  }

  #decedent-form {
    padding: 0 16px 20px;
  }

  #decedent-form form {
    overflow-x: auto;
  }

  #decedent-form .form-card {
    padding: 16px;
  }

  #seperator-left {
    width: calc(100% - 32px);
    margin: 0 16px 12px;
  }
}

@media (max-width: 720px) {
  #seperator {
    min-height: 38px;
    padding: 0 12px;
  }

  #seperator p,
  #seperator-left p {
    letter-spacing: 0.04em;
  }

  #decedent-form form {
    overflow-x: visible;
  }

  #decedent-form .form-card {
    border-radius: 18px;
  }
}
