:root {
  --bg-app: #F6F9F4;
  --bg-surface: #FFFFFF;
  --bg-subtle: #FFFFFF;
  --sidebar-bg: #F6F9F4;
  --sidebar-hover: #FFFFFF;
  --sidebar-active: #D7EEDD;
  --text-main: #243B35;
  --text-secondary: #243B35;
  --text-muted: #6B7F79;
  --primary: #27765B;
  --primary-hover: #27765B;
  --primary-light: #D7EEDD;
  --accent: #856000;
  --accent-light: #F5F0BB;
  --danger: #A83A45;
  --danger-light: #F6D5CF;
  --warning: #856000;
  --warning-light: #F5F0BB;
  --info: #2B5CA6;
  --info-light: #D2E0FB;
  --border: rgba(36,59,53,0.14);
  --border-strong: rgba(36,59,53,0.14);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(36,59,53,0.021);
  --shadow-md: 0 6px 20px rgba(36,59,53,0.042);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  background: var(--bg-app);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  background: #F6F9F4;
  color: #243B35;
  padding: 8px 14px;
  border-radius: 6px;
  z-index: 9999;
}
.skip-link:focus {
  top: 12px;
}

/* 1. 로그인 화면 */
.login-backdrop {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #F6F9F4 0%, #FFFFFF 100%);
}
.login-backdrop[hidden] {
  display: none !important;
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 20px 40px rgba(36,59,53,0.122);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}
.login-sub {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
}
.login-title {
  margin: 2px 0 0;
  font-size: 1.5rem;
  font-weight: 900;
}
.login-helper-row {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.btn-link {
  background: none;
  border: none;
  color: var(--info);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
}
.demo-accounts-box {
  margin-top: 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
}
.demo-accounts-title {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.demo-btn-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 공통 레이아웃 */
.admin-shell {
  display: flex;
  min-height: 100vh;
}
.admin-shell[hidden] {
  display: none !important;
}

/* 좌측 사이드바 */
.admin-sidebar {
  width: 230px;
  background: var(--sidebar-bg);
  color: #243B35;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(36,59,53,0.14);
}
.brand-icon {
  font-size: 1.6rem;
}
.brand-text {
  display: flex;
  flex-direction: column;
}
.brand-text strong {
  font-size: 1.05rem;
  font-weight: 900;
}
.brand-text span {
  font-size: 0.75rem;
  color: #4A605A;
}
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
}
.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-item {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: #4A605A;
  font-size: 0.92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: #243B35;
}
.nav-item[aria-current="page"] {
  background: var(--sidebar-active);
  color: #243B35;
}
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
}
.nav-badge-warn {
  background: var(--warning);
}
.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(36,59,53,0.14);
}

/* 우측 영역 */
.admin-content-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* 상단 상태 바 */
.admin-topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 62px;
}
.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.store-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 0.9rem;
}
.reception-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.85rem;
}
.reception-pill.is-receiving {
  background: var(--primary-light);
  color: #27765B;
  border: 1px solid rgba(39,118,91,0.55);
}
.reception-pill.is-paused {
  background: var(--danger-light);
  color: #A83A45;
  border: 1px solid rgba(168,58,69,0.55);
}
.btn-xs {
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid currentColor;
  background: #FFFFFF;
  color: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}
.new-order-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-light);
  color: #856000;
  border: 1px solid rgba(133,96,0,0.55);
  font-weight: 800;
  font-size: 0.85rem;
}
.net-sim-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  background: #F6F9F4;
  border: 1px solid var(--border-strong);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.clock-box {
  font-size: 0.8rem;
  text-align: right;
  line-height: 1.3;
}
.sync-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.account-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}
.role-badge {
  background: var(--info-light);
  color: var(--info);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 800;
}

.offline-alert-bar {
  background: var(--danger);
  color: #FFFFFF;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-toast {
  position: fixed;
  top: 74px;
  right: 24px;
  z-index: 60;
  background: #F6F9F4;
  color: #243B35;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--primary);
}

/* 본문 작업 영역 */
.admin-main {
  flex: 1;
  padding: 20px;
  outline: none;
}

/* 그리드 & 카드 컴포넌트 */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.page-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 900;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.kpi-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: block;
}
.kpi-value {
  font-size: 1.65rem;
  font-weight: 900;
  margin-top: 4px;
  display: block;
}
.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.panel-grid-2 {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 1100px) {
  .panel-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* 주문 관리: 좌측 목록 + 우측 상세 분할 레이아웃 */
.orders-split-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 1150px) {
  .orders-split-layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
}

/* 테이블 */
.data-table-wrap {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.data-table th,
.data-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.data-table th {
  background: var(--bg-subtle);
  font-weight: 800;
  color: var(--text-secondary);
  white-space: nowrap;
}
.data-table tr.is-selected {
  background: var(--primary-light);
}
.data-table tr.clickable-row {
  cursor: pointer;
}
.data-table tr.clickable-row:hover {
  background: #FFFFFF;
}

/* 폼 & 버튼 */
.form-group {
  margin-bottom: 12px;
}
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--text-main);
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  background: #FFFFFF;
}
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  background: var(--bg-subtle);
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.btn {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-sm {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 0.78rem;
}
.btn-block {
  width: 100%;
}
.btn-primary {
  background: #27765B;
  color: #FFFFFF;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}
.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-strong);
}
.btn-outline {
  background: transparent;
  color: var(--text-main);
  border-color: var(--border-strong);
}
.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(168,58,69,0.55);
}
.btn-warning {
  background: var(--warning-light);
  color: #856000;
  border-color: rgba(133,96,0,0.55);
}

/* 배지 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}
.status-paid {
  background: #EEF4EC;
  color: #2B5CA6;
}
.status-accepted {
  background: #F6F9F4;
  color: #2B5CA6;
}
.status-preparing {
  background: #EEF4EC;
  color: #856000;
}
.status-ready {
  background: #C4DFAA;
  color: #27765B;
}
.status-pickedup {
  background: #F6F9F4;
  color: #243B35;
}
.status-cancelled {
  background: #F6F9F4;
  color: #A83A45;
}

.alert-box {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 0.85rem;
  font-weight: 700;
}
.alert-danger {
  background: var(--danger-light);
  color: #A83A45;
  border: 1px solid rgba(168,58,69,0.55);
}
.alert-warning {
  background: var(--warning-light);
  color: #856000;
  border: 1px solid rgba(133,96,0,0.55);
}
.alert-info {
  background: var(--info-light);
  color: #2B5CA6;
  border: 1px solid rgba(43,92,166,0.55);
}

/* 시간대별 막대 차트 */
.bar-chart {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  align-items: end;
  height: 120px;
  padding: 14px 8px 4px;
  border-bottom: 1px solid var(--border);
}
.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}
.bar-fill {
  width: 100%;
  max-width: 34px;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  min-height: 6px;
}
.bar-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* 모달 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(246,249,244,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop[hidden] {
  display: none !important;
}
.modal-dialog {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 900;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
}
.modal-body {
  padding: 18px;
}
.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

