/* ============================================================
   TMS 운송관리시스템 — Main Stylesheet
   Enterprise SaaS Admin Design
   ============================================================ */

/* ── Variables ── */
:root {
    --primary: #3b5bdb;
    --primary-dark: #2f4ac7;
    --primary-light: #e7ecff;
    --primary-50: rgba(59,91,219,0.08);
    --secondary: #0ca678;
    --secondary-light: #e6f9f3;
    --danger: #e03131;
    --danger-light: #fff5f5;
    --warning: #f08c00;
    --warning-light: #fff9db;
    --info: #1971c2;
    --info-light: #e7f5ff;
    --sidebar-width: 260px;
    --sidebar-collapsed: 64px;
    --header-height: 56px;
    --tabbar-height: 42px;
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --bg-sidebar: #1a1f2e;
    --bg-sidebar-hover: rgba(255,255,255,0.07);
    --bg-sidebar-active: rgba(59,91,219,0.22);
    --text-primary: #1a1f2e;
    --text-secondary: #637381;
    --text-muted: #9aa5b4;
    --text-sidebar: rgba(255,255,255,0.75);
    --text-sidebar-active: #ffffff;
    --border: #e8ecf0;
    --border-light: #f2f4f7;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
    --shadow-sidebar: 4px 0 20px rgba(0,0,0,0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --font-main: 'Noto Sans KR', 'Inter', -apple-system, sans-serif;
}

/* ── Reset & Base ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

input, select, textarea {
    font-family: inherit;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */
.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1f2e 0%, #2d3561 50%, #1a1f2e 100%);
    z-index: 1000;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

    .login-screen.fade-out {
        opacity: 0;
        transform: scale(1.03);
        pointer-events: none;
    }

.login-bg-overlay {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(ellipse at 20% 50%, rgba(59,91,219,0.15) 0%, transparent 60%), radial-gradient(ellipse at 80% 20%, rgba(12,166,120,0.1) 0%, transparent 50%);
}

.login-container {
    display: flex;
    width: 900px;
    max-width: 96vw;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}

/* Login card (left) */
.login-card {
    width: 420px;
    flex-shrink: 0;
    padding: 48px 44px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.login-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, var(--primary), #6c63ff);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(59,91,219,0.4);
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.logo-sub {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 2px;
}

.login-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.form-input {
    width: 100%;
    height: 44px;
    padding: 0 42px 0 40px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-primary);
    background: #fafbfc;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

    .form-input:focus {
        border-color: var(--primary);
        background: #fff;
        box-shadow: 0 0 0 3px var(--primary-50);
    }

    .form-input::placeholder {
        color: var(--text-muted);
    }

.pw-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    transition: color var(--transition);
}

    .pw-toggle:hover {
        color: var(--primary);
    }

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

    .checkbox-label input[type=checkbox] {
        accent-color: var(--primary);
        width: 14px;
        height: 14px;
    }

.forgot-link {
    font-size: 13px;
    color: var(--primary);
    font-weight: 500;
}

    .forgot-link:hover {
        text-decoration: underline;
    }

.login-error {
    background: var(--danger-light);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(224,49,49,0.2);
}

.login-btn {
    height: 46px;
    background: linear-gradient(135deg, var(--primary), #6c63ff);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
    box-shadow: 0 4px 14px rgba(59,91,219,0.35);
}

    .login-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 6px 20px rgba(59,91,219,0.45);
    }

    .login-btn:active {
        transform: translateY(0);
    }

.login-footer {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    padding-top: 4px;
    border-top: 1px solid var(--border-light);
}

/* Login side (right) */
.login-side {
    flex: 1;
    background: linear-gradient(135deg, var(--primary) 0%, #2d3561 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
    position: relative;
    overflow: hidden;
}

    .login-side::before {
        content: '';
        position: absolute;
        inset: 0;
        background-image: radial-gradient(circle at 30% 70%, rgba(255,255,255,0.06) 0%, transparent 50%), radial-gradient(circle at 70% 30%, rgba(255,255,255,0.04) 0%, transparent 50%);
    }

.login-side-content {
    position: relative;
    z-index: 1;
    color: #fff;
}

    .login-side-content h2 {
        font-size: 26px;
        font-weight: 700;
        margin-bottom: 14px;
        line-height: 1.3;
    }

    .login-side-content p {
        font-size: 14px;
        color: rgba(255,255,255,0.75);
        line-height: 1.7;
        margin-bottom: 32px;
    }

.feature-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: rgba(255,255,255,0.85);
}

    .feature-item i {
        color: #74c7a1;
        font-size: 15px;
    }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-screen {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    transition: width var(--transition);
    box-shadow: var(--shadow-sidebar);
    position: relative;
    z-index: 100;
}

    .sidebar.collapsed {
        width: var(--sidebar-collapsed);
    }

.sidebar-header {
    height: 56px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.logo-icon-sm {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), #6c63ff);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
}

.sidebar-logo-text {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition), width var(--transition);
}

