        :root {
            --bg: #0b0f12;
            --panel: #12161a;
            --border: #1f262d;
            --text: #e5e7eb;
            --muted: #9aa3b2;
            --primary: #22c55e;
            --primary-soft: rgba(34, 197, 94, 0.14);
            --warning: #f59e0b;
            --danger: #ef4444;
            --sidebar: #0a0e11;
            --sidebar-text: #cbd5e1;
            --panel-glow: 0 12px 30px rgba(0, 0, 0, 0.35);
        }

        * { box-sizing: border-box; }

        body {
            margin: 0;
            font-family: "Inter", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
            color: var(--text);
            background: radial-gradient(circle at 20% 20%, rgba(34, 197, 94, 0.08), transparent 45%), var(--bg);
        }

        .app {
            display: grid;
            grid-template-columns: var(--sidebar-width, 240px) minmax(0, 1fr);
            min-height: 100vh;
            transition: grid-template-columns 0.18s ease;
        }

        .sidebar {
            background: linear-gradient(180deg, #0a0e11 0%, #0b1116 100%);
            color: var(--sidebar-text);
            padding: 24px 18px;
            display: flex;
            flex-direction: column;
            gap: 24px;
            border-right: 1px solid rgba(255, 255, 255, 0.04);
            transition: transform 0.18s ease, opacity 0.18s ease;
            width: var(--sidebar-width, 240px);
            overflow: hidden;
            position: sticky;
            top: 0;
            height: 100vh;
            z-index: 5;
            pointer-events: auto;
        }

        .brand {
            font-size: 18px;
            font-weight: 700;
            letter-spacing: 0.4px;
        }

        .nav {
            display: grid;
            gap: 10px;
            min-height: 0;
            overflow-y: auto;
            position: relative;
            z-index: 6;
            pointer-events: auto;
        }

        .nav-item {
            padding: 10px 12px;
            border-radius: 10px;
            color: var(--sidebar-text);
            font-weight: 500;
            font-size: 14px;
            background: transparent;
            border: 1px solid transparent;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            pointer-events: auto;
        }

        .nav-item.active {
            background: rgba(34, 197, 94, 0.12);
            border-color: rgba(34, 197, 94, 0.2);
            color: #e2fbe9;
        }

        .nav-icon {
            display: inline-flex;
            width: 22px;
            justify-content: center;
            color: var(--muted);
            font-size: 18px;
            filter: grayscale(1) saturate(0);
        }

        .nav-label {
            display: inline-flex;
        }

        .main {
            display: flex;
            flex-direction: column;
            min-width: 0;
            position: relative;
            z-index: 1;
        }

        .topbar {
            padding: 16px 24px;
            border-bottom: 1px solid var(--border);
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: rgba(18, 22, 26, 0.92);
            backdrop-filter: blur(8px);
        }

        .mobile-nav {
            display: none;
            gap: 8px;
            flex-wrap: wrap;
        }

        .mobile-nav .nav-item {
            padding: 8px 10px;
            font-size: 13px;
        }

        .sidebar-toggle {
            margin-top: auto;
            align-self: flex-end;
            width: 26px;
            height: 26px;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: rgba(18, 22, 26, 0.9);
            color: var(--sidebar-text);
            font-size: 16px;
            line-height: 1;
            cursor: pointer;
            position: relative;
            z-index: 6;
            pointer-events: auto;
        }

        body.sidebar-collapsed .sidebar {
            padding: 20px 12px;
        }
        
        body.sidebar-collapsed {
            --sidebar-width: 72px;
        }

        body.sidebar-collapsed .brand,
        body.sidebar-collapsed .nav-label {
            display: none;
        }

        body.sidebar-collapsed .nav-item {
            justify-content: center;
            padding: 10px;
        }

        .topbar h1 {
            font-size: 18px;
            margin: 0;
            font-weight: 600;
        }

        .content {
            padding: 24px;
            display: grid;
            gap: 18px;
        }

        .panel {
            background: linear-gradient(180deg, rgba(18, 22, 26, 0.98) 0%, rgba(15, 19, 23, 0.98) 100%);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 20px;
            box-shadow: var(--panel-glow);
        }

        .panel-title {
            font-size: 18px;
            font-weight: 600;
        }

        #proxy-manage-cname-banner {
            margin-left: auto;
            white-space: nowrap;
        }

        .compact-panel {
            padding: 14px;
        }

        .compact-grid {
            gap: 10px;
        }

        #proxy-traffic-panel {
            padding: 12px 14px;
        }

        #proxy-traffic-chart {
            width: 100%;
            display: block;
        }

        .grid {
            display: grid;
            gap: 16px;
        }

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

        .muted { color: var(--muted); font-size: 13px; }

        label { font-size: 13px; font-weight: 600; display: block; margin-bottom: 6px; }

        input, textarea, select {
            width: 100%;
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 8px 10px;
            font-size: 14px;
            font-family: inherit;
            background: #0f1317;
            color: var(--text);
        }

        select {
            appearance: none;
            background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                linear-gradient(135deg, var(--muted) 50%, transparent 50%);
            background-position: calc(100% - 16px) calc(50% - 4px),
                calc(100% - 10px) calc(50% - 4px);
            background-size: 6px 6px, 6px 6px;
            background-repeat: no-repeat;
        }

        select option {
            background: #0f1317;
            color: var(--text);
        }

        .inline-check {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 13px;
            color: var(--muted);
        }

        textarea { resize: vertical; min-height: 90px; }

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

        .btn {
            border: 1px solid transparent;
            border-radius: 10px;
            padding: 9px 14px;
            font-weight: 600;
            font-size: 13px;
            cursor: pointer;
        }

        .btn-primary { background: var(--primary); color: #07130a; border-color: transparent; }
        .btn-outline { background: #0f1317; color: var(--text); border-color: var(--border); }
        .btn-ghost { background: transparent; color: var(--text); border-color: transparent; }

        .status {
            padding: 10px 12px;
            border-radius: 10px;
            font-size: 13px;
            background: var(--primary-soft);
            color: #b7f4cc;
            border: 1px solid rgba(34, 197, 94, 0.2);
        }

        .status.hidden { display: none; }

        .status.warn { background: rgba(245, 158, 11, 0.15); color: #b45309; }
        .status.error { background: rgba(239, 68, 68, 0.15); color: #b91c1c; }

        .toast-stack {
            position: fixed;
            left: 50%;
            top: 44px;
            transform: translateX(-50%);
            display: grid;
            gap: 8px;
            z-index: 60;
            max-width: min(360px, 92vw);
        }

        .toast {
            padding: 10px 12px;
            border-radius: 10px;
            font-size: 13px;
            background: var(--primary-soft);
            color: #b7f4cc;
            border: 1px solid rgba(34, 197, 94, 0.2);
            box-shadow: var(--panel-glow);
            opacity: 1;
            transform: translateY(0);
            transition: opacity 3s ease, transform 3s ease;
        }

        .toast.warn { background: rgba(245, 158, 11, 0.15); color: #b45309; }
        .toast.error { background: rgba(239, 68, 68, 0.15); color: #b91c1c; }

        .toast-hide {
            opacity: 0;
            transform: translateY(-10px);
            pointer-events: none;
        }

        .pill {
            display: inline-flex;
            align-items: center;
            padding: 4px 10px;
            border-radius: 999px;
            font-size: 12px;
            font-weight: 600;
            background: rgba(34, 197, 94, 0.12);
            color: #15803d;
        }

        .pill.warn { background: rgba(245, 158, 11, 0.15); color: #b45309; }
        .pill.rejected { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
        .pill.pending { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
        .pill.active { background: rgba(34, 197, 94, 0.18); color: #86efac; }
        .pill.suspended { background: rgba(148, 163, 184, 0.18); color: #cbd5e1; }

        .clickable {
            cursor: pointer;
        }
        .pill.muted { background: rgba(148, 163, 184, 0.2); color: var(--muted); }

        .table {
            width: 100%;
            border-collapse: collapse;
            font-size: 13px;
        }

        .table th, .table td {
            border-bottom: 1px solid var(--border);
            padding: 10px 8px;
            text-align: left;
        }

        .table tbody tr:hover {
            background: rgba(34, 197, 94, 0.06);
        }

        .search-wrap {
            position: relative;
        }

        .suggestions {
            position: absolute;
            top: calc(100% + 6px);
            left: 0;
            right: 0;
            border: 1px solid var(--border);
            border-radius: 12px;
            background: rgba(8, 12, 16, 0.8);
            padding: 6px;
            max-height: min(260px, 40vh);
            overflow-y: auto;
            z-index: 20;
        }

        .suggestion-row {
            width: 100%;
            padding: 8px 10px;
            border-radius: 10px;
            text-align: left;
            background: transparent;
            color: var(--text);
            border: none;
            display: flex;
            align-items: center;
        }

        .suggestion-row:hover {
            background: rgba(34, 197, 94, 0.08);
        }

        .manage-enter {
            animation: manageEnter 0.18s ease-out;
        }

        @keyframes manageEnter {
            from { transform: translateY(6px); opacity: 0.6; }
            to { transform: translateY(0); opacity: 1; }
        }

        .modal-backdrop {
            position: fixed;
            inset: 0;
            background: rgba(3, 6, 9, 0.72);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 50;
        }

        .modal {
            width: min(520px, 92vw);
            background: var(--panel);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 16px;
            box-shadow: var(--panel-glow);
        }

        .modal.hidden {
            display: none;
        }

        .hidden { display: none; }

        .unit-field {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .unit-field span { font-weight: 600; color: var(--muted); }

        body[data-view="auth"] .sidebar,
        body[data-view="auth"] .topbar {
            display: none;
        }

        body[data-view="auth"] .app {
            grid-template-columns: 1fr;
        }

        body[data-view="auth"] .content {
            min-height: 100vh;
            place-items: center;
        }

        .auth-panel {
            max-width: 420px;
            width: 100%;
        }

        .balance-card {
            padding: 16px;
            border: 1px solid var(--border);
            border-radius: 12px;
        }

        .balance-card h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
        .balance-card strong { font-size: 20px; }

        @media (max-width: 900px) {
            .app { grid-template-columns: 1fr; }
            .sidebar { display: none; }
            .grid-2, .grid-3 { grid-template-columns: 1fr; }
            .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
            .topbar h1 { font-size: 20px; }
            .topbar .actions { width: 100%; justify-content: space-between; }
            .actions { flex-wrap: wrap; }
            .panel { padding: 14px; }
            .table { display: block; width: 100%; overflow-x: auto; }
            .table th, .table td { white-space: nowrap; }
            .modal { width: min(520px, 94vw); }
            .mobile-nav { display: flex; }
            .sidebar-toggle { display: none; }
        }
    </style>
