:root {
  color-scheme: light;
  --bg: #eef3f6;
  --ink: #152027;
  --muted: #60717d;
  --line: #d4dde3;
  --panel: #ffffff;
  --field: #f8fbfc;
  --accent: #08756f;
  --accent-strong: #064f4a;
  --gold: #bd7a18;
  --danger: #b42318;
  --blue: #1d5f8f;
  --shadow: 0 24px 70px rgba(29, 58, 73, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(8, 117, 111, 0.18), transparent 34%),
    linear-gradient(315deg, rgba(29, 95, 143, 0.16), transparent 32%),
    radial-gradient(circle at 12px 12px, rgba(21, 32, 39, 0.08) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 24px 24px;
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

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

.shell {
  width: min(1220px, calc(100vw - 32px));
  margin: 24px auto;
}

.workspace {
  min-height: calc(100vh - 48px);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(212, 221, 227, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.94), rgba(242, 249, 248, 0.94));
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 1.58rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.mark {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #e8f2ef;
  border: 1px solid #b7d7d3;
  flex: 0 0 auto;
}

.mark::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 8px;
  width: 17px;
  height: 24px;
  border: 2px solid var(--accent);
  border-radius: 4px;
  background: #fff;
}

.doc-line,
.doc-line.short {
  position: absolute;
  left: 15px;
  top: 17px;
  width: 11px;
  height: 2px;
  background: var(--accent);
}

.doc-line.short {
  top: 22px;
  width: 8px;
}

.wave {
  position: absolute;
  right: 8px;
  top: 14px;
  width: 12px;
  height: 16px;
  border-right: 3px solid var(--gold);
  border-radius: 50%;
}

.plan-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 190px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef0e8;
}

.plan {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.plan.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(32, 33, 31, 0.12);
}

.main-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: calc(100vh - 126px);
}

.left-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(247, 251, 252, 0.96), rgba(241, 247, 245, 0.96));
}

.auth-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.eyebrow {
  display: block;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#account-label {
  display: block;
  margin-top: 2px;
  font-size: 1rem;
}

.email-login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.email-login button {
  padding: 0 14px;
}

.auth-panel small {
  color: var(--muted);
  line-height: 1.35;
}

.feature-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.feature-strip span {
  padding: 9px 11px;
  border: 1px solid rgba(8, 117, 111, 0.2);
  border-radius: 8px;
  background: #f1fbf8;
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 800;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 158px;
  padding: 20px;
  border: 1.5px dashed #9bb9b5;
  border-radius: 8px;
  background: var(--field);
  text-align: center;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: #ecf6f4;
}

.dropzone input {
  display: none;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
}

.dropzone strong,
.dropzone small {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

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

.controls,
.pro-panel {
  display: grid;
  gap: 14px;
}

.pro-status {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.manual-unlock {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px 12px;
}

.manual-unlock summary {
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.manual-unlock label {
  margin-top: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-transform: none;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.check-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  outline: none;
}

select,
input {
  min-height: 42px;
  padding: 0 12px;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(9, 107, 104, 0.15);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 750;
}

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

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
}

.primary:hover:not(:disabled) {
  background: var(--accent-strong);
}

.secondary {
  background: #fff8ea;
  color: #734a0b;
  border-color: #dfbd7b;
}

.button-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.72rem;
  transform: translateY(-1px);
}

.progress-wrap {
  display: grid;
  gap: 9px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.progress-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e6dc;
}

.progress-hero {
  padding: 14px;
  border: 1px solid rgba(8, 117, 111, 0.22);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #eef9f6);
}

.progress-hero .progress-track {
  height: 22px;
  box-shadow: inset 0 0 0 1px rgba(8, 117, 111, 0.12);
}

#progress-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.22) 50%, rgba(255, 255, 255, 0.22) 75%, transparent 75%),
    linear-gradient(90deg, var(--accent), var(--blue));
  background-size: 28px 28px, auto;
  transition: width 220ms ease;
  animation: progress-stripes 900ms linear infinite;
}

.progress-stages {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

@keyframes progress-stripes {
  from {
    background-position: 0 0, 0 0;
  }
  to {
    background-position: 28px 0, 0 0;
  }
}

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

.meter div {
  min-height: 78px;
  padding: 14px 14px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.meter span,
.meter strong {
  display: block;
}

.meter span {
  color: var(--muted);
  font-size: 0.78rem;
}

.meter strong {
  margin-top: 4px;
  font-size: 1.1rem;
}

.editor-pane {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(249, 251, 252, 0.92));
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.editor-toolbar div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.icon-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  background: #f0f1eb;
  color: var(--muted);
  border-color: var(--line);
  font-size: 1.2rem;
}

textarea {
  min-height: 520px;
  resize: none;
  border: 0;
  border-radius: 0;
  padding: 18px;
  background: #fff;
  font-size: 1rem;
  line-height: 1.58;
}

textarea:focus {
  box-shadow: none;
}

.statusbar {
  min-height: 42px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #fbfcf8;
}

.statusbar.error {
  color: var(--danger);
}

.statusbar.success {
  color: var(--accent-strong);
}

.statusbar.busy {
  color: var(--gold);
}

@media (max-width: 860px) {
  .shell {
    width: min(100vw - 20px, 760px);
    margin: 10px auto;
  }

  .workspace {
    min-height: calc(100vh - 20px);
  }

  .topbar,
  .main-grid {
    display: block;
  }

  .topbar {
    padding: 14px;
  }

  .plan-switch {
    width: 100%;
    margin-top: 14px;
  }

  .left-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  textarea {
    min-height: 420px;
  }
}
