:root {
  color-scheme: light;
  --bg: #f5f6f1;
  --ink: #20211f;
  --muted: #62685e;
  --line: #d9ddd1;
  --panel: #ffffff;
  --field: #fbfcf8;
  --accent: #096b68;
  --accent-strong: #064f4d;
  --gold: #b7791f;
  --danger: #b42318;
  --shadow: 0 22px 50px rgba(32, 33, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(145deg, rgba(9, 107, 104, 0.12), transparent 32%),
    linear-gradient(315deg, rgba(183, 121, 31, 0.12), transparent 28%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe 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.82);
  border: 1px solid rgba(217, 221, 209, 0.9);
  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: rgba(255, 255, 255, 0.72);
}

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

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

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

.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: rgba(248, 249, 244, 0.86);
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 170px;
  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;
}

.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: #fff7e8;
  color: #72470c;
  border-color: #e5c27f;
}

.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: 7px;
}

.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-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #32a08f);
  transition: width 220ms ease;
}

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

.meter div {
  padding: 12px;
  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: 3px;
  font-size: 1.08rem;
}

.editor-pane {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  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;
  }
}
