/* PC-first workspace shell. Loaded after page styles so every page shares one layout contract. */
:root {
  --sidebar-width: 224px;
  --workspace-gap: 16px;
  --workspace-main-max: 1024px;
  --workspace-app-width: calc(var(--sidebar-width) + var(--workspace-main-max));
  --workspace-stage-max: 1880px;
  --display-ad-rail-width: 300px;
  --mobile-workspace-header: 56px;
}

html,
body {
  min-width: 0;
  overflow-x: hidden;
}

body {
  background: var(--workspace-outside);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

.app-shell {
  display: block !important;
  min-height: 100vh !important;
}

.workspace-stage {
  align-items: start;
  display: grid;
  gap: var(--workspace-gap);
  grid-template-areas: "app";
  grid-template-columns: minmax(0, var(--workspace-app-width));
  justify-content: center;
  margin: 0 auto;
  max-width: var(--workspace-stage-max);
  min-width: 0;
  width: min(calc(100% - 32px), var(--workspace-stage-max));
}

.workspace-app-frame {
  --sidebar-width: 224px;
  --workspace-app-width: calc(var(--sidebar-width) + var(--workspace-main-max));
  background: var(--workspace-main);
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  display: grid;
  grid-area: app;
  grid-template-columns: var(--sidebar-width) minmax(0, var(--workspace-main-max));
  max-width: var(--workspace-app-width);
  min-height: 100vh;
  min-width: 0;
  position: relative;
  width: 100%;
}

.workspace-column {
  background: var(--workspace-main);
  display: flex;
  min-width: 0;
  min-height: 100vh;
  flex-direction: column;
  margin-left: 0;
}

.content-ad-layout {
  display: block;
  flex: 1 0 auto;
  min-width: 0;
  padding: 16px 12px 0;
  width: 100%;
}

.workspace-primary,
.content-ad-layout > *,
.app-main,
.community-page-main {
  min-width: 0;
}

#app.app-main,
.community-page-main {
  margin: 0;
  max-width: none;
  padding: 24px 0 56px;
  width: 100%;
}

.service-footer {
  background: var(--workspace-main);
  border-top-color: var(--border-subtle);
  flex: 0 0 auto;
  margin: 0;
  min-width: 0;
}

/* The desktop brand row lives inside the centered application frame. */
@media (min-width: 1024px) {
  .workspace-header {
    background: var(--workspace-sidebar) !important;
    border: 0 !important;
    border-right: 1px solid var(--border-subtle) !important;
    height: 62px !important;
    left: 0;
    min-height: 62px !important;
    padding: 0 !important;
    position: absolute !important;
    top: 0;
    width: var(--sidebar-width);
    z-index: 32;
  }

  .workspace-header .brand {
    align-items: center;
    display: flex;
    font-size: 17px;
    font-weight: 800;
    height: 44px;
    left: 14px;
    letter-spacing: -.025em;
    line-height: 1.4;
    gap: 7px;
    max-width: calc(var(--sidebar-width) - 82px);
    overflow: hidden;
    position: absolute;
    text-overflow: ellipsis;
    top: 10px;
    white-space: nowrap;
    z-index: 32;
  }

  #workspace-brand-controls {
    align-items: center;
    display: flex !important;
    height: 36px;
    left: calc(var(--sidebar-width) - 70px);
    position: absolute;
    top: 14px;
    width: 60px;
    z-index: 32;
  }

  #workspace-brand-controls #theme-toggle {
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    display: flex;
    font-size: 13px;
    gap: 3px;
    height: 32px;
    justify-content: center;
    min-height: 32px;
    padding: 0 5px;
    width: 60px;
  }

  #workspace-brand-controls #theme-toggle::after {
    content: "모드";
    font-size: 12px;
    font-weight: 600;
  }

  #workspace-sidebar-controls .header-right {
    align-items: center;
    background: var(--workspace-sidebar);
    bottom: 10px;
    display: flex;
    gap: 8px;
    left: 10px;
    margin: 0;
    position: absolute;
    width: calc(var(--sidebar-width) - 20px);
    z-index: 32;
  }

  #workspace-sidebar-controls .active-channel {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
  }

  #workspace-sidebar-controls .notification-trigger,
  #workspace-sidebar-controls .profile {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    min-height: 36px;
  }

  #workspace-sidebar-controls .community-notification-center {
    flex: 0 0 40px;
    order: 2;
  }

  #workspace-sidebar-controls .notification-trigger {
    height: 36px;
    min-height: 36px;
    width: 40px;
  }

  #workspace-sidebar-controls .profile {
    flex: 1 1 auto;
    order: 1;
    overflow: hidden;
    min-height: 38px;
    padding: 0 14px 0 36px;
    position: relative;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
  }

  #workspace-sidebar-controls .drawer-toggle {
    display: none !important;
  }

}

