/* ============================================================
   피라인모터스 파트너스 — Design System
   Commercial-grade UI/UX Design Language
   ============================================================ */

/* ─── 1. Design Tokens ──────────────────────────────────── */
:root {
  /* Brand */
  --ds-brand:          #2563eb;
  --ds-brand-dark:     #1d4ed8;
  --ds-brand-light:    #3b82f6;
  --ds-brand-subtle:   #eff6ff;
  --ds-brand-border:   #bfdbfe;

  /* Neutrals */
  --ds-gray-50:  #f8fafc;
  --ds-gray-100: #f1f5f9;
  --ds-gray-150: #eaf0f6;
  --ds-gray-200: #e2e8f0;
  --ds-gray-300: #cbd5e1;
  --ds-gray-400: #94a3b8;
  --ds-gray-500: #64748b;
  --ds-gray-600: #475569;
  --ds-gray-700: #334155;
  --ds-gray-800: #1e293b;
  --ds-gray-900: #0f172a;

  /* Semantic */
  --ds-success:        #16a34a;
  --ds-success-bg:     #f0fdf4;
  --ds-success-border: #bbf7d0;
  --ds-danger:         #dc2626;
  --ds-danger-bg:      #fef2f2;
  --ds-danger-border:  #fecaca;
  --ds-warning:        #d97706;
  --ds-warning-bg:     #fffbeb;
  --ds-warning-border: #fde68a;
  --ds-info:           #0891b2;
  --ds-info-bg:        #ecfeff;
  --ds-info-border:    #a5f3fc;

  /* Sidebar */
  --sidebar-bg:          #0f172a;
  --sidebar-surface:     #1e293b;
  --sidebar-border:      rgba(255,255,255,0.06);
  --sidebar-text:        #94a3b8;
  --sidebar-text-hover:  #e2e8f0;
  --sidebar-active-bg:   rgba(37,99,235,0.18);
  --sidebar-active-text: #93c5fd;
  --sidebar-label:       #475569;
  --sidebar-width:       256px;

  /* Layout */
  --content-bg:   #f1f5f9;
  --card-bg:      #ffffff;
  --border-color: #e2e8f0;

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
  --shadow:    0 4px 6px -1px rgba(0,0,0,0.10), 0 2px 4px -2px rgba(0,0,0,0.10);
  --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.10), 0 4px 6px -4px rgba(0,0,0,0.10);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.10), 0 8px 10px -6px rgba(0,0,0,0.10);
  --shadow-inner: inset 0 2px 4px rgba(0,0,0,0.06);

  /* Typography */
  --font: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Transitions */
  --t-fast: 100ms ease;
  --t-base: 180ms ease;
  --t-slow: 280ms ease;
}

/* ─── 2. Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ds-gray-800);
  background: var(--content-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── 3. App Layout ─────────────────────────────────────── */
#app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
#app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  transition: transform var(--t-slow);
  border-right: 1px solid var(--sidebar-border);
  scrollbar-width: thin;
  scrollbar-color: var(--ds-gray-700) transparent;
}

#app-sidebar::-webkit-scrollbar { width: 4px; }
#app-sidebar::-webkit-scrollbar-thumb { background: var(--ds-gray-700); border-radius: 2px; }

/* Main wrapper */
#app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* Top bar */
#app-topbar {
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

/* Content area — all pages inherit this padding, no extra containers needed */
#app-content {
  padding: 28px 32px;
  flex: 1;
  /* Prevent ultra-wide layouts on large monitors */
  max-width: 1400px;
  width: 100%;
  box-sizing: border-box;
}

/* App footer */
#app-footer {
  background: #fff;
  border-top: 1px solid var(--border-color);
  padding: 14px 28px;
  text-align: center;
  font-size: 12px;
  color: var(--ds-gray-400);
  flex-shrink: 0;
}

/* ─── 4. Sidebar Components ─────────────────────────────── */
.sidebar-brand {
  padding: 18px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-brand-link {
  display: block;
  text-decoration: none;
}

/* Sidebar logos */
.sb-logo-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
}

/* 한차 로고는 밝은 배경용 → 작은 흰 배경으로 자연스럽게 감쌈 */
.sb-logo-pill--hc {
  background: rgba(255,255,255,0.92);
  border-radius: 6px;
  padding: 5px 12px;
}

.sb-logo-img {
  display: block;
  width: 140px;
  height: 22px;
  object-fit: contain;
}

/* PARTNERS separator line */
.sb-logo-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px;
}

