:root {
  --bg: #f1f4f8;
  --panel: #ffffff;
  --ink: #1d2a38;
  --muted: #5e6a77;
  --line: #d6dee8;
  --line-strong: #c4d1df;
  --soft: #f8fbff;
  --primary: #0a7f8f;
  --primary-dark: #086874;
  --danger: #c13a3a;
  --sidebar-ink: #d9e7f5;
  --focus: #67b1ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 0% 0%, #e2edf8 0%, var(--bg) 48%, #e5edf6 100%);
}

.hidden {
  display: none !important;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-card {
  width: min(560px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 38px rgba(7, 28, 45, 0.15);
  padding: 30px;
}

.auth-card .btn.large {
  width: 100%;
}

.auth-card #loginForm {
  margin: 0;
}

.auth-card #requestRegisterBtn {
  margin-top: 52px;
}

.login-remember {
  margin-top: -2px;
  color: #405a74;
  font-size: 0.92rem;
  font-weight: 700;
}

.auth-card h1 {
  margin: 6px 0 8px;
  font-size: 2rem;
}

.auth-desc,
.hint {
  color: var(--muted);
}

.auth-logo {
  width: 180px;
  max-width: 50%;
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  color: #2d3f53;
  font-size: 0.97rem;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fbfdff;
  color: #1f2f41;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #afc2d6;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #6ca6dc;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(103, 177, 255, 0.19);
}

button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

textarea {
  resize: vertical;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn.large {
  min-height: 52px;
  font-size: 1.05rem;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-dark);
}

.btn.register {
  background: #e4f4f7;
  color: #0b6f7d;
  border: 1px solid #9bcdd5;
}

.btn.register:hover {
  background: #d6edf2;
}

.btn.secondary {
  background: #dfeaf4;
  color: #17324d;
}

.btn.ghost {
  border: 1px solid var(--line);
  color: #27384a;
  background: #fff;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.app-shell {
  --sidebar-width: 220px;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  transition: grid-template-columns 0.22s ease;
}

.app-shell.sidebar-collapsed {
  --sidebar-width: 0px;
}

.sidebar {
  background: linear-gradient(180deg, #12293d, #091728);
  color: var(--sidebar-ink);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: opacity 0.2s ease, padding 0.2s ease;
}

.app-shell.sidebar-collapsed .sidebar {
  opacity: 0;
  pointer-events: none;
  padding: 0;
  overflow: hidden;
}

.sidebar-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.sidebar-logo {
  height: 48px;
  width: auto;
  max-width: calc(100% - 60px);
  object-fit: contain;
  background: #fff;
  padding: 6px 10px;
  border-radius: 12px;
}

.brand-sub {
  margin: 12px 0 20px;
  font-size: 1.34rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #d7e6f5;
  line-height: 1.1;
  white-space: nowrap;
  text-align: center;
}

.tree-root {
  width: 100%;
  border: none;
  text-align: left;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--sidebar-ink);
  font-weight: 700;
  cursor: pointer;
}

