:root {
  --desk-rule: rgba(25, 18, 6, 0.22);
}

.inner-hero {
  padding: 72px 0 64px;
  border-bottom: 1px solid var(--line);
}

.inner-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 0.7fr);
  gap: 64px;
  align-items: end;
}

.inner-hero h1 {
  max-width: none;
  overflow-wrap: anywhere;
}

.inner-hero h1 em {
  white-space: normal;
}

.inner-hero .section-intro {
  max-width: 600px;
  margin-bottom: 0;
  color: var(--muted);
}

.access-stage,
.access-conversation,
.access-card,
.access-editorial,
.desk-shell,
.desk-banner {
  min-width: 0;
}

.access-stage {
  padding: 80px 0 104px;
}

.access-conversation {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

.access-editorial {
  padding: 32px 0;
}

.access-editorial blockquote {
  margin: 40px 0 0;
  padding: 32px;
  border-radius: var(--radius-card);
  color: var(--paper);
  background: var(--night);
  font-size: 22px;
  line-height: 1.45;
}

.access-card {
  padding: 40px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-card);
  color: var(--paper);
  background: var(--night-raised) !important;
}

.access-card h2 {
  color: var(--paper);
  font-size: 30px;
}

.access-card input,
.access-card textarea,
.access-card .code-field,
.access-card .alias-composer {
  color: var(--ink) !important;
  border: 1.5px solid rgba(255, 250, 237, 0.58);
  background: var(--paper) !important;
}

.access-card input::placeholder,
.access-card .code-field::placeholder {
  color: var(--muted);
}

.surface-safety input,
.surface-safety textarea,
.surface-safety .code-field,
[data-desk-root] .surface-safety input,
[data-desk-root] .surface-safety textarea,
[data-desk-root] .surface-safety .code-field {
  color: var(--ink) !important;
  border-color: var(--line);
  background: var(--white) !important;
}

.surface-safety input::placeholder,
.surface-safety .code-field::placeholder {
  color: var(--muted);
}

.auth-notice {
  min-height: 52px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 14px;
  color: var(--ink-soft);
  background: var(--paper-deep);
}

.field-stack {
  display: grid;
  gap: 10px;
}

.field-stack + .field-stack {
  margin-top: 16px;
}

.field-stack label {
  font-size: 13px;
  font-weight: 700;
}

.field-stack input,
.alias-composer input,
.code-field {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--paper);
  outline: none;
}

.field-stack input:focus,
.alias-composer:focus-within,
.code-field:focus {
  border-color: var(--ink);
  outline: none;
  box-shadow: none;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.form-actions + * {
  margin-top: 24px;
}

.text-action {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-control);
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font-weight: 700;
}

.text-action:disabled {
  color: var(--ink-soft);
  background: var(--paper-warm);
  opacity: 1;
  cursor: default;
}

.auth-email-note {
  margin-bottom: 24px;
  color: var(--muted);
}

.desk-shell {
  padding: 56px 0 104px;
}

.desk-banner {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  align-items: center;
  margin-bottom: 48px;
  padding: 32px 40px;
  border-radius: var(--radius-card);
  color: var(--paper);
  background: var(--night);
}

.desk-banner h1 {
  max-width: 760px;
  margin-bottom: 8px;
  font-size: clamp(2.25rem, 4vw, 3.25rem);
}

.desk-banner p {
  margin-bottom: 0;
  color: var(--night-muted);
}

.desk-banner .session-mail {
  margin-top: 16px;
  color: var(--night-muted);
  font-weight: 700;
  word-break: break-all;
}

.desk-banner .session-mail:empty {
  display: none;
}

.desk-banner .text-action {
  flex: none;
  color: var(--ink);
  background: var(--paper);
}

.route-workroom {
  border-top: 1px solid var(--desk-rule);
}

.workroom-chapter {
  display: grid;
  grid-template-columns: minmax(220px, 0.34fr) minmax(0, 1fr);
  gap: 56px;
  padding: 64px 0;
  border-bottom: 1px solid var(--desk-rule);
}

.chapter-label {
  position: sticky;
  top: 112px;
  align-self: start;
}

.chapter-label h2 {
  margin-bottom: 12px;
  font-size: 30px;
}

.chapter-label p {
  color: var(--muted);
}

.alias-composer {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--night-raised) !important;
}

.alias-composer input {
  flex: 1;
  border: 0;
  border-radius: 16px 0 0 16px;
  color: var(--paper);
  background: var(--night-raised);
}

.alias-suffix {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border-left: 1px solid var(--line);
  border-radius: 0 16px 16px 0;
  color: var(--paper);
  background: var(--night-raised);
  white-space: nowrap;
}

.compose-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: stretch;
}

.compose-row .button,
.compose-row .compose-random {
  min-height: 48px;
  align-self: stretch;
}

.compose-random {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
}

.surface-paper,
.surface-ledger,
.surface-safety {
  min-width: 0;
}

.surface-paper {
  padding: 32px;
  border-radius: var(--radius-card);
  background: var(--paper);
}

.surface-ledger {
  padding: 32px 0;
}

.surface-safety {
  padding: 28px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  color: var(--ink);
  background: var(--paper);
}

.surface-safety input,
.surface-safety textarea,
.surface-safety .filter-trigger,
.surface-safety .filter-panel,
.surface-safety .code-field {
  color: var(--ink) !important;
  border-color: var(--line);
  background: var(--white) !important;
}

.surface-safety p,
.surface-safety label,
.surface-safety strong {
  color: var(--ink);
}

.safety-idle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px 24px;
}

.safety-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  min-width: 0;
}

.safety-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  counter-reset: safety-step;
}

.safety-steps li {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-left: 0;
  white-space: nowrap;
}