/* The navigation stays inside the application frame; only its middle region scrolls. */
#side-nav.app-sidebar {
  background: var(--workspace-sidebar) !important;
  border-bottom: 0 !important;
  border-right: 1px solid var(--border-subtle) !important;
  bottom: 0;
  display: flex !important;
  flex-direction: column;
  height: 100dvh !important;
  grid-column: 1;
  grid-row: 1;
  left: auto;
  max-width: var(--sidebar-width) !important;
  min-width: var(--sidebar-width) !important;
  overflow: visible !important;
  padding: 62px 0 0 !important;
  position: sticky !important;
  top: 0 !important;
  width: var(--sidebar-width) !important;
  z-index: 30;
}

.side-nav-content {
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.workspace-sidebar-controls {
  flex: 0 0 auto;
}

.utility-icon {
  fill: none;
  flex: 0 0 18px;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
  width: 18px;
}

#workspace-sidebar-controls .profile::before {
  background: currentColor;
  content: "";
  height: 18px;
  left: 10px;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75'%3E%3Ccircle cx='9' cy='6' r='3'/%3E%3Cpath d='M3.5 16c.5-3 2.4-4.5 5.5-4.5s5 1.5 5.5 4.5'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
  position: absolute;
  top: 9px;
  width: 18px;
}

#workspace-sidebar-controls .profile::after {
  display: none;
}

#workspace-sidebar-controls .profile[aria-current="page"] {
  background: var(--workspace-active-bg) !important;
  border-color: color-mix(in srgb, var(--workspace-active-fg) 28%, var(--border-subtle)) !important;
  color: var(--workspace-active-fg) !important;
  font-weight: 700;
}

.sidebar-navigation-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 8px 18px;
  scrollbar-color: color-mix(in srgb, var(--text-tertiary) 48%, transparent) transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.sidebar-navigation-body::-webkit-scrollbar {
  width: 6px;
}

.sidebar-navigation-body::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-navigation-body::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-tertiary) 42%, transparent);
  border: 1px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.sidebar-bottom-navigation {
  background: var(--workspace-sidebar);
  border-top: 1px solid var(--border-subtle);
  flex: 0 0 auto;
  padding: 9px 8px 58px;
}

.side-section {
  margin: 0 !important;
}

.side-section.home-navigation {
  display: block;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0 !important;
  padding-bottom: 14px;
}

.side-section:not(.home-navigation) {
  margin-top: 21px !important;
}

.side-section > p {
  align-items: center;
  color: var(--workspace-nav-group);
  display: flex;
  font: 600 12px/16.5px var(--font-sans);
  letter-spacing: .04em;
  font-size: var(--nav-group-size);
  line-height: var(--nav-group-line-height);
  margin: 0 10px 7px;
  min-height: var(--nav-group-line-height);
}

.side-section--folder > p {
  clip: auto;
  clip-path: none;
  height: auto;
  margin: 0 10px 7px;
  overflow: visible;
  position: static;
  white-space: normal;
  width: auto;
}

.side-platform-folder {
  margin: 0;
}

.side-folder-button {
  align-items: center;
  background: transparent !important;
  border: 0 !important;
  border-radius: 7px !important;
  color: var(--workspace-nav-text) !important;
  display: flex !important;
  font: 500 var(--nav-font-size)/var(--nav-line-height) var(--font-sans) !important;
  gap: 10px;
  height: var(--nav-row-height) !important;
  justify-content: space-between;
  min-height: var(--nav-row-height) !important;
  padding: 7px 10px !important;
  text-align: left;
  width: 100%;
}