.sidebar.collapsed .sidebar-logo-text {
    opacity: 0;
    width: 0;
}

.sidebar-close-btn {
    color: rgba(255,255,255,0.5);
    font-size: 14px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background var(--transition), color var(--transition), transform var(--transition);
    flex-shrink: 0;
}

    .sidebar-close-btn:hover {
        background: rgba(255,255,255,0.08);
        color: #fff;
    }

.sidebar.collapsed .sidebar-close-btn {
    transform: rotate(180deg);
}

.sidebar-user {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
    flex-shrink: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f06595, #cc5de8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.user-info {
    overflow: hidden;
}

.user-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    transition: opacity var(--transition);
}

.user-role {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    transition: opacity var(--transition);
}

.sidebar.collapsed .user-info {
    opacity: 0;
    pointer-events: none;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0;
}

    .sidebar-nav::-webkit-scrollbar {
        width: 3px;
    }

    .sidebar-nav::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.1);
    }

.nav-item {
    border-radius: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    height: 42px;
    color: var(--text-sidebar);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    border-radius: 0;
    white-space: nowrap;
    position: relative;
}

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

.nav-item.active > .nav-link,
.nav-item.single-menu.active > .nav-link {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
}

    .nav-item.active > .nav-link .nav-icon {
        color: var(--primary);
        filter: brightness(1.5);
    }

.single-menu.active .nav-icon {
    color: var(--primary) !important;
    filter: brightness(1.5);
}

.nav-icon {
    width: 18px;
    flex-shrink: 0;
    font-size: 15px;
    text-align: center;
}

.nav-text {
    flex: 1;
    font-size: 13.5px;
    font-weight: 500;
    transition: opacity var(--transition);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-arrow {
    display: none;
}

.nav-arrow {
    font-size: 11px;
    color: rgba(255,255,255,0.35);
    transition: transform var(--transition);
    flex-shrink: 0;
}

.nav-item.open > .nav-link .nav-arrow {
    transform: rotate(180deg);
}

/* Group label */
.nav-group-label {
    padding: 12px 16px 5px;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.25);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: opacity var(--transition);
}

.sidebar.collapsed .nav-group-label {
    opacity: 0;
}

/* Sub nav */
.nav-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0,0,0,0.15);
}

.nav-item.open .nav-sub {
    max-height: 400px;
}

.sidebar.collapsed .nav-sub {
    max-height: 0 !important;
}

.nav-sub-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px 0 46px;
    height: 36px;
    color: rgba(255,255,255,0.55);
    cursor: pointer;
    font-size: 13px;
    transition: background var(--transition), color var(--transition), padding var(--transition);
    white-space: nowrap;
}

    .nav-sub-item i {
        width: 16px;
        font-size: 12px;
        text-align: center;
        flex-shrink: 0;
    }

    .nav-sub-item:hover {
        background: var(--bg-sidebar-hover);
        color: rgba(255,255,255,0.9);
        padding-left: 50px;
    }

    .nav-sub-item.active {
        color: var(--text-sidebar-active);
        background: rgba(59,91,219,0.18);
        border-right: 3px solid var(--primary);
    }