.sb-logo-sep span:first-child,
.sb-logo-sep span:last-child {
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.15);
}

.sb-logo-sep-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.35);
  white-space: nowrap;
  flex: none;
}

.sidebar-brand img {
  max-width: 100%;
  height: auto;
  display: block;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--sidebar-label);
  padding: 16px 10px 6px;
  display: block;
}

.sidebar-section-label:first-child { padding-top: 4px; }

.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 1px;
}

.sidebar-link i {
  font-size: 15px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  opacity: 0.8;
}

.sidebar-link:hover {
  background: var(--sidebar-surface);
  color: var(--sidebar-text-hover);
}

.sidebar-link:hover i { opacity: 1; }

.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--ds-brand-light);
  border-radius: 0 3px 3px 0;
}

.sidebar-link.active i { opacity: 1; }

.sidebar-divider {
  height: 1px;
  background: var(--sidebar-border);
  margin: 8px 10px;
}

.sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  padding: 10px;
  flex-shrink: 0;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--sidebar-surface);
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  background: rgba(37,99,235,0.2);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ds-brand-light);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: var(--sidebar-label);
}

/* Sidebar overlay (mobile) */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 999;
  backdrop-filter: blur(2px);
}

/* ─── 5. Top Bar Components ─────────────────────────────── */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 5px 9px;
  color: var(--ds-gray-600);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  transition: background var(--t-fast);
}

.topbar-menu-btn:hover { background: var(--ds-gray-100); }

.topbar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ds-gray-900);
  letter-spacing: -0.3px;
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--ds-brand);
  background: var(--ds-brand-subtle);
  border: 1px solid var(--ds-brand-border);
}

.topbar-logout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ds-gray-600);
  border: 1px solid var(--border-color);
  background: #fff;
  text-decoration: none;
  transition: all var(--t-fast);
}

.topbar-logout:hover {
  background: var(--ds-danger-bg);
  border-color: var(--ds-danger-border);
  color: var(--ds-danger);
}

/* ─── 6. Page Header ────────────────────────────────────── */
.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--ds-gray-900);
  letter-spacing: -0.5px;
  margin: 0 0 4px;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--ds-gray-500);
  margin: 0;
}

/* ─── 7. Cards ──────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.card-body { padding: 20px; }
.card-header {
  padding: 14px 20px;
  background: var(--ds-gray-50);
  border-bottom: 1px solid var(--border-color);
  border-radius: var(--radius) var(--radius) 0 0;
}

/* ─── 8. Form Elements ──────────────────────────────────── */
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ds-gray-600);
  margin-bottom: 5px;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.form-control,
.form-select {
  height: 40px;
  padding: 0 12px;
  border: 1.5px solid var(--ds-gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--ds-gray-900);
  background: #fff;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
  -webkit-appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 32px;
}

textarea.form-control {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.6;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--ds-brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
  outline: none;
}

.form-control::placeholder { color: var(--ds-gray-400); }

.form-control:disabled,
.form-select:disabled {
  background: var(--ds-gray-100);
  color: var(--ds-gray-400);
  cursor: not-allowed;
}

/* Input group */
.input-group-text {
  background: var(--ds-gray-50);
  border: 1.5px solid var(--ds-gray-300);
  color: var(--ds-gray-500);
  font-size: 13px;
  padding: 0 12px;
  height: 40px;
}

.input-group .form-control:not(:first-child) { border-left: none; }
.input-group .form-control:not(:last-child) { border-right: none; }

/* ─── 9. Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}

.btn i { font-size: 14px; }

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.btn-sm i { font-size: 12px; }

.btn-lg {
  height: 46px;
  padding: 0 24px;
  font-size: 15px;
  border-radius: var(--radius-sm);
}

/* Primary */
.btn-primary {
  background: var(--ds-brand);
  border-color: var(--ds-brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--ds-brand-dark);
  border-color: var(--ds-brand-dark);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37,99,235,0.30);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-primary:disabled,
.btn-primary.disabled {
  background: var(--ds-gray-300);
  border-color: var(--ds-gray-300);
  color: var(--ds-gray-500);
  transform: none;
  box-shadow: none;
  cursor: not-allowed;
}

/* Success */
.btn-success {
  background: var(--ds-success);
  border-color: var(--ds-success);
  color: #fff;
}

.btn-success:hover {
  background: #15803d;
  border-color: #15803d;
  color: #fff;
  box-shadow: 0 4px 12px rgba(22,163,74,0.25);
  transform: translateY(-1px);
}

