@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700&family=Space+Grotesk:wght@500;700&display=swap');

:root {
  --bg: #e7f7f5;
  --surface: rgba(248, 255, 254, 0.84);
  --surface-strong: #f9fffe;
  --surface-muted: rgba(235, 249, 247, 0.9);
  --line: rgba(62, 122, 118, 0.18);
  --line-strong: rgba(62, 122, 118, 0.34);
  --text: #173433;
  --muted: #52716f;
  --accent: #81d8d0;
  --accent-deep: #3b8f8b;
  --accent-rgb: 129, 216, 208;
  --accent-deep-rgb: 59, 143, 139;
  --accent-soft: rgba(129, 216, 208, 0.14);
  --shadow: 0 24px 60px rgba(45, 115, 111, 0.13);
  --shadow-soft: 0 10px 30px rgba(36, 96, 92, 0.08);
  --focus-ring: 0 0 0 4px rgba(129, 216, 208, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Noto Sans KR', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(129, 216, 208, 0.3), transparent 32%),
    radial-gradient(circle at bottom right, rgba(72, 170, 164, 0.18), transparent 30%),
    linear-gradient(180deg, #f4fffe 0%, #e8f8f6 52%, #f6fffe 100%);
  color: var(--text);
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.page-shell {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.page-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.55;
}

.orb-left {
  width: 280px;
  height: 280px;
  top: 60px;
  left: -80px;
  background: rgba(129, 216, 208, 0.52);
}

.orb-right {
  width: 360px;
  height: 360px;
  right: -120px;
  top: 240px;
  background: rgba(59, 143, 139, 0.18);
}

.app {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 32px));
  margin: 24px auto 64px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  position: relative;
  padding: 28px;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.82), transparent 36%),
    linear-gradient(135deg, rgba(248, 255, 254, 0.96), rgba(235, 249, 247, 0.9));
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, rgba(129, 216, 208, 0.12), rgba(59, 143, 139, 0.9));
}

.hero::after {
  content: '';
  position: absolute;
  right: -48px;
  top: -54px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(129, 216, 208, 0.2), transparent 68%);
  pointer-events: none;
}

.eyebrow,
.section-label,
.status-label {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.hero-copy {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 24px;
  align-items: center;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: 'Space Grotesk', 'Noto Sans KR', sans-serif;
  letter-spacing: -0.04em;
}

h1 {
  margin-top: 10px;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 0.97;
  max-width: 11ch;
}

.hero-text,
.panel-hint,
.receipt-meta,
.item-row p,
.file-card p,
.category-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.hero-text {
  max-width: 52ch;
  margin-top: 14px;
  font-size: 1.04rem;
}

.hero-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}

.hero-action-btn {
  min-width: 164px;
  min-height: 54px;
}

.note-chip,
.keyword-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(62, 122, 118, 0.12);
  color: var(--accent-deep);
  font-size: 0.92rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(380px, 460px) minmax(0, 1fr);
  gap: 22px;
  margin-top: 22px;
  align-items: start;
}

.view-shell {
  display: grid;
  gap: 22px;
}

.view-shell[hidden] {
  display: none !important;
}

.content-standalone {
  display: grid;
  gap: 22px;
}

.product-view-shell {
  max-width: 860px;
  margin: 0 auto;
}

.product-screen-panel {
  min-height: calc(100vh - 120px);
}

.sidebar,
.content {
  display: grid;
  gap: 22px;
}

.sidebar {
  position: sticky;
  top: 18px;
}

.sidebar .panel-head {
  flex-direction: column;
  align-items: start;
}

.panel {
  position: relative;
  border-radius: 24px;
  padding: 24px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(249, 255, 254, 0.94), rgba(241, 252, 251, 0.9));
}

.panel::before,
.metric-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, rgba(129, 216, 208, 0.16), rgba(59, 143, 139, 0.82));
}

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

.panel-head h2 {
  margin-top: 6px;
  font-size: 1.5rem;
  letter-spacing: -0.05em;
}

.receipt-details,
.raw-text {
  display: grid;
  gap: 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  padding: 14px 15px;
  color: var(--text);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

textarea {
  resize: vertical;
  min-height: 92px;
}

input::placeholder,
textarea::placeholder {
  color: rgba(82, 113, 111, 0.72);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(var(--accent-deep-rgb), 0.42);
  box-shadow: var(--focus-ring);
  background: rgba(255, 255, 255, 0.92);
}

.primary-btn,
.ghost-btn,
.remove-btn {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease;
}

.primary-btn,
.ghost-btn {
  padding: 13px 18px;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #f8fffe;
  box-shadow: 0 16px 32px rgba(59, 143, 139, 0.24);
}

.ghost-btn,
.remove-btn {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.primary-btn:hover,
.ghost-btn:hover,
.remove-btn:hover {
  transform: translateY(-1px);
}

.ghost-btn:hover,
.remove-btn:hover {
  border-color: rgba(var(--accent-deep-rgb), 0.32);
  background: rgba(236, 251, 249, 0.92);
}

.primary-btn:active,
.ghost-btn:active,
.remove-btn:active {
  transform: translateY(0);
}

.primary-btn:disabled,
.ghost-btn:disabled {
  cursor: progress;
  opacity: 0.68;
}

#confirmBtn:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.category-list,
.selected-files,
.category-summary,
.results {
  display: grid;
  gap: 14px;
}

.category-card,
.summary-card,
.receipt-card,
.file-card {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.category-card-head,
.summary-card-head,
.receipt-card-head,
.upload-actions,
.status-panel {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.fixed-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.18);
  color: var(--accent-deep);
  font-size: 0.84rem;
  border: 1px solid rgba(var(--accent-deep-rgb), 0.12);
}

.category-editor-grid {
  display: grid;
  grid-template-columns: minmax(120px, 220px);
  gap: 12px;
  margin-top: 14px;
}

.category-editor-stack {
  grid-template-columns: 1fr;
}

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

.compact-field input {
  min-height: 54px;
}

.reference-items {
  margin-top: 14px;
}

.reference-items summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  color: var(--accent-deep);
  font-weight: 600;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface-muted);
}