.sidebar.collapsed .nav-sub-item {
    padding-left: 20px;
}

/* Tooltip for collapsed */
.sidebar.collapsed .nav-link {
    position: relative;
}

    .sidebar.collapsed .nav-link:hover::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        transform: translateY(-50%);
        background: rgba(26,31,46,0.95);
        color: #fff;
        padding: 6px 12px;
        border-radius: 6px;
        font-size: 12px;
        white-space: nowrap;
        z-index: 200;
        pointer-events: none;
        box-shadow: var(--shadow-md);
    }

/* Sidebar footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.logout-btn {
    width: 100%;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    color: rgba(255,255,255,0.5);
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: background var(--transition), color var(--transition);
}

    .logout-btn:hover {
        background: rgba(224,49,49,0.15);
        color: #ff6b6b;
    }

    .logout-btn i {
        width: 18px;
        text-align: center;
        flex-shrink: 0;
    }

.sidebar.collapsed .logout-btn .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

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

    .sidebar-overlay.show {
        display: block;
    }

/* ── Main Wrapper ── */
.main-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ── Top Header ── */
.top-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    position: relative;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.hamburger-btn {
    width: 36px;
    height: 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

    .hamburger-btn:hover {
        background: var(--bg-body);
    }

    .hamburger-btn span {
        display: block;
        width: 18px;
        height: 2px;
        background: var(--text-secondary);
        border-radius: 2px;
        transition: transform var(--transition), opacity var(--transition);
    }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

    .breadcrumb i {
        color: var(--primary);
    }

    .breadcrumb span {
        font-weight: 500;
    }

.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 15px;
    position: relative;
    transition: background var(--transition), color var(--transition);
}

    .header-btn:hover {
        background: var(--bg-body);
        color: var(--text-primary);
    }

.badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: var(--danger);
    color: #fff;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
}

/* ══════════════════════════════════════════════════
   ★ 잔여 포인트 위젯
   ══════════════════════════════════════════════════ */