.side-folder-button:hover,
.side-folder-button:focus-visible {
  background: var(--bg-subtle) !important;
  color: var(--text-primary) !important;
}

.side-folder-button.current {
  color: var(--workspace-active-fg) !important;
  font-weight: 600 !important;
}

.side-folder-button small {
  display: none !important;
}

.side-folder-button > .nav-icon {
  display: block;
}

.side-folder-button > span {
  display: block;
  min-width: 0;
  overflow: hidden;
}

.side-folder-button b {
  display: block;
  font: inherit !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-folder-chevron {
  fill: none;
  flex: 0 0 16px;
  height: 16px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-left: auto;
  stroke-width: 1.75;
  transform: rotate(-90deg);
  transition: transform .16s ease;
  width: 16px;
}

.side-folder-button.expanded .side-folder-chevron {
  transform: rotate(0);
}

.side-folder-children {
  border: 0 !important;
  display: none;
  margin: 1px 0 0 !important;
  padding: 0 !important;
}

.side-folder-children.show:not([hidden]) {
  display: grid;
  gap: 1px;
}

.side-nav-item {
  align-items: center;
  background: transparent !important;
  border: 0 !important;
  border-radius: 8px !important;
  color: var(--workspace-nav-text) !important;
  display: flex !important;
  font-size: var(--nav-font-size) !important;
  font-weight: 500 !important;
  gap: 10px !important;
  height: var(--nav-row-height) !important;
  line-height: var(--nav-line-height) !important;
  min-height: var(--nav-row-height) !important;
  padding: 7px 10px !important;
  text-align: left;
  text-decoration: none;
  transition: background-color .14s ease, color .14s ease;
  width: 100%;
}

#side-nav.app-sidebar .side-nav-item {
  height: var(--nav-row-height) !important;
  min-height: var(--nav-row-height) !important;
}

#side-nav.app-sidebar .side-folder-button {
  height: var(--nav-row-height) !important;
  min-height: var(--nav-row-height) !important;
  padding-block: 7px !important;
}

.side-nav-item > span {
  display: block;
  min-width: 0;
  overflow: hidden;
}

.side-nav-item b {
  display: block;
  font-size: var(--nav-font-size) !important;
  font-weight: inherit !important;
  line-height: var(--nav-line-height) !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-navigation-body .side-nav-item small,
.sidebar-bottom-navigation .side-nav-item small {
  display: none !important;
}

.side-nav-item:hover:not(:disabled),
.side-nav-item:focus-visible {
  background: var(--bg-subtle) !important;
  color: var(--text-primary) !important;
  outline-offset: -2px;
}

.side-nav-item.active {
  background: var(--workspace-active-bg) !important;
  box-shadow: none !important;
  color: var(--workspace-active-fg) !important;
  font-weight: 600 !important;
}

.side-folder-children .nav-icon {
  height: var(--nav-icon-size);
  width: var(--nav-icon-size);
}

.nav-icon {
  fill: none;
  flex: 0 0 var(--nav-icon-size);
  height: var(--nav-icon-size);
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
  width: var(--nav-icon-size);
}

.nav-icon--brand {
  color: inherit !important;
  overflow: visible;
  stroke: none;
}

.nav-icon--coupang {
  display: block;
  object-fit: contain;
}

.nav-icon--brand * {
  vector-effect: non-scaling-stroke;
}

.side-nav-item:not(.active) > .nav-icon,
.side-folder-button:not(.current) > .nav-icon {
  color: var(--workspace-nav-icon);
}

.soon-badge {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  color: var(--text-tertiary);
  flex: 0 0 auto;
  font-size: 11px !important;
  font-style: normal;
  font-weight: 650;
  line-height: 1;
  margin-left: auto;
  padding: 3px 6px;
  white-space: nowrap;
}

.side-nav-item:disabled {
  color: var(--text-tertiary) !important;
  cursor: not-allowed;
  opacity: .64;
}

.side-hint {
  background: var(--bg-subtle) !important;
  border: 0;
  border-radius: 10px !important;
  margin: 0 0 6px !important;
  padding: 9px 10px !important;
  position: static !important;
}

.side-hint b {
  color: var(--accent-link) !important;
  font-size: 12px !important;
}

.side-hint p {
  color: var(--text-tertiary) !important;
  display: -webkit-box;
  font-size: 11.5px !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.4 !important;
  margin: 2px 0 0 !important;
  overflow: hidden;
}

#sidebar-resizer {
  bottom: 0;
  cursor: col-resize;
  display: none;
  min-height: 100%;
  position: absolute;
  right: -4px;
  top: 0;
  width: 8px;
  z-index: 3;
}

