/* =====================================================
   Holding Multi-Tenant Application - White Design
   ===================================================== */

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

:root {
    --bg: #f8f9fc;
    --surface: #ffffff;
    --border: #e9edf4;
    --border-light: #f1f3f8;
    --text: #1a1f36;
    --text-secondary: #6b7280;
    --text-muted: #9ca3b5;
    --primary: #4f6cf7;
    --primary-light: #eef2ff;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #3b82f6;
    --info-light: #eff6ff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.05);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.06);
    --sidebar-width: 250px;
    --radius: 10px;
    --radius-sm: 8px;
    --radius-lg: 14px;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

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

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
    position: relative;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 400px at 10% 20%, rgba(79,108,247,0.04) 0%, transparent 100%),
        radial-gradient(ellipse 500px 500px at 90% 80%, rgba(16,185,129,0.03) 0%, transparent 100%);
    pointer-events: none;
}

.login-container {
    display: flex;
    width: 100%;
    max-width: 960px;
    min-height: 520px;
    position: relative;
    z-index: 1;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 20px 60px rgba(0,0,0,0.06);
    background: var(--surface);
}

.login-panel-left {
    width: 380px;
    background: linear-gradient(170deg, #fafbff 0%, #f0f3ff 100%);
    padding: 48px 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.login-panel-left::before {
    content: '';
    position: absolute;
    top: -120px;
    right: -120px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(79,108,247,0.06), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.login-panel-left::after {
    content: '';
    position: absolute;
    bottom: -100px;
    left: -100px;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(16,185,129,0.04), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.login-brand { position: relative; z-index: 1; }

.login-brand .logo {
    width: 72px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-brand .logo img {
    width: 100%;
    height: auto;
    display: block;
}

.login-brand h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
    margin-bottom: 6px;
}

.login-brand .tagline {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    margin-bottom: 24px;
}

.login-features {
    position: relative;
    z-index: 1;
}

.login-features .feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    color: var(--text-secondary);
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    transition: all 0.2s;
}

.login-features .feature-item:last-child { border-bottom: none; }

.login-features .feature-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.login-panel-right {
    flex: 1;
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-card-header { margin-bottom: 28px; }

.login-card-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
    margin-bottom: 4px;
}

.login-card-header .subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.quick-login { margin-bottom: 24px; }

.quick-login-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.quick-login-grid { display: flex; flex-direction: column; gap: 6px; }

.quick-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fafbfc;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: inherit;
    width: 100%;
}

.quick-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    transform: none;
}

.quick-btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
    font-size: 16px;
}

.quick-btn-label { display: flex; flex-direction: column; gap: 1px; }

.quick-btn-label strong { font-size: 12px; font-weight: 600; color: var(--text); }
.quick-btn-label small { font-size: 11px; color: var(--text-muted); }

.quick-btn-retail .quick-btn-icon { background: var(--primary-light); }
.quick-btn-pertashop .quick-btn-icon { background: var(--warning-light); }
.quick-btn-franchise .quick-btn-icon { background: var(--success-light); }

.login-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.login-divider span {
    padding: 0 14px;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-form .form-group { margin-bottom: 16px; }

.login-form .form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-form .input-wrapper { position: relative; }

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

.login-form .form-control {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: #fafbfc;
    transition: all 0.2s;
    font-family: inherit;
}

.login-form .form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(79,108,247,0.08);
}

.login-form .input-wrapper:focus-within .input-icon { color: var(--primary); }

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
    color: var(--text-muted);
}

.password-toggle:hover { background: var(--border-light); }

.btn-login {
    width: 100%;
    padding: 11px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 4px;
    font-family: inherit;
}

.btn-login:hover {
    background: #3b56d4;
    box-shadow: 0 4px 16px rgba(79,108,247,0.25);
}

.login-form .alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 500;
}

.login-form .alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
}

@media (max-width: 800px) {
    .login-panel-left { display: none; }
    .login-panel-right { padding: 36px 28px; }
    .login-container { max-width: 420px; }
}

@media (max-width: 480px) {
    .login-wrapper { padding: 0; }
    .login-container { border-radius: 0; min-height: 100vh; box-shadow: none; }
    .login-panel-right { padding: 28px 20px; }
}

/* =====================================================
   LAYOUT
   ===================================================== */
.app-layout { display: flex; min-height: 100vh; }

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    color: var(--text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    transition: transform 0.3s;
    box-shadow: 1px 0 3px rgba(0,0,0,0.02);
}

