/* ==========================================================================
   Settings → Plans (admin)
   js/account/plans-admin.js emitted 28 `plans-*` classes and NONE of them had a
   stylesheet — the page relied entirely on `.auth-input` (a login-page control:
   11px/14px padding, 10px radius) plus raw browser defaults for every table,
   grid and checkbox.

   THE SELECTORS specifically: `.auth-input` sets `appearance: none`, which strips
   a <select>'s native dropdown arrow. Nothing drew one back, so every dropdown on
   this page rendered as a plain box with no affordance that it opens. That is
   fixed here with an inline-SVG chevron (no extra request, no icon font).

   Palette follows DESIGN_SYSTEM.md: indigo #5B53E8 accent, #14171F ink,
   #8A93A1 muted, #E7E8EC borders.
   ========================================================================== */

/* ── Form controls ──────────────────────────────────────────────────────── */
/* Denser than the login-page default — this is a data-entry grid, not a form of
   four fields. Overrides .auth-input where both classes are present. */
.plans-input {
    width: 100%;
    padding: 8px 11px;
    font-size: 13.5px;
    border-radius: 8px;
    border: 1px solid #D7DAE1;
    color: #14171F;
    background: #fff;
}
.plans-input:focus {
    border-color: #5B53E8;
    box-shadow: 0 0 0 3px rgba(91, 83, 232, 0.14);
}
.plans-input:disabled { background: #F7F8F9; color: #6B7280; cursor: not-allowed; }
.plans-input::placeholder { color: #AEB4BE; }

/* The fix for the "selectors" — appearance:none removed the native arrow, so draw
   one. Extra right padding keeps long option text from running under it. */
select.plans-input {
    padding-right: 32px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239099A6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    cursor: pointer;
}
select.plans-input:hover { border-color: #C9C4F4; }
/* Native option lists are OS-drawn; only colour is reliably honoured. */
select.plans-input option { color: #14171F; background: #fff; }

/* Number inputs: hide the spinners — the values here are semantic (credits, SKUs),
   and a stepper invites nudging rather than typing an intended figure. */
.plans-input[type="number"] { -moz-appearance: textfield; }
.plans-input[type="number"]::-webkit-outer-spin-button,
.plans-input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ── Field (label + control + hint) ─────────────────────────────────────── */
.plans-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.plans-field-label { font-size: 11.5px; font-weight: 600; color: #5B6473; letter-spacing: .01em; }
.plans-field-hint { font-size: 11px; color: #6B7280; line-height: 1.45; }

/* ── Plan editor card ───────────────────────────────────────────────────── */
.plans-edit-card {
    border: 1px solid #E7E8EC;
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
    background: #fff;
}
.plans-edit-card:hover { border-color: #DCDEE5; }
.plans-edit-top {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 13px; padding-bottom: 11px; border-bottom: 1px solid #F0F1F4;
}
/* The plan id is the join key to Stripe metadata — monospace so it reads as an
   identifier rather than prose, and it must not be mistaken for the plan NAME. */
.plans-edit-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px; font-weight: 600; color: #5B53E8;
    background: #F4F3FE; border: 1px solid #E6E3FB;
    border-radius: 6px; padding: 3px 8px;
}
.plans-edit-top .btn { margin-left: auto; }
.plans-edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 13px 14px;
}

/* ── Checkbox row ───────────────────────────────────────────────────────── */
.plans-checks {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: 14px; padding-top: 13px; border-top: 1px solid #F0F1F4;
}
/* Chip-shaped so a long row of flags stays scannable and each hit target is
   comfortably clickable — a bare checkbox + text is a ~13px target. */
.plans-check {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 12.5px; color: #3B414C;
    border: 1px solid #E2E4EA; border-radius: 8px;
    padding: 6px 11px 6px 9px;
    cursor: pointer; user-select: none;
    transition: border-color .12s, background .12s;
}
.plans-check:hover { border-color: #C9C4F4; background: #FBFBFE; }
.plans-check:focus-within { border-color: #5B53E8; box-shadow: 0 0 0 3px rgba(91,83,232,.14); }
.plans-check input[type="checkbox"] {
    width: 15px; height: 15px; margin: 0;
    accent-color: #5B53E8;   /* native control, brand tint — no custom sprite to drift */
    cursor: pointer; flex: 0 0 auto;
}
/* A checked flag should read as ON at a glance, not require reading the box. */
.plans-check:has(input:checked) { border-color: #C9C4F4; background: #F4F3FE; color: #14171F; font-weight: 500; }

/* ── Credit-pack rows ───────────────────────────────────────────────────── */
.plans-pack-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px; align-items: end;
    border: 1px solid #E7E8EC; border-radius: 10px;
    padding: 13px; margin-top: 10px; background: #fff;
}
.plans-pack-right { display: flex; align-items: center; gap: 9px; justify-content: flex-end; }

/* ── Read-only config preview ───────────────────────────────────────────── */
.plans-config-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
    gap: 9px; margin-top: 11px;
}
.plans-config-cell {
    border: 1px solid #EDEFF2; border-radius: 9px;
    padding: 9px 11px; background: #FAFAFB; min-width: 0;
}
.plans-config-k { font-size: 11px; font-weight: 600; color: #646B78; text-transform: uppercase; letter-spacing: .04em; }
.plans-config-v {
    font-size: 13px; color: #14171F; margin-top: 3px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    overflow-wrap: anywhere;   /* keys and URLs must not widen the grid */
}

/* ── Webhook URL ────────────────────────────────────────────────────────── */
.plans-webhook { margin-top: 12px; }
.plans-webhook-url {
    display: block; margin-top: 5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px; color: #3B414C;
    background: #F4F5F7; border: 1px solid #E7E8EC; border-radius: 8px;
    padding: 9px 11px; overflow-wrap: anywhere; user-select: all;   /* click-drag selects the whole URL */
}

/* ── Tables (model costs, users) ────────────────────────────────────────── */
.plans-costs-table, .plans-users-table {
    width: 100%; border-collapse: collapse; margin-top: 11px; font-size: 12.5px;
}
.plans-costs-table th, .plans-users-table th {
    text-align: left; font-size: 10.5px; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase; color: #646B78;
    padding: 8px 10px; background: #FAFAFB;
    border-top: 1px solid #EDEFF2; border-bottom: 1px solid #EDEFF2;
    position: sticky; top: 0; z-index: 1;   /* header survives a long model list */
}
.plans-costs-table td, .plans-users-table td {
    padding: 9px 10px; border-bottom: 1px solid #F2F3F6; color: #2A3343; vertical-align: middle;
}
.plans-costs-table tr:hover td, .plans-users-table tr:hover td { background: #FCFCFD; }
.plans-costs-model {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px; color: #14171F; overflow-wrap: anywhere;
}
.plans-users { margin-top: 6px; }
/* Wide tables scroll INSIDE their own box — the page must never scroll sideways. */
.plans-users, .plans-costs-wrap { overflow-x: auto; }

/* ── Per-project billing rows + ledger ──────────────────────────────────── */
.plans-pb-row {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 11px 0; border-bottom: 1px solid #F2F3F6;
}
.plans-pb-row:last-child { border-bottom: none; }
.plans-pb-row .plans-input { width: auto; min-width: 150px; }
.plans-pb-status { font-size: 12px; color: #646B78; }
.plans-pb-detail { margin-top: 10px; padding-top: 10px; border-top: 1px solid #F0F1F4; }
.plans-pb-ledger { margin-top: 10px; font-size: 12px; }
.plans-pb-ledger-h {
    display: grid; grid-template-columns: 130px 1fr 90px 90px; gap: 10px;
    font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: #646B78; padding: 7px 0; border-bottom: 1px solid #EDEFF2;
}
.plans-pb-ledger-row {
    display: grid; grid-template-columns: 130px 1fr 90px 90px; gap: 10px;
    padding: 8px 0; border-bottom: 1px solid #F5F6F8; color: #3B414C;
}
.plans-pb-ledger-row:last-child { border-bottom: none; }

/* ── Narrow screens ─────────────────────────────────────────────────────── */
@media (max-width: 720px) {
    .plans-edit-grid, .plans-pack-row, .plans-config-grid { grid-template-columns: 1fr; }
    .plans-pb-ledger-h, .plans-pb-ledger-row { grid-template-columns: 1fr 70px; }
    .plans-pb-ledger-h span:nth-child(2), .plans-pb-ledger-row span:nth-child(2) { display: none; }
    .plans-pack-right { justify-content: flex-start; }
}
