/* ================= BASE ================= */
:root {

    /* BACKGROUND */
    --bg: #f5f5f5;
    --panel: #ffffff;
    --sidebar: #111111;
    --topbar: #ff8800;

    /* TEXT */
    --text: #222222;
    --text-light: #ffffff;
    --text-muted: #999999;
    --text-muted: #999999;
    --muted: #9aa8bc;
    --soft: #cbd5e1;
    --green: #22c55e;
    --blue: #3b82f6;
    --red: #ef4444;
    --amber: #f59e0b;

    /* BORDER */
    --border: #e5e5e5;

    /* BRAND */
    --primary: #ff8800;
    --primary-hover: #e67600;

    /* CARD */
    --card-blue: #2563eb;
    --card-green: #16a34a;
    --card-red: #dc2626;
    --card-orange: #ea580c;
    --card-purple: #9333ea;

    /* STATUS */
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;

    /* SHADOW */
    --shadow:
        0 4px 12px rgba(0,0,0,.08);

    /* RADIUS */
    --radius: 14px;
}
* {
    box-sizing: border-box;
}

html {
    min-width: 0;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-width: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

body.modal-open {
    overflow: hidden;
}

a {
    color: var(--green);
    text-decoration: none;
}

a:hover {
    opacity: .86;
}

img,
video,
canvas {
    max-width: 100%;
}

hr {
    border: 0;
    border-top: 1px solid var(--text-muted);
}

/* ================= LAYOUT ================= */
.wrapper {
    display: flex;
    min-height: 100vh;
    min-width: 0;
}

.mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-height: 42px;
    border: 0;
    border-right: 1px solid rgba(255, 255, 255, .18);
    background: transparent;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

.main {
    flex: 1;
    min-width: 0;
    
}

.container {
    width: 100%;
    min-width: 0;
    padding: 24px;
}

.header {
    margin: 10px 0 22px;
}

.header h2 {
    margin: 0;
    font-size: 25px;
    line-height: 1.25;
}

/* ================= SIDEBAR ================= */
.sidebar {
    width: 240px;
    flex: 0 0 240px;
    background: var(--sidebar);
    padding: 18px 14px;
    border-right: 1px solid var(--border);
}

.sidebar.is-collapsed {
    width: 0;
    flex-basis: 0;
    padding: 0;
    overflow: hidden;
    border-right: 0;
}

.sidebar h2 {
    margin: 0 8px 24px;
    color: var(--green);
    font-size: 20px;
}

.sidebar a,
.menu-parent {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 9px 10px;
    margin-bottom: 6px;
    color: var(--text-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

.sidebar a:hover,
.menu-parent:hover,
.sidebar a.active {
    background: var(--panel-3);
    color: #fff;
}

.sidebar i,
.menu-parent i,
.submenu i {
    width: 20px;
    text-align: center;
}

.menu-parent {
    justify-content: space-between;
    font-weight: 700;
}

.menu-parent div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.submenu {
    display: none;
    padding-left: 18px;
    margin: 3px 0 8px;
}

.submenu.active,
.menu-group.active .submenu {
    display: block;
}

.submenu a {
    font-size: 14px;
    margin-bottom: 3px;
}

.arrow {
    transition: transform .2s ease;
}

.menu-group.active .arrow {
    transform: rotate(180deg);
}

/* ================= TOPBAR ================= */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--topbar);
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
}

.topbar-left,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0px;
}

.topbar-brand {
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
}

.topbar-user {
    position: relative;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
    padding: 8px 10px;
    border-radius: 10px;
}

.user-dropdown-btn:hover {
    background: rgba(255,255,255,.08);
}

.user-name small {
    opacity: .75;
    font-weight: 600;
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    display: none;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px;
    z-index: 999;
    box-shadow: 0 12px 30px rgba(0,0,0,.25);
}

.user-dropdown-menu.show {
    display: block;
}

.user-dropdown-menu a,
.dropdown-item-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
}

.user-dropdown-menu a:hover,
.dropdown-item-btn:hover {
    background: rgba(255,255,255,.08);
}

