:root {
  --bg: #edf2fb;
  --surface: #ffffff;
  --surface-soft: #f7fafe;
  --text: #13243b;
  --muted: #5b6f87;
  --border: #d8e2ef;
  --primary: #0059d6;
  --primary-dark: #0047ab;
  --secondary: #17395f;
  --accent: #0f7b84;
  --accent-bg: #e6f5f7;
  --ok-bg: #e8f8ef;
  --ok-text: #17623d;
  --info-bg: #edf5ff;
  --info-border: #cedef7;
  --info-text: #215491;
  --danger-bg: #ffe9ec;
  --danger-border: #f0c4cb;
  --danger-text: #a42838;
  --shadow: 0 14px 36px rgba(15, 34, 62, 0.06);
  --app-shell-max: 1380px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.hidden {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", "Noto Sans KR", sans-serif;
  background:
    radial-gradient(circle at 10% 0%, rgba(173, 203, 255, 0.5), transparent 32%),
    radial-gradient(circle at 88% 0%, rgba(185, 232, 240, 0.55), transparent 28%),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

input::placeholder {
  color: #9daec3;
  opacity: 1;
}

button {
  border: none;
  border-radius: 10px;
  padding: 0.62rem 0.95rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--primary);
  cursor: pointer;
  transition: background 120ms ease, opacity 120ms ease;
}

button:hover:not(:disabled) {
  background: var(--primary-dark);
}

button.ghost {
  border: 1px solid #b8c9df;
  background: #ffffff;
  color: #22364f;
}

button.ghost:hover:not(:disabled) {
  background: #f4f8fd;
}

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

button.secondary:hover:not(:disabled) {
  background: #112c48;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
.drop-zone:focus-visible {
  outline: 3px solid rgba(0, 89, 214, 0.2);
  outline-offset: 2px;
}

input[type="text"],
select {
  width: 100%;
  border: 1px solid #c6d4e6;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: #ffffff;
  color: inherit;
}

input[readonly] {
  background: #f8fbff;
}

.layout {
  display: grid;
  gap: 1.15rem;
  padding-bottom: 1.5rem;
}

.panel {
  display: grid;
  gap: 1rem;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  overflow: hidden;
}

.section-intro,
.workspace-card,
.editor-panel,
.settings-panel {
  min-width: 0;
}

.panel-head {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.panel-head--compact {
  gap: 0.75rem;
}

.panel h2,
.panel h3 {
  margin: 0;
}

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

.small {
  font-size: 0.93rem;
}

.button-row,
.badge-row,
.workspace-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.3rem 0.72rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.badge {
  border: 1px solid #d2e2ff;
  background: #edf4ff;
  color: #2257ae;
}

.badge--ok {
  border-color: #c3e9d0;
  background: var(--ok-bg);
  color: var(--ok-text);
}

.status-badge {
  border: 1px solid var(--border);
  background: #f5f8fc;
  color: #51627a;
}

.task-grid,
.support-grid,
.guide-layout {
  display: grid;
  gap: 1rem;
}

.task-card,
.mini-panel,
.workspace-card,
.guide-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
}

.task-card {
  display: grid;
  gap: 1rem;
  padding: 1.1rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 250, 255, 0.98));
}

.task-card__header {
  display: grid;
  gap: 0.8rem;
}

.task-card__header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.task-card__tag {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 999px;
  padding: 0.32rem 0.8rem;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 0.83rem;
  font-weight: 700;
}

.feature-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.6;
}

.mini-panel,
.guide-card {
  padding: 1.1rem;
}

.mini-panel {
  display: grid;
  gap: 0.8rem;
  background: #ffffff;
}

.mini-panel p {
  margin: 0;
  line-height: 1.55;
  color: var(--muted);
}

.workspace-panel,
.editor-panel,
.settings-panel,
.workspace-card {
  display: grid;
  gap: 1rem;
}

.workspace-grid {
  display: grid;
  gap: 1rem;
}