.pt-widget {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 8px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 1px solid #ddd6fe;
    cursor: pointer;
    position: relative;
    transition: background var(--transition), box-shadow var(--transition);
    user-select: none;
}

    .pt-widget:hover {
        background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
        box-shadow: var(--shadow-sm);
    }

    .pt-widget.pt-low {
        background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
        border-color: #fdba74;
    }

    .pt-widget.pt-empty {
        background: linear-gradient(135deg, #fff1f2 0%, #fecdd3 100%);
        border-color: #fca5a5;
    }

.pt-icon-wrap {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    flex-shrink: 0;
}

.pt-widget.pt-low .pt-icon-wrap {
    background: linear-gradient(135deg, #f08c00, #fbbf24);
}

.pt-widget.pt-empty .pt-icon-wrap {
    background: linear-gradient(135deg, #e03131, #f87171);
}

.pt-info {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.pt-label {
    font-size: 10px;
    font-weight: 600;
    color: #7c3aed;
    line-height: 1.2;
    white-space: nowrap;
}

.pt-widget.pt-low .pt-label {
    color: #f08c00;
}

.pt-widget.pt-empty .pt-label {
    color: #e03131;
}

.pt-value {
    font-size: 13px;
    font-weight: 700;
    color: #4c1d95;
    line-height: 1.3;
    white-space: nowrap;
}

.pt-widget.pt-low .pt-value {
    color: #92400e;
}

.pt-widget.pt-empty .pt-value {
    color: #991b1b;
}

.pt-arrow {
    font-size: 10px;
    color: #a78bfa;
    margin-left: 2px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

/* ── 포인트 패널 ── */
.pt-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.16);
    z-index: 8000;
    overflow: hidden;
    animation: ptPanelIn .18s ease;
}

    .pt-panel.show {
        display: block;
    }

@keyframes ptPanelIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 패널 헤더 */
.pt-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 10px;
    background: linear-gradient(135deg, #4c1d95, #7c3aed);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.pt-panel-actions {
    display: flex;
    gap: 6px;
}

.pt-charge-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.35);
    color: #fff;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

    .pt-charge-btn:hover {
        background: rgba(255,255,255,.28);
    }

/* 요약 카드 */
.pt-summary {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 0;
    border-bottom: 1px solid #f1f5f9;
}

.pt-summary-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 8px;
    border-right: 1px solid #f1f5f9;
}

    .pt-summary-card:last-child {
        border-right: none;
    }

.pt-summary-label {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 600;
    white-space: nowrap;
}

.pt-summary-val {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.pt-summary-remain .pt-summary-val {
    color: #7c3aed;
}

.pt-summary-used .pt-summary-val {
    color: #e03131;
}

.pt-summary-next .pt-summary-val {
    color: #1971c2;
    font-size: 11px;
}

/* 요금제 안내 */
.pt-plan-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: #f8f4ff;
    border-bottom: 1px solid #ede9fe;
    font-size: 11.5px;
    color: #6d28d9;
}

    .pt-plan-info i {
        color: #a78bfa;
        flex-shrink: 0;
    }

/* 포인트 부족 경고 */
.pt-warn {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 16px;
    background: #fff7ed;
    border-bottom: 1px solid #fed7aa;
    font-size: 12px;
    color: #92400e;
    font-weight: 500;
}

    .pt-warn i {
        color: #f08c00;
    }

    .pt-warn button {
        margin-left: auto;
        padding: 3px 10px;
        border-radius: 5px;
        background: #f08c00;
        color: #fff;
        font-size: 11.5px;
        font-weight: 600;
        cursor: pointer;
        border: none;
    }

        .pt-warn button:hover {
            background: #d97706;
        }

/* 이력 목록 */
.pt-history-wrap {
    padding: 0 0 4px;
}

.pt-history-title {
    padding: 8px 16px 4px;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.pt-history-list {
    max-height: 220px;
    overflow-y: auto;
}

.pt-loading {
    padding: 14px;
    text-align: center;
    font-size: 12.5px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.pt-empty-msg {
    padding: 14px;
    text-align: center;
    font-size: 12.5px;
    color: #cbd5e1;
}

/* 이력 행 */
.pt-history-row {
    display: grid;
    grid-template-columns: 28px 1fr auto 88px;
    align-items: center;
    gap: 0;
    padding: 6px 16px;
    border-bottom: 1px solid #f8fafc;
    transition: background .1s;
}

    .pt-history-row:hover {
        background: #f8fafc;
    }

.pt-history-icon {
    font-size: 13px;
    justify-self: center;
}

.pt-history-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding-left: 8px;
}

.pt-history-desc {
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
}

.pt-history-date {
    font-size: 10.5px;
    color: #94a3b8;
}

.pt-history-amount {
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    text-align: right;
    padding-right: 8px;
}

    .pt-history-amount.pos {
        color: #0ca678;
    }

    .pt-history-amount.neg {
        color: #e03131;
    }

.pt-history-bal {
    font-size: 11.5px;
    color: #64748b;
    text-align: right;
    white-space: nowrap;
}

/* 패널 푸터 */
.pt-panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-top: 1px solid #f1f5f9;
    background: #fafafa;
}

.pt-refresh-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 5px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    font-size: 11.5px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .15s;
}

    .pt-refresh-btn:hover {
        background: #e2e8f0;
    }

@media (max-width: 640px) {
    .pt-info {
        display: none;
    }

    .pt-arrow {
        display: none;
    }

    .pt-widget {
        padding: 5px 8px;
    }

    .pt-panel {
        width: min(340px, 96vw);
        right: -10px;
    }
}

