:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #4338ca;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --success: #16a34a;
    --success-hover: #15803d;
    --danger: #dc2626;
    --warning: #f59e0b;
    --neutral-dark: #1e1b4b;
    --neutral-gray: #64748b;
    --neutral-light: #f8fafc;
    --border: #e2e8f0;
    --card-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.08), 0 8px 20px -6px rgba(0, 0, 0, 0.05);
    --card-shadow-hover: 0 20px 40px -5px rgba(0, 0, 0, 0.12), 0 10px 24px -6px rgba(0, 0, 0, 0.08);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f0f4ff 0%, #f8fafc 100%);
    color: #1e293b;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    min-height: 100vh;
    padding: 0;
}

/* === PORTAL HEADER === */
.portal-header {
    width: 100%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    padding: 14px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.portal-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.portal-header-left img {
    height: 40px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
}

.portal-header-left span {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.portal-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
}

.user-tag {
    font-weight: 600;
    color: var(--neutral-dark);
    background: #eef2ff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
}

.company-tag {
    color: var(--neutral-gray);
    font-size: 0.8rem;
    background: #f1f5f9;
    padding: 6px 14px;
    border-radius: 20px;
}

/* === MAIN CONTENT === */
.main-content {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 40px 20px;
}

/* === FOOTER === */
.portal-footer {
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    padding: 20px 32px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--neutral-gray);
}

.footer-links {
    margin-top: 8px;
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

.footer-links a, .footer-links span {
    text-decoration: none;
    color: #475569;
    font-weight: 500;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary);
}

/* === CARDS === */
.portal-card {
    background: #ffffff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    width: 100%;
    max-width: 480px;
    padding: 36px 32px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.portal-card:hover {
    box-shadow: var(--card-shadow-hover);
}

.portal-card.history-container {
    max-width: 820px;
    padding: 32px;
}

.portal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--primary-gradient);
}

/* === LOGIN SPECIFIC === */
.portal-card .logo-container {
    text-align: center;
    margin-bottom: 32px;
}

.portal-card .logo-container img {
    height: 56px;
    width: auto;
    margin-bottom: 16px;
}

.portal-card .logo-container h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    color: var(--neutral-dark);
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.portal-card .logo-container p {
    font-size: 0.95rem;
    color: var(--neutral-gray);
}

/* === FORM ELEMENTS === */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
    letter-spacing: 0.01em;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
    outline: none;
    background: #ffffff;
    color: #1e293b;
}

.form-control:hover {
    border-color: #c7d2fe;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.form-control::placeholder {
    color: #94a3b8;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.01em;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 2px solid transparent;
}

.btn-secondary:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.4);
}

/* === ALERTS === */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-danger {
    background-color: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
}

.alert-danger::before {
    content: '⚠️';
    font-size: 1.1rem;
}

.alert-success {
    background-color: #f0fdf4;
    color: var(--success);
    border: 1px solid #bbf7d0;
}

.alert-success::before {
    content: '✅';
    font-size: 1.1rem;
}

/* === DASHBOARD === */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
}

.welcome-msg {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--neutral-dark);
}

.welcome-msg small {
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--neutral-gray);
    display: block;
    margin-top: 2px;
}

.logout-link {
    font-size: 0.85rem;
    color: var(--danger);
    text-decoration: none;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 20px;
    border: 2px solid #fecaca;
    transition: var(--transition);
}

.logout-link:hover {
    background: #fef2f2;
    border-color: var(--danger);
}

.bundle-badge {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border: 1px solid #c7d2fe;
    color: var(--primary-dark);
    border-radius: 9999px;
    padding: 6px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 16px;
}

.bundle-badge strong {
    color: var(--neutral-dark);
}

/* === ACTION CARDS GRID === */
.actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 24px;
}

.action-card {
    background: var(--neutral-light);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.action-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--primary-gradient);
    transition: var(--transition);
}

.action-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

.action-card:hover::after {
    width: 80%;
}

.action-card:active {
    transform: translateY(-2px);
}

