/* ==========================================================================
   Jason Tweaks — admin panel (layers on top of styles.css)
   ========================================================================== */

body.admin {
    background: var(--line-2);
}

/* ---------------------------------------------------------- Login gate --- */
.gate {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.gate-card {
    width: 100%;
    max-width: 400px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 38px 34px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.gate-card img {
    height: 42px;
    width: auto;
    margin: 0 auto 20px;
}

.gate-card h1 {
    font-size: 21px;
    margin-bottom: 8px;
}

.gate-card > p {
    color: var(--ink-2);
    font-size: 14.5px;
    margin-bottom: 26px;
}

.gate-card form {
    text-align: left;
}

/* ------------------------------------------------------------- Shell --- */
.panel {
    display: none;
}

.panel.on {
    display: block;
}

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 66px;
}

.topbar .tag {
    background: var(--blue-50);
    color: var(--blue-700);
    border: 1px solid var(--blue-100);
    border-radius: 999px;
    padding: 3px 11px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.topbar .spacer {
    margin-left: auto;
}

.panel-body {
    padding: 30px 0 70px;
}

/* ------------------------------------------------------------- Stats --- */
.kpis {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    margin-bottom: 26px;
}

.kpi {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
}

.kpi b {
    display: block;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.kpi span {
    font-size: 12.5px;
    color: var(--ink-3);
    font-weight: 500;
}

.kpi.accent b {
    color: var(--blue);
}

/* ------------------------------------------------------------ Layout --- */
.cols {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 22px;
    align-items: start;
}

.box {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.box-head {
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 12px;
}

.box-head h2 {
    font-size: 15.5px;
    font-weight: 700;
}

.box-head .spacer {
    margin-left: auto;
}

.box-body {
    padding: 22px;
}

.row {
    display: flex;
    gap: 10px;
}

.row > * {
    flex: 1;
    min-width: 0;
}

select.input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237488a0' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 34px;
}

/* --------------------------------------------------------- Installer --- */
.stack {
    display: grid;
    gap: 22px;
    align-content: start;
}

.hint {
    font-size: 13px;
    color: var(--ink-3);
    margin-bottom: 14px;
}

.hint b {
    color: var(--ink);
}

.drop {
    display: grid;
    justify-items: center;
    gap: 3px;
    padding: 22px 16px;
    border: 1.5px dashed var(--line);
    border-radius: var(--radius);
    background: var(--line-2);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.16s, background 0.16s;
}

.drop:hover,
.drop.over {
    border-color: var(--blue);
    background: var(--blue-50);
}

.drop svg {
    width: 22px;
    height: 22px;
    color: var(--blue);
    margin-bottom: 4px;
}

.drop b {
    font-size: 13.5px;
}

.drop small {
    font-size: 12px;
    color: var(--ink-3);
    word-break: break-all;
}

.bar {
    height: 6px;
    background: var(--line);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 12px;
}

.bar span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--blue);
    border-radius: 999px;
    transition: width 0.2s ease;
}

/* --------------------------------------------------------- Generated --- */
.generated {
    margin-top: 20px;
    border: 1px solid var(--blue-100);
    background: var(--blue-50);
    border-radius: var(--radius);
    padding: 16px;
    display: none;
}

.generated.on {
    display: block;
}

.generated h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--blue-700);
    margin-bottom: 12px;
}

.gen-list {
    max-height: 210px;
    overflow-y: auto;
    background: var(--white);
    border: 1px solid var(--blue-100);
    border-radius: 8px;
    padding: 10px 12px;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.9;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

/* ------------------------------------------------------------- Table --- */
.toolbar {
    display: flex;
    gap: 10px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.toolbar .input {
    padding: 9px 12px;
    font-size: 14px;
}

.toolbar .search {
    flex: 1;
    min-width: 180px;
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--ink-3);
    background: var(--line-2);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line-2);
    vertical-align: middle;
}

tbody tr:hover {
    background: #fbfdff;
}

td.key {
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 0.04em;
    white-space: nowrap;
    font-weight: 600;
}

td.dim {
    color: var(--ink-3);
    font-size: 13px;
    white-space: nowrap;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: capitalize;
}

.badge.active {
    background: #e7f7ee;
    color: #12673f;
}

.badge.unused {
    background: var(--blue-50);
    color: var(--blue-700);
}

.badge.expired {
    background: #fdf4e3;
    color: #8a5a12;
}

.badge.banned {
    background: #fdecec;
    color: #a13030;
}

.acts {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--ink-2);
    cursor: pointer;
    transition: all 0.14s;
}

.icon-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: var(--blue-50);
}

.icon-btn.danger:hover {
    border-color: var(--bad);
    color: var(--bad);
    background: #fdf0f0;
}

.empty {
    padding: 56px 22px;
    text-align: center;
    color: var(--ink-3);
    font-size: 14.5px;
}

/* ------------------------------------------------------------ Toasts --- */
.toasts {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 100;
    display: grid;
    gap: 10px;
    max-width: min(340px, calc(100vw - 40px));
}

.toast {
    background: var(--ink);
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    animation: rise 0.22s ease;
}

.toast.ok {
    background: #10704a;
}

.toast.err {
    background: #a5312f;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* -------------------------------------------------------- Responsive --- */
@media (max-width: 1080px) {
    .kpis {
        grid-template-columns: repeat(3, 1fr);
    }

    .cols {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .kpis {
        grid-template-columns: repeat(2, 1fr);
    }

    .topbar .brand-text {
        display: none;
    }
}