.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition);
    position: relative;
    margin-left: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

    .header-user:hover {
        background: var(--bg-body);
    }

.header-avatar {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #f06595, #cc5de8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.header-username {
    font-weight: 600;
    color: var(--text-primary);
}

.header-user > .fa-chevron-down {
    font-size: 11px;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px 0;
    z-index: 200;
    display: none;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

    .user-dropdown.show {
        display: block;
        opacity: 1;
        transform: translateY(0);
    }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition);
}

    .dropdown-item i {
        width: 16px;
        color: var(--text-secondary);
    }

    .dropdown-item:hover {
        background: var(--bg-body);
    }

    .dropdown-item.text-danger {
        color: var(--danger);
    }

        .dropdown-item.text-danger i {
            color: var(--danger);
        }

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ── Tab Bar ── */
.tab-bar-wrapper {
    display: flex;
    align-items: center;
    background: #f7f9fc;
    border-bottom: 1px solid var(--border);
    height: var(--tabbar-height);
    flex-shrink: 0;
    overflow: hidden;
}

.tab-bar {
    flex: 1;
    display: flex;
    align-items: flex-end;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0;
    padding: 0 4px;
}

    .tab-bar::-webkit-scrollbar {
        height: 0;
    }

.tab-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 14px;
    height: 34px;
    margin-top: 8px;
    background: #eff1f5;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    font-size: 12.5px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition), box-shadow var(--transition);
    user-select: none;
    position: relative;
    min-width: 110px;
    max-width: 180px;
}

    .tab-item:hover {
        background: #e4e8f0;
        color: var(--text-primary);
    }

    .tab-item.active {
        background: var(--bg-card);
        color: var(--primary);
        font-weight: 600;
        border-color: var(--border);
        border-bottom: 2px solid var(--bg-card);
        margin-bottom: -1px;
        box-shadow: 0 -2px 0 var(--primary);
    }

    .tab-item i.tab-icon {
        font-size: 12px;
        flex-shrink: 0;
    }

    .tab-item span.tab-label {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
    }

.tab-close {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 10px;
    transition: background var(--transition);
    color: var(--text-muted);
}

    .tab-close:hover {
        background: rgba(0,0,0,0.12);
        color: var(--danger);
    }

/* Drag states */
.tab-item.dragging {
    opacity: 0.45;
    background: var(--primary-light);
}

.tab-item.drag-over {
    background: var(--primary-light);
    border-color: var(--primary);
}

.tab-actions {
    padding: 0 10px;
    flex-shrink: 0;
}

.tab-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13px;
    transition: background var(--transition), color var(--transition);
}

    .tab-action-btn:hover {
        background: var(--border);
        color: var(--danger);
    }

/* ── Page Content ── */
.page-content {
    flex: 1;
    /* ★ overflow-y auto → 탭 패널이 남은 높이를 100% 쓰도록 hidden으로 변경
       각 탭 패널이 내부 스크롤을 담당 */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 24px;
    background: var(--bg-body);
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    position: relative;
}

/* ★ 탭별 독립 패널 — show/hide 로 상태 유지
   #pageContent 의 직접 자식으로 생성됨 */
.tab-panel {
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    animation: pageIn 0.18s ease;
    /* 기본은 overflow-y auto (일반 페이지용) */
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
}

    /* 배차일보·운송현황처럼 전체 높이를 쓰는 탭: overflow hidden */
    .tab-panel.tab-fullheight {
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
    color: var(--text-muted);
}

    .welcome-screen .welcome-icon {
        font-size: 52px;
        color: var(--primary);
        opacity: 0.3;
    }

    .welcome-screen h2 {
        font-size: 22px;
        font-weight: 700;
        color: var(--text-secondary);
    }

    .welcome-screen p {
        font-size: 14px;
    }

/* ============================================================
   PAGE COMMON STYLES (used by all page modules)
   ============================================================ */

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

    .page-title i {
        color: var(--primary);
        font-size: 18px;
    }