.action-card.grid-span-2 {
    grid-column: span 2;
}

.action-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.action-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--neutral-dark);
}

.action-subtitle {
    font-size: 0.8rem;
    color: var(--neutral-gray);
}

/* === MODALS === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-content {
    background: #ffffff;
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 440px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.3s ease;
    position: relative;
}

.modal-content .modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--neutral-gray);
    transition: var(--transition);
    padding: 4px 8px;
    border-radius: 8px;
}

.modal-content .modal-close:hover {
    background: #f1f5f9;
    color: var(--neutral-dark);
}

.modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--neutral-dark);
    margin-bottom: 8px;
}

.modal-subtitle {
    font-size: 0.95rem;
    color: var(--neutral-gray);
    margin-bottom: 20px;
}

.modal-body {
    font-size: 0.95rem;
    color: #475569;
    margin-bottom: 24px;
    line-height: 1.7;
}

.modal-body strong {
    color: var(--neutral-dark);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-buttons .btn {
    flex: 1;
}

/* === QR DISPLAY === */
.qr-card {
    text-align: center;
}

.qr-wrapper {
    margin: 20px 0;
    padding: 16px;
    background: #ffffff;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    display: inline-block;
    transition: var(--transition);
}

.qr-wrapper:hover {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08);
}

.qr-wrapper img {
    width: 100%;
    max-width: 220px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.qr-instruction {
    font-size: 0.85rem;
    color: var(--neutral-gray);
    margin: 8px 0 16px 0;
    padding: 10px 16px;
    background: #f0f7ff;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
    text-align: left;
}

.iccid-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 16px 0 20px 0;
}

.iccid-value {
    font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
    font-size: 0.85rem;
    color: #166534;
    font-weight: 600;
    word-break: break-all;
    letter-spacing: 0.5px;
}

.copy-btn {
    background: var(--success);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}

.copy-btn:hover {
    background: var(--success-hover);
    transform: scale(1.05);
}

.copy-btn:active {
    transform: scale(0.95);
}

/* === HISTORY TABLE === */
.history-table-wrapper {
    overflow-x: auto;
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #ffffff;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

thead {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

th {
    padding: 14px 16px;
    font-weight: 600;
    color: #475569;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #fafbff;
}

/* === BADGES === */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-reserved {
    background: #fef3c7;
    color: #d97706;
}

.badge-activated {
    background: #dcfce7;
    color: #15803d;
}

.badge-consumed {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-valid {
    background: #f1f5f9;
    color: #475569;
}

/* === ACTION BUTTON IN TABLE === */
.action-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.action-btn:active {
    transform: translateY(0);
}

/* === RESPONSIVE === */
@media (max-width: 640px) {
    .portal-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .portal-header-left span {
        font-size: 1.1rem;
    }

    .portal-header-right {
        flex-wrap: wrap;
        gap: 8px;
    }

    .user-tag, .company-tag {
        font-size: 0.7rem;
        padding: 4px 10px;
    }

    .portal-card {
        padding: 24px 16px;
        border-radius: var(--radius-sm);
    }

    .portal-card.history-container {
        padding: 20px 12px;
    }

    .actions-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .action-card.grid-span-2 {
        grid-column: span 1;
    }

    .modal-content {
        padding: 24px 16px;
        margin: 10px;
    }

    .modal-buttons {
        flex-direction: column;
    }

    .modal-buttons .btn {
        width: 100%;
    }

    .footer-links {
        flex-direction: column;
        gap: 8px;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .welcome-msg {
        font-size: 1rem;
    }

    .history-table-wrapper {
        font-size: 0.75rem;
    }

    th, td {
        padding: 10px 12px;
    }

    .qr-wrapper img {
        max-width: 180px;
    }

    .iccid-box {
        flex-direction: column;
        text-align: center;
    }

    .copy-btn {
        width: 100%;
        justify-content: center;
    }
}

/* === UTILITY CLASSES === */
.text-center { text-align: center; }
.text-muted { color: var(--neutral-gray); }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }
.gap-2 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }