/* ============================================================
   KING THE LAND - Design System v3
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-soft: #f1f5f9;
    --bg-sidebar: #ffffff;
    --accent: #6366f1;
    --accent-dim: rgba(99,102,241,0.08);
    --accent-hover: #4f46e5;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-sub: #94a3b8;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.04);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 64px;
    --input-bg: #f8fafc;
    --calc-accent: #4834d4;
}

body.dark-mode {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-soft: #334155;
    --bg-sidebar: #0f172a;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-sub: #64748b;
    --border: #334155;
    --accent: #818cf8;
    --accent-dim: rgba(129,140,248,0.1);
    --accent-hover: #6366f1;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.4);
    --input-bg: #1e293b;
    --danger: #f87171;
    --success: #34d399;
    --warning: #fbbf24;
    --calc-accent: #a5b4fc;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg-main);
    color: var(--text-main);
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    transition: background 0.3s, color 0.3s;
    overflow-x: hidden;
    display: flex;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    box-shadow: 1px 0 0 var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 1000;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed-width); }

/* Header */
.sidebar-header {
    padding: 20px 16px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-height: 64px;
}
.sidebar-logo {
    font-size: 15px;
    font-weight: 900;
    color: var(--accent);
    letter-spacing: 0.3px;
    white-space: nowrap;
    transition: opacity 0.2s;
}
.sidebar-logo-icon { font-size: 22px; flex-shrink: 0; }
.sidebar.collapsed .sidebar-logo { opacity: 0; width: 0; overflow: hidden; }

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 13.5px;
    border-left: 3px solid transparent;
    white-space: nowrap;
    user-select: none;
}
.nav-item:hover { background: var(--accent-dim); color: var(--accent); }
.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 700;
}
.nav-icon { font-size: 17px; margin-right: 10px; flex-shrink: 0; }
.sidebar.collapsed .nav-text { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; border-left-color: transparent; }
.sidebar.collapsed .nav-icon { margin-right: 0; }
.sidebar.collapsed .nav-item.active { border-left-color: transparent; background: var(--accent-dim); }

/* Admin accordion */
.nav-accordion { list-style: none; margin: 0; padding: 0; overflow: hidden; max-height: 0; transition: max-height 0.3s ease; }
.nav-accordion.open { max-height: 420px; }
.nav-accordion-item {
    display: flex; align-items: center;
    padding: 9px 12px 9px 38px;
    border-radius: var(--radius-sm);
    cursor: pointer; color: var(--text-muted);
    font-size: 13px; font-weight: 600;
    transition: 0.15s; margin: 1px 4px;
    border-left: 3px solid transparent;
}
.nav-accordion-item:hover { background: var(--accent-dim); color: var(--accent); border-left-color: var(--accent); }
.nav-admin-toggle {
    display: flex; align-items: center;
    padding: 10px 12px; border-radius: var(--radius-md);
    cursor: pointer; color: var(--text-muted);
    font-weight: 700; font-size: 13.5px;
    transition: 0.15s; user-select: none;
}
.nav-admin-toggle:hover { background: var(--accent-dim); color: var(--accent); }
.nav-admin-toggle .nav-icon { margin-right: 10px; }
.nav-admin-toggle .toggle-arrow { margin-left: auto; font-size: 10px; transition: transform 0.3s; }
.nav-admin-toggle.open .toggle-arrow { transform: rotate(180deg); }
.sidebar.collapsed .nav-admin-toggle .nav-text { display: none; }
.sidebar.collapsed .nav-admin-toggle { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-admin-toggle .nav-icon { margin-right: 0; }
.sidebar.collapsed .nav-admin-toggle .toggle-arrow { display: none; }
.sidebar.collapsed .nav-accordion { display: none; }
.sidebar.collapsed #nav-admin-section { display: none !important; }

/* Footer */
.sidebar-footer {
    padding: 14px 14px 70px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}
.sidebar.collapsed .sidebar-footer { padding-bottom: 72px; }
.sidebar.collapsed .sidebar-footer .user-detail,
.sidebar.collapsed .sidebar-footer .footer-btns,
.sidebar.collapsed .sidebar-footer .logout-link-v2,
.sidebar.collapsed .sidebar-footer .theme-info .nav-text { display: none; }
.sidebar.collapsed .user-card { justify-content: center; }
.sidebar.collapsed .theme-toggle-container { justify-content: center; }

/* Theme Toggle */
.theme-toggle-container { display: flex; justify-content: space-between; align-items: center; padding: 0 4px; }
.theme-info { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text-muted); }
.switch { position: relative; display: inline-block; width: 38px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: var(--border); border-radius: 34px; transition: 0.3s; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background: white; transition: 0.3s; border-radius: 50%; }
input:checked + .slider { background: var(--accent); }
input:checked + .slider:before { transform: translateX(18px); }