.page-title-sub {
    font-size: 12.5px;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 8px;
}

.page-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

    .card-title i {
        color: var(--primary);
    }

.card-body {
    padding: 20px;
}

/* KPI cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}

    .kpi-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

    .kpi-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
    }

    .kpi-card.blue::before {
        background: linear-gradient(90deg, #3b5bdb, #74c0fc);
    }

    .kpi-card.green::before {
        background: linear-gradient(90deg, #0ca678, #8ce99a);
    }

    .kpi-card.orange::before {
        background: linear-gradient(90deg, #f08c00, #ffd43b);
    }

    .kpi-card.purple::before {
        background: linear-gradient(90deg, #7950f2, #da77f2);
    }

    .kpi-card.red::before {
        background: linear-gradient(90deg, #e03131, #ff8787);
    }

    .kpi-card.teal::before {
        background: linear-gradient(90deg, #0891b2, #67e8f9);
    }

.kpi-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 10px;
}

.kpi-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 8px;
}

.kpi-change {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

    .kpi-change.up {
        color: var(--secondary);
    }

    .kpi-change.down {
        color: var(--danger);
    }

.kpi-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 36px;
    opacity: 0.08;
    color: var(--text-primary);
}

/* ── Dashboard: KPI card hover cursor ── */
.dash-kpi-card {
    transition: transform var(--transition), box-shadow var(--transition);
}

/* ── Dashboard: 서브 요약 바 ── */
.dash-summary-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.dash-sum-box {
    flex: 1 1 80px;
    min-width: 72px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.dash-sum-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 6px;
    white-space: nowrap;
}

.dash-sum-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

    .dash-sum-value.dash-sum-blue {
        color: #1971c2;
    }

    .dash-sum-value.dash-sum-green {
        color: #0ca678;
    }

    .dash-sum-value.dash-sum-red {
        color: #e03131;
    }

    .dash-sum-value.dash-sum-orange {
        color: #e67700;
    }

    .dash-sum-value.dash-sum-teal {
        color: #0891b2;
    }

/* Search bar */
.search-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.search-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 150px;
}

    .search-field label {
        font-size: 12px;
        font-weight: 600;
        color: var(--text-secondary);
    }

.search-input, .search-select {
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: #fafbfc;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

    .search-input:focus, .search-select:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-50);
        background: #fff;
    }

.search-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 16px;
    height: 36px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
    border: none;
}

    .btn:active {
        transform: scale(0.98);
    }

.btn-primary {
    background: var(--primary);
    color: #fff;
}

    .btn-primary:hover {
        background: var(--primary-dark);
        box-shadow: 0 3px 10px rgba(59,91,219,0.3);
    }

.btn-secondary {
    background: var(--bg-body);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

    .btn-secondary:hover {
        background: var(--border);
    }

.btn-success {
    background: var(--secondary);
    color: #fff;
}

    .btn-success:hover {
        background: #099268;
        box-shadow: 0 3px 10px rgba(12,166,120,0.3);
    }

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

    .btn-danger:hover {
        background: #c92a2a;
    }

.btn-warning {
    background: var(--warning);
    color: #fff;
}

    .btn-warning:hover {
        background: #e67700;
    }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
}

    .btn-outline:hover {
        background: var(--primary-light);
    }

.btn-sm {
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
}

.btn-lg {
    height: 42px;
    padding: 0 20px;
    font-size: 14px;
}

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

/* Tables */
.table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-toolbar {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 10px;
}

.table-info {
    font-size: 12.5px;
    color: var(--text-secondary);
}

    .table-info strong {
        color: var(--text-primary);
    }