#sidebar-resizer span {
  background: transparent;
  display: block;
  height: 100%;
  margin: auto;
  transition: background .15s;
  width: 2px;
}

#sidebar-resizer:hover span,
#sidebar-resizer:focus-visible span,
body.sidebar-resizing #sidebar-resizer span {
  background: var(--accent-link);
}

/* Page density and hierarchy. Fields, buttons, results and table values keep their current sizes. */
.home-hub {
  max-width: var(--workspace-main-max) !important;
}

.home-hero {
  min-height: 300px !important;
  padding: 28px 32px !important;
}

.home-visual-window {
  padding: 10px 12px 12px;
}

.home-mini-title {
  margin: 12px 0 10px;
  padding-bottom: 8px;
}

.home-mini-kpis b {
  padding: 8px 10px;
  font-size: 18px;
}

.home-mini-chart {
  height: 62px;
  margin-top: 8px;
  padding: 8px 10px 0;
}

.home-hero h1 {
  font-size: 36px !important;
  line-height: 1.25 !important;
}

.page-top h1,
.ad-page-top h1,
.calculator-page-heading h1,
.fee-guide-heading h1,
.policy-page-heading h1,
.policy-day-heading h1,
.rank-page-heading h1,
.community-page-heading h1,
.mapping-empty h1,
.empty h1,
.coming h1 {
  font-size: 32px !important;
  line-height: 1.25 !important;
}

#app h2,
.community-page-main h2 {
  font-size: 22px !important;
  line-height: 1.3 !important;
}

#app h3,
.community-page-main h3 {
  font-size: 18px !important;
  line-height: 1.3 !important;
}

#app label,
.community-page-main label {
  font-size: 14px;
  line-height: 1.4;
}

#app input,
#app select,
#app textarea,
.community-page-main input,
.community-page-main select,
.community-page-main textarea {
  font-size: 16px;
}

.eyebrow,
.community-eyebrow,
.notification-panel-heading p {
  font-size: 11px !important;
  line-height: 1.35 !important;
}

.page-top,
.ad-page-top {
  margin-bottom: 28px !important;
}

.home-choice {
  margin-top: 30px !important;
}

.home-tool-card,
.settings-card,
.fee-guide-panel,
.community-detail,
.community-form,
.community-comment-form {
  padding: 20px 24px;
}

.home-hero,
.home-tool-card,
.home-values article,
.panel,
.metrics article,
.period-summary,
.sales-guide,
.mapping-guide,
.upload-intro,
.local-rule,
.settings-card,
.group-manager,
.product-panel,
.mapping-workbench,
.mapping-empty,
.empty,
.coming,
.fee-guide-heading,
.fee-guide-panel,
.fee-guide-notice,
.policy-board,
.policy-detail-article,
.community-state,
.community-detail,
.community-form,
.community-comment-form,
.community-comment,
.community-post-list {
  border-radius: 12px !important;
  box-shadow: none !important;
}

.table-wrap,
.ad-table-wrap,
.fee-guide-table-wrap,
.fee-guide-naver-grid > section,
.ad-monthly-table-wrap,
.ad-support-body {
  max-width: 100%;
  overflow-x: auto;
}

.table-wrap thead th,
.ad-table-wrap thead th,
.fee-guide-table-wrap thead th,
.fee-guide-naver-grid thead th,
.ad-monthly-table-wrap thead th,
.ad-support-body thead th,
.ad-keyword-monthly > div thead th,
.panel table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

#app table th,
#app table td,
.community-page-main table th,
.community-page-main table td {
  font-size: 14px !important;
  line-height: 1.4 !important;
}