.workspace-card {
  padding: 1.1rem;
  background: linear-gradient(180deg, #ffffff, #f8fbfe);
}

.drop-zone {
  display: grid;
  gap: 0.45rem;
  justify-items: center;
  text-align: center;
  min-height: 152px;
  border: 1px dashed #98aec9;
  border-radius: 16px;
  padding: 1.25rem;
  background: #f4f8ff;
  color: #56708f;
  cursor: pointer;
}

.drop-zone:hover,
.drop-zone.is-over {
  border-color: var(--primary);
  background: #ebf3ff;
  color: #24486f;
}

.loaded-files-panel {
  display: grid;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.9rem;
  background: #fbfdff;
}

.source-file-list {
  display: grid;
  gap: 0.65rem;
  max-height: 13rem;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.source-file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: #ffffff;
}

.source-file-item__details {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.source-file-item__details strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.source-file-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.source-file-item__remove {
  display: grid;
  place-items: center;
  inline-size: 2rem;
  min-inline-size: 2rem;
  block-size: 2rem;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

.item-list {
  display: grid;
  gap: 0.85rem;
}

.item-list--scrollable {
  max-height: min(68vh, 42rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.35rem;
}

.item-card {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  padding: 0.9rem;
}

.item-card.is-selected {
  border-color: #9cbce8;
  background: #f4f8ff;
}

.item-card__media {
  width: 112px;
  min-width: 112px;
  height: 84px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(180deg, #edf3fb, #dde7f4);
  display: grid;
  place-items: center;
}

.item-card__media--page {
  height: 136px;
}

.item-card__media.item-card__media--image img {
  object-fit: contain;
  background: #ffffff;
}

.item-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-card__details {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.item-card__details strong,
.item-card__details span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.item-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.item-card__actions {
  display: grid;
  gap: 0.55rem;
  justify-items: end;
}

.item-card__action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.item-card__action-button {
  padding: 0.46rem 0.62rem;
  font-size: 0.82rem;
  line-height: 1.15;
  white-space: nowrap;
}

.page-toggle {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.field,
.settings-stack,
.action-stack {
  display: grid;
  gap: 0.85rem;
}

.field {
  gap: 0.45rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.field-hint {
  margin: 0;
  color: #7388a2;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.45;
}

.segmented-control {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.segmented-control__button {
  padding: 0.52rem 0.78rem;
  border: 1px solid #c8d7ea;
  border-radius: 999px;
  background: #ffffff;
  color: #4b617d;
  font-size: 0.88rem;
  font-weight: 700;
}

.segmented-control__button:hover:not(:disabled) {
  background: #f4f8fd;
}

.segmented-control__button.is-active {
  border-color: #9cbce8;
  background: #edf4ff;
  color: #1d4f98;
}

.progress-card {
  display: grid;
  gap: 0.7rem;
  border: 1px solid #cfe0f8;
  border-radius: 14px;
  padding: 0.95rem;
  background: linear-gradient(180deg, #f7fbff, #eef5ff);
}

.progress-card__head {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
}

.progress-card__percent {
  color: #1d4f98;
  font-size: 0.9rem;
  font-weight: 800;
}

.progress-track {
  position: relative;
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 89, 214, 0.12);
}

.progress-track__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f7b84, #0059d6);
  transition: width 140ms ease;
}

.message {
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  font-size: 0.93rem;
  line-height: 1.5;
}

.message.info {
  border: 1px solid var(--info-border);
  background: var(--info-bg);
  color: var(--info-text);
}

.message.success {
  border: 1px solid #c3e9d0;
  background: var(--ok-bg);
  color: var(--ok-text);
}

.message.error {
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.empty-state {
  display: grid;
  gap: 0.35rem;
  border: 1px dashed #c3d3e6;
  border-radius: 14px;
  padding: 1rem;
  color: var(--muted);
  background: #fafcff;
}

.fact-list {
  display: grid;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fact-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(216, 226, 239, 0.9);
}

.fact-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.fact-list span {
  color: var(--muted);
}

.guide-layout {
  padding-bottom: 1.5rem;
}

.guide-card {
  box-shadow: var(--shadow);
}

.guide-card p,
.guide-card ul {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.guide-card ul {
  padding-left: 1.2rem;
}

.tool-footer {
  padding-bottom: 2rem;
}

.tool-footer__inner {
  display: grid;
  gap: 0.75rem;
}

.tool-footer__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.tool-footer__note,
.tool-footer__meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.hub-panel,
.tool-panel,
.panel-soft {
  display: grid;
  gap: 1rem;
}

.panel-soft {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f8fbfe);
  padding: 1.1rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.3rem 0.72rem;
  border: 1px solid #d2e2ff;
  background: #edf4ff;
  color: #2257ae;
  font-size: 0.82rem;
  font-weight: 700;
}

.queue-list,
.page-grid {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.queue-entry {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  padding: 0.9rem;
}

.queue-entry__preview,
.page-card__preview {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
}

.queue-entry__preview {
  max-width: 112px;
  max-height: 84px;
  object-fit: cover;
}

.queue-entry__meta {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.queue-entry__meta strong,
.queue-entry__meta span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.queue-entry__meta span,
.metadata-empty {
  color: var(--muted);
}

.metadata-empty {
  margin: 0;
  border: 1px dashed #c3d3e6;
  border-radius: 14px;
  padding: 1rem;
  background: #fafcff;
}

.page-card {
  display: grid;
  gap: 0.75rem;
  justify-items: start;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.9rem;
  background: #ffffff;
  color: var(--text);
  text-align: left;
}

.page-card:hover:not(:disabled) {
  background: #f4f8ff;
}

.page-card[aria-pressed="true"],
.page-card.is-selected {
  border-color: #9cbce8;
  background: #edf4ff;
}

.page-card__preview {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  background: linear-gradient(180deg, #edf3fb, #dde7f4);
}

.page-card__title {
  font-size: 1rem;
}

.page-card__meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.range-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}

.field-grow {
  flex: 1 1 220px;
}

.compact.wrap {
  flex-wrap: wrap;
}

.result-card {
  display: grid;
  gap: 0.75rem;
  border: 1px solid #c3e9d0;
  border-radius: 14px;
  padding: 1rem;
  background: var(--ok-bg);
}

.result-card p {
  margin: 0;
}

.visually-hidden,
.visually-hidden-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (min-width: 860px) {
  .task-grid,
  .support-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (min-width: 1080px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
    align-items: start;
  }
}

@media (max-width: 760px) {
  .panel,
  .task-card,
  .mini-panel,
  .workspace-card,
  .guide-card {
    padding: 1rem;
  }

  .item-card {
    grid-template-columns: 1fr;
  }

  .queue-entry {
    grid-template-columns: 1fr;
  }

  .source-file-item {
    grid-template-columns: 1fr;
  }

  .source-file-item__remove {
    justify-self: end;
  }

  .item-card__media,
  .item-card__media--page {
    width: 100%;
    min-width: 0;
    max-width: 240px;
    height: 150px;
  }

  .item-card__actions {
    justify-items: start;
  }

  .item-card__action-group {
    justify-content: flex-start;
  }

  .queue-entry__preview,
  .page-card__preview {
    max-width: 100%;
  }

  .fact-list li {
    flex-direction: column;
    align-items: flex-start;
  }
}