.safety-steps li::before {
  flex: none;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--paper-deep);
  content: counter(safety-step);
  counter-increment: safety-step;
  font-size: 11px;
  font-weight: 700;
}

.safety-steps li + li {
  border-left: 1px solid var(--line);
  padding-left: 16px;
}

.safety-idle [data-start-twofa] {
  flex: none;
}

.surface-safety:has([data-twofa-setup]:not([hidden])) .safety-idle {
  display: none;
}

.surface-safety:has([data-disable-twofa]:not([hidden])) [data-start-twofa] {
  display: none;
}

.twofa-setup-fields {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.surface-safety .code-field {
  color: var(--ink) !important;
  border-color: var(--line);
  background: var(--white) !important;
}

.helper-copy {
  margin: 12px 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.empty-state {
  margin-top: 24px;
  padding: 24px;
  border-radius: 18px;
  background: var(--paper-deep);
}

.data-table {
  width: 100%;
  margin: 24px 0 32px;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
}

.data-table td:first-child {
  overflow-wrap: anywhere;
}

.data-table td:nth-last-child(-n+2) {
  white-space: nowrap;
}

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

.mini-button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--paper);
  cursor: pointer;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: var(--radius-control);
  background: var(--paper-deep);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  content: "";
}

.filter-menu {
  position: relative;
  width: max-content;
  margin-bottom: 24px;
}

.filter-trigger {
  position: relative;
  min-height: 38px;
  margin-block: 16px;
  padding: 0 38px 0 16px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-control);
  color: var(--paper);
  background: var(--night-raised);
  cursor: pointer;
}

.filter-trigger::after {
  position: absolute;
  top: 50%;
  right: 17px;
  width: 7px;
  height: 7px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(calc(-50% - 0.28em)) rotate(45deg);
  content: "";
}

.filter-panel {
  position: absolute;
  z-index: 5;
  top: calc(100% + 8px);
  left: 0;
  min-width: 156px;
  padding: 8px;
  border: 1px solid var(--line-dark);
  border-radius: 14px;
  color: var(--paper);
  background: var(--night-raised);
}

.filter-panel button,
.filter-menu [role="option"] {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

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

.archive-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  appearance: none;
  text-align: left;
  cursor: pointer;
}

.archive-copy {
  min-width: 0;
  overflow-wrap: anywhere;
}

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

.archive-row span {
  color: var(--muted);
}

.archive-row time {
  white-space: nowrap;
}

.archive-detail {
  margin-top: 24px;
  padding: 24px;
  border-radius: 18px;
  background: var(--paper);
}

.archive-detail .mail-frame {
  width: 100%;
  min-height: 240px;
  border: 0;
  background: var(--white);
}

.archive-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.attachment-chip {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
}

.archive-attach-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.twofa-setup {
  display: grid;
  grid-template-columns: 192px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin: 0;
  margin-bottom: 24px;
  padding: 0;
  border: 0;
  background: transparent;
}

.twofa-qr-plate {
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
}

.twofa-setup img,
.twofa-qr-plate img {
  display: block;
  width: 160px;
  height: 160px;
  object-fit: contain;
  background: var(--white);
}

.twofa-howto {
  margin: 0;
  padding-left: 1.2em;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}

.twofa-secret {
  display: grid;
  gap: 8px;
}

.twofa-secret strong {
  font-size: 13px;
}

.secret-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  margin: 0;
  padding: 0 8px 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
}

.secret-row code {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
}

.secret-row code:empty::before {
  content: "•••• •••• •••• ••••";
  color: var(--muted);
  letter-spacing: 0.08em;
}

.twofa-confirm-row {
  display: grid;
  grid-template-columns: minmax(160px, 220px) auto;
  gap: 10px;
  align-items: stretch;
}

.twofa-confirm-row .code-field {
  width: 100%;
  max-width: 220px;
  letter-spacing: 0.18em;
}

.twofa-confirm-row .button {
  min-height: 48px;
  white-space: nowrap;
}

.surface-safety .form-actions {
  margin-top: 0;
}

@media (max-width: 900px) {
  .inner-hero-grid,
  .access-conversation,
  .workroom-chapter {
    grid-template-columns: minmax(0, 1fr);
  }

  .chapter-label {
    position: static;
  }
}

@media (max-width: 640px) {
  .inner-hero,
  .access-stage,
  .desk-shell {
    padding-top: 48px;
    padding-bottom: 64px;
  }

  .access-card,
  .surface-paper,
  .surface-safety,
  .desk-banner {
    padding: 24px;
  }

  .desk-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .compose-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .safety-idle {
    grid-template-columns: minmax(0, 1fr);
  }

  .safety-idle [data-start-twofa] {
    width: 100%;
  }

  .safety-steps li {
    white-space: normal;
  }

  .twofa-setup {
    grid-template-columns: minmax(0, 1fr);
  }

  .twofa-confirm-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .twofa-confirm-row .code-field {
    max-width: none;
  }

  .data-table-wrap {
    overflow-x: auto;
  }

  .data-table {
    min-width: 680px;
  }

  .archive-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .archive-row time {
    white-space: normal;
  }

  .alias-composer {
    min-width: 0;
    flex-direction: column;
  }

  .alias-composer input {
    border-radius: 16px 16px 0 0;
  }

  .alias-suffix {
    min-height: 42px;
    border-top: 1px solid var(--line);
    border-left: 0;
    border-radius: 0 0 16px 16px;
  }
}

body.is-console .inner-hero {
  display: none;
}

.night-section input,
.night-section textarea {
  color: var(--paper);
  border-color: var(--line-dark);
  background: var(--night);
}

.surface-safety input,
.surface-safety textarea,
.surface-safety .code-field {
  color: var(--ink) !important;
  border-color: var(--line);
  background: var(--white) !important;
}