.copy-next-button,
.text-button,
.group-manager-body article span,
.similar-family span,
.required-mark,
.ad-keyword-name small,
.catalog-items small,
.mapping-status,
.period-change small,
.period-change strong,
.funnel-grid span,
.detail-toggle,
.unclassified-detail small,
.workflow-title span,
.workflow-step small,
.map-fields label > small,
.home-mini-title i,
.home-mini-kpis small,
.ad-placement-metrics dt,
.ad-latest-change article > span,
.ad-metric-label > small,
.ad-product-breakdown article > span small,
.rank-scope-grid article span,
.rank-create-card label > small,
.rank-form-action > p,
.rank-target-main small,
.rank-surface-badge,
.rank-lifecycle,
.rank-history-heading span,
.rank-history-list time,
.rank-history-list small,
.rank-source,
.rank-retention-note p {
  font-size: 11px !important;
}

.rank-page-heading > button,
.rank-state-card button,
.rank-target-actions button,
.rank-form-action > button {
  font-size: 14px !important;
  min-height: 42px;
}

.rank-feedback button {
  font-size: 14px !important;
  min-height: 30px;
}

.rank-create-card label > span {
  font-size: 14px !important;
}

.rank-create-card input,
.rank-create-card select {
  font-size: 16px !important;
}

.chev .nav-icon,
.ad-privacy > span .nav-icon,
[data-remove-file] .nav-icon,
#mapping-notice-close .nav-icon {
  height: 18px;
  stroke-width: 1.75;
  width: 18px;
}

.mapping-empty-icon .nav-icon,
.multi-upload-icon .nav-icon,
.upload-icon .nav-icon {
  height: 30px;
  stroke-width: 1.75;
  width: 30px;
}

.workflow {
  margin-inline: auto;
  max-width: calc(100% - 32px);
  width: 760px;
}

.workflow-step {
  flex: 1 1 0;
  gap: 6px;
  min-width: 0;
  padding-inline: 6px;
}

.workflow-title {
  flex: 0 0 112px;
  min-width: 0;
  padding-right: 10px;
}

.workflow-step b {
  white-space: nowrap;
}

.workflow-step:disabled {
  background: #F8FAFC;
  border-color: #E2E8F0;
  color: #718096;
}

.workflow-step:disabled b {
  color: #64748B;
}

.workflow-step:disabled small {
  color: #718096;
}

.workflow-step:disabled i {
  background: #EEF2F7;
  border-color: #E2E8F0;
  color: #64748B;
}

html[data-theme="dark"] .workflow-step:disabled {
  background: var(--bg-subtle);
  border-color: var(--border-subtle);
  color: var(--text-tertiary);
}

html[data-theme="dark"] .workflow-step:disabled b {
  color: var(--text-secondary);
}

html[data-theme="dark"] .workflow-step:disabled small {
  color: var(--text-tertiary);
}

html[data-theme="dark"] .workflow-step:disabled i {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

.mapping-empty.mapping-empty-start {
  height: auto;
  margin-inline: auto;
  max-width: calc(100% - 32px);
  min-height: 280px;
  padding: 32px;
  width: 760px;
}

.mapping-empty-start .primary {
  display: block;
  margin-inline: auto;
  max-width: 400px;
}

.mapping-empty-start ~ .workflow {
  margin-top: 16px;
}

.header-right .notification-trigger svg {
  height: 18px !important;
  stroke-width: 1.75 !important;
  width: 18px !important;
}

#app:has(#ad-dropzone) > .seller-display-ad-slot[data-display-ad-context="inline"] {
  order: 5;
}

/* Calculator: input + result remain one workspace; the ad rail is a separate shell column. */
body .app-shell:has(.calculator-center) {
  --sidebar-width: inherit;
}

#app:has(.calculator-center) {
  max-width: none !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.calculator-workspace {
  gap: 24px !important;
  inline-size: 100% !important;
}

.calculator-results {
  top: 16px !important;
}

.calculator-summary-card:not(.positive):not(.negative),
.calculator-vat-summary {
  background: var(--surface-subtle) !important;
  border-color: var(--line) !important;
}

.calculator-summary-card:not(.positive):not(.negative) b,
.calculator-vat-summary b {
  color: var(--text-primary) !important;
}

.calculator-summary-card:not(.positive):not(.negative) span,
.calculator-summary-card:not(.positive):not(.negative) small,
.calculator-vat-summary span {
  color: var(--text-secondary) !important;
}