.sidebar-header {
    padding: 28px 20px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header .logo {
    width: 42px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header .logo img {
    width: 100%;
    height: auto;
    display: block;
}

.sidebar-header .brand-text { flex: 1; }

.sidebar-header .brand-text h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
    line-height: 1.3;
}

.sidebar-header .brand-text span {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.nav-section { margin-bottom: 20px; }

.nav-section-title {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    margin-bottom: 1px;
}

.nav-item:hover {
    background: var(--border-light);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

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

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.sidebar-user:hover { background: var(--border-light); }

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-info .name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .role { font-size: 10px; color: var(--text-muted); }

/* =====================================================
   MAIN AREA
   ===================================================== */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--surface);
    padding: 14px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.topbar-title h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.topbar-title p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.usaha-switcher { position: relative; }

.usaha-switcher select {
    appearance: none;
    -webkit-appearance: none;
    padding: 7px 32px 7px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: #fafbfc;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.usaha-switcher select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
}

.usaha-switcher::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--text-muted);
    pointer-events: none;
}

.content-area {
    flex: 1;
    padding: 28px 32px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* =====================================================
   STAT CARDS
   ===================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #dce1ea;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.amber { background: var(--warning-light); color: var(--warning); }
.stat-icon.purple { background: #f5f0ff; color: #7c6ff0; }

.stat-body { flex: 1; }

.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* =====================================================
   PANELS
   ===================================================== */
.panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 22px;
    overflow: hidden;
}

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

.panel-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.panel-body { padding: 22px; }

/* =====================================================
   TABLES
   ===================================================== */
.table-wrap { overflow-x: auto; }

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

.table thead th {
    padding: 10px 16px;
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    background: #fafbfc;
    border-bottom: 1.5px solid var(--border);
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    vertical-align: middle;
}

.table tbody tr:hover { background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: none; }

.table tfoot td {
    padding: 12px 16px;
    background: #fafbfc;
    font-weight: 600;
    color: var(--text);
    border-top: 1.5px solid var(--border);
}

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }

/* =====================================================
   BADGES
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

.badge-retail { background: var(--primary-light); color: var(--primary); }
.badge-pertashop { background: var(--warning-light); color: #b7791f; }
.badge-franchise { background: var(--success-light); color: var(--success); }
.badge-penjualan { background: var(--primary-light); color: var(--primary); }
.badge-pembelian { background: var(--danger-light); color: var(--danger); }
.badge-superadmin { background: #f5f0ff; color: #7c6ff0; }
.badge-admin { background: var(--success-light); color: var(--success); }
.badge-operator { background: var(--border-light); color: var(--text-secondary); }

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    font-family: inherit;
}

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

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

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

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

.btn-ghost {
    background: var(--border-light);
    color: var(--text-secondary);
}
.btn-ghost:hover { background: #e5e9f0; }

.btn-sm { padding: 5px 12px; font-size: 11px; border-radius: 6px; }
.btn-lg { padding: 12px 24px; font-size: 14px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; justify-content: center; }

/* =====================================================
   FORMS
   ===================================================== */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text);
    background: #fafbfc;
    transition: all 0.2s;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(79,108,247,0.08);
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='%239ca3b5'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
}

textarea.form-control { resize: vertical; min-height: 70px; }

.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }

.col-2 { flex: 0 0 calc(16.666% - 12px); }
.col-3 { flex: 0 0 calc(25% - 11px); }
.col-4 { flex: 0 0 calc(33.333% - 10px); }

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

/* =====================================================
   ALERTS
   ===================================================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #d1fae5; }
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #b7791f; border: 1px solid #fde68a; }
.alert-info { background: var(--info-light); color: var(--info); border: 1px solid #bfdbfe; }

/* =====================================================
   FILTER BAR
   ===================================================== */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    padding: 18px;
    background: #fafbfc;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    flex-wrap: wrap;
    border: 1px solid var(--border);
}

.filter-bar .form-group { margin-bottom: 0; }
.filter-bar label { font-size: 11px; }

/* =====================================================
   EMPTY STATE
   ===================================================== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 40px; margin-bottom: 14px; }
.empty-state h4 { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.empty-state p { font-size: 13px; }

/* =====================================================
   FOOTER
   ===================================================== */
.footer {
    text-align: center;
    padding: 18px;
    color: var(--text-muted);
    font-size: 11px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-area { margin-left: 0; }
    .content-area { padding: 20px; }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .col-2, .col-3, .col-4 { flex: 1 1 100%; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .topbar { padding: 10px 16px; }
    .content-area { padding: 16px; }
}

/* =====================================================
   ANIMATIONS
   ===================================================== */
.stat-card, .panel { animation: fadeInUp 0.4s ease-out; }
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

/* =====================================================
   SCROLLBAR
   ===================================================== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #dce1ea; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #b0b7c6; }