.dropdown-status {
    padding: 10px 12px;
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}
.global-alert {
    width: 100%;
}

/* ================= CARD ================= */
.grid,
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.card {
    min-width: 0;
    background: var(--panel);
    padding: 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow-x: auto;
    gap: 14px;
}

.card h3 {
    margin: 0 0 12px;
    color: var(--text);
    font-size: 18px;
    text-align:center;
}

.card p {
    margin: 7px 0;
    text-align:center;
}

.card-blue{
    background: var(--card-blue);
    color: white;
}

.card-green{
    background: var(--card-green);
    color: white;
}

.card-red{
    background: var(--card-red);
    color: white;
}

.card-orange{
    background: var(--card-orange);
    color: white;
}
.card-purple{
    background: var(--card-purple);
    color: white;
}
/* ================= TABLE ================= */
.table-wrapper{
    width: 100%;
    overflow-x: auto;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(0,0,0,.06);
}

table {
    width: 100%;
    
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 14px;
}
table thead{
    background: #111111;
}

table thead th{
    padding: 16px 14px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    text-align: left;
    border-bottom: 4px solid #ff8800;
    white-space: nowrap;
}

/* BODY */
table tbody td{
    padding: 15px 14px;
    border-bottom: 1px solid #ececec;
    color: #333;
    font-size: 14px;
    vertical-align: middle;
}

/* ZEBRA */
table tbody tr:nth-child(even){
    background: #fff8f1;
}

/* HOVER */
table tbody tr:hover{
    background: #ffe7cc;
    transition: .2s;
}

/* FIRST COLUMN */
table tbody td:first-child{
    font-weight: 700;
    color: #111;
}

/* PRICE */
.td-price{
    font-weight: 800;
    color: #ff8800;
}

/* STATUS */
.badge-online{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 12px;
    font-weight: 700;
}


table th,
table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table th {
    color: var(--text);
    text-align: left;
    font-weight: 700;
    white-space: nowrap;
}

table td {
    color: var(--text);
}

table tr:hover {
    background: rgba(30, 41, 59, .26);
}