@media (min-width: 1280px) {
  .calculator-workspace {
    grid-template-columns: minmax(0, 1fr) 318px !important;
  }
}

/* Reusable display-ad slots. No slot reserves space until preview or a filled ad is visible. */
.display-ad-rail[hidden],
.seller-display-ad-slot[hidden],
.seller-display-ad-slot.is-disabled {
  display: none !important;
}

.display-ad-rail {
  align-content: start;
  align-items: center;
  align-self: start;
  display: grid;
  gap: 44px;
  justify-items: center;
  min-width: 0;
  padding-top: 40px;
  position: static;
  width: var(--display-ad-rail-width);
}

.display-ad-rail--left {
  grid-area: left;
}

.display-ad-rail--right {
  grid-area: right;
}

.seller-display-ad-slot.is-development-preview {
  align-items: center;
  background: color-mix(in srgb, var(--workspace-card) 92%, var(--workspace-active-fg));
  border: 1px dashed color-mix(in srgb, var(--workspace-active-fg) 58%, var(--border-subtle));
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  display: flex;
  font-size: 12px;
  font-weight: 600;
  justify-content: center;
  line-height: 1.45;
  text-align: center;
}

.seller-display-ad-slot--left-tall,
.seller-display-ad-slot--right-tall {
  height: 600px;
  width: 300px;
}

.seller-display-ad-slot--right-small {
  height: 250px;
  width: 300px;
}

.seller-display-ad-slot[data-display-ad-context="inline"] {
  height: 120px;
  margin: 32px 0;
  max-width: 100%;
  width: 100%;
}

@media (min-width: 1880px) {
  .workspace-stage {
    width: min(100%, var(--workspace-stage-max));
  }

  .workspace-stage:has(.display-ad-rail--left:not([hidden])):has(.display-ad-rail--right:not([hidden])) {
    grid-template-areas: "left app right";
    grid-template-columns: 300px 1248px 300px;
  }

  .workspace-stage:has(.display-ad-rail--right:not([hidden])):not(:has(.display-ad-rail--left:not([hidden]))) {
    grid-template-areas: "app right";
    grid-template-columns: 1248px 300px;
    max-width: 1564px;
  }
}

@media (min-width: 1600px) and (max-width: 1879px) {
  .display-ad-rail--left {
    display: none !important;
  }

  .workspace-stage:has(.display-ad-rail--right:not([hidden])) {
    grid-template-areas: "app right";
    grid-template-columns: 1248px 300px;
    max-width: 1564px;
    width: min(calc(100% - 32px), 1564px);
  }
}

@media (min-width: 1440px) and (max-width: 1599px) {
  .workspace-stage {
    max-width: 1440px;
    width: min(100%, 1440px);
  }

  .display-ad-rail--left {
    display: none !important;
  }

  .workspace-stage:has(.display-ad-rail--right:not([hidden])) {
    grid-template-areas: "app right";
    grid-template-columns: minmax(0, 1248px) 176px;
  }

  .display-ad-rail--right {
    width: 176px;
  }

  .display-ad-rail--right .seller-display-ad-slot {
    max-width: 176px;
    width: 100%;
  }
}

@media (min-width: 1024px) and (max-width: 1439px) {
  .workspace-app-frame {
    --sidebar-width: 216px;
  }

  .workspace-stage {
    max-width: 1248px;
  }

  .display-ad-rail {
    display: none !important;
  }

  .workspace-header .brand {
    max-width: calc(var(--sidebar-width) - 22px);
  }
}

