:root {
    --sidebar-width: 260px;
    --primary-color: #0d6efd;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f4f6f9;
}

/* Auth layout */
.auth-wrapper {
    --auth-navy: #0c2340;
    --auth-teal: #0d9488;
    --auth-sky: #38bdf8;
    --auth-gold: #d97706;
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem 4rem;
    overflow-x: hidden;
    background: linear-gradient(145deg, #071525 0%, var(--auth-navy) 35%, #0f4c5c 70%, #115e59 100%);
}

.auth-backdrop {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.auth-backdrop-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 70% at 30% 40%, #000 20%, transparent 75%);
}

.auth-backdrop-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.auth-backdrop-glow--1 {
    width: 420px;
    height: 420px;
    background: var(--auth-sky);
    top: -8%;
    left: -5%;
}

.auth-backdrop-glow--2 {
    width: 360px;
    height: 360px;
    background: var(--auth-teal);
    bottom: -10%;
    right: 10%;
}

.auth-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1180px;
}

.auth-layout {
    display: grid;
    grid-template-columns: minmax(240px, 0.82fr) minmax(0, 2.18fr);
    gap: 1.5rem;
    align-items: stretch;
}

/* Hero wording on backdrop */
.auth-hero {
    color: #fff;
    padding: 0.5rem 0.5rem 0.5rem 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-hero-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1.5rem;
    padding: 0.4rem 0.85rem 0.4rem 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 2rem;
    backdrop-filter: blur(8px);
}

.auth-hero-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--auth-sky), var(--auth-teal));
    border-radius: 0.65rem;
    font-size: 1.1rem;
}

.auth-hero-label {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
}

.auth-hero-title {
    font-size: clamp(1.65rem, 3.5vw, 2.15rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.auth-hero-lead {
    font-size: 0.95rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.78);
    margin-bottom: 1.75rem;
    max-width: 38ch;
}

.auth-hero-stats {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.auth-hero-stats li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.88);
}

.auth-hero-stats li i {
    color: var(--auth-sky);
    font-size: 1rem;
}

/* Cards sebaris: Login | Pelan | Kelebihan */
.auth-cards {
    display: grid;
    grid-template-columns: 1.1fr 1fr 1fr;
    gap: 0.85rem;
    align-items: stretch;
}

.auth-card {
    background: #fff;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
}

.auth-card--login .auth-card-divider {
    margin-top: auto;
}

.auth-card--plans .plan-tiles {
    flex: 1;
}

.auth-card--features .feature-grid {
    flex: 1;
}

.auth-card--features .auth-card-footer {
    margin-top: auto;
}

.auth-card-head {
    margin-bottom: 1rem;
}

.auth-card-head--compact {
    margin-bottom: 0.85rem;
}

.auth-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.auth-card-sub {
    font-size: 0.78rem;
    color: #64748b;
    margin: 0.15rem 0 0;
}

.auth-card-divider {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.85rem 0;
    color: #94a3b8;
    font-size: 0.72rem;
}

.auth-card-divider::before,
.auth-card-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.auth-card-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    font-size: 0.72rem;
    color: #94a3b8;
    margin-bottom: 0;
    border-top: 1px solid #e2e8f0;
}