/* User Card */
.user-card { display: flex; align-items: center; gap: 10px; padding: 4px 2px; }
.user-avatar {
    width: 38px; height: 38px;
    background: var(--accent);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 900; color: #fff;
    flex-shrink: 0; letter-spacing: -0.5px;
}
.user-detail { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.user-name { font-size: 13px; font-weight: 800; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.user-rank-tag { font-size: 11px; color: var(--text-sub); font-weight: 600; }
.user-status-line { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); font-weight: 600; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.online { background: #10b981; box-shadow: 0 0 0 2px rgba(16,185,129,0.25); }
.status-dot.offline { background: #94a3b8; }

/* Work Buttons */
.footer-btns { display: flex; gap: 6px; }
.work-btn-v2 {
    flex: 1; padding: 9px; border: none;
    border-radius: var(--radius-sm); font-weight: 800; font-size: 12px;
    cursor: pointer; transition: 0.15s;
}
.work-btn-v2.in { background: var(--success); color: #fff; }
.work-btn-v2.in:hover { background: #059669; }
.work-btn-v2.out { background: var(--danger); color: #fff; }
.work-btn-v2.out:hover { background: #dc2626; }

.logout-link-v2 {
    background: none; border: none; color: var(--text-muted); font-size: 11.5px;
    font-weight: 600; cursor: pointer; display: flex; align-items: center;
    gap: 6px; padding: 4px 2px; opacity: 0.7; transition: opacity 0.15s;
}
.logout-link-v2:hover { opacity: 1; }

/* Toggle Button */
.sidebar-toggle-btn {
    position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
    width: 38px; height: 38px; background: var(--accent); border: none;
    border-radius: 50%; cursor: pointer; display: flex; align-items: center;
    justify-content: center; font-size: 14px; color: #fff; z-index: 1002;
    box-shadow: 0 4px 12px rgba(99,102,241,0.4); transition: box-shadow 0.2s, transform 0.2s;
}
.sidebar-toggle-btn:hover { box-shadow: 0 6px 18px rgba(99,102,241,0.5); transform: translateX(-50%) scale(1.08); }

/* ============================================================
   MAIN HEADER BAR
   ============================================================ */
.main-header {
    position: sticky;
    top: 0;
    height: 64px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 32px;
    gap: 16px;
    z-index: 100;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    flex-shrink: 0;
}

.header-left { flex-shrink: 0; }
.header-tab-title {
    font-size: 16px;
    font-weight: 900;
    color: var(--text-main);
    letter-spacing: -0.3px;
    white-space: nowrap;
}

.header-center { flex: 1; max-width: 480px; margin: 0 auto; }
.header-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-soft);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 14px;
    gap: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.header-search-wrap.focused {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
    background: var(--bg-card);
}
.header-search-icon { color: var(--text-sub); font-size: 13px; flex-shrink: 0; }
.header-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 10px 0;
    font-size: 13px;
    color: var(--text-main);
    font-family: inherit;
}
.header-search-input::placeholder { color: var(--text-sub); }
.header-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 200;
    overflow: hidden;
}
.header-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.12s;
}
.header-search-item:hover { background: var(--accent-dim); color: var(--accent); }

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}
.header-status-group {
    display: flex;
    align-items: center;
    gap: 6px;
}
.header-status-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}
.header-user-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 900;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    padding: 0;
    transition: margin-left 0.3s cubic-bezier(0.4,0,0.2,1);
    display: flex;
    flex-direction: column;
}
.main-content.sidebar-collapsed { margin-left: var(--sidebar-collapsed-width); }
.tab-content { animation: fadeInUp 0.25s ease; padding: 32px 36px; }

/* ============================================================
   DASHBOARD COMPONENTS
   ============================================================ */
.summary-scroll-bar {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: none;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-main);
}
.summary-scroll-bar::-webkit-scrollbar { display: none; }

