/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg: #0f172a;
    --bg2: #1e293b;
    --bg3: #334155;
    --text: #e2e8f0;
    --text2: #94a3b8;
    --text3: #64748b;
    --accent: #facc15;
    --accent2: #2563eb;
    --success: #16a34a;
    --error: #dc2626;
    --warning: #d97706;
    --border: #334155;
    --radius: 14px;
    --shadow: 0 4px 24px rgba(0,0,0,0.45);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== HEADER ===== */
.header {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 16px rgba(0,0,0,0.35);
}
.header-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-icon { font-size: 30px; }
.brand-name { font-size: 20px; font-weight: 800; color: var(--accent); letter-spacing: -0.5px; margin: 0; }
.brand-sub { font-size: 12px; color: var(--text2); }

/* ===== MAIN ===== */
.main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px 20px 48px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== SETUP OVERVIEW ===== */
.setup-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px 20px 0;
}
.setup-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 14px;
}
.setup-head h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
}
.setup-head p {
    color: var(--text2);
    font-size: 13px;
    margin-top: 2px;
}
.setup-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.setup-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 3px 18px rgba(0,0,0,0.28);
}
.setup-card.is-ready { border-color: rgba(22,163,74,0.34); }
.setup-card.is-warning { border-color: rgba(217,119,6,0.38); }
.setup-card.is-error { border-color: rgba(220,38,38,0.38); }
.setup-card-title {
    display: flex;
    align-items: center;
    gap: 9px;
}
.setup-card-title h3 {
    font-size: 14px;
    font-weight: 800;
}
.setup-card p {
    color: var(--text2);
    font-size: 12px;
    line-height: 1.5;
    flex: 1;
}
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--text3);
    box-shadow: 0 0 0 4px rgba(100,116,139,0.15);
    flex: 0 0 auto;
}
.status-dot.ready { background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,0.16); }
.status-dot.warning { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,0.16); }
.status-dot.error { background: #ef4444; box-shadow: 0 0 0 4px rgba(239,68,68,0.16); }
.status-dot.pending { background: #94a3b8; box-shadow: 0 0 0 4px rgba(148,163,184,0.16); }

/* ===== SETTINGS HELPERS ===== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 16px 0;
}
.settings-block {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
}
.settings-block h3 {
    font-size: 14px;
    margin-bottom: 4px;
}
.settings-block p {
    color: var(--text2);
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 10px;
}
.settings-block code {
    color: #bfdbfe;
    font-size: 11px;
    word-break: break-all;
}
.copy-row {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid rgba(51,65,85,0.7);
}
.copy-row:first-of-type { border-top: none; }
.copy-row span {
    color: var(--text3);
    font-size: 11px;
    font-weight: 700;
}
.copy-row code {
    background: rgba(15,23,42,0.9);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
}
.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text);
    cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent2); background: rgba(37,99,235,0.12); }

/* ===== CARD ===== */
.card {
    background: var(--bg2);
    border-radius: var(--radius);
    padding: 22px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
}
.card-header h2 { font-size: 15px; font-weight: 700; color: var(--text); }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.18s;
    font-family: inherit;
    white-space: nowrap;
}
.btn-primary { background: var(--accent2); color: white; }
.btn-primary:hover:not(:disabled) { background: #1d4ed8; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.35); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg3); }
.btn-full { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.link-btn {
    background: none; border: none; color: var(--text2);
    cursor: pointer; font-size: 12px; font-family: inherit;
    transition: color 0.2s; padding: 0;
}
.link-btn:hover { color: #f87171; }

/* ===== FORM ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 11px; font-weight: 700;
    color: var(--text2); margin-bottom: 6px;
    letter-spacing: 0.08em; text-transform: uppercase;
}
.req { color: #f87171; }
.form-group input,
.form-group textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 11px 14px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent2);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.18);
}
.form-group small { display: block; font-size: 11px; color: var(--text3); margin-top: 5px; }
.form-group textarea { min-height: 200px; font-family: 'Courier New', monospace; font-size: 13px; }
.input-meta {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 6px; font-size: 12px;
}
.line-count { color: var(--text2); }

/* ===== PARSE PREVIEW ===== */
.parse-preview {
    background: var(--bg); border-radius: 8px;
    border: 1px solid var(--border); padding: 12px;
    margin-bottom: 14px;
}
.parse-preview.hidden { display: none; }
.preview-head { display: flex; gap: 12px; margin-bottom: 10px; font-size: 13px; font-weight: 600; }
.valid-label { color: #4ade80; }
.invalid-label { color: #f87171; }
.invalid-label.hidden { display: none; }
.preview-list { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow-y: auto; }
.preview-item {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; padding: 4px 8px; border-radius: 6px;
}
.preview-item.valid { background: rgba(74,222,128,0.07); }
.preview-item.invalid { background: rgba(220,38,38,0.1); }

/* ===== ALERT BOX ===== */
.alert-box {
    padding: 12px 14px; border-radius: 8px;
    font-size: 13px; font-weight: 500; margin-bottom: 12px;
}
.alert-success { background: rgba(22,163,74,0.14); color: #4ade80; border: 1px solid rgba(22,163,74,0.28); }
.alert-error   { background: rgba(220,38,38,0.12); color: #f87171; border: 1px solid rgba(220,38,38,0.28); }
.alert-info    { background: rgba(37,99,235,0.12);  color: #93c5fd; border: 1px solid rgba(37,99,235,0.28); }
.alert-warning { background: rgba(217,119,6,0.12);  color: #fbbf24; border: 1px solid rgba(217,119,6,0.28); }

/* ===== BADGE PILL ===== */
.badge-pill {
    padding: 4px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 700;
}

/* ===== NIK GRID ===== */
.nik-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.nik-item {
    background: var(--bg); border-radius: 10px;
    padding: 12px 14px; border: 1px solid var(--border);
}
.nik-number { font-size: 12px; font-weight: 700; color: var(--text); font-family: monospace; word-break: break-all; }
.nik-slots { font-size: 12px; color: var(--text2); margin-top: 5px; }
.nik-avail { color: #4ade80; font-weight: 700; }
.nik-zero  { color: #f87171; font-weight: 700; }
.nik-ts    { font-size: 10px; color: var(--text3); margin-top: 4px; }
.empty-state-sm { font-size: 13px; color: var(--text3); padding: 8px 0; }

/* ===== BATCH LIST ===== */
.batch-list { display: flex; flex-direction: column; gap: 12px; }
.batch-item {
    background: var(--bg); border-radius: 10px;
    border: 1px solid var(--border); padding: 14px 16px;
    transition: border-color 0.2s, background 0.2s; cursor: pointer;
}
.batch-item:hover { border-color: var(--accent2); background: rgba(37,99,235,0.04); }
.batch-item-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 10px; }
.batch-item-name { font-size: 14px; font-weight: 700; color: var(--text); }
.batch-item-meta { font-size: 11px; color: var(--text3); margin-top: 3px; }
.batch-item-stats { display: flex; gap: 8px; font-size: 12px; flex-wrap: wrap; margin-top: 8px; }
.stat-chip {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 6px; padding: 3px 9px; color: var(--text2);
}
.progress-bar-wrap { margin-top: 10px; }
.progress-bar-bg { background: var(--bg3); border-radius: 99px; height: 5px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 99px; background: var(--accent2); transition: width 0.5s ease; }
.progress-bar-label { font-size: 11px; color: var(--text3); margin-top: 4px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text3); display: flex; flex-direction: column; align-items: center; gap: 8px; }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.72);
    display: flex; justify-content: center; align-items: flex-start;
    z-index: 1000; padding: 20px; overflow-y: auto;
    backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal-box {
    background: var(--bg2); border-radius: var(--radius);
    padding: 24px; width: 100%; max-width: 500px;
    border: 1px solid var(--border); box-shadow: var(--shadow);
    margin: auto;
}
.modal-wide { max-width: 720px; }
.modal-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 16px; }
.close-btn {
    background: none; border: none; color: var(--text2);
    font-size: 26px; cursor: pointer; line-height: 1; transition: color 0.2s;
}
.close-btn:hover { color: #f87171; }

/* ===== DETAIL MODAL ===== */
.detail-meta {
    background: var(--bg); border-radius: 8px; padding: 12px 14px;
    margin-bottom: 6px; font-size: 12px; color: var(--text2);
    display: flex; flex-wrap: wrap; gap: 14px;
}
.detail-items { display: flex; flex-direction: column; gap: 5px; max-height: 420px; overflow-y: auto; }
.detail-row {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg); border-radius: 8px; padding: 9px 12px; font-size: 13px;
    border: 1px solid transparent; transition: border-color 0.15s;
}
.detail-row.running { border-color: rgba(37,99,235,0.4); }
.detail-row.success { border-color: rgba(22,163,74,0.3); }
.detail-row.error   { border-color: rgba(220,38,38,0.3); }
.detail-phone { color: var(--text); font-family: monospace; font-weight: 600; }
.detail-iccid { color: var(--text3); font-size: 11px; margin-top: 1px; }
.detail-result { font-size: 11px; color: var(--text3); margin-top: 2px; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-status { font-size: 12px; font-weight: 700; text-align: right; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 4px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .main { display: flex !important; flex-direction: column !important; padding: 16px 14px 40px !important; gap: 16px !important; }
    .setup-shell { padding: 16px 14px 0; }
    .setup-head { align-items: flex-start; flex-direction: column; }
    .setup-grid { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .copy-row { grid-template-columns: 1fr 34px; }
    .copy-row span { grid-column: 1 / -1; }
    .brand-name { font-size: 17px; }
    .card { padding: 16px; }
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal-box { border-radius: var(--radius) var(--radius) 0 0; margin: 0; max-width: 100%; max-height: 92dvh; overflow-y: auto; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.batch-item, .nik-item { animation: fadeIn 0.22s ease; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.running-pulse { animation: pulse 1.5s infinite; }