.tree-items {
  list-style: none;
  margin: 10px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.menu-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #d1dfef;
  border: 1px solid transparent;
  padding: 11px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.menu-btn:hover,
.menu-btn.active {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
}

.tree-nav {
  flex: 1;
}

.sidebar-admin {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.sidebar-admin-title {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: #a9c2da;
  font-weight: 700;
}

.sidebar-admin-btn {
  width: 100%;
  border: none;
  border-radius: 16px;
  padding: 14px 12px;
  background: #dce8f5;
  color: #17324d;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
}

.sidebar-admin-btn:hover {
  background: #ccdff1;
}

.sidebar-pin-btn {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(216, 231, 245, 0.12);
  color: #d8e7f6;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0;
}

.sidebar-pin-btn:hover {
  background: rgba(216, 231, 245, 0.2);
}

.sidebar-pin-floating {
  position: fixed;
  top: 12px;
  left: 12px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: #14324d;
  color: #eaf2fb;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(6, 18, 31, 0.25);
  z-index: 60;
}

.sidebar-pin-floating:hover {
  background: #1a405f;
}

.pin-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.content {
  padding: 20px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 14px;
}

.topbar h2 {
  margin: 0;
}

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

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

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid #d9e3ee;
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 14px 30px rgba(15, 41, 66, 0.07);
}

.card h3 {
  margin: 4px 0 14px;
  font-size: 1.85rem;
  letter-spacing: -0.02em;
  color: #1d344b;
}

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

.tablet-form {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.form-section {
  border: 1px solid #e1eaf3;
  border-radius: 16px;
  padding: 14px;
  background: var(--soft);
  box-shadow: inset 0 1px 0 #fff;
}

.form-section:last-of-type {
  margin-bottom: 0;
}

.section-title {
  display: inline-flex;
  align-items: center;
  margin: 0 0 12px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #e9f2fb;
  border: 1px solid #cfe0f0;
  font-size: 1rem;
  font-weight: 800;
  color: #23435f;
  letter-spacing: -0.01em;
}

.grid {
  display: grid;
  gap: 12px;
}

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

.grid.three {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.grid .full {
  grid-column: 1 / -1;
}

.parent-cell-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
}

.check-grid.large {
  gap: 9px 11px;
}

.check-grid label {
  font-weight: 700;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  border: 1px solid #d6e2ef;
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: #30475f;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.check-grid label:hover {
  border-color: #a7c7e7;
  background: #f2f9ff;
}

.check-grid label:has(input:checked) {
  border-color: #70a7da;
  background: #e9f4ff;
  color: #153d61;
}

.check-grid input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: #0a7f8f;
}

.check-grid input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: #0a7f8f;
}

.dynamic-option-groups {
  display: grid;
  gap: 12px;
}

.dynamic-option-group {
  display: grid;
  gap: 8px;
}

.dynamic-option-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  color: #213d59;
}

.product-manager {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 12px;
}

.product-pane {
  border: 1px solid #dbe6f1;
  border-radius: 16px;
  background: #f8fbff;
  padding: 12px;
}

.product-pane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.product-group-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 62vh;
  overflow: auto;
}

.product-group-btn {
  width: 100%;
  border: 1px solid #ceddeb;
  border-radius: 12px;
  background: #fff;
  text-align: left;
  padding: 9px 10px;
  cursor: pointer;
  display: grid;
  gap: 3px;
}

.product-group-btn strong {
  font-size: 0.98rem;
  color: #203b56;
}

.product-group-btn span {
  font-size: 0.82rem;
  color: #57708a;
}

.product-group-btn.active {
  border-color: #6ea8dd;
  background: #eaf4ff;
}

.product-group-btn:hover {
  border-color: #9ebfdd;
}

.product-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}

.product-group-enabled {
  justify-self: start;
  align-self: end;
  min-height: 44px;
}

.product-item-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.product-item-head {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 180px) 88px 72px;
  gap: 8px;
  color: #4f6780;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0 2px;
}

.product-item-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 180px) 88px auto;
  gap: 8px;
  align-items: center;
}

.product-item-enabled-check {
  justify-content: flex-start;
}

.product-item-actions {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.inline-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
}

.inline-check.compact {
  font-size: 0.92rem;
  font-weight: 700;
}

.inline-check.compact input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.token-guide {
  font-size: 0.92rem;
  color: #445566;
  line-height: 1.6;
}

.token-guide code {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #c8d8ea;
  background: #f2f7fc;
  font-size: 0.86rem;
}

.address-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.visit-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.address-row input {
  flex: 1;
}

.address-search-btn {
  min-width: 108px;
  white-space: nowrap;
}

.form-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.form-actions-left {
  justify-content: flex-start;
  margin-top: 8px;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-title-row h3 {
  margin: 0;
}

.excel-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1f8f4d;
  color: #ffffff;
  border: 1px solid #16733d;
  box-shadow: 0 6px 16px rgba(24, 109, 58, 0.18);
}

.excel-download-btn:hover {
  background: #167a40;
}

