:root {
    /* Premium Dark Theme Variables */
    --bg-base: #0f172a; /* Slate 900 */
    --bg-surface: #1e293b; /* Slate 800 */
    --bg-surface-hover: #334155; /* Slate 700 */
    
    --text-primary: #f8fafc; /* Slate 50 */
    --text-secondary: #94a3b8; /* Slate 400 */
    --text-muted: #64748b; /* Slate 500 */
    
    --accent-primary: #3b82f6; /* Blue 500 */
    --accent-primary-hover: #2563eb; /* Blue 600 */
    --accent-glow: rgba(59, 130, 246, 0.4);
    
    --border-color: #334155;
    
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    
    --transition-speed: 0.3s;
    --border-radius: 12px;
}
ㅗ
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow: hidden; /* App feels native */
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

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

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

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

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: opacity 0.2s;
}

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

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    transition: color 0.2s;
}

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

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-item i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar.collapsed .nav-item span {
    display: none;
}

.nav-item:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
    position: relative;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background-color: var(--accent-primary);
    border-radius: 0 4px 4px 0;
}

/* User Profile */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .user-info {
    display: none;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content Wrapper */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-base);
    overflow: hidden;
}

/* Header */
.top-header {
    height: var(--header-height);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 50;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

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

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.icon-btn:hover {
    color: var(--text-primary);
}

.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--bg-base);
}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, var(--accent-primary), #2563eb);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px var(--accent-glow);
    min-width: 150px;
    white-space: nowrap;
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--accent-glow);
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Dashboard Placeholders */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

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

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-info p {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Auth Layout (Login/Signup) */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100vw;
    background: radial-gradient(circle at center, var(--bg-surface) 0%, var(--bg-base) 100%);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 200;
}

.auth-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 48px 40px;
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    text-align: center;
}

.auth-card .logo-container {
    justify-content: center;
    margin-bottom: 32px;
}

.auth-title {
    font-size: 1.5rem;
    margin-bottom: 24px;
    font-weight: 600;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: left;
}

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

.form-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-control {
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 14px 16px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 14px;
    margin-top: 8px;
    font-size: 1rem;
}

.auth-footer {
    margin-top: 32px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.auth-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-link:hover {
    color: var(--accent-primary-hover);
    text-decoration: underline;
}

/* Slide-over UI */
.slide-over-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.slide-over-overlay.open {
    opacity: 1;
    visibility: visible;
}
.slide-over {
    position: fixed;
    top: 0; right: -450px; bottom: 0;
    width: 450px;
    max-width: 100vw;
    background: var(--bg-card);
    box-shadow: -4px 0 15px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
}
.slide-over.open {
    right: 0;
}
.slide-over-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.slide-over-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}
.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}
.close-btn:hover {
    color: var(--text-primary);
}
.slide-over-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}
.slide-over-footer {
    padding: 24px 32px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-card);
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    border-radius: 0 0 16px 16px;
}

.slide-over-footer .btn, .slide-over-footer .primary-btn {
    min-width: 140px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Groups & Channels UI */
.list-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}
.list-item:last-child {
    border-bottom: none;
}
.list-item-title {
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Dashed Card for UX improvement */
.dashed-card {
    background: transparent !important;
    border: 1px dashed var(--border-color) !important;
    color: var(--text-secondary) !important;
    cursor: pointer;
    justify-content: center !important;
    transition: all 0.2s ease;
}
.dashed-card:hover {
    border-color: var(--accent-primary) !important;
    color: var(--accent-primary) !important;
    background: rgba(59, 130, 246, 0.05) !important;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border-color);
    transition: .3s;
    border-radius: 24px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .toggle-slider {
    background-color: var(--accent-primary);
}
input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Upload Button */
.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    background: var(--bg-base);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}
.upload-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Split Layout for Users View */
.split-layout {
    display: flex;
    gap: 24px;
    height: calc(100vh - 200px);
}
.split-left {
    flex: 2;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}
.split-right {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* User Table */
.user-table-container {
    flex: 1;
    overflow-x: auto;
    overflow-y: auto;
}
.user-table {
    width: 100%;
    border-collapse: collapse;
}
.user-table th {
    text-align: left;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 500;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
}
.user-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}
.user-row {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}
.user-row:hover {
    background: rgba(255, 255, 255, 0.02);
}
.user-row.selected {
    background: rgba(59, 130, 246, 0.08);
}
.user-row.dragging {
    opacity: 0.5;
    background: var(--bg-card);
}

/* Drop Targets (Channels) */
.drop-channel {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--bg-base);
    border: 2px dashed transparent;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.drop-channel.drag-over {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.1);
    transform: scale(1.02);
}

/* Onboarding Wizard */
.wizard-container {
    max-width: 600px;
    margin: 40px auto;
    background-color: var(--bg-surface);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    padding: 48px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.wizard-step-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 0 20px var(--accent-glow);
}

.wizard-title {
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.wizard-desc {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 32px;
}

/* Settings Tab Buttons */
.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 12px 16px;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}
.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}
.tab-btn.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
    font-weight: 500;
}

/* B2B Freemium Features */
/* PRO Badge */
.pro-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(45deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}
body.plan-premium .pro-badge {
    background: linear-gradient(45deg, #10b981, #059669);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

/* Paywall Modal */
.paywall-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.paywall-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.paywall-modal {
    background: var(--bg-card);
    border-radius: 12px;
    width: 400px;
    max-width: 90%;
    padding: 32px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    border: 1px solid rgba(245, 158, 11, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s;
}
.paywall-modal-overlay.active .paywall-modal {
    transform: translateY(0);
}
.paywall-icon {
    font-size: 48px;
    margin-bottom: 16px;
}
.paywall-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 12px;
}
.paywall-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 24px;
}
.paywall-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.paywall-btn-primary {
    background: linear-gradient(45deg, #f59e0b, #d97706);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s;
}
.paywall-btn-primary:hover {
    transform: scale(1.02);
}
.paywall-btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.95rem;
}
.paywall-btn-secondary:hover {
    background: rgba(255,255,255,0.05);
}

/* User Limit Progress Bar */
.user-limit-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}
.user-limit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.user-limit-header strong {
    color: var(--text-primary);
}
.user-limit-bar-bg {
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
}
.user-limit-bar-fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 4px;
    transition: width 0.5s ease;
}
.user-limit-bar-fill.warning {
    background: #f59e0b; /* Orange */
}
.user-limit-bar-fill.danger {
    background: #ef4444; /* Red */
}

/* Pricing Table */
.pricing-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 24px;
}
.pricing-card {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.pricing-card.premium {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.05);
    background: rgba(245, 158, 11, 0.03);
}
.pricing-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}
.pricing-card.premium .pricing-title {
    color: #f59e0b;
}
.pricing-features {
    list-style: none;
    margin-bottom: 24px;
    flex-grow: 1;
}
.pricing-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}
.pricing-features li i {
    color: var(--accent-primary);
}
.pricing-card.premium .pricing-features li i {
    color: #f59e0b;
}
.current-plan-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,0.1);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
}
