/* JJakP2P admin + reseller — minimal dark theme, no external fonts. */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic",
                 "Microsoft YaHei", "Apple SD Gothic Neo", system-ui, sans-serif;
    background: #0b1220;
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.5;
}

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }
.muted  { color: #64748b; }

/* ------- Login ------- */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; flex-direction: column; gap: 12px;
}
.login-box {
    background: #111a2c;
    padding: 36px 32px 28px;
    border-radius: 14px;
    width: 320px;
    border: 1px solid #1e293b;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.login-box h1 {
    margin: 0 0 20px 0; font-size: 20px; text-align: center;
    letter-spacing: 0.4px; color: #f1f5f9;
}
.login-box form { display: flex; flex-direction: column; gap: 12px; }
.login-foot {
    display: flex; justify-content: space-between; align-items: center;
    width: 320px; padding: 0 4px; font-size: 12px; color: #94a3b8;
}
.login-foot a { color: #60a5fa; text-decoration: none; }
.login-foot a:hover { text-decoration: underline; }

/* ------- Inputs ------- */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
    background: #0b1220;
    border: 1px solid #2a3a56;
    color: #e2e8f0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
input::placeholder { color: #64748b; }

button {
    background: #3b82f6; color: #fff; border: none;
    padding: 9px 14px; border-radius: 8px; cursor: pointer;
    font-size: 14px; font-family: inherit; font-weight: 500;
    transition: background .15s, transform .05s;
}
button:hover:not(:disabled) { background: #2563eb; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary { background: #334155; }
button.secondary:hover:not(:disabled) { background: #475569; }
button.danger { background: #dc2626; }
button.danger:hover:not(:disabled) { background: #b91c1c; }

.error {
    color: #fca5a5; font-size: 13px; min-height: 18px; text-align: center;
}

/* ------- Header ------- */
header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px;
    background: #111a2c;
    border-bottom: 1px solid #1e293b;
    position: sticky; top: 0; z-index: 10;
}
header h1 { margin: 0; font-size: 17px; letter-spacing: 0.3px; }
header nav { display: flex; gap: 8px; align-items: center; }

/* ------- Tabs ------- */
.tabs {
    display: flex; gap: 4px;
    padding: 8px 24px 0;
    background: #111a2c;
    border-bottom: 1px solid #1e293b;
}
.tab {
    background: transparent; color: #94a3b8;
    padding: 9px 14px; border-radius: 8px 8px 0 0;
    border-bottom: 2px solid transparent;
    font-weight: 500;
}
.tab:hover:not(.active) { background: #172238; color: #cbd5e1; }
.tab.active {
    background: #0b1220; color: #e2e8f0;
    border-bottom-color: #3b82f6;
}

/* ------- Main ------- */
main {
    padding: 20px 24px;
    max-width: 1500px;
    margin: 0 auto;
}
.tab-panel { display: block; }
.tab-panel.hidden { display: none; }

.toolbar {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    margin-bottom: 14px;
}
.toolbar .spacer { flex: 1; }
.toolbar input[type="text"],
.toolbar select { width: auto; min-width: 180px; }

.summary {
    padding: 0 0 10px 2px;
    color: #94a3b8;
    font-size: 12px;
    min-height: 18px;
}

/* ------- Table ------- */
.table-wrap {
    background: #111a2c;
    border: 1px solid #1e293b;
    border-radius: 10px;
    overflow: hidden;
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid #1e293b;
    font-size: 13px;
    vertical-align: middle;
    white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
th {
    background: #0d1525;
    font-weight: 600; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.6px;
    color: #94a3b8;
}
tbody tr:hover { background: #172238; }
td strong { color: #f1f5f9; }

.col-actions { display: flex; gap: 6px; justify-content: flex-end; }
.col-actions button {
    padding: 5px 10px; font-size: 12px; border-radius: 6px;
}

.badge {
    display: inline-block;
    padding: 3px 10px; border-radius: 999px;
    font-size: 11px; font-weight: 600;
}
.badge.active   { background: rgba(34,197,94,0.15); color: #4ade80; }
.badge.inactive { background: rgba(220,38,38,0.18); color: #fca5a5; }
.expired { color: #f87171; }

.loading, .empty {
    text-align: center; padding: 40px 20px; color: #64748b; font-size: 13px;
}

/* ------- Summary cards (dashboard, reseller overview) ------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.card {
    background: #111a2c;
    border: 1px solid #1e293b;
    border-radius: 10px;
    padding: 16px 18px;
}
.card .label {
    font-size: 11px; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
    margin-bottom: 6px;
}
.card .value {
    font-size: 22px; font-weight: 600; color: #f1f5f9;
    font-variant-numeric: tabular-nums;
}
.card .value .currency {
    font-size: 12px; color: #64748b; font-weight: 400; margin-left: 4px;
}
.card.outstanding .value { color: #fca5a5; }
.card.paid .value { color: #4ade80; }

.kv-grid {
    display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px;
    font-size: 13px;
}
.kv-grid .k { color: #94a3b8; }

/* ------- Settlement toolbar ------- */
.settle-toolbar {
    display: flex; gap: 10px; align-items: center;
    margin-bottom: 12px; flex-wrap: wrap;
}
.settle-toolbar strong { color: #f1f5f9; font-variant-numeric: tabular-nums; }

h2.section {
    font-size: 13px; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 0.5px;
    margin: 22px 0 10px; font-weight: 600;
}

/* ------- Modal ------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(2,6,23,0.78);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    animation: fadeIn .15s ease;
}
.modal-overlay.hidden { display: none; }
.modal {
    background: #111a2c;
    padding: 24px 26px 20px;
    border-radius: 14px;
    width: 460px;
    max-width: calc(100vw - 32px);
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #1e293b;
    box-shadow: 0 30px 80px rgba(0,0,0,0.7);
    animation: popIn .18s ease;
}
.modal h2 { margin: 0 0 14px 0; font-size: 17px; color: #f1f5f9; }
.modal form { display: flex; flex-direction: column; gap: 12px; }
.modal label {
    display: flex; flex-direction: column; gap: 5px;
    font-size: 11px; color: #94a3b8;
    font-weight: 600; letter-spacing: 0.4px;
    text-transform: uppercase;
}
.modal label.checkbox {
    flex-direction: row; align-items: center; gap: 8px;
    font-size: 13px; text-transform: none; font-weight: 500;
    color: #e2e8f0; letter-spacing: 0;
}
.modal label.checkbox input { width: auto; }
.modal .hint {
    font-size: 10px; color: #64748b; font-weight: 400;
    text-transform: none; letter-spacing: 0;
}
.grid-2 {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.quick-extend {
    display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap;
}
.quick-extend button {
    flex: 1; min-width: 50px;
    padding: 6px 4px; font-size: 12px;
    background: #1e293b;
}
.quick-extend button:hover:not(:disabled) { background: #334155; }
.modal-buttons {
    display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px;
}
.modal-buttons button { min-width: 88px; }

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes popIn {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ------- Toast ------- */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    padding: 12px 18px;
    background: #111a2c; border: 1px solid #334155;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    opacity: 0; transform: translateY(12px);
    transition: opacity .2s, transform .2s;
    max-width: 380px; font-size: 13px;
    pointer-events: none;
    z-index: 200;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: #991b1b; color: #fecaca; }
.toast.ok { border-color: #166534; color: #bbf7d0; }

/* ------- Language switcher ------- */
select#langSelect {
    width: auto; min-width: 60px;
    padding: 6px 8px; font-size: 12px;
    background: #1e293b; border-color: #334155;
}