/* Danger */
.btn-danger {
  background: var(--ds-danger);
  border-color: var(--ds-danger);
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
  transform: translateY(-1px);
}

/* Outline */
.btn-outline-primary {
  background: transparent;
  border-color: var(--ds-brand);
  color: var(--ds-brand);
}

.btn-outline-primary:hover {
  background: var(--ds-brand);
  color: #fff;
  transform: translateY(-1px);
}

.btn-outline-secondary {
  background: #fff;
  border-color: var(--ds-gray-300);
  color: var(--ds-gray-700);
}

.btn-outline-secondary:hover {
  background: var(--ds-gray-100);
  border-color: var(--ds-gray-400);
  color: var(--ds-gray-900);
}

.btn-outline-danger {
  background: transparent;
  border-color: var(--ds-danger);
  color: var(--ds-danger);
}

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

/* Secondary (filled) */
.btn-secondary {
  background: var(--ds-gray-100);
  border-color: var(--ds-gray-200);
  color: var(--ds-gray-700);
}

.btn-secondary:hover {
  background: var(--ds-gray-200);
  color: var(--ds-gray-900);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ds-gray-600);
}

.btn-ghost:hover {
  background: var(--ds-gray-100);
  color: var(--ds-gray-900);
}

/* Full-width */
.btn-block {
  width: 100%;
  justify-content: center;
}

.d-grid .btn { width: 100%; justify-content: center; }

/* ─── 10. Tables ────────────────────────────────────────── */
.table {
  font-size: 13.5px;
  color: var(--ds-gray-800);
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.table > :not(caption) > * > * {
  padding: 11px 14px;
  vertical-align: middle;
}

/* Default thead */
.table thead th {
  background: var(--ds-gray-800);
  color: #fff;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: none;
  white-space: nowrap;
}

.table thead tr th:first-child { border-radius: 6px 0 0 0; }
.table thead tr th:last-child  { border-radius: 0 6px 0 0; }

/* Light thead override */
.table-light thead th,
.table > thead.table-light > tr > th {
  background: var(--ds-gray-100);
  color: var(--ds-gray-700);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--ds-gray-200);
}

/* Body rows */
.table tbody td {
  border-bottom: 1px solid var(--ds-gray-100);
  color: var(--ds-gray-800);
}

.table tbody tr:last-child td { border-bottom: none; }

.table-hover tbody tr:hover td {
  background: #f8faff;
}

.table-striped tbody tr:nth-child(odd) td {
  background: transparent;
}

.table-striped tbody tr:nth-child(even) td {
  background: var(--ds-gray-50);
}

.table-bordered td,
.table-bordered th {
  border: 1px solid var(--ds-gray-200);
}

/* Blue accent thead */
.table-thead-brand thead th {
  background: var(--ds-brand);
  color: #fff;
}