.table-controls {
    display: flex;
    gap: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

    .data-table thead tr {
        background: #f8fafc;
        border-bottom: 1.5px solid var(--border);
    }

    .data-table th {
        padding: 11px 14px;
        font-size: 12px;
        font-weight: 700;
        color: var(--text-secondary);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        text-align: left;
        white-space: nowrap;
    }

    .data-table td {
        padding: 11px 14px;
        font-size: 13px;
        color: var(--text-primary);
        border-bottom: 1px solid var(--border-light);
    }

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

    .data-table tbody tr:hover {
        background: #fafbff;
    }

    .data-table .th-actions {
        text-align: center;
    }

    .data-table .td-actions {
        text-align: center;
        white-space: nowrap;
    }

.table-actions-group {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 12px;
    transition: background var(--transition), color var(--transition);
}

    .action-btn.edit {
        color: var(--info);
    }

        .action-btn.edit:hover {
            background: var(--info-light);
        }

    .action-btn.delete {
        color: var(--danger);
    }

        .action-btn.delete:hover {
            background: var(--danger-light);
        }

    .action-btn.view {
        color: var(--secondary);
    }

        .action-btn.view:hover {
            background: var(--secondary-light);
        }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
}

.page-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
}

    .page-btn:hover {
        background: var(--bg-body);
        color: var(--text-primary);
    }

    .page-btn.active {
        background: var(--primary);
        color: #fff;
        font-weight: 600;
    }

    .page-btn:disabled {
        opacity: 0.4;
        pointer-events: none;
    }

/* Badges / Status */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
}

    .badge-status.active, .badge-status.completed {
        background: var(--secondary-light);
        color: var(--secondary);
    }

    .badge-status.inactive, .badge-status.cancelled {
        background: var(--danger-light);
        color: var(--danger);
    }

    .badge-status.pending {
        background: var(--warning-light);
        color: var(--warning);
    }

    .badge-status.processing {
        background: var(--info-light);
        color: var(--info);
    }

    .badge-status.dot::before {
        content: '';
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: currentColor;
    }

/* Charts container */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.chart-container {
    height: 280px;
    position: relative;
}

/* Form styles (page forms) */
.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 16px;
}

.form-section-header {
    padding: 14px 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
}

.form-section-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

    .form-section-title i {
        color: var(--primary);
    }