.excel-btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.edit-history {
  margin-top: 18px;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}

.edit-history h4 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

.accordion-stack {
  display: grid;
  gap: 12px;
}

.screen-accordion {
  padding: 0;
  overflow: hidden;
}

.screen-accordion-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 2.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #1d344b;
}

.screen-accordion-summary::-webkit-details-marker {
  display: none;
}

.screen-accordion-arrow {
  font-size: 1.15rem;
  color: #4e6780;
  transition: transform 0.16s ease;
}

.screen-accordion[open] .screen-accordion-arrow {
  transform: rotate(180deg);
}

.screen-accordion-body {
  padding: 0 22px 20px;
}

.form-accordion {
  border: 1px solid transparent;
  border-radius: 16px;
  margin-bottom: 8px;
}

.form-accordion-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 0;
}

.form-accordion-summary::-webkit-details-marker {
  display: none;
}

.form-accordion-summary .section-title {
  margin-bottom: 0;
}

.form-accordion .form-section {
  margin-top: 8px;
}

.form-accordion:last-of-type {
  margin-bottom: 0;
}

.split {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 12px;
}

.list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: grid;
  gap: 8px;
  max-height: 56vh;
  overflow: auto;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 4px;
  cursor: pointer;
}

.list-item.active {
  border-color: var(--primary);
  background: #eef7f9;
}

.full-width {
  width: 100%;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.customer-list-table th,
.customer-list-table td {
  padding: 6px 9px;
  line-height: 1.3;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.customer-list-table {
  table-layout: fixed;
}

.customer-list-table .edit-btn {
  padding: 5px 10px;
  border-radius: 9px;
  min-height: 30px;
}

.customer-list-table th:last-child,
.customer-list-table td:last-child {
  text-align: center;
  vertical-align: middle;
}

.customer-list-table .cell-summary {
  color: #294158;
}

th,
td {
  border: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #ecf3fa;
}

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

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 30, 0.52);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  width: min(460px, 94vw);
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 20px;
}

@media (max-width: 1280px) {
  .split {
    grid-template-columns: 1fr;
  }

  .grid.three {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .product-manager {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    --sidebar-width: 184px;
  }

  .sidebar {
    padding: 14px 10px;
  }

  .tree-items {
    padding-left: 0;
  }

  .menu-btn {
    padding: 10px;
    font-size: 0.92rem;
  }

  .sidebar-top {
    gap: 8px;
    margin-bottom: 8px;
  }

  .sidebar-logo {
    height: 42px;
  }

  .sidebar-pin-btn {
    width: 42px;
    height: 42px;
  }

  .brand-sub {
    font-size: 1.15rem;
    margin: 10px 0 16px;
  }

  .screen-accordion-summary {
    font-size: 1.55rem;
    padding: 15px 16px;
  }

  .screen-accordion-body {
    padding: 0 16px 16px;
  }

  .content {
    padding: 14px;
  }

  .grid.three {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .parent-cell-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

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

  .visit-inline {
    grid-template-columns: 1fr 1fr;
  }

  .card-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .excel-download-btn {
    width: fit-content;
    align-self: flex-end;
  }
}

@media (max-width: 600px) {
  .app-shell {
    --sidebar-width: 160px;
  }

  .content {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .sidebar-admin-btn {
    padding: 10px 8px;
    font-size: 0.95rem;
  }

  .screen-accordion-summary {
    font-size: 1.24rem;
    padding: 12px 12px;
  }

  .screen-accordion-body {
    padding: 0 12px 12px;
  }

  .sidebar-top {
    gap: 6px;
  }

  .sidebar-logo {
    height: 38px;
    padding: 5px 8px;
  }

  .sidebar-pin-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .brand-sub {
    font-size: 1.02rem;
    margin: 8px 0 12px;
  }

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

  .parent-cell-grid {
    grid-template-columns: 1fr;
  }

  .address-row {
    flex-direction: column;
    align-items: stretch;
  }

  .visit-inline {
    grid-template-columns: 1fr;
  }
}