/* ─── 11. Status Badges ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Order status badges */
.badge-received    { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.badge-shipped     { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.badge-delayed     { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.badge-unavailable { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.badge-alternative { background: #f5f3ff; color: #7c3aed; border: 1px solid #ddd6fe; }
.badge-deleted     { background: var(--ds-gray-100); color: var(--ds-gray-500); border: 1px solid var(--ds-gray-200); }
.badge-added       { background: #ecfeff; color: #0891b2; border: 1px solid #a5f3fc; }
.badge-admin       { background: #fdf4ff; color: #9333ea; border: 1px solid #e9d5ff; }

/* Dot before badge */
.badge-dot::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ─── 12. Alerts ────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13.5px;
  border-width: 1px;
  border-style: solid;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert i { flex-shrink: 0; font-size: 15px; margin-top: 1px; }

.alert-danger  { background: var(--ds-danger-bg);  border-color: var(--ds-danger-border);  color: #991b1b; }
.alert-success { background: var(--ds-success-bg); border-color: var(--ds-success-border); color: #166534; }
.alert-info    { background: var(--ds-info-bg);    border-color: var(--ds-info-border);    color: #164e63; }
.alert-warning { background: var(--ds-warning-bg); border-color: var(--ds-warning-border); color: #92400e; }

/* ─── 13. Loading & Empty States ────────────────────────── */
.ds-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ds-gray-200);
  border-top-color: var(--ds-brand);
  border-radius: 50%;
  animation: ds-spin 0.65s linear infinite;
  flex-shrink: 0;
}

.ds-spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

@keyframes ds-spin { to { transform: rotate(360deg); } }

.ds-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 20px;
  color: var(--ds-gray-400);
  font-size: 13px;
  font-weight: 500;
}

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

.ds-empty-icon {
  font-size: 36px;
  color: var(--ds-gray-300);
  display: block;
  margin-bottom: 12px;
}

.ds-empty-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ds-gray-600);
  margin: 0 0 4px;
}

.ds-empty-desc {
  font-size: 13px;
  color: var(--ds-gray-400);
  margin: 0;
}

/* ─── 14. Search Bar Component ──────────────────────────── */
.ds-search {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1.5px solid var(--ds-gray-300);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  height: 40px;
}

.ds-search:focus-within {
  border-color: var(--ds-brand);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.ds-search-icon {
  padding: 0 10px 0 12px;
  color: var(--ds-gray-400);
  font-size: 14px;
  flex-shrink: 0;
}

.ds-search input {
  border: none;
  outline: none;
  background: transparent;
  padding: 0 10px 0 0;
  font-size: 14px;
  font-family: var(--font);
  color: var(--ds-gray-900);
  flex: 1;
  min-width: 0;
  height: 100%;
}

.ds-search input::placeholder { color: var(--ds-gray-400); }

.ds-search-btn {
  background: var(--ds-brand);
  border: none;
  height: 100%;
  padding: 0 16px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--t-fast);
  white-space: nowrap;
  flex-shrink: 0;
  border-radius: 0;
}

.ds-search-btn:hover { background: var(--ds-brand-dark); }

/* ─── 15. Toast Notifications ───────────────────────────── */
#ds-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.ds-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 380px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: toast-in 200ms ease forwards;
  line-height: 1.4;
}

.ds-toast-icon { font-size: 15px; flex-shrink: 0; }
.ds-toast-msg  { flex: 1; }

.ds-toast--default { background: var(--ds-gray-900); color: #f1f5f9; }
.ds-toast--success { background: #166534; color: #dcfce7; }
.ds-toast--error   { background: #991b1b; color: #fee2e2; }
.ds-toast--warning { background: #92400e; color: #fef3c7; }
.ds-toast--info    { background: #164e63; color: #cffafe; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}

/* ─── 16. Pagination ─────────────────────────────────────── */
.ds-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  gap: 12px;
}

.ds-pagination-info {
  font-size: 12.5px;
  color: var(--ds-gray-500);
}

.ds-pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── 17. Section Panel ─────────────────────────────────── */
.ds-panel {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.ds-panel-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ds-gray-50);
}

.ds-panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ds-gray-900);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.ds-panel-title i {
  color: var(--ds-brand);
  font-size: 15px;
}

.ds-panel-body { padding: 20px; }

/* ─── 18. Info Notice Banner ────────────────────────────── */
.ds-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--ds-brand-subtle);
  border: 1px solid var(--ds-brand-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: #1e40af;
}

.ds-notice i {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--ds-brand);
}

/* ─── 19. Scrollbar (global) ─────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ds-gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ds-gray-400); }

/* ─── 20. Utility Overrides ─────────────────────────────── */
.text-muted     { color: var(--ds-gray-500) !important; }
.text-brand     { color: var(--ds-brand) !important; }
.text-success   { color: var(--ds-success) !important; }
.text-danger    { color: var(--ds-danger) !important; }
.text-warning   { color: var(--ds-warning) !important; }

.bg-brand-subtle { background: var(--ds-brand-subtle); }
.bg-surface      { background: var(--ds-gray-50); }

.shadow-xs  { box-shadow: var(--shadow-xs) !important; }
.shadow-sm  { box-shadow: var(--shadow-sm) !important; }
.shadow-md  { box-shadow: var(--shadow-md) !important; }

.border-color { border-color: var(--border-color) !important; }
.rounded-sm   { border-radius: var(--radius-sm) !important; }
.rounded      { border-radius: var(--radius) !important; }

/* Gap utilities */
.gap-xs { gap: 4px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 14px; }

/* Separator */
.ds-sep {
  height: 1px;
  background: var(--border-color);
  margin: 18px 0;
}

/* Mono text (part numbers) */
.text-mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

/* Remove number spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Smooth focus outline */
a, button, [role="button"] { outline-offset: 2px; }

/* ─── 21. Login Page ─────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  padding: 32px 24px;
  gap: 28px;
  position: relative;
  overflow: hidden;
}

.login-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 50%, rgba(37,99,235,0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 60% at 80% 30%, rgba(14,165,233,0.10) 0%, transparent 60%);
  pointer-events: none;
}

.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.05);
  width: 100%;
  max-width: 420px;
  padding: 40px 40px 36px;
  position: relative;
  z-index: 1;
}

/* Login page brand block — sits on dark gradient above white card */
.login-brand-outer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-logo-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 100%;
}

.login-logo-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
}

/* 한차 로고는 밝은 배경용 → 작은 흰 배경으로 감쌈 */
.login-logo-pill--hc {
  background: rgba(255,255,255,0.92);
  border-radius: 8px;
  padding: 7px 16px;
}

.login-logo-img {
  display: block;
  width: 190px;
  height: 28px;
  object-fit: contain;
}

.login-logo-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}

.login-logo-sep span:first-child,
.login-logo-sep span:last-child {
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.15);
}

.login-logo-sep-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.35);
  white-space: nowrap;
  flex: none;
}