td a,
td button,
.btn,
.btn-add,
.btn-copy,
.btn-save,
.btn-filter,
.btn-generate,
.btnTopup,
.btnApprove,
.btnApproveBonus,
.btn-view {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 12px;
    border: 0;
    border-radius: var(--radius);
    color: var(--text);
    background: var(--blue);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

td a,
.btn-view {
    background: var(--red);
}

.btn,
.btn-save,
.btn-success {
    background: #ff8800;
}

.btn-primary,
.btn-info,
.btn-generate,
.btn-filter {
    background: var(--primary);
    color: white;
}

.btn-add {
    background: linear-gradient(135deg, #06b6d4, #2563eb);
}

.btn-warning {
    background: var(--amber);
    color: #111827;
}

.btn-danger {
    background: var(--red);
}

button:disabled,
.button:disabled,
.disabled-link {
    opacity: .55;
    pointer-events: none;
    cursor: not-allowed;
}

.disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn-topup {
    min-height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
/* ================= TABLE ACTION ================= */

.table-actions{
    /* = display: flex; = */
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.table-btn{
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: .2s ease;
    font-size: 12px;
    color: #fff;
}

/* PRIMARY */
.table-btn.primary{
    background: #3b82f6;
}

.table-btn.primary:hover{
    background: #2563eb;
    transform: translateY(-2px);
}

/* WARNING */
.table-btn.warning{
    background: #ff8800;
}

.table-btn.warning:hover{
    background: #ea580c;
    transform: translateY(-2px);
}

/* SUCCESS */
.table-btn.success{
    background: #22c55e;
}

.table-btn.success:hover{
    background: #16a34a;
}

/* DANGER */
.table-btn.danger{
    background: #ef4444;
}

.table-btn.danger:hover{
    background: #dc2626;
}
/* ================= FORMS & FILTERS ================= */
input,
select,
textarea {
    max-width: 100%;
    font: inherit;
}

.filter-wrapper,
.filter-box {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-wrapper input,
.filter-wrapper select,
.filter-box input,
.filter-box select,
.form-group input,
.form-group select,
.form-group textarea,
.form-box input,
.form-box textarea {
    min-height: 40px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    outline: none;
}

.filter-wrapper input,
.filter-wrapper select,
.filter-box input,
.filter-box select {
    min-width: 170px;
}

.form-group {
    margin-bottom: 14px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
}

textarea,
.form-group textarea {
    min-height: 78px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, .18);
}

.form-grid,
.grid-form,
.form-grid-2,
.form-grid-3 {
    display: grid;
    gap: 12px;
}

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

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

.form-full,
.form-group.full,
.form-grid textarea,
.form-grid button {
    grid-column: 1 / -1;
}

.form-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ================= MODAL ================= */
.modal {
    display: none;
    position: fixed;
    z-index: 999;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 16px;
    overflow-y: auto;
    background: rgba(0, 0, 0, .72);
    backdrop-filter: blur(5px);
}

.modal.show {
    display: block;
}

.modal-content {
    width: min(520px, 100%);
    margin: 7vh auto;
    padding: 22px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    box-shadow: var(--shadow);
    animation: fadeIn .22s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 18px;
}

.modal-header h3 {
    margin: 0;
}

.close {
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

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

/* ================= STATUS & UTILITIES ================= */
.badge,
.status,
.alert,
.badgestatus {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 12px;
}

.badge.success,
.alert.success {
    background: #16a34a;
    color: #fff;
}

.badge.warning,
.alert.warning {
    background: var(--amber);
    color: #111827;
}

.badge.danger,
.alert.error {
    background: var(--red);
    color: #fff;
}

.status.pending {
    color: var(--amber);
}

.status.active {
    color: var(--green);
}

.status.reject {
    color: var(--red);
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 16px;
}

.pagination a,
.pagination span {
    min-width: 34px;
    padding: 8px 10px;
    border-radius: var(--radius);
    background: var(--panel-3);
    color: var(--soft);
    text-align: center;
}

.pagination a.active {
    background: var(--green);
    color: #06240f;
    font-weight: 700;
}

.invoice-actions,
.doc-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

.request-box {
    min-width: 180px;
}

.paket-box {
    padding: 12px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .05);
    color: var(--soft);
    font-size: 14px;
}

.btn-copy {
    margin-top: 10px;
}

.btn-doc {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: #ffc107;
    color: #111827;
    font-weight: 700;
}

.alert-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 12px 14px;
    border: 1px solid rgba(245, 158, 11, .45);
    border-radius: var(--radius);
}

.alert-box .actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.teknisi-modal {
    width: min(720px, 100%);
}

.mode-box {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.mode-item {
    flex: 1;
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel-3);
    text-align: center;
    font-weight: 700;
    cursor: pointer;
}

.mode-item input {
    display: none;
}

.mode-item:has(input:checked) {
    background: #ff8800;
    color: #fff;
}

.script-row {
    display: none;
    background: var(--bg);
}

.script-box {
    padding: 1px;
}

.script-box textarea {
    width: 100%;
    min-height: 120px;
    background: var(--panel);
    color: var(--green);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    font-family: monospace;
    font-size: 12px;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    padding: 10px 15px;
    border-radius: var(--radius);
    background: #111827;
    color: #fff;
    opacity: 0;
    transition: opacity .2s ease;
}

.toast.show {
    opacity: 1;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 999px;
}

.mobile-action-wrapper {
        position: relative;
        display: block;
        margin-bottom: 0;
    }

    .mobile-action-btn {
        min-height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        border: 0;
        border-radius: 6px;
        background: transparent;
        color: white;
        font-weight: 800;
        cursor: pointer;
    }

    .mobile-action-menu {
        display: none;
        position: absolute;
        
        left: 10px;
        
        z-index: 50;
        padding: 8px;
        background: var(--panel);
        border: 1px solid var(--border);
        border-radius: 14px;
        box-shadow: var(--shadow);
    }

    .mobile-action-menu.show {
        display: grid;
        gap: 6px;
    }

    .mobile-action-menu button {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: var(--text);
        font-weight: 700;
        cursor: pointer;
        text-align: left;
    }

    .mobile-action-menu button:hover {
        background: rgba(255,255,255,.08);
    }
    
    .mobile-search-modal {
    max-width: 620px;
    padding: 0;
    background: #fff;
    color: #333;
}

.mobile-search-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px;
    border-bottom: 1px solid #e5e7eb;
}

.mobile-search-modal .modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.mobile-search-modal .close {
    font-size: 26px;
    cursor: pointer;
    color: #aaa;
}

.modal-filter-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 24px 22px 18px;
}

.modal-filter-form input,
.modal-filter-form select {
    width: 100%;
    height: 48px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #333;
    border-radius: 10px;
    padding: 0 14px;
    font-size: 15px;
}

.modal-filter-form input:focus,
.modal-filter-form select:focus {
    border-color: #3b82f6;
    outline: none;
}

.modal-filter-actions {
    border-top: 1px solid #e5e7eb;
    padding-top: 18px;
}

.modal-filter-actions .btn-generate {
    width: auto;
    min-width: 160px;
    height: 42px;
    border-radius: 0;
    background: #3393c7;
    color: #fff;
}
/* ================= MOBILE ================= */
@media (max-width: 900px) {
    .mobile-hide {
        display: none !important;
        }
    
        .mobile-only {
            display: table-cell !important;
        }
    .mobile-only {
        display: none;
    }
    .container {
        padding: 10px;
    }
    
    .topbar {
        min-height: 62px;
        padding: 10px 14px;
    }

    .mobile-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border: 0;
        background: transparent;
        color: var(--text);
        font-size: 22px;
        cursor: pointer;
    }

    .topbar-brand {
        font-size: 16px;
    }

    .user-dropdown-btn {
        max-width: 170px;
        padding: 8px;
    }

    .user-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .user-name small {
        display: none;
    }

    .user-dropdown-menu {
        position: fixed;
        top: 66px;
        right: 25px;
        
        width: 60%;
    }

    .sidebar {
        display: none;
        position: fixed;
        top: 62px;
        left: 0;
        right: 0;
        z-index: 90;
        width: 60%;
        max-height: calc(100vh - 62px);
        overflow-y: auto;
        background: var(--sidebar);
        border-bottom: 1px solid var(--border);
        padding: 12px;
    }

    .sidebar.is-open {
        display: block;
    }


    .header h2 {
        font-size: 22px;
    }

    .cards,
    .grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .card {
        padding: 14px;
        border-radius: 10px;
    }

    .filter-wrapper,
    .filter-box {
        display: grid;
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .filter-wrapper input,
    .filter-wrapper select,
    .filter-wrapper button,
    .filter-box input,
    .filter-box select,
    .filter-box button {
        width: 50%;
        min-width: 0;
    }

    table {
        
        font-size: 13px;
    }

    table th,
    table td {
        padding: 10px;
    }

    .form-grid,
    .grid-form,
    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr;
    }

    .modal {
        padding: 10px;
    }

    .modal-content {
        margin: 5vh auto;
        padding: 18px;
    }

    .invoice-actions,
    .doc-actions,
    .alert-box,
    .mode-box {
        display: grid;
        
    }
    .invoice-actions > *,
    .doc-actions > *,
    .alert-box > *,
    .mode-box > * {
        width: 100%;
    }
    
    .table-actions{
        gap: 6px;
    }

    .table-btn{
        width: 34px;
        height: 34px;
        border-radius: 10px;
        font-size: 14px;
    }
}

@media (max-width: 520px) {
    container {
        padding: 10px;
    }
    body {
        font-size: 14px;
    }

    

    .card {
        padding: 12px;
    }

    .topbar-right {
        flex-basis: auto;
        font-size: 13px;
    }

    .pagination {
        justify-content: center;
    }

    td a,
    td button,
    .btn,
    .btn-add,
    .btn-save,
    .btn-filter,
    .btn-generate {
        min-height: 34px;
        padding: 8px 10px;
        font-size: 13px;
    }
}
