:root {
  --bg: #f7f5f0;
  --panel: #ffffff;
  --panel-soft: #f1ece3;
  --text: #171717;
  --muted: #67615b;
  --border: #ddd5c9;
  --accent: #1f6f68;
  --accent-dark: #14524d;
  --accent-soft: #dff1ed;
  --danger: #9f2d20;
  --shadow: 0 16px 48px rgba(42, 34, 24, 0.11);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px 1fr;
}

.sidebar {
  min-height: 100vh;
  background: #24211d;
  color: #fff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
}

.brand-block {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-kicker,
.page-kicker,
.section-kicker,
.plan-label {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-kicker {
  color: #9ad6ca;
}

.brand-title {
  font-size: 24px;
  font-weight: 800;
  margin-top: 8px;
}

.brand-sub {
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.45;
  margin-top: 7px;
}

.step-nav {
  display: grid;
  gap: 8px;
}

.step-button {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  text-align: left;
}

.step-button.is-active,
.step-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.step-index {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
  font-size: 12px;
  font-weight: 800;
}

.plan-box {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  padding: 14px;
}

.plan-name {
  font-size: 18px;
  font-weight: 800;
  margin: 5px 0 14px;
}

.usage-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  margin-top: 8px;
}

.usage-row strong {
  color: #fff;
}

.plan-note {
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  line-height: 1.4;
  margin-top: 14px;
}

.main {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  font-size: clamp(30px, 4vw, 48px);
  max-width: 720px;
}

h2 {
  font-size: 24px;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.auth-panel,
.app-panel {
  max-width: 980px;
}

.auth-card,
.workflow-panel,
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card {
  padding: 28px;
  max-width: 720px;
}

.auth-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.notice-band {
  background: var(--accent-soft);
  border: 1px solid #b9ddd5;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  color: #17433f;
  line-height: 1.5;
}

.workflow-panel {
  display: none;
  padding: 22px;
}

.workflow-panel.is-active {
  display: block;
}

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

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

label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  margin-bottom: 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

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

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 111, 104, 0.12);
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 750;
}

.text-button {
  background: transparent;
  color: var(--accent);
  font-weight: 800;
}

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

.helper-text {
  margin-top: -8px;
}

.result-box {
  background: #fbfaf7;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  min-height: 280px;
  white-space: pre-wrap;
  line-height: 1.62;
}

.empty-state {
  color: var(--muted);
}

.status-message {
  color: var(--muted);
  margin-top: 12px;
  min-height: 22px;
  line-height: 1.4;
}

.status-message.is-error {
  color: var(--danger);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 13, 0.52);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: min(920px, 100%);
  max-height: 86vh;
  overflow: auto;
  padding: 22px;
}

.admin-table {
  display: grid;
  gap: 8px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr 0.8fr;
  gap: 12px;
  padding: 12px;
  background: #fbfaf7;
  border: 1px solid var(--border);
  border-radius: 8px;
  align-items: center;
  font-size: 13px;
}

.muted {
  color: var(--muted);
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .form-grid,
  .auth-row,
  .admin-row {
    grid-template-columns: 1fr;
  }

  .auth-row {
    display: grid;
  }

  .topbar,
  .section-head {
    flex-direction: column;
  }
}