.login-brand-tagline {
  font-size: 12.5px;
  color: rgba(255,255,255,0.45);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.login-field {
  margin-bottom: 16px;
}

.login-input-wrap {
  position: relative;
}

.login-input-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ds-gray-400);
  font-size: 15px;
  pointer-events: none;
}

.login-input-wrap .form-control {
  padding-left: 38px;
  height: 46px;
  font-size: 14px;
}

.login-btn {
  width: 100%;
  height: 48px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-top: 8px;
  border-radius: var(--radius-sm);
  background: var(--ds-brand);
  border-color: var(--ds-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--t-base);
  cursor: pointer;
  border: none;
}

.login-btn:hover {
  background: var(--ds-brand-dark);
  box-shadow: 0 6px 20px rgba(37,99,235,0.35);
  transform: translateY(-1px);
}

.login-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ds-gray-800);
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ds-gray-100);
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--ds-gray-400);
}

/* ─── 22. Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
  #app-sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
    transition: transform var(--t-slow);
  }

  #app-sidebar.sidebar-open { transform: translateX(0); }

  #sidebar-overlay.active { display: block; }

  #app-main { margin-left: 0; }

  .topbar-menu-btn { display: inline-flex; }

  #app-content { padding: 16px 16px; max-width: 100%; }

  #app-topbar { padding: 0 16px; }

  .login-card { padding: 28px 24px; }
}

@media (max-width: 576px) {
  .page-title { font-size: 18px; }
}

/* ─── 23. Home / Dashboard ───────────────────────────────── */

/* Hero banner */
.home-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 55%, #162a4a 100%);
  border-radius: var(--radius-lg);
  padding: 42px 44px;
  position: relative;
  overflow: hidden;
  margin-bottom: 32px;
  color: #fff;
}

.home-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,0.25) 0%, transparent 70%);
  pointer-events: none;
}

.home-hero::after {
  content: '';
  position: absolute;
  bottom: -40px; left: 30%;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14,165,233,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.home-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #60a5fa;
  background: rgba(37,99,235,0.18);
  border: 1px solid rgba(96,165,250,0.25);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 16px;
}

.home-hero-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.6px;
  margin: 0 0 10px;
  line-height: 1.2;
}

.home-hero-title span {
  color: #60a5fa;
}

.home-hero-sub {
  font-size: 15px;
  color: #94a3b8;
  margin: 0 0 28px;
  max-width: 520px;
  line-height: 1.6;
}

.home-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  padding: 0 22px;
  background: var(--ds-brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--t-base);
}

.hero-btn-primary:hover {
  background: var(--ds-brand-dark);
  color: #fff;
  box-shadow: 0 6px 18px rgba(37,99,235,0.4);
  transform: translateY(-1px);
}

.hero-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  padding: 0 22px;
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--t-base);
  backdrop-filter: blur(4px);
}

.hero-btn-ghost:hover {
  background: rgba(255,255,255,0.14);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
}

/* Section title */
.home-section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ds-gray-500);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* Feature cards grid */
.home-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

@media (max-width: 1100px) {
  .home-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .home-grid { grid-template-columns: 1fr 1fr; }
  .home-grid-3 { grid-template-columns: 1fr 1fr; }
}

.home-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

@media (max-width: 900px) {
  .home-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* Feature card */
.feature-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 22px 20px 20px;
  text-decoration: none;
  color: var(--ds-gray-800);
  transition: all var(--t-base);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--fc-accent, var(--ds-brand));
  opacity: 0;
  transition: opacity var(--t-base);
}