.category-top-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px 110px;
  grid-template-areas:
    "name name name"
    "price price register"
    "options options options";
  gap: 10px;
  align-items: end;
}

.new-product-field {
  grid-area: name;
}

.new-price-field {
  grid-area: price;
}

.new-options-field {
  grid-area: options;
}

.inline-action-btn {
  grid-area: register;
  width: 100%;
  min-height: 54px;
}

.new-product-field input {
  min-height: 58px;
  font-size: 1.02rem;
}

.product-editor-list {
  display: grid;
  gap: 12px;
  margin-top: 10px;
  max-height: 58vh;
  overflow: auto;
  padding-right: 6px;
}

.product-editor-list::-webkit-scrollbar {
  width: 10px;
}

.product-editor-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(var(--accent-deep-rgb), 0.18);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.product-editor-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(243, 253, 252, 0.82));
  display: grid;
  gap: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.product-editor-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.product-editor-head strong {
  font-size: 0.96rem;
}

.product-meta-row {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 12px;
}

.product-meta-row textarea {
  min-height: 88px;
}

.product-remove-btn {
  padding: 10px 14px;
}

.upload-zone {
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
  padding: 28px;
  border-radius: 24px;
  border: 1.5px dashed var(--line-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(241, 255, 253, 0.88)),
    repeating-linear-gradient(
      135deg,
      rgba(var(--accent-rgb), 0.08),
      rgba(var(--accent-rgb), 0.08) 12px,
      transparent 12px,
      transparent 24px
    );
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 12px 30px rgba(43, 111, 107, 0.08);
}

.upload-zone strong {
  font-size: 1.18rem;
}

.upload-zone span {
  max-width: 32ch;
}

.upload-zone input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.status-panel {
  margin-top: 16px;
  padding: 16px;
  border-radius: 20px;
  background: var(--accent-soft);
  border: 1px solid rgba(var(--accent-deep-rgb), 0.12);
}

.status-panel > div {
  min-width: 0;
}

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

.preview-summary {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(var(--accent-rgb), 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.66);
}

.preview-summary strong,
.preview-summary p {
  margin: 0;
}

.preview-summary p {
  color: var(--muted);
}

.metric-card {
  position: relative;
  border-radius: 22px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(242, 253, 251, 0.88));
}

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

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-family: 'Space Grotesk', 'Noto Sans KR', sans-serif;
  font-size: 1.7rem;
  line-height: 1;
}

.summary-amounts {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.summary-amounts strong {
  font-size: 1.15rem;
}

.progress-track {
  margin-top: 14px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(var(--accent-deep-rgb), 0.12);
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #9ee4de, #3b8f8b);
}

.empty-block {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed var(--line);
  background: rgba(247, 255, 254, 0.72);
  color: var(--muted);
}

.receipt-card-head {
  align-items: start;
}

.receipt-file {
  margin: 0 0 6px;
  color: var(--accent-deep);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.receipt-total {
  text-align: right;
}

.receipt-total span {
  display: block;
  color: var(--muted);
}

.receipt-total strong {
  font-family: 'Space Grotesk', 'Noto Sans KR', sans-serif;
  font-size: 1.45rem;
}

.receipt-body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.receipt-preview {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
}

.item-table {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.72);
}

.total-only-panel {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(var(--accent-rgb), 0.12);
}

.total-only-panel strong,
.total-only-panel p,
.total-only-amount {
  margin: 0;
}

.total-only-panel p {
  margin-top: 8px;
  color: var(--muted);
}

.total-only-amount {
  margin-top: 14px;
  font-family: 'Space Grotesk', 'Noto Sans KR', sans-serif;
  font-size: 1.8rem;
  color: var(--accent-deep);
}

.item-table-head,
.item-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 120px 110px;
  gap: 14px;
  padding: 14px 16px;
}

.item-table-head {
  background: rgba(var(--accent-rgb), 0.14);
  font-size: 0.88rem;
  color: var(--muted);
}

.item-row {
  align-items: start;
  border-top: 1px solid rgba(var(--accent-deep-rgb), 0.12);
}

.item-row strong {
  font-size: 0.96rem;
}

