/* =========================================================
   RK DREAM CASH FLOW — admin panel
   ========================================================= */

:root {
    --bg: #060a10;
    --panel: #0b1622;
    --panel-2: #101f2e;
    --gold: #d9a93a;
    --gold-2: #f6d78b;
    --text: #e9eef5;
    --muted: #8b9cb1;
    --line: rgba(255, 255, 255, 0.08);
    --green: #33d17a;
    --red: #ff6b6b;
    --sidebar: 248px;
}

* { box-sizing: border-box; }

body.admin-body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, "Noto Sans", Arial, sans-serif;
    background:
        radial-gradient(800px 400px at 90% -100px, rgba(217, 169, 58, 0.12), transparent 65%),
        var(--bg);
    color: var(--text);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--gold-2); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; }
.icon { vertical-align: middle; }

.admin-shell { display: flex; min-height: 100vh; }

/* ---------------- Sidebar ---------------- */
.sidebar {
    width: var(--sidebar);
    flex: 0 0 var(--sidebar);
    background: linear-gradient(180deg, #0a1521, #060c13);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 60;
}

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.sidebar-brand img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.sidebar-brand strong { display: block; font-size: 13px; letter-spacing: 1px; color: var(--gold-2); }
.sidebar-brand span { display: block; font-size: 10.5px; color: var(--muted); letter-spacing: 0.6px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }

.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #a9b9ca;
    font-size: 13px;
    border: 1px solid transparent;
}

.side-link:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }

.side-link.active {
    background: linear-gradient(100deg, rgba(217, 169, 58, 0.18), rgba(217, 169, 58, 0.04));
    border-color: rgba(217, 169, 58, 0.35);
    color: var(--gold-2);
}

.side-link .icon { flex: 0 0 auto; }

.side-count {
    margin-left: auto;
    background: var(--gold);
    color: #171207;
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.sidebar-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }

.admin-who { display: flex; align-items: center; gap: 10px; padding: 6px 4px 12px; }
.admin-who strong { display: block; font-size: 12.5px; }
.admin-who span { display: block; font-size: 11px; color: var(--muted); }

.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(140deg, var(--gold-2), #b07d18);
    color: #171207; font-weight: 700; font-size: 12px;
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.avatar.lg { width: 52px; height: 52px; font-size: 17px; }

/* ---------------- Main ---------------- */
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--line);
    background: rgba(6, 10, 16, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 30;
}