.btn-auth-primary {
    background: linear-gradient(135deg, #0c4a6e, #0d9488);
    border: none;
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

.btn-auth-primary:hover,
.btn-auth-primary:focus {
    background: linear-gradient(135deg, #0a3d5c, #0f766e);
    color: #fff;
}

.btn-outline-auth {
    border-color: #cbd5e1;
    color: #475569;
    font-weight: 500;
}

.btn-outline-auth:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #1e293b;
}

.btn-premium {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    border: none;
    color: #fff;
    font-weight: 600;
}

.btn-premium:hover {
    background: linear-gradient(135deg, #b45309, #d97706);
    color: #fff;
}

.text-teal {
    color: var(--auth-teal) !important;
}

/* Plan tiles */
.plan-tiles {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.plan-tile {
    padding: 0.85rem;
    border-radius: 0.65rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
}

.plan-tile--premium {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-color: #fde68a;
}

.plan-tile-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.plan-tile-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.5rem;
    border-radius: 0.3rem;
    background: #0ea5e9;
    color: #fff;
}

.plan-tile-badge--gold {
    background: var(--auth-gold);
}

.plan-tile-price {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
}

.plan-tile-price small {
    font-size: 0.7rem;
    font-weight: 500;
    color: #64748b;
}

.plan-tile-list {
    margin: 0 0 0.65rem;
    padding-left: 1rem;
    font-size: 0.78rem;
    color: #475569;
    flex: 1;
}

.plan-tile-list li {
    margin-bottom: 0.15rem;
}

/* Feature grid */
.feature-grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.feature-grid li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.78rem;
    color: #334155;
    line-height: 1.35;
}

.feature-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.4rem;
    font-size: 0.8rem;
}

.feature-icon--pdf { background: #fee2e2; color: #dc2626; }
.feature-icon--product { background: #dbeafe; color: #2563eb; }
.feature-icon--payment { background: #d1fae5; color: #059669; }
.feature-icon--link { background: #e0f2fe; color: #0284c7; }
.feature-icon--portal { background: #d1fae5; color: #047857; }
.feature-icon--secure { background: #f1f5f9; color: #475569; }

/* Test bar */
.auth-test-bar {
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0.65rem;
    padding: 0.6rem 0.85rem;
    color: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(6px);
}

.auth-test-bar-title {
    font-size: 0.68rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.auth-test-accounts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.auth-test-chip {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 2rem;
    padding: 0.3rem 0.65rem;
    font-size: 0.68rem;
    color: #334155;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.auth-test-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.auth-test-chip .badge {
    font-size: 0.58rem;
    margin-right: 0.2rem;
}

@media (max-width: 1199.98px) {
    .auth-layout {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .auth-hero {
        text-align: center;
        padding: 0;
    }

    .auth-hero-brand {
        margin-left: auto;
        margin-right: auto;
    }

    .auth-hero-lead {
        max-width: none;
        margin-left: auto;
        margin-right: auto;
    }

    .auth-hero-stats {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem 1.25rem;
    }

    .auth-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767.98px) {
    .auth-cards {
        grid-template-columns: 1fr;
    }

    .plan-tiles {
        flex-direction: row;
    }

    .plan-tile {
        flex: 1;
    }

    .feature-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem 0.75rem;
    }
}

@media (max-width: 575.98px) {
    .auth-wrapper {
        padding: 1.5rem 1rem 3.5rem;
    }

    .auth-card {
        padding: 1.25rem;
    }

    .plan-tiles {
        flex-direction: column;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }
}

.plan-card:hover {
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.share-link-group {
    max-width: 420px;
}

.share-link-compact .btn {
    line-height: 1.2;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    border: none;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.auth-card .card-header {
    background: transparent;
    border-bottom: none;
    padding: 2rem 2rem 0.5rem;
    text-align: center;
}

.auth-card .card-body {
    padding: 1.5rem 2rem 2rem;
}

.test-credentials {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 0.5rem;
    padding: 0.75rem;
    font-size: 0.75rem;
}

.test-credentials-title {
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.test-credentials code {
    font-size: 0.7rem;
    color: #334155;
}

.test-account-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.test-account-row:hover {
    background-color: #e2e8f0;
}

.auth-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #0c4a6e, #0d9488);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: #fff;
    font-size: 1.75rem;
    font-weight: 700;
}

/* App layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: #1e293b;
    color: #e2e8f0;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-nav {
    padding: 1rem 0;
    list-style: none;
    margin: 0;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.5rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-nav .nav-link.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    flex-shrink: 0;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-content {
    flex: 1;
    padding: 1.5rem;
}

.role-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.app-footer {
    flex-shrink: 0;
    margin-top: auto;
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: #94a3b8;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.app-footer strong {
    color: #64748b;
}

.app-footer a {
    color: inherit;
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

.auth-wrapper + .app-footer,
.auth-shell + .app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: transparent;
    border-top: none;
    color: rgba(255, 255, 255, 0.85);
}

.auth-wrapper + .app-footer strong {
    color: #fff;
}

.auth-wrapper + .app-footer a:hover {
    color: #fff;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

/* Products module */
.invoice-preview-card {
    position: sticky;
    top: 1rem;
}

.invoice-preview-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.5rem 0.75rem;
}

.invoice-preview-table td {
    font-size: 0.85rem;
    padding: 0.75rem;
    vertical-align: top;
}

#productsTable td {
    font-size: 0.9rem;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    padding: 0.25rem 0.5rem;
}