/* Mobile and small tablet: 56px header, one drawer, no right rail or top preview. */
@media (max-width: 1023px) {
  :root {
    --sidebar-width: min(320px, 86vw);
  }

  .workspace-stage,
  .workspace-app-frame {
    display: block;
    max-width: none;
    width: 100%;
  }

  .workspace-app-frame {
    --sidebar-width: min(320px, 86vw);
    border: 0;
  }

  .workspace-header {
    align-items: center !important;
    background: var(--bg-shell) !important;
    border-bottom: 1px solid var(--border-subtle) !important;
    display: flex !important;
    height: var(--mobile-workspace-header) !important;
    padding: 0 12px !important;
    position: sticky !important;
    top: 0;
    z-index: 50;
  }

  .workspace-header .brand {
    align-items: center;
    display: flex;
    flex: 0 1 auto;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.025em;
    line-height: 1.4;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace-header .brand-logo {
    height: 25px;
    width: 25px;
  }

  .workspace-header .active-channel {
    display: none;
  }

  .workspace-brand-controls {
    display: none;
  }

  .workspace-header .header-right {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
    margin-left: auto;
  }

  .workspace-header #theme-toggle,
  .workspace-header .notification-trigger,
  .workspace-header .drawer-toggle {
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    display: flex;
    height: 36px;
    justify-content: center;
    min-height: 36px;
    padding: 0;
    width: 36px;
  }

  .workspace-header #theme-toggle::after {
    display: none;
  }

  #workspace-sidebar-controls .profile {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    bottom: 12px;
    color: var(--text-primary);
    display: none;
    height: 44px;
    left: 12px;
    overflow: hidden;
    padding: 0 12px 0 40px;
    position: fixed;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: calc(min(320px, 86vw) - 24px);
    z-index: 46;
  }

  body.drawer-open #workspace-sidebar-controls .profile {
    display: block;
  }

  #side-nav.app-sidebar {
    bottom: 0;
    height: calc(100dvh - var(--mobile-workspace-header)) !important;
    max-width: min(320px, 86vw) !important;
    min-width: min(320px, 86vw) !important;
    left: 0;
    padding: 0 !important;
    position: fixed !important;
    top: var(--mobile-workspace-header) !important;
    transform: translateX(-101%);
    transition: transform .2s ease;
    width: min(320px, 86vw) !important;
    z-index: 45;
  }

  #side-nav.app-sidebar[data-open="true"] {
    transform: translateX(0);
  }

  .sidebar-navigation-body {
    padding-top: 12px;
  }

  #side-nav.app-sidebar .side-nav-item {
    height: var(--nav-row-height) !important;
    min-height: var(--nav-row-height) !important;
  }

  #side-nav.app-sidebar .side-folder-button {
    height: 36px !important;
    min-height: 36px !important;
  }

  .sidebar-bottom-navigation {
    padding-bottom: 68px;
  }

  #sidebar-resizer {
    display: none !important;
  }

  .drawer-overlay {
    background: rgb(0 0 0 / 52%);
    border: 0;
    bottom: 0;
    display: block;
    left: 0;
    position: fixed;
    right: 0;
    top: var(--mobile-workspace-header);
    z-index: 40;
  }

  .drawer-overlay[hidden] {
    display: none !important;
  }

  body.drawer-open {
    overflow: hidden;
  }

  .workspace-column {
    margin-left: 0;
    min-height: calc(100vh - var(--mobile-workspace-header));
  }

  .content-ad-layout {
    display: block;
    padding: 0;
  }

  #app.app-main,
  .community-page-main {
    padding: 24px 15px 48px;
  }

  .display-ad-rail {
    display: none !important;
  }

  .seller-display-ad-slot[data-display-ad-context="inline"] {
    height: 100px;
    margin: 28px 0;
  }

  .home-hero {
    min-height: auto !important;
    padding: 24px 20px !important;
  }

  .home-hero h1,
  .page-top h1,
  .ad-page-top h1,
  .calculator-page-heading h1,
  .fee-guide-heading h1,
  .policy-page-heading h1,
  .policy-day-heading h1,
  .community-page-heading h1,
  .mapping-empty h1,
  .empty h1 {
    font-size: 30px !important;
  }

  .calculator-workspace {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .calculator-results {
    position: static !important;
  }

  .fee-guide-table-wrap,
  .fee-guide-naver-grid,
  .table-wrap,
  .ad-table-wrap {
    max-width: 100%;
    overflow-x: auto;
  }

  .service-footer {
    padding-left: 15px;
    padding-right: 15px;
  }

}

@media (max-width: 560px) {
  .workspace-header .brand {
    font-size: 16px;
  }

  .workspace-header .brand-logo {
    margin-right: 5px;
  }

  .home-tool-card,
  .settings-card,
  .fee-guide-panel,
  .community-detail,
  .community-form,
  .community-comment-form {
    padding: 18px;
  }
}
