* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: Arial, sans-serif; background: #f4f6f8; color: #111827; }
a { color: inherit; text-decoration: none; }
body { min-height: 100vh; }

.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: #111827; color: #f9fafb; padding: 20px 16px; }
.brand { padding: 8px 10px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 18px; }
.brand-title { font-size: 24px; font-weight: 700; }
.brand-sub { color: #cbd5e1; font-size: 13px; margin-top: 6px; }

.nav { display: grid; gap: 6px; }
.nav-link {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    color: #dbe4ee;
    font-size: 14px;
}
.nav-link:hover { background: rgba(255,255,255,0.08); }
.nav-link.active { background: #2563eb; color: #fff; }

.main { padding: 24px; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}
.topbar h1 { margin: 0; font-size: 28px; }
.muted { color: #6b7280; margin: 6px 0 0; font-size: 14px; }
.topbar-right { display: flex; gap: 8px; flex-wrap: wrap; }

.content { display: grid; gap: 18px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card-grid { display: grid; gap: 18px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.card {
    background: #fff;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 4px 16px rgba(17, 24, 39, 0.06);
    border: 1px solid #e5e7eb;
}
.summary-label { font-size: 13px; color: #6b7280; margin-bottom: 8px; }
.summary-value { font-size: 24px; font-weight: 700; }

.section-title { font-size: 18px; font-weight: 700; margin-bottom: 14px; }
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #111827;
    height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    cursor: pointer;
}
.btn.primary {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}
.btn.danger {
    background: #fff1f2;
    color: #be123c;
    border-color: #fecdd3;
}
.btn.small {
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
}

.input, select.input {
    width: 100%;
    height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 0 12px;
    background: #fff;
}
.input.compact, select.input.compact {
    height: 34px;
    font-size: 13px;
}
.filter-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: 2fr 1fr 1fr auto;
}

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid #eef2f7;
    font-size: 14px;
    vertical-align: top;
}
.table th { color: #6b7280; font-weight: 600; }

.badge, .pill, .tag {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 600;
}
.pill.success { background: #dcfce7; color: #166534; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; }

.form-grid { display: grid; gap: 14px; }
.form-grid label { display: grid; gap: 8px; font-size: 14px; font-weight: 600; }
.plain-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; }

.subtext {
    margin-top: 6px;
    color: #6b7280;
    font-size: 12px;
}
.inline-form {
    margin: 0;
}
.candidate-form {
    display: grid;
    gap: 8px;
}
.flash-card {
    background: #eff6ff;
    border-color: #bfdbfe;
}
.action-stack {
    display: grid;
    gap: 8px;
}

@media (max-width: 1100px) {
    .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid.two { grid-template-columns: 1fr; }
    .filter-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { padding-bottom: 8px; }
    .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .main { padding: 16px; }
    .topbar { flex-direction: column; }
    .card-grid { grid-template-columns: 1fr; }
    .filter-grid { grid-template-columns: 1fr; }
}

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

/* ── Toast ── */
#plus-toast-wrap {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.plus-toast {
    background: #1e293b;
    color: #f8fafc;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.28);
    opacity: 0;
    transform: translateX(24px);
    transition: opacity .32s ease, transform .32s ease;
    pointer-events: auto;
    max-width: 360px;
    word-break: break-word;
    border-left: 4px solid #64748b;
}
.plus-toast.t-show  { opacity: 1; transform: translateX(0); }
.plus-toast.t-ok    { border-left-color: #22c55e; }
.plus-toast.t-err   { border-left-color: #ef4444; background: #3b0a0a; }
.plus-toast.t-info  { border-left-color: #3b82f6; }
.plus-toast b       { margin-right: 6px; }

/* flash-card → toast 전환 후 DOM에서 숨김 */
.flash-card { display: none !important; }

@media (max-width: 520px) {
    #plus-toast-wrap { top: 12px; right: 12px; left: 12px; }
    .plus-toast { max-width: 100%; }
}

/* ── 상태 배지 색상 ── */
.badge-신규주문,.badge-blue    { background:#dbeafe; color:#1d4ed8; }
.badge-출고대기,.badge-orange  { background:#ffedd5; color:#c2410c; }
.badge-발행실패,.badge-red,
.badge-실패,.badge-오류        { background:#fee2e2; color:#b91c1c; }
.badge-완료,.badge-배송완료,
.badge-발행완료,.badge-green   { background:#dcfce7; color:#15803d; }
.badge-배송중,.badge-발행중,
.badge-purple                  { background:#ede9fe; color:#7c3aed; }
.badge-품절                    { background:#fee2e2; color:#b91c1c; font-weight:700; }
.badge-주의                    { background:#fef9c3; color:#92400e; }
.badge-재고여유                { background:#dcfce7; color:#15803d; }

/* ── 메트릭 카드 tone ── */
.metric-blue   .summary-value { color:#2563eb; }
.metric-orange .summary-value { color:#ea580c; }
.metric-red    .summary-value { color:#dc2626; }
.metric-purple .summary-value { color:#7c3aed; }
.metric-green  .summary-value { color:#16a34a; }

/* ── 필터바 ── */
.filter-bar { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; align-items:center; }
.filter-bar a, .filter-bar button {
    height:32px; padding:0 12px; border-radius:8px; font-size:13px;
    border:1px solid #e5e7eb; background:#fff; color:#374151; cursor:pointer;
    display:inline-flex; align-items:center; text-decoration:none;
}
.filter-bar a.active, .filter-bar button.active { background:#2563eb; color:#fff; border-color:#2563eb; }
.filter-bar .filter-label { font-size:12px; color:#9ca3af; }

/* ── 인라인 주문 수정 폼 ── */
.order-edit-form { display:grid; gap:6px; }