.feature-card:hover {
  border-color: var(--fc-accent, var(--ds-brand));
  box-shadow: var(--shadow), 0 0 0 3px rgba(37,99,235,0.07);
  transform: translateY(-2px);
  color: var(--ds-gray-900);
}

.feature-card:hover::before { opacity: 1; }

.feature-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--fc-icon-bg, var(--ds-brand-subtle));
  color: var(--fc-accent, var(--ds-brand));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  transition: background var(--t-base), transform var(--t-base);
}

.feature-card:hover .feature-card-icon {
  background: var(--fc-accent, var(--ds-brand));
  color: #fff;
  transform: scale(1.05);
}

.feature-card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ds-gray-900);
  margin: 0 0 4px;
  line-height: 1.3;
}

.feature-card-desc {
  font-size: 12.5px;
  color: var(--ds-gray-500);
  margin: 0;
  line-height: 1.5;
  flex: 1;
}

.feature-card-arrow {
  font-size: 12px;
  color: var(--fc-accent, var(--ds-brand));
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity var(--t-fast), transform var(--t-fast);
}

.feature-card:hover .feature-card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* Color variants */
.fc-blue   { --fc-accent: #2563eb; --fc-icon-bg: #eff6ff; }
.fc-violet { --fc-accent: #7c3aed; --fc-icon-bg: #f5f3ff; }
.fc-teal   { --fc-accent: #0891b2; --fc-icon-bg: #ecfeff; }
.fc-green  { --fc-accent: #16a34a; --fc-icon-bg: #f0fdf4; }
.fc-orange { --fc-accent: #ea580c; --fc-icon-bg: #fff7ed; }
.fc-pink   { --fc-accent: #db2777; --fc-icon-bg: #fdf2f8; }
.fc-amber  { --fc-accent: #d97706; --fc-icon-bg: #fffbeb; }
.fc-slate  { --fc-accent: #475569; --fc-icon-bg: #f8fafc; }

/* Notice card */
.home-notice {
  background: var(--ds-brand-subtle);
  border: 1px solid var(--ds-brand-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 28px;
}

.home-notice-icon {
  width: 36px;
  height: 36px;
  background: rgba(37,99,235,0.12);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ds-brand);
  font-size: 17px;
  flex-shrink: 0;
}

.home-notice-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ds-gray-900);
  margin: 0 0 3px;
}

.home-notice-desc {
  font-size: 12.5px;
  color: var(--ds-gray-600);
  margin: 0;
  line-height: 1.5;
}

/* Quick stat cards */
.home-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

@media (max-width: 700px) {
  .home-stats { grid-template-columns: 1fr; }
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ds-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--ds-gray-900);
  letter-spacing: -0.5px;
  line-height: 1;
  margin: 0;
}

/* ─── 24. Table Enhancements ─────────────────────────────── */

/* Inline action button group (admin tables) */
.tbl-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
}

.tbl-btn {
  height: 27px;
  padding: 0 8px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font);
  transition: all var(--t-fast);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.tbl-btn-shipped   { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
.tbl-btn-delayed   { background: #fffbeb; color: #d97706; border-color: #fde68a; }
.tbl-btn-alt       { background: #f5f3ff; color: #7c3aed; border-color: #ddd6fe; }
.tbl-btn-no        { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.tbl-btn-del       { background: var(--ds-gray-100); color: var(--ds-gray-600); border-color: var(--ds-gray-200); }

.tbl-btn:hover { filter: brightness(0.93); transform: translateY(-1px); }
.tbl-btn:active { transform: translateY(0); filter: brightness(0.88); }

/* Expandable row */
.tbl-expand-row td {
  padding: 0 !important;
  border-bottom: none !important;
}

.tbl-expand-inner {
  background: var(--ds-gray-50);
  border-top: 1px solid var(--ds-brand-border);
  border-bottom: 2px solid var(--ds-brand-border);
  padding: 18px 24px;
  animation: expand-in 150ms ease forwards;
}

@keyframes expand-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Checkbox cell */
.tbl-check {
  width: 38px;
  text-align: center !important;
}

.tbl-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--ds-brand);
}

/* Bulk action bar */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-xs);
}

.bulk-bar-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ds-gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
}

/* Date input compact */
.tbl-date-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  min-width: 130px;
}

.tbl-date-wrap .form-control {
  height: 30px;
  font-size: 12px;
  padding: 0 8px;
  text-align: center;
}

/* Add-item row inside expand */
.add-item-row {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-color);
}

.add-item-row-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ds-gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

/* Search filter bar */
.filter-bar {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}