.summary-chip {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 190px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s, transform 0.15s;
}
.summary-chip:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.sc-icon { font-size: 26px; }
.sc-label { font-size: 11px; color: var(--text-muted); font-weight: 700; margin-bottom: 4px; white-space: nowrap; }
.sc-value { font-size: 17px; font-weight: 900; color: var(--text-main); display: flex; align-items: center; gap: 6px; }

.quick-access-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 12px;
    background: var(--bg-soft);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-main);
    transition: 0.15s;
    font-family: inherit;
    width: 100%;
}
.quick-access-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.quick-access-btn .qa-icon { font-size: 22px; }

.dash-mini-table { width: 100%; border-collapse: collapse; }
.dash-mini-table tr { border-bottom: 1px solid var(--border); }
.dash-mini-table tr:last-child { border-bottom: none; }
.dash-mini-table td { padding: 10px 12px; font-size: 12.5px; color: var(--text-main); vertical-align: middle; }
.dash-mini-table tr:hover td { background: var(--bg-soft); }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes shake {
    0%,100%{ transform:translateX(0); } 20%,60%{ transform:translateX(-6px); } 40%,80%{ transform:translateX(6px); }
}

/* ============================================================
   KTL COMPONENTS
   ============================================================ */

/* Card */
.ktl-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    color: var(--text-main);
    overflow: hidden;
}
/* Legacy aliases */
.card-v2 { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); color: var(--text-main); }
.v2-card { background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); color: var(--text-main); }

/* Page Header */
.ktl-page-header { margin-bottom: 28px; }
.ktl-page-header h1, .v2-page-title { font-size: 24px; font-weight: 900; color: var(--text-main); margin: 0 0 4px; letter-spacing: -0.4px; }
.ktl-page-header p, .v2-page-sub { font-size: 13px; color: var(--text-muted); margin: 0; font-weight: 500; }

/* Section Label */
.v2-section-label, .ktl-section-label {
    font-size: 13px; font-weight: 900; color: var(--text-main);
    border-left: 4px solid var(--accent); padding-left: 10px; margin-bottom: 14px;
}

/* Buttons */
.ktl-btn-primary {
    background: var(--accent); color: #fff; border: none;
    border-radius: var(--radius-md); padding: 10px 20px;
    font-weight: 800; font-size: 13px; cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 12px rgba(99,102,241,0.25);
}
.ktl-btn-primary:hover { background: var(--accent-hover); box-shadow: 0 6px 16px rgba(99,102,241,0.35); }