.raw-text summary {
  cursor: pointer;
  color: var(--accent-deep);
  font-weight: 600;
}

.raw-text pre {
  margin: 0;
  padding: 16px;
  max-height: 240px;
  overflow: auto;
  border-radius: 18px;
  background: #f6fffe;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
}

@media (max-width: 980px) {
  .hero-copy,
  .workspace,
  .receipt-body,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .preview-summary,
  .hero-notes,
  .panel-head {
    justify-content: start;
  }

  .sidebar,
  .content {
    gap: 18px;
  }

  .content-standalone,
  .view-shell {
    gap: 18px;
  }

  .category-editor-grid {
    grid-template-columns: 1fr;
  }

  .category-top-actions,
  .product-meta-row {
    grid-template-columns: 1fr;
  }

  .category-top-actions {
    grid-template-areas:
      "name"
      "price"
      "options"
      "register";
  }

  .preview-summary,
  .panel-head {
    align-items: start;
  }

  .panel-head {
    flex-direction: column;
  }

  .panel-head > .primary-btn,
  .panel-head > .ghost-btn {
    width: 100%;
    justify-content: center;
  }

  .upload-actions,
  .status-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .product-editor-list {
    max-height: none;
    padding-right: 0;
  }
}

@media (max-width: 720px) {
  .app {
    width: min(100vw - 18px, 100%);
    margin: 10px auto 40px;
  }

  .hero,
  .panel,
  .metric-card {
    padding: 18px;
    border-radius: 22px;
  }

  .hero-copy {
    gap: 18px;
  }

  .hero-actions {
    margin-top: 18px;
  }

  .hero-action-btn {
    width: 100%;
  }

  h1 {
    max-width: none;
    font-size: clamp(1.8rem, 10vw, 2.8rem);
    line-height: 1.02;
  }

  .hero-text {
    font-size: 0.96rem;
  }

  .hero-notes {
    justify-content: start;
    gap: 8px;
  }

  .note-chip {
    font-size: 0.82rem;
    padding: 7px 10px;
  }

  .workspace {
    gap: 16px;
    margin-top: 16px;
  }

  .content-standalone,
  .view-shell {
    gap: 16px;
  }

  .panel-head {
    gap: 12px;
    margin-bottom: 16px;
  }

  .panel-head h2 {
    font-size: 1.34rem;
  }

  .upload-zone {
    padding: 22px 16px;
    border-radius: 20px;
  }

  .upload-zone strong {
    font-size: 1.04rem;
  }

  .upload-zone span {
    font-size: 0.92rem;
  }

  .upload-actions,
  .status-panel,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .primary-btn,
  .ghost-btn,
  .remove-btn,
  .inline-action-btn {
    min-height: 52px;
  }

  .category-card,
  .summary-card,
  .receipt-card,
  .file-card,
  .product-editor-card {
    padding: 14px;
  }

  .category-card-head,
  .summary-card-head,
  .receipt-card-head,
  .product-editor-head,
  .reference-items summary {
    align-items: start;
    flex-direction: column;
  }

  .fixed-badge,
  .product-remove-btn {
    align-self: flex-start;
  }

  .category-top-actions {
    gap: 12px;
  }

  .new-product-field input,
  .compact-field input {
    min-height: 52px;
  }

  .reference-items summary {
    gap: 8px;
  }

  .product-editor-head strong {
    font-size: 1rem;
  }

  .receipt-total {
    text-align: left;
  }

  .receipt-total strong {
    font-size: 1.3rem;
  }

  .item-table-head,
  .item-row {
    grid-template-columns: 1fr;
  }

  .item-table-head {
    display: none;
  }

  .item-table {
    display: grid;
    gap: 10px;
    border: 0;
    background: transparent;
  }

  .item-row {
    gap: 8px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.78);
  }

  .item-row + .item-row {
    border-top: 1px solid var(--line);
  }

  .receipt-preview {
    height: 180px;
  }

  .raw-text pre {
    padding: 14px;
    max-height: 220px;
    font-size: 0.9rem;
  }
}

@media (max-width: 520px) {
  .app {
    width: min(100vw - 12px, 100%);
    margin: 6px auto 28px;
  }

  .hero,
  .panel,
  .metric-card {
    padding: 15px;
    border-radius: 18px;
  }

  .eyebrow,
  .section-label,
  .status-label {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
  }

  h1 {
    font-size: clamp(1.65rem, 9vw, 2.3rem);
  }

  .hero-notes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .hero-actions {
    display: grid;
  }

  .note-chip {
    justify-content: center;
    text-align: center;
  }

  .upload-zone {
    padding: 18px 14px;
  }

  .upload-actions {
    gap: 10px;
  }

  .status-panel {
    gap: 10px;
    padding: 14px;
  }

  .metric-card strong,
  .total-only-amount {
    font-size: 1.5rem;
  }

  .product-editor-list {
    gap: 10px;
  }

  .product-editor-card {
    gap: 10px;
    border-radius: 16px;
  }

  .receipt-body {
    gap: 14px;
    margin-top: 14px;
  }

  .receipt-preview {
    height: 156px;
    border-radius: 14px;
  }
}
