/* =============================================================================
   Digital Recharge Platform — Admin/Operator Console
   Shared stylesheet.  Aesthetic: refined utilitarian, light-blue + white.
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    /* Palette — light blue + white */
    --bg:           #e9f2fc;
    --surface:      #ffffff;
    --surface-2:    #f4f9fe;
    --primary:      #2470d6;
    --primary-600:  #1c5cb5;
    --primary-700:  #164a93;
    --primary-tint: #d7e8fb;
    --primary-soft: #eef5fd;
    --border:       #d3e3f5;
    --border-soft:  #e6eff8;
    --text:         #15314f;
    --muted:        #5e7691;
    --success:      #1f8a4c;
    --success-bg:   #e3f6ec;
    --danger:       #d23b3b;
    --danger-bg:    #fbe7e7;
    --warning:      #b9740f;
    --warning-bg:   #fbf0dd;

    --radius:       10px;
    --radius-sm:    7px;
    --shadow:       0 1px 2px rgba(21,49,79,.06), 0 8px 24px rgba(21,49,79,.07);
    --shadow-sm:    0 1px 2px rgba(21,49,79,.08);
    --ring:         0 0 0 3px rgba(36,112,214,.18);

    --sans: 'IBM Plex Sans', system-ui, sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--sans);
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Money / mono ---------- */
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.money { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.money::after { content: ' LYD'; color: var(--muted); font-size: .85em; }
.money.bare::after { content: ''; }

/* =============================================================================
   Login
   ============================================================================= */

.login-wrap {
    min-height: 100%;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(1200px 500px at 50% -10%, var(--primary-soft), transparent),
        var(--bg);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 34px 30px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 26px;
}
.brand-mark {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(150deg, var(--primary), var(--primary-700));
    display: grid; place-items: center;
    color: #fff; font-weight: 700; font-size: 18px;
    box-shadow: var(--shadow-sm);
}
.brand-text { line-height: 1.2; }
.brand-text strong { display: block; font-size: 15px; font-weight: 600; }
.brand-text span { font-size: 12px; color: var(--muted); }

/* Role toggle */
.role-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 18px;
}
.role-toggle button {
    border: 0;
    background: transparent;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: all .15s;
}
.role-toggle button.active {
    background: var(--surface);
    color: var(--primary-700);
    box-shadow: var(--shadow-sm);
}

/* =============================================================================
   Forms
   ============================================================================= */

.field { margin-bottom: 15px; }
.field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
    letter-spacing: .01em;
}
.input, select.input, textarea.input {
    width: 100%;
    font-family: var(--sans);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 11px;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, select.input:focus, textarea.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}
.input::placeholder { color: #9fb3cc; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* =============================================================================
   Buttons
   ============================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    padding: 9px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-600); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--primary-tint); }
.btn-soft { background: var(--primary-soft); color: var(--primary-700); }
.btn-soft:hover:not(:disabled) { background: var(--primary-tint); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b93232; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-icon { padding: 7px 9px; }

/* =============================================================================
   App shell
   ============================================================================= */

.app {
    display: grid;
    grid-template-columns: 232px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar .brand { margin-bottom: 22px; padding: 0 6px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #95a9c4;
    padding: 14px 10px 6px;
}
.nav a, .nav span.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.nav a:hover { background: var(--surface-2); }
.nav a.active {
    background: var(--primary-soft);
    color: var(--primary-700);
    font-weight: 600;
}
.nav .nav-item.disabled {
    color: #aebfd4;
    cursor: not-allowed;
}
.nav-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--primary-tint);
    flex-shrink: 0;
}
.nav a.active .nav-dot { background: var(--primary); }
.soon {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 1px 7px;
}

.sidebar-foot {
    border-top: 1px solid var(--border-soft);
    padding-top: 14px;
    margin-top: 8px;
}
.who { display: flex; align-items: center; gap: 10px; padding: 4px 6px 10px; }
.who-avatar {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--primary-tint); color: var(--primary-700);
    display: grid; place-items: center; font-weight: 600; font-size: 13px;
}
.who-info { line-height: 1.25; overflow: hidden; }
.who-info strong { display: block; font-size: 13px; }
.who-info span { font-size: 11px; color: var(--muted); text-transform: capitalize; }

/* ---------- Main ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px 0;
}
.topbar h1 { font-size: 21px; font-weight: 600; margin: 0; }
.topbar .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.content { padding: 22px 28px 40px; }

/* =============================================================================
   Cards / toolbar / table
   ============================================================================= */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border-soft);
}
.toolbar .field { margin: 0; }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar-actions { margin-left: auto; display: flex; gap: 8px; }

.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    white-space: nowrap;
}
table.data td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .1s; }
table.data tbody tr:hover { background: var(--primary-soft); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.cell-strong { font-weight: 600; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-green  { color: var(--success); background: var(--success-bg); }
.badge-amber  { color: var(--warning); background: var(--warning-bg); }
.badge-red    { color: var(--danger);  background: var(--danger-bg); }
.badge-blue   { color: var(--primary-700); background: var(--primary-soft); }
.badge-grey   { color: var(--muted); background: var(--surface-2); }

/* ---------- Pagination ---------- */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    border-top: 1px solid var(--border-soft);
    font-size: 13px;
    color: var(--muted);
}
.pager .pg-btns { display: flex; gap: 8px; }

/* ---------- Empty / loading ---------- */
.state {
    padding: 48px 20px;
    text-align: center;
    color: var(--muted);
}
.state .big { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.spinner {
    width: 18px; height: 18px;
    border: 2px solid var(--primary-tint);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================================================
   Modal
   ============================================================================= */

.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(21,49,79,.32);
    backdrop-filter: blur(2px);
    display: grid;
    place-items: start center;
    padding: 48px 16px;
    overflow-y: auto;
    z-index: 50;
}
.modal {
    width: 100%;
    max-width: 480px;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: pop .16s ease-out;
}
.modal.wide { max-width: 620px; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-soft);
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-head .x { border: 0; background: transparent; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; padding: 4px; }
.modal-body { padding: 20px; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 9px;
    padding: 15px 20px;
    border-top: 1px solid var(--border-soft);
    background: var(--surface-2);
}

/* Detail list */
.detail-grid { display: grid; grid-template-columns: 130px 1fr; gap: 9px 14px; font-size: 13px; }
.detail-grid dt { color: var(--muted); font-weight: 500; }
.detail-grid dd { margin: 0; font-weight: 500; word-break: break-all; }
.section-title {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); margin: 20px 0 10px;
}

/* Inline alert inside modals (e.g. operator cap note) */
.note {
    font-size: 12.5px;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 4px;
}
.note-blue { background: var(--primary-soft); color: var(--primary-700); border: 1px solid var(--primary-tint); }
.note-amber { background: var(--warning-bg); color: var(--warning); border: 1px solid #f0dcb4; }

/* =============================================================================
   Toasts
   ============================================================================= */

.toasts {
    position: fixed;
    bottom: 22px; right: 22px;
    display: flex; flex-direction: column; gap: 10px;
    z-index: 80;
}
.toast {
    min-width: 260px; max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 12px 14px;
    font-size: 13px;
    animation: slidein .2s ease-out;
}
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
.toast strong { display: block; margin-bottom: 2px; }
.toast.ok strong { color: var(--success); }
.toast.err strong { color: var(--danger); }

/* Utilities */
.flex { display: flex; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.mt-16 { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