.ktl-btn-success {
    background: var(--success); color: #fff; border: none;
    border-radius: var(--radius-md); padding: 10px 20px;
    font-weight: 800; font-size: 13px; cursor: pointer;
    transition: background 0.15s;
}
.ktl-btn-success:hover { background: #059669; }

.ktl-btn-danger {
    background: var(--danger); color: #fff; border: none;
    border-radius: var(--radius-md); padding: 10px 20px;
    font-weight: 800; font-size: 13px; cursor: pointer;
    transition: background 0.15s;
}
.ktl-btn-danger:hover { background: #dc2626; }

.ktl-btn-ghost {
    background: transparent; color: var(--text-muted); border: 1.5px solid var(--border);
    border-radius: var(--radius-md); padding: 10px 20px;
    font-weight: 700; font-size: 13px; cursor: pointer;
    transition: 0.15s;
}
.ktl-btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Input */
.ktl-input, .v2-input {
    background: var(--input-bg); border: 1.5px solid var(--border);
    color: var(--text-main); border-radius: var(--radius-md); padding: 11px 14px;
    font-size: 13.5px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}
.ktl-input:focus, .v2-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.ktl-input::placeholder, .v2-input::placeholder { color: var(--text-sub); }

/* Table */
.ktl-table-wrapper, .v2-table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.ktl-table, .v2-table { width: 100%; border-collapse: collapse; }
.ktl-table thead tr, .v2-table thead tr {
    background: var(--bg-soft);
    color: var(--text-muted); font-size: 12px;
}
.ktl-table thead th, .v2-table thead th {
    padding: 13px 15px; font-weight: 800; text-align: left;
}
.ktl-table tbody tr, .v2-table tbody tr {
    border-top: 1px solid var(--border);
    color: var(--text-main); font-size: 13px;
    transition: background 0.12s;
}
.ktl-table tbody tr:hover, .v2-table tbody tr:hover { background: var(--bg-soft); }
.ktl-table tbody td, .v2-table tbody td { padding: 13px 15px; }

/* Search Bar */
.v2-search-bar {
    background: var(--bg-card); border-radius: var(--radius-lg);
    padding: 12px 16px; display: flex; align-items: center; gap: 10px;
    box-shadow: var(--shadow-sm);
}

/* Badge */
.ktl-badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 800;
}
.ktl-badge-accent { background: var(--accent-dim); color: var(--accent); }
.ktl-badge-success { background: rgba(16,185,129,0.1); color: var(--success); }
.ktl-badge-danger  { background: rgba(239,68,68,0.1);  color: var(--danger); }
.ktl-badge-warning { background: rgba(245,158,11,0.1); color: var(--warning); }

/* Stat Card */
.v2-stat-card {
    background: var(--bg-card); border-radius: var(--radius-lg); padding: 20px;
    text-align: center; box-shadow: var(--shadow-sm);
}
.v2-stat-label { font-size: 12px; color: var(--text-muted); font-weight: 700; margin-bottom: 6px; }
.v2-stat-value { font-size: 22px; font-weight: 900; color: var(--text-main); }

/* Rank Badge */
.v2-rank-badge { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11px; font-weight: 800; background: var(--accent-dim); color: var(--accent); }

/* Empty State */
.ktl-empty-state {
    text-align: center; padding: 70px 20px; color: var(--text-muted);
}
.ktl-empty-state .empty-icon { font-size: 48px; margin-bottom: 14px; }
.ktl-empty-state .empty-title { font-size: 15px; font-weight: 800; color: var(--text-main); margin-bottom: 6px; }
.ktl-empty-state .empty-desc  { font-size: 13px; }

/* Toast */
.ktl-toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    background: var(--accent); color: #fff;
    padding: 12px 24px; border-radius: var(--radius-md);
    z-index: 99999; font-weight: 800; font-size: 13.5px;
    box-shadow: var(--shadow-md); animation: fadeIn 0.3s;
}

/* ============================================================
   RESPONSIVE – 900px base
   ============================================================ */
@media (max-width: 900px) {
    .tab-content { padding: 20px 16px; }
    .main-header { padding: 0 16px; }
    .header-center { max-width: 240px; }
    .summary-chip { min-width: 160px; }
}

/* ============================================================
   HAMBURGER BUTTON (모바일 전용)
   ============================================================ */
.hamburger-btn {
    display: none;
    width: 44px; height: 44px;
    background: none; border: none;
    border-radius: var(--radius-md);
    cursor: pointer; flex-shrink: 0;
    flex-direction: column; align-items: center; justify-content: center;
    gap: 5px; transition: background 0.15s;
}
.hamburger-btn:hover { background: var(--accent-dim); }
.hamburger-btn span {
    display: block; width: 20px; height: 2px;
    background: var(--text-main); border-radius: 2px; transition: 0.3s;
}

