/*
  파일 역할: 전체 UI 스타일(CSS)
  - 레이아웃: 헤더/사이드바/콘텐츠, 대시보드 카드/그리드, 리스트/모달/토글 등
  - 반응형: 일부 구간에서 간단한 미디어쿼리 적용
  - 주의: 색상/간격 토큰은 :root 변수로 관리합니다.
*/
:root{
  --bg:#f5f7fb;
  --card:#ffffff;
  --muted:#6b7280;
  --primary:#0f63d8; /* deeper blue */
  --accent:#06b6d4;
  --success:#10b981;
  --danger:#ef4444;
  --radius:10px;
}

*{box-sizing:border-box}
body{
  font-family: 'Noto Sans KR', Inter, "Helvetica Neue", Arial, sans-serif;
  background:var(--bg);
  margin:0;
  color:#0b1220;
  -webkit-font-smoothing:antialiased;
}

/* 로그인 화면 */
.login-wrapper{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:32px;
}
.login-box{
  width:760px; /* 가로로 넓게 */
  max-width:95%;
  background:var(--card);
  padding:24px 28px;
  border-radius:var(--radius);
  box-shadow:0 8px 28px rgba(2,6,23,0.06);
  display:flex;
  align-items:center;
  gap:20px;
}
.login-brand h1{margin:0;font-size:28px;color:var(--primary)}
.login-brand p{margin:0;color:var(--muted);font-size:13px}
.login-tabs{margin-bottom:8px}
.login-tab{display:inline-block;background:#fff3cd;color:#856404;border:1px solid #ffeeba;border-radius:8px;padding:6px 10px;font-size:12px}
.login-form{flex:1}
.login-form .input-row{margin-bottom:12px}
.login-form input{
  width:100%;
  padding:10px 12px;
  border:1px solid #e6e9ee;
  border-radius:8px;
  font-size:14px; /* 글씨 작게 */
}
.btn-primary{
  background:var(--primary);
  color:white;
  border:0;
  padding:10px 12px;
  width:auto;
  border-radius:8px;
  font-weight:600;
  cursor:pointer;
  box-shadow:0 6px 18px rgba(15,23,42,0.04);
}
.sr-only{position:absolute!important;height:1px;width:1px;overflow:hidden;clip:rect(1px,1px,1px,1px);white-space:nowrap}

/* 앱(메인) 레이아웃 */
.app-header{
  height:56px;
  background:#2b2f38; /* 네이버 스마트스토어 상단바 느낌의 다크 */
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 24px;
  border-bottom:1px solid rgba(0,0,0,0.2);
}
.brand{font-weight:700;color:#fff}
.top-actions .btn-ghost{background:none;border:1px solid rgba(255,255,255,0.28);color:#fff;padding:6px 10px;border-radius:8px;cursor:pointer}
.clock-now{font-size:13px;color:#e5e7eb}
.user-name{font-size:13px;color:#fff;font-weight:700}

.app-main{display:flex;min-height:calc(100vh - 56px)}
.sidebar{width:220px;min-width:220px;background:#f3f5f7;padding:20px 18px;border-right:1px solid #e5e7eb}
.nav{list-style:none;padding:0;margin:0}
.nav-group{margin-bottom:10px}
.group-header{padding:10px 12px;border-radius:6px;color:#0b3b8f;background:#e6f0ff;border:1px solid #c7dbff;cursor:pointer;display:flex;justify-content:space-between;align-items:center}
.group-header:hover{background:#dbe8ff}
.subnav{list-style:none;margin:6px 0 0 0;padding:0 0 0 14px;overflow:hidden;height:0;position:relative}
.subnav::before{content:"";position:absolute;left:6px;top:6px;bottom:6px;width:2px;background:#dbe4ef;border-radius:2px}
.subnav-item{padding:10px 12px;border-radius:6px;color:#374151;cursor:pointer;margin:6px 0;background:#ffffff;border:1px solid #eef2f7;position:relative}
.subnav-item::before{content:"";position:absolute;left:-8px;top:50%;transform:translateY(-50%);width:8px;height:8px;border-radius:50%;background:#cbd5e1;border:2px solid #e5edf7}
.subnav-item:hover{background:#f3f4f6}
.subnav-item.active{background:#e6f4ea;color:#03c75a;font-weight:700;border-color:#bfe5cf}
.content{flex:1;padding:28px}
.tab-panel{display:none}
.tab-panel.active{display:block}

/* 주문/배송 관리 스타일 */
.orders-filters.card{background:var(--card);padding:14px;border-radius:10px;box-shadow:0 6px 20px rgba(2,6,23,0.04)}
.filter-chips{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px}
.chip{border:1px solid #e5e7eb;background:#f8fafc;border-radius:999px;padding:6px 10px;font-size:12px;cursor:pointer}
.chip.active{background:#03c75a;color:#fff;border-color:#03c75a}
.status-kpis{display:flex;gap:12px;margin:10px 0}
.kpi{display:flex;gap:10px;align-items:center;background:#f7f9fc;border:1px solid #eef2f7;border-radius:10px;padding:10px 12px}
.kpi i{font-size:18px;color:#6b7280}
.kpi-title{font-size:12px;color:#6b7280}
.kpi-val{font-weight:700}
.filter-form .row{display:flex;align-items:center;gap:8px;margin:6px 0}
.filter-form label{font-size:12px;color:#6b7280}

/* 대시보드 통계 카드 */
.dashboard-stats{display:flex;gap:12px;margin-bottom:18px}
.stat-card{background:var(--card);padding:14px;border-radius:10px;display:flex;gap:12px;align-items:center;cursor:pointer;box-shadow:0 8px 22px rgba(2,6,23,0.04);flex:1}
.stat-icon{width:48px;height:48px;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:20px;color:white}
.stat-body{display:flex;flex-direction:column}
.stat-label{font-size:13px;color:var(--muted)}
.stat-value{font-size:20px;font-weight:700}
.bg-primary{background:var(--primary)}
.bg-accent{background:var(--accent)}
.bg-success{background:var(--success)}
.bg-muted{background:#9ca3af}
.bg-warning{background:#f59e0b}

/* 대시보드 그리드 */
.dash-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:12px 0}
@media (min-width:1200px){.dash-grid{grid-template-columns:1fr 1fr 1fr}}
.dash-card{background:var(--card);border-radius:10px;box-shadow:0 6px 20px rgba(2,6,23,0.04);padding:14px}
.dash-card-header{font-weight:700;color:#111827;margin-bottom:10px}
.dash-summary{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.summary-item{background:#f7f9fc;border:1px solid #eef2f7;border-radius:8px;padding:10px;display:flex;flex-direction:column;gap:6px}
.summary-item .lbl{font-size:12px;color:#6b7280}
.summary-item .val{font-size:18px;font-weight:700;color:#0b1220}
.metric-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.metric{background:#f7f9fc;border:1px solid #eef2f7;border-radius:8px;padding:10px}
.metric-label{font-size:12px;color:#6b7280}
.metric-value{font-size:18px;font-weight:700;color:#0b1220}
.dash-blank{height:72px;display:flex;align-items:center;justify-content:center;color:#9ca3af;background:#fafbff;border:1px dashed #e5e7eb;border-radius:8px}
.chart-card{background:var(--card);border-radius:10px;box-shadow:0 6px 20px rgba(2,6,23,0.04);padding:16px;margin:16px 0}

/* 반응형 간단 규칙 */
@media (max-width:800px){
  .login-box{width:95%;flex-direction:column}
  .sidebar{display:none}
}

/* 상품관리 스타일 */
.product-panel{display:grid;grid-template-columns:1fr 360px;gap:16px;align-items:start}
.product-form{display:flex;flex-direction:column;gap:8px}
.product-form input{padding:8px;border:1px solid #e6e9ee;border-radius:8px}
.product-table-wrap{overflow:auto;background:var(--card);padding:14px;border-radius:10px;box-shadow:0 6px 20px rgba(2,6,23,0.03)}
.product-table{width:100%;border-collapse:collapse}
.product-table th,.product-table td{padding:12px 14px;text-align:left;border-bottom:1px solid #eef2f7;line-height:1.5;vertical-align:middle;font-size:14px}
.product-chart{background:var(--card);padding:12px;border-radius:10px;box-shadow:0 6px 20px rgba(15,23,42,0.03)}

@media (max-width:1000px){
  .product-panel{grid-template-columns:1fr}
}

/* 리스트/패널 스타일 */
.panel-actions{display:flex;gap:8px;align-items:center;margin-bottom:12px}
.panel-actions input{flex:1;padding:8px;border:1px solid #e6e9ee;border-radius:8px}
.list-wrap{background:var(--card);padding:16px;border-radius:10px;box-shadow:0 8px 28px rgba(2,6,23,0.03)}
.list-wrap table th,.list-wrap table td{padding:12px 14px;text-align:left;border-bottom:1px solid #eef2f7;line-height:1.5;vertical-align:middle;font-size:14px}
.list-wrap tbody tr:hover{background:linear-gradient(90deg, rgba(15,99,216,0.02), rgba(15,99,216,0.01));}
.btn-danger{background:#ff6b6b;color:#fff;border:none;padding:6px 8px;border-radius:6px}
.form-row{display:flex;flex-direction:column;margin-bottom:8px}
.form-row label{font-size:13px;color:var(--muted);margin-bottom:6px}
.form-row input,.form-row select{padding:10px;border:1px solid #eef2f7;border-radius:8px}
.list-wrap table{width:100%;border-collapse:collapse}
/* 통일된 테이블 셀 간격 및 가독성 향상 */
.list-wrap th,.list-wrap td{padding:12px 14px;border-bottom:1px solid #eef2f7;text-align:left;line-height:1.5;vertical-align:middle;font-size:14px}
.btn-sm{padding:6px 8px;border-radius:6px;border:1px solid #e6eefb;background:#fff;cursor:pointer}

/* 모달 */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.4);display:flex;align-items:center;justify-content:center;z-index:2000}
.modal{background:var(--card);width:640px;max-width:95%;border-radius:10px;overflow:hidden;box-shadow:0 12px 48px rgba(2,6,23,0.18)}
.modal-small{width:480px}
.modal-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid #eef2f7}
.modal-body{padding:16px}
.modal-footer{padding:12px 16px;border-top:1px solid #eef2f7;text-align:right}
.modal-header button{background:none;border:0;font-size:16px;cursor:pointer}
.action-btn{padding:8px 10px;border-radius:8px;border:0;cursor:pointer}
.action-confirm{background:var(--primary);color:#fff}
.action-secondary{background:#fbfbfd;color:#111}

/* 보정: 중복 정의 제거, 필요한 항목만 유지 */
.product-chart{margin-top:12px}

/* Toast 스타일 */
#toastContainer .toast{min-width:200px;max-width:360px;padding:10px 12px;border-radius:10px;color:#fff;box-shadow:0 8px 30px rgba(2,6,23,0.08);opacity:1;transition:opacity .35s ease,transform .35s ease}
#toastContainer .toast.info{background:linear-gradient(90deg,#111827,#374151)}
#toastContainer .toast.success{background:linear-gradient(90deg,#10b981,#059669)}
#toastContainer .toast.error{background:linear-gradient(90deg,#ef4444,#dc2626)}

/* 차트 캔버스 크기 축소 (대시보드) */
#last5Chart{height:160px !important;max-height:220px}

/* 작은 모달 폼을 위해 패딩 조정 */
.modal-small .modal-body{padding:12px}
.modal-small .form-row input{padding:8px}

/* 권한설정 토글 UI */
.perm-group{margin-bottom:12px}
.perm-group-header{font-weight:700;font-size:13px;color:#0b1220;background:#eef2f7;border:1px solid #e5e7eb;padding:8px 10px;border-radius:8px}
.perm-list{margin-top:8px;padding-left:10px;border-left:2px solid #e5e7eb;display:grid;grid-template-columns:1fr 1fr;gap:8px}
@media (max-width:800px){.perm-list{grid-template-columns:1fr}}
.toggle{display:flex;align-items:center;gap:10px;background:#f8fafc;border:1px solid #eef2f7;border-radius:10px;padding:8px 10px}
.toggle input{display:none}
.toggle .switch{position:relative;width:40px;height:22px;background:#e5e7eb;border-radius:999px;transition:all .2s ease}
.toggle .switch .knob{position:absolute;top:3px;left:3px;width:16px;height:16px;background:#fff;border-radius:50%;box-shadow:0 1px 2px rgba(0,0,0,0.1);transition:left .2s ease}
.toggle input:checked + .switch{background:#03c75a}
.toggle input:checked + .switch .knob{left:21px}
.toggle .label{font-size:13px;color:#374151}
