:root {
  --orange: #ff5800;
  --orange-dark: #e74700;
  --orange-soft: #fff0e4;
  --orange-pale: #fff9f4;
  --line: #f0d7c6;
  --soft: #fff8f3;
  --text: #25211e;
  --muted: #756d67;
  --recommend: #ffead8;
  --optimized: #dcf5df;
  --blue: var(--orange);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: "Pretendard", "Noto Sans KR", Arial, sans-serif; color: var(--text); background: #fff; }
body { overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
.page-body { min-height: calc(100vh - 260px); }

.site-header {
  min-height: 135px;
  display: grid;
  grid-template-columns: minmax(250px, 360px) 1fr auto;
  align-items: center;
  gap: 34px;
  padding: 22px clamp(24px, 4vw, 68px) 18px;
  background: #fff;
}
.brand-lockup { display: flex; align-items: center; gap: 17px; color: var(--orange); }
.brand-lockup > span:last-child, .footer-brand > span:last-child { display: grid; gap: 3px; }
.brand-lockup strong { font-size: clamp(28px, 3vw, 48px); line-height: 1; letter-spacing: -3px; white-space: nowrap; }
.brand-lockup small { font-size: 18px; font-weight: 850; letter-spacing: -.6px; }
.brand-mark {
  width: 70px; height: 70px; position: relative; flex: 0 0 auto;
  border: 4px solid #ffb66d; border-radius: 50% 50% 45% 45%;
  background: linear-gradient(#fff, #fff5df);
}
.brand-mark::after {
  content: ""; position: absolute; width: 18px; height: 11px; left: 22px; top: 39px;
  background: #ff9a2f; clip-path: polygon(50% 100%, 0 0, 100% 0);
}
.brand-mark i {
  position: absolute; width: 25px; height: 25px; top: 17px;
  border: 4px solid var(--orange); border-radius: 50%; background: #fff;
}
.brand-mark i:first-child { left: 7px; }
.brand-mark i:last-child { right: 7px; }
.brand-mark i:first-child::after {
  content: ""; position: absolute; width: 11px; height: 4px; left: 21px; top: 7px; background: var(--orange);
}
.site-navigation { min-width: 0; }
.primary-menu, .secondary-menu { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.primary-menu a {
  min-width: 94px; padding: 13px 19px; border: 1px solid #ffad78; border-radius: 9px;
  text-align: center; font-size: 17px; font-weight: 850; background: #fff;
}
.primary-menu a.active { color: #fff; border-color: var(--orange); background: var(--orange); box-shadow: 0 5px 12px rgba(255,88,0,.18); }
.secondary-menu { margin-top: 13px; gap: 0; }
.secondary-menu a { padding: 2px 17px; font-size: 15px; font-weight: 750; border-right: 1px solid #ddd; }
.secondary-menu a:last-child { border-right: 0; }
.secondary-menu a.active { color: var(--orange); }
.admin-button {
  padding: 13px 20px; color: #fff; background: var(--orange); border-radius: 8px;
  font-weight: 850; white-space: nowrap;
}

.consultation-shell { min-height: 65vh; padding: 12px 94px 36px 36px; }
.customer-panel {
  display: grid; grid-template-columns: 1fr .7fr 1.3fr 2fr 2fr; gap: 12px;
  background: var(--orange-pale); border: 1px solid var(--line); border-radius: 16px; padding: 15px 18px;
}
.customer-panel label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 750; }
.customer-panel input, .customer-panel select {
  width: 100%; border: 1px solid #ead8ca; border-radius: 8px; background: #fff; padding: 10px; color: var(--text);
}
.prescription { display: grid; grid-template-columns: 26px repeat(4, 1fr); gap: 6px; align-items: center; }
.prescription input { min-width: 0; }
.catalog-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 25px 4px 14px; }
.catalog-heading p { margin: 0 0 3px; color: var(--orange); font-weight: 850; }
.catalog-heading h1 { margin: 0; color: var(--orange); font-size: clamp(24px, 2.5vw, 39px); letter-spacing: -1.5px; }
.legend { display: flex; justify-content: flex-end; gap: 18px; margin: 0 8px 4px; font-size: 14px; font-weight: 750; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { width: 28px; height: 14px; display: inline-block; }
.recommend-color { background: var(--recommend); }
.optimized-color { background: var(--optimized); }

.comparison-board { display: grid; gap: 20px; }
.grade-block { min-width: 0; }
.grade-title {
  margin: 0; padding: 11px; color: #fff; text-align: center; font-size: 20px;
  border-radius: 13px 13px 0 0; background: linear-gradient(90deg, #ff8a39, #ff5600);
}
.grade-title.grade-최고급 { background: linear-gradient(90deg, #ffb047, #ff7a00); }
.grade-title.grade-프리미엄 { background: linear-gradient(90deg, #ff6700, #e84600); }
.product-grid {
  display: grid; grid-template-columns: 88px repeat(var(--product-count), minmax(145px, 1fr));
  overflow-x: auto; border: 1px solid #ffb17e; border-top: 0; border-radius: 0 0 13px 13px;
}
.product-grid > * { min-height: 52px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.row-label { display: flex; align-items: center; justify-content: center; background: #fff; font-weight: 850; }
.header-label { background: #fff7f0; color: var(--orange-dark); }
.product-head {
  display: grid; place-items: center; align-content: center; gap: 3px; padding: 10px;
  text-align: center; color: #3b2b22; background: linear-gradient(#fff6ec, #ffe2c7);
}
.product-head small { opacity: .78; }
.product-head strong { font-size: 17px; }
.product-head span { font-size: 12px; }
.product-head.recommended { color: #fff; background: linear-gradient(135deg, #ff8734, #ff5800); }
.product-head.optimized { color: #fff; background: linear-gradient(135deg, #68c77f, #2e9c59); }
.price-cell, .detail-cell {
  display: grid; place-items: center; padding: 9px; text-align: center; background: #fffdfa; font-weight: 750;
}
.unavailable { color: #c8c2bd; }
.detail-cell { font-size: 14px; background: #fff; }
.feature-cell { min-height: 68px; color: #4e4844; }
.empty-state { margin: 40px auto; max-width: 620px; padding: 50px; text-align: center; border: 1px dashed #e0ad8a; border-radius: 20px; }

.site-footer {
  min-height: 145px; display: grid; grid-template-columns: 1fr minmax(330px, 430px);
  align-items: stretch; margin-top: 10px; background: #fffaf5; border-top: 1px solid #f4e2d4;
}
.footer-benefits { display: grid; grid-template-columns: repeat(4, 1fr); align-items: center; padding: 24px 30px; }
.footer-benefit { min-width: 0; display: flex; align-items: center; gap: 14px; padding: 10px 22px; border-right: 1px solid #efdccc; }
.footer-benefit:last-child { border-right: 0; }
.footer-benefit > span:last-child { display: grid; gap: 5px; }
.footer-benefit strong { font-size: 18px; }
.footer-benefit small { color: #4f4944; font-size: 14px; }
.benefit-icon {
  width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto;
  border: 3px solid var(--orange); border-radius: 13px; color: var(--orange); font-weight: 900;
}
.benefit-icon::before { content: "OK"; }
.icon-store::before { content: "50"; }
.icon-glasses { border-radius: 50%; }
.icon-glasses::before { content: "OO"; letter-spacing: -4px; }
.icon-shield { border-radius: 50% 50% 55% 55%; }
.icon-shield::before { content: "V"; }
.footer-brand {
  display: flex; align-items: center; justify-content: center; gap: 18px; color: #fff;
  padding: 22px 35px; background: linear-gradient(135deg, #ff7b16, #ef4700);
  border-radius: 55px 0 0 0;
}
.footer-brand-mark { width: 70px; height: 70px; border: 6px solid rgba(255,255,255,.75); border-radius: 50%; }
.footer-brand strong { font-size: 34px; letter-spacing: -2px; white-space: nowrap; }
.footer-brand small { font-size: 16px; font-weight: 750; }

#drawingCanvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 50; pointer-events: none; touch-action: none; }
#drawingCanvas.drawing-active { pointer-events: auto; cursor: crosshair; }
.drawing-toolbar {
  position: fixed; right: 14px; top: 50%; z-index: 60; transform: translateY(-50%);
  display: grid; gap: 8px; padding: 10px 8px; border-radius: 20px;
  background: linear-gradient(180deg, #ff7b24, #ee4800); box-shadow: 0 12px 35px rgba(180,60,0,.25); color: #fff;
}
.drawing-toolbar button, .drawing-toolbar label {
  width: 58px; min-height: 52px; display: grid; place-items: center; align-content: center; gap: 2px;
  border: 0; border-radius: 12px; background: transparent; color: #fff; cursor: pointer;
}
.drawing-toolbar button:hover, .drawing-toolbar button.active, .drawing-toolbar label:hover { background: rgba(255,255,255,.2); }
.drawing-toolbar span { font-size: 10px; }
.drawing-toolbar input[type="color"] { width: 27px; height: 27px; padding: 0; border: 2px solid #fff; border-radius: 50%; overflow: hidden; }
.drawing-toolbar input[type="range"] { width: 45px; }

.admin-shell { min-height: 100vh; background: #f7f4f1; }
.admin-nav { display: flex; justify-content: space-between; align-items: center; padding: 16px 28px; background: #39271e; color: #fff; }
.admin-nav div { display: flex; gap: 18px; align-items: center; }
.admin-nav a, .admin-nav button { color: #fff; background: transparent; border: 0; cursor: pointer; }
.admin-content { max-width: 1500px; margin: auto; padding: 28px; }
.admin-card { background: #fff; border-radius: 16px; padding: 22px; margin-bottom: 22px; box-shadow: 0 5px 18px rgba(67,40,24,.07); }
.admin-card h2 { margin-top: 0; }
.admin-help { margin-top: -8px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.form-grid label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: #665b54; }
.form-grid input, .form-grid select, .form-grid textarea,
.menu-admin-row input, .menu-admin-row select { width: 100%; padding: 10px; border: 1px solid #d9cec6; border-radius: 8px; }
.form-grid .wide { grid-column: span 2; }
.check-row { display: flex !important; align-items: center; gap: 7px !important; }
.check-row input { width: auto; }
.primary-button, .danger-button { border: 0; border-radius: 9px; padding: 10px 17px; color: #fff; background: var(--orange); font-weight: 800; cursor: pointer; }
.danger-button { background: #c23b42; }
.menu-admin-list { display: grid; gap: 8px; margin-top: 20px; }
.menu-admin-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr 90px 90px auto auto; gap: 8px; align-items: center; padding: 9px; background: #fff9f4; border-radius: 10px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 1100px; }
.admin-table th, .admin-table td { padding: 9px; border-bottom: 1px solid #e7dfd9; text-align: left; }
.admin-table input, .admin-table select { width: 100%; min-width: 72px; padding: 7px; border: 1px solid #d9cec6; border-radius: 6px; }
.actions { display: flex; gap: 5px; }
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(145deg, #fff2e8, #fff); }
.login-card { width: min(420px, 90vw); padding: 32px; border-radius: 20px; background: #fff; box-shadow: 0 18px 50px rgba(140,60,10,.15); }
.login-card label { display: grid; gap: 7px; margin: 15px 0; font-weight: 700; }
.login-card input { padding: 12px; border: 1px solid #d9cec6; border-radius: 9px; }
.eyebrow { color: var(--orange); font-weight: 800; margin: 0 0 6px; }
.validation-error { color: #c7283d; }

@media (max-width: 1200px) {
  .site-header { grid-template-columns: 270px 1fr; }
  .admin-button { grid-column: 2; justify-self: end; margin-top: -46px; }
  .footer-benefits { grid-template-columns: repeat(2, 1fr); }
  .footer-benefit:nth-child(2) { border-right: 0; }
  .menu-admin-row { grid-template-columns: 1fr 1fr 1fr 80px; }
}

@media (max-width: 850px) {
  .site-header { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
  .site-navigation { order: 3; width: 100%; }
  .admin-button { margin: 0 0 0 auto; }
  .consultation-shell { padding: 12px 82px 36px 20px; }
  .customer-panel { grid-template-columns: repeat(2, 1fr); }
  .prescription { grid-column: span 2; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .site-footer { grid-template-columns: 1fr; }
  .footer-brand { border-radius: 45px 0 0; }
}

@media (max-width: 620px) {
  .brand-lockup strong { font-size: 29px; }
  .brand-mark { width: 55px; height: 55px; }
  .brand-mark i { top: 11px; }
  .brand-mark::after { left: 15px; top: 34px; }
  .primary-menu { gap: 7px; }
  .primary-menu a { min-width: auto; padding: 10px 13px; font-size: 14px; }
  .secondary-menu a { padding: 3px 10px; font-size: 13px; }
  .customer-panel { grid-template-columns: 1fr; }
  .prescription { grid-column: span 1; grid-template-columns: 24px repeat(2, 1fr); }
  .catalog-heading { display: block; }
  .legend { justify-content: flex-start; margin-top: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: span 1; }
  .footer-benefits { grid-template-columns: 1fr; }
  .footer-benefit { border-right: 0; border-bottom: 1px solid #efdccc; }
  .footer-brand strong { font-size: 27px; }
  .menu-admin-row { grid-template-columns: 1fr; }
}