.admin-topbar h1 { font-size: 17px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.rate-pill {
    font-size: 11.5px;
    color: var(--gold-2);
    border: 1px dashed rgba(217, 169, 58, 0.4);
    border-radius: 8px;
    padding: 6px 10px;
    background: rgba(217, 169, 58, 0.06);
    white-space: nowrap;
}

.icon-btn {
    width: 36px; height: 36px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--panel);
    color: var(--text); display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.admin-menu { display: none; }

.admin-content { padding: 22px 24px 40px; flex: 1; }

.admin-foot { padding: 14px 24px; color: #63748a; font-size: 11.5px; border-top: 1px solid var(--line); }

/* ---------------- Cards & grids ---------------- */
.card {
    background: linear-gradient(165deg, rgba(16, 30, 44, 0.92), rgba(8, 14, 21, 0.95));
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 18px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.card-head h2 { font-size: 14px; letter-spacing: 0.3px; }
.card-head .muted { font-size: 12px; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.stat {
    background: linear-gradient(160deg, rgba(17, 31, 45, 0.95), rgba(8, 14, 21, 0.95));
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.stat::after {
    content: "";
    position: absolute;
    right: -24px; top: -24px;
    width: 80px; height: 80px; border-radius: 50%;
    background: rgba(217, 169, 58, 0.07);
}

.stat .s-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.7px; }
.stat .s-value { font-size: 22px; font-weight: 700; margin-top: 6px; color: #fdf3dd; }
.stat .s-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.stat.gold { border-color: rgba(217, 169, 58, 0.4); }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 15px;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

.btn-gold { background: linear-gradient(120deg, #f6d78b, #d9a93a 60%, #b07d18); color: #1a1305; }
.btn-gold:hover { filter: brightness(1.06); }
.btn-ghost { border-color: var(--line); color: var(--text); background: rgba(16, 31, 46, 0.6); }
.btn-ghost:hover { border-color: rgba(217, 169, 58, 0.4); color: var(--gold-2); }
.btn-outline { border-color: rgba(217, 169, 58, 0.45); color: var(--gold-2); background: transparent; }
.btn-danger { background: rgba(255, 107, 107, 0.13); border-color: rgba(255, 107, 107, 0.35); color: #ffb3b3; }
.btn-success { background: rgba(51, 209, 122, 0.13); border-color: rgba(51, 209, 122, 0.35); color: #9ff0bd; }
.btn-sm { padding: 6px 10px; font-size: 11.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------------- Forms ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

.field { margin-bottom: 12px; }
.field label {
    display: block;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: rgba(6, 12, 18, 0.9);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
}

.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(217, 169, 58, 0.55); }
.field .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; }

/* ---------------- Tables ---------------- */
.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    min-width: 640px;
}

table.data th {
    text-align: left;
    padding: 10px 12px;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--muted);
    font-weight: 600;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.02);
}

table.data td {
    padding: 11px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: rgba(255, 255, 255, 0.02); }
table.data td.right, table.data th.right { text-align: right; }
table.data .sub { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
table.data .strong { font-weight: 600; }

/* ---------------- Badges & alerts ---------------- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    border: 1px solid transparent;
    white-space: nowrap;
}

.badge-success { background: rgba(51, 209, 122, 0.12); color: var(--green); border-color: rgba(51, 209, 122, 0.35); }
.badge-warning { background: rgba(217, 169, 58, 0.14); color: var(--gold-2); border-color: rgba(217, 169, 58, 0.4); }
.badge-danger  { background: rgba(255, 107, 107, 0.12); color: var(--red); border-color: rgba(255, 107, 107, 0.35); }
.badge-muted   { background: rgba(139, 156, 177, 0.12); color: var(--muted); border-color: rgba(139, 156, 177, 0.3); }

.alert {
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12.5px;
    margin-bottom: 16px;
    border: 1px solid;
}
.alert-success { background: rgba(51, 209, 122, 0.1); border-color: rgba(51, 209, 122, 0.3); color: #a9f0c6; }
.alert-danger  { background: rgba(255, 107, 107, 0.1); border-color: rgba(255, 107, 107, 0.3); color: #ffc0c0; }
.alert-info    { background: rgba(217, 169, 58, 0.1); border-color: rgba(217, 169, 58, 0.3); color: #f1dca8; }

/* ---------------- Misc ---------------- */
.muted { color: var(--muted); }
.gold { color: var(--gold-2); }
.green { color: var(--green); }
.red { color: var(--red); }
.small { font-size: 11.5px; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 12px; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 14px; }
.flex { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed rgba(255, 255, 255, 0.07); font-size: 12.5px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv strong { font-weight: 600; text-align: right; }

.search-bar { display: flex; gap: 8px; }
.search-bar input {
    padding: 9px 12px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: rgba(6, 12, 18, 0.9);
    color: var(--text);
    font-size: 12.5px;
    min-width: 220px;
    font-family: inherit;
}

.pagination { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 6px 11px;
    border-radius: 7px;
    border: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
}
.pagination .active { background: var(--gold); color: #171207; border-color: transparent; font-weight: 700; }

.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10.5px;
    background: rgba(217, 169, 58, 0.1);
    border: 1px solid rgba(217, 169, 58, 0.3);
    color: var(--gold-2);
}

@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        height: 100vh;
    }
    .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0, 0, 0, 0.6); }
    .admin-menu { display: inline-flex; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .admin-content { padding: 18px 16px 32px; }
    .admin-topbar { padding: 12px 16px; }
    .rate-pill { display: none; }
}

@media (max-width: 640px) {
    .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
    .admin-topbar h1 { font-size: 15px; }
}