/* 모바일 사이드바 오버레이 배경 */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   TABLET (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {
    /* 사이드바: 기본 접힌 상태 (64px) */
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }
    .sidebar .sidebar-logo,
    .sidebar .nav-text,
    .sidebar .sidebar-footer .user-detail,
    .sidebar .sidebar-footer .footer-btns,
    .sidebar .sidebar-footer .logout-link-v2,
    .sidebar .sidebar-footer .theme-info .nav-text,
    .sidebar .toggle-arrow { display: none; }
    .sidebar .nav-item { justify-content: center; padding: 12px; border-left-color: transparent; }
    .sidebar .nav-icon { margin-right: 0; }
    .sidebar .nav-admin-toggle { justify-content: center; padding: 12px; }
    .sidebar .nav-admin-toggle .nav-icon { margin-right: 0; }
    .sidebar .nav-accordion,
    .sidebar #nav-admin-section { display: none !important; }
    .sidebar .user-card { justify-content: center; }
    .sidebar .theme-toggle-container { justify-content: center; }
    .sidebar .sidebar-footer { padding-bottom: 72px; }

    /* 메인 콘텐츠 */
    .main-content { margin-left: var(--sidebar-collapsed-width); }
    .main-content.sidebar-collapsed { margin-left: var(--sidebar-collapsed-width); }

    /* 그리드 2열 */
    div[style*="grid-template-columns:1fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* 헤더 */
    .hamburger-btn { display: flex; }
    .header-center { display: none; }
    .main-header { padding: 0 12px; gap: 10px; }

    /* 카드 그리드 2열 */
    .summary-chip { min-width: 140px; }
    .tab-content { padding: 16px 12px; }
}

/* ============================================================
   DARK MODE - CALCULATOR INPUTS
   ============================================================ */
body.dark-mode .qty-input-box,
body.dark-mode .bulk-qty-input {
    color: #a5b4fc !important;
    background: var(--bg-soft) !important;
    border: 1.5px solid #6366f1 !important;
}

/* ============================================================
   SHORTCUT BUTTON & BADGE
   ============================================================ */
.shortcut-btn {
    width: 38px; height: 38px;
    background: var(--bg-soft);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; transition: background 0.15s;
    flex-shrink: 0;
}
.shortcut-btn:hover { background: var(--accent-dim); border-color: var(--accent); }

.shortcut-badge {
    display: inline-block;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: monospace;
    padding: 2px 8px;
    font-size: 12px; font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
}

/* ============================================================
   GOAL PROGRESS BAR
   ============================================================ */
.goal-progress-track {
    height: 8px; border-radius: 4px;
    background: var(--bg-soft); overflow: hidden; margin: 6px 0;
}
.goal-progress-fill {
    height: 100%; border-radius: 4px;
    transition: width 0.5s ease;
}

/* ============================================================
   MOBILE (max-width: 480px)
   ============================================================ */
@media (max-width: 480px) {
    /* 사이드바: 모바일에서는 기본 숨김, 오버레이로 표시 */
    .sidebar {
        width: var(--sidebar-width) !important;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), width 0.3s;
        z-index: 1001;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    /* 모바일 열린 사이드바: 전체 텍스트 노출 */
    .sidebar.mobile-open .sidebar-logo,
    .sidebar.mobile-open .nav-text,
    .sidebar.mobile-open .sidebar-footer .user-detail,
    .sidebar.mobile-open .sidebar-footer .footer-btns,
    .sidebar.mobile-open .sidebar-footer .logout-link-v2,
    .sidebar.mobile-open .sidebar-footer .theme-info .nav-text,
    .sidebar.mobile-open .toggle-arrow { display: unset !important; }
    .sidebar.mobile-open .nav-item { justify-content: flex-start; padding: 10px 12px; }
    .sidebar.mobile-open .nav-icon { margin-right: 10px; }
    .sidebar.mobile-open .nav-admin-toggle { justify-content: flex-start; padding: 10px 12px; }
    .sidebar.mobile-open .nav-admin-toggle .nav-icon { margin-right: 10px; }
    .sidebar.mobile-open #nav-admin-section { display: block !important; }
    .sidebar.mobile-open .user-card { justify-content: flex-start; }
    .sidebar.mobile-open .theme-toggle-container { justify-content: space-between; }
    .sidebar-toggle-btn { display: none !important; }

    /* 메인 콘텐츠: margin 없음 */
    .main-content,
    .main-content.sidebar-collapsed { margin-left: 0; }

    /* 헤더 */
    .hamburger-btn { display: flex; }
    .header-center { display: none; }
    .main-header { padding: 0 12px; height: 56px; }
    .header-tab-title { font-size: 14px; }

    /* 카드 그리드 → 1열 */
    .summary-chip { min-width: 130px; }
    .tab-content { padding: 12px 10px; }

    /* 테이블 가로 스크롤 */
    .v2-table-wrapper, .ktl-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .v2-table, .ktl-table { min-width: 560px; }

    /* 폰트 크기 조정 */
    .v2-page-title, .ktl-page-header h1 { font-size: 18px; }
    .v2-page-sub, .ktl-page-header p { font-size: 12px; }

    /* 버튼 최소 터치 크기 44px */
    .ktl-btn-primary, .ktl-btn-success, .ktl-btn-danger, .ktl-btn-ghost,
    .work-btn-v2, .auth-btn { min-height: 44px; }

    /* 대시보드 그리드 → 1열 */
    div[style*="grid-template-columns:1fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}
