:root {
  color-scheme: light;
  --ink: #1d2522;
  --muted: #69736d;
  --paper: #f4efe4;
  --panel: #fffaf0;
  --panel-strong: #fffdf7;
  --line: #d9d0bf;
  --accent: #2f6f5e;
  --accent-soft: #dcebe4;
  --danger: #9d3b35;
  --shadow: rgba(43, 35, 23, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  min-height: 42px;
  padding: 10px 15px;
  color: white;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.secondary,
.tabs button,
.link-btn {
  color: var(--ink);
  background: #eee5d5;
  border: 1px solid var(--line);
}

button.danger {
  background: var(--danger);
}

button.active,
.tabs button.active {
  color: white;
  background: var(--accent);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar,
.top-actions,
.panel-head,
.publish-row,
.inline-controls,
.tabs {
  display: flex;
  gap: 12px;
  align-items: center;
}

.topbar,
.panel-head {
  justify-content: space-between;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(36px, 5vw, 62px);
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(24px, 3vw, 38px);
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hint,
.account-email {
  color: var(--muted);
  line-height: 1.45;
}

.status-pill {
  min-width: 94px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff8e8;
  font-weight: 800;
  text-align: center;
}

.auth-grid,
.setup-strip,
.control-deck,
.grid.tools,
.grid.bottom {
  display: grid;
  gap: 16px;
}

.auth-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  margin-top: 24px;
}

.control-deck {
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.8fr) minmax(280px, 0.8fr);
  margin-top: 22px;
}

.grid.bottom {
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  margin-top: 16px;
}

.grid.tools {
  grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.2fr);
  margin-top: 16px;
}

.button-stack {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.setup-strip {
  grid-template-columns: minmax(0, 0.7fr) minmax(360px, 1fr);
  align-items: center;
  margin-top: 22px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #fffaf0, #f6ead8);
  box-shadow: 0 18px 42px var(--shadow);
}

.setup-strip h2 {
  margin-bottom: 4px;
}

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

.setup-chip {
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.setup-chip.done {
  border-color: #98c7ad;
  background: var(--accent-soft);
  color: #1d563f;
}

.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 42px var(--shadow);
}

.email-panel h2 {
  margin-bottom: 8px;
}

.advanced-setup {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.advanced-setup summary {
  color: var(--accent);
  font-weight: 900;
  cursor: pointer;
}

.delivery-card {
  display: grid;
  gap: 5px;
  margin-top: 16px;
  padding: 14px;
  color: #284f40;
  background: var(--accent-soft);
  border: 1px solid #98c7ad;
  border-radius: 8px;
  line-height: 1.4;
}

.delivery-card strong {
  color: #1d563f;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.hero-panel img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  object-fit: cover;
}

label {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.switch-panel {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.metal-switch {
  display: grid;
  gap: 10px;
  justify-items: center;
  width: 150px;
  height: 190px;
  color: var(--ink);
  background: linear-gradient(145deg, #dad3c7, #fffaf0 48%, #b8b0a3);
  border: 1px solid #9f978c;
  box-shadow: inset 0 2px 8px rgba(255,255,255,0.8), 0 16px 28px var(--shadow);
}

.switch-slot {
  position: relative;
  width: 50px;
  height: 108px;
  margin-top: 18px;
  border-radius: 999px;
  background: #262927;
}

.switch-lever {
  position: absolute;
  left: 7px;
  top: 10px;
  width: 36px;
  height: 68px;
  border-radius: 999px;
  background: linear-gradient(#f7f1e5, #7c756b);
  transform-origin: bottom center;
}

.metal-switch.off .switch-lever {
  top: 30px;
  transform: rotate(180deg);
}

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

.empty-state {
  display: grid;
  gap: 6px;
  padding: 18px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.7);
  line-height: 1.45;
}

.empty-state strong {
  color: var(--ink);
  font-size: 17px;
}

.message-item {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel-strong);
  cursor: pointer;
  text-align: left;
}

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

.attachment-box {
  display: grid;
  gap: 12px;
  margin: 16px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.65);
}

.attachment-box h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.file-label {
  display: inline-grid;
  width: fit-content;
  min-width: 150px;
  margin: 0;
  padding: 11px 14px;
  color: white;
  background: var(--accent);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
}

.file-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.attachment-list {
  display: grid;
  gap: 8px;
}

.attachment-empty {
  color: var(--muted);
  font-size: 13px;
}

.attachment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.attachment-row.pending {
  border-style: dashed;
}

.attachment-row span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.attachment-row strong,
.attachment-row small {
  overflow-wrap: anywhere;
}

.attachment-row small {
  color: var(--muted);
}

.activity-list {
  display: grid;
  gap: 9px;
}

.activity-row {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

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

.message-item.active {
  border-color: var(--accent);
  box-shadow: inset 5px 0 0 var(--accent);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  padding: 13px 15px;
  color: white;
  background: #202824;
  border-radius: 8px;
  box-shadow: 0 20px 40px var(--shadow);
}

.auth-notice {
  margin-top: 14px;
  padding: 13px 14px;
  color: #284f40;
  background: var(--accent-soft);
  border: 1px solid #98c7ad;
  border-radius: 8px;
  font-weight: 800;
  line-height: 1.4;
}

.diagnostics {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

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

@media (max-width: 880px) {
  .auth-grid,
  .setup-strip,
  .control-deck,
  .grid.tools,
  .grid.bottom,
  .hero-panel,
  .switch-panel {
    grid-template-columns: 1fr;
  }

  .topbar,
  .top-actions,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

@media (max-width: 520px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .tabs,
  .publish-row,
  .inline-controls,
  .attachment-row {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .setup-steps {
    grid-template-columns: 1fr;
  }
}