.form-section-body {
    padding: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.form-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.form-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.form-group-v {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .form-group-v label {
        font-size: 12px;
        font-weight: 600;
        color: var(--text-secondary);
    }

.form-control {
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    outline: none;
    background: #fafbfc;
    transition: border-color var(--transition);
}

    .form-control:focus {
        border-color: var(--primary);
        background: #fff;
        box-shadow: 0 0 0 3px var(--primary-50);
    }

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

.form-required::after {
    content: ' *';
    color: var(--danger);
}

.form-actions {
    padding: 16px 20px;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Tabs in page */
.inner-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.inner-tab {
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color var(--transition), border-color var(--transition);
}

    .inner-tab:hover {
        color: var(--primary);
    }

    .inner-tab.active {
        color: var(--primary);
        border-bottom-color: var(--primary);
        font-weight: 600;
    }

/* Summary boxes */
.summary-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.summary-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .summary-box .s-label {
        font-size: 11.5px;
        color: var(--text-secondary);
        font-weight: 500;
    }

    .summary-box .s-value {
        font-size: 18px;
        font-weight: 700;
        color: var(--text-primary);
    }

        .summary-box .s-value.blue {
            color: var(--primary);
        }

        .summary-box .s-value.green {
            color: var(--secondary);
        }

        .summary-box .s-value.orange {
            color: var(--warning);
        }

        .summary-box .s-value.red {
            color: var(--danger);
        }

/* Empty state */
.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

    .empty-state i {
        font-size: 48px;
        margin-bottom: 16px;
        opacity: 0.3;
        display: block;
    }

    .empty-state h3 {
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 8px;
        color: var(--text-secondary);
    }

    .empty-state p {
        font-size: 13px;
    }

/* ============================================================
   RESPONSIVE / MOBILE
   ============================================================ */

/* Tablet (≤ 1024px) */
@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .login-side {
        display: none;
    }

    .login-card {
        width: 100%;
        max-width: 420px;
        margin: 0 auto;
    }

    .login-container {
        width: 460px;
        border-radius: var(--radius-lg);
    }
}

/* Mobile (≤ 768px) */
@media (max-width: 768px) {
    :root {
        --header-height: 50px;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform var(--transition), width var(--transition);
        z-index: 200;
        width: var(--sidebar-width) !important;
    }

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

    .main-wrapper {
        width: 100vw;
    }

    .page-content {
        padding: 14px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .kpi-value {
        font-size: 20px;
    }

    .search-bar {
        flex-direction: column;
        gap: 10px;
    }

    .search-field {
        min-width: 100%;
    }

    .search-actions {
        width: 100%;
    }

        .search-actions .btn {
            flex: 1;
        }

    .form-grid, .form-grid-2, .form-grid-4 {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .data-table {
        font-size: 12px;
    }

        .data-table th, .data-table td {
            padding: 9px 10px;
        }

    .header-username {
        display: none;
    }

    .tab-item {
        min-width: 90px;
        max-width: 130px;
        font-size: 12px;
        padding: 0 10px;
    }

        .tab-item span.tab-label {
            font-size: 11.5px;
        }

    .login-container {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

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

    .summary-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-grid {
        grid-template-columns: 1fr;
    }
}

/* Extra small (≤ 480px) */
@media (max-width: 480px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .header-btn:not(:last-child) {
        display: none;
    }

    .breadcrumb span {
        display: none;
    }

    .breadcrumb i {
        font-size: 16px;
    }

    .summary-row {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-animate {
    animation: fadeSlideIn 0.25s ease forwards;
}

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

.spin {
    animation: spin 1s linear infinite;
}

/* Print */
@media print {
    .sidebar, .top-header, .tab-bar-wrapper, .page-actions, .search-actions {
        display: none !important;
    }

    .page-content {
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ============================================================
   KPI 미니 카드 (오더 등 페이지 요약)
   ============================================================ */
.kpi-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    min-width: 80px;
    box-shadow: var(--shadow-sm);
}

    .kpi-mini.success {
        border-left: 3px solid var(--secondary);
    }

    .kpi-mini.warning {
        border-left: 3px solid var(--warning);
    }

    .kpi-mini.info {
        border-left: 3px solid var(--info);
    }

    .kpi-mini.danger {
        border-left: 3px solid var(--danger);
    }

    .kpi-mini.primary {
        border-left: 3px solid var(--primary);
    }

.kpi-mini-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.kpi-mini-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.kpi-mini.success .kpi-mini-val {
    color: var(--secondary);
}

.kpi-mini.warning .kpi-mini-val {
    color: var(--warning);
}

.kpi-mini.info .kpi-mini-val {
    color: var(--info);
}

.kpi-mini.danger .kpi-mini-val {
    color: var(--danger);
}

.kpi-mini.primary .kpi-mini-val {
    color: var(--primary);
    font-size: 15px;
}

/* ============================================================
   모달 (상세보기)
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26,31,46,0.52);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.18s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-dialog {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.2s ease;
}

    .modal-dialog.modal-lg {
        max-width: 720px;
    }

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

    .modal-title i {
        color: var(--primary);
    }

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: #f8f9fc;
}

/* 상세 그리드 */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .detail-item.full {
        grid-column: 1 / -1;
    }

.detail-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.detail-value {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

    .detail-value a {
        color: var(--primary);
        text-decoration: none;
    }

        .detail-value a:hover {
            text-decoration: underline;
        }

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

    .detail-item.full {
        grid-column: 1;
    }

    .modal-dialog {
        max-width: 100%;
        margin: 0;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        align-self: flex-end;
    }

    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
}

/* icon-btn (닫기 버튼) */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition);
}

    .icon-btn:hover {
        background: var(--danger-light);
        color: var(--danger);
    }
