:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef3f0;
  --ink: #202523;
  --muted: #66706b;
  --line: #d9e0db;
  --accent: #0f766e;
  --accent-2: #b9472d;
  --focus: #2563eb;
  --shadow: 0 16px 48px rgba(25, 39, 34, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: 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;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 88px;
  padding: 18px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 12px;
  font-size: 1rem;
}

h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.topbar__actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.brand__logo {
  width: clamp(150px, 22vw, 260px);
  max-height: 58px;
  object-fit: contain;
  flex: 0 0 auto;
}

.shell {
  display: block;
  padding: 20px clamp(16px, 4vw, 40px) 40px;
}

.workspace {
  min-width: 0;
  max-width: 1480px;
  margin: 0 auto;
}

.tools-home {
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tools-home__header h2 {
  margin-bottom: 8px;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.tools-home__header p:last-child {
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.tool-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-chip {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfb;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  font-size: 0.86rem;
}

.filter-chip.is-active {
  border-color: var(--accent);
  background: #e7f6f1;
  color: #075e56;
}

.tool-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.tool-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 14px;
  row-gap: 4px;
  min-height: 126px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.tool-card svg {
  grid-row: 1 / span 2;
  width: 48px;
  height: 48px;
  padding: 10px;
  border-radius: 8px;
  background: #e7f6f1;
  color: var(--accent);
}

.tool-card strong {
  align-self: end;
  font-size: 1.05rem;
}

.tool-card span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.tool-card:hover {
  border-color: var(--accent);
  background: #f4fbf8;
}

.tool-card:disabled,
.tool-card[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.46;
  filter: grayscale(0.4);
}

.tool-card:disabled:hover,
.tool-card[aria-disabled="true"]:hover {
  border-color: var(--line);
  background: #fbfcfb;
  transform: none;
}

.tool-card.is-hidden {
  display: none;
}

.tool-card--red svg {
  background: #feecec;
  color: #c24132;
}

.tool-card--blue svg {
  background: #eaf1ff;
  color: #2559b8;
}

.tool-card--teal svg,
.tool-card--cyan svg {
  background: #e6f8fb;
  color: #087b8f;
}

.tool-card--violet svg {
  background: #f0edff;
  color: #6842c2;
}

.tool-card--amber svg {
  background: #fff4d8;
  color: #a46300;
}

.tool-card--slate svg {
  background: #eef1f3;
  color: #334155;
}

.dropzone {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 112px;
  padding: 22px;
  border: 2px dashed #aebbb4;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  outline: none;
}

.dropzone.is-dragging {
  border-color: var(--accent);
  background: #effaf7;
}

.dropzone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.dropzone__copy {
  display: grid;
  gap: 6px;
}

.dropzone__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.dropzone__copy span,
.privacy,
.empty p {
  color: var(--muted);
  line-height: 1.55;
}

.button,
.tool {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.button {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 6px;
  font-weight: 700;
}

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

.button--ghost {
  background: transparent;
}

.button--wide {
  width: 100%;
}

.tool {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 6px;
  font-size: 1.25rem;
}

.tool--text {
  width: auto;
  min-width: 74px;
  padding: 0 12px;
  font-size: 0.9rem;
  font-weight: 800;
}

.tool--danger {
  color: var(--accent-2);
}

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

button:not(:disabled):hover {
  transform: translateY(-1px);
  border-color: #8ca098;
}

button:focus-visible,
.dropzone:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus), transparent 65%);
  outline-offset: 2px;
}

.toolbar {
  margin: 16px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.toolbar__spacer {
  flex: 1;
}

.empty {
  padding: 54px 20px;
  text-align: center;
}

.pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

.page-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(25, 39, 34, 0.09);
  cursor: grab;
}

.page-card:active {
  cursor: grabbing;
}

.page-card.is-selected {
  border-color: var(--accent);
}

.page-card.is-drag-over {
  border-color: var(--focus);
}

.page-card canvas {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f9faf8;
}

.page-card__meta {
  display: grid;
  gap: 3px;
  min-height: 44px;
}

.page-card__title {
  font-weight: 800;
  font-size: 0.92rem;
}

.page-card__source {
  color: var(--muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-options-heading {
  margin: 18px 0 10px;
}

.tool-options-heading h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.panel section {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.panel section.is-highlighted {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.stats {
  display: grid;
  gap: 10px;
  margin: 0;
}

.stats div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.stats div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

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

.stats dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
}

.field input,
.field select {
  min-height: 42px;
}

.field textarea {
  min-height: 86px;
  padding-block: 10px;
  resize: vertical;
}

.field--compact {
  margin-top: 10px;
}

.progress-line {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #e7f6f1;
  color: #075e56;
  font-size: 0.88rem;
  font-weight: 800;
}

.divider {
  height: 1px;
  margin: 14px 0;
  background: var(--line);
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.check input {
  width: 18px;
  height: 18px;
}

.button-grid,
.button-stack {
  display: grid;
  gap: 8px;
}

.button-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.button-grid .button,
.button-stack .button {
  min-width: 0;
  padding-inline: 10px;
}

.two-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 8px;
}

.status {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(140%);
  max-width: min(560px, calc(100vw - 24px));
  padding: 12px 16px;
  border-radius: 8px;
  background: #1f2937;
  color: #fff;
  box-shadow: var(--shadow);
  transition: transform 180ms ease;
  z-index: 20;
}

.status.is-visible {
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 860px) {
  .topbar,
  .dropzone {
    grid-template-columns: 1fr;
  }

  .dropzone__actions {
    justify-content: stretch;
  }

  .dropzone__actions .button {
    flex: 1;
  }

  .topbar {
    align-items: stretch;
  }

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

  .brand__logo {
    width: min(230px, 100%);
    max-height: 52px;
  }

  .topbar__actions {
    justify-content: stretch;
  }

  .topbar__actions .button {
    flex: 1;
  }

  .panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .pages {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .tool--text {
    flex: 1 1 44%;
  }

  .toolbar__spacer {
    display: none;
  }
}
