:root {
    --ink: #18201c;
    --muted: #69736d;
    --line: #dfe5e1;
    --surface: #ffffff;
    --canvas: #f2f5f2;
    --lime: #d8ff64;
    --green: #155f43;
    --red: #a43838;
    --blue: #315f90;
    --amber: #8b651c;
    --radius: 18px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 85% -10%, rgba(216, 255, 100, .32), transparent 28rem),
        var(--canvas);
}

button, input, select { font: inherit; }

.topbar {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 max(24px, calc((100vw - 1240px) / 2));
    background: rgba(255, 255, 255, .84);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
    font-size: 19px;
    letter-spacing: -.03em;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--ink);
    color: var(--lime);
    font-weight: 800;
}

.topbar-actions, .input-row, .result-meta, .pos-tags {
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-nav { display: flex; align-items: center; gap: 4px; }
.panel-nav a { padding: 9px 11px; border-radius: 9px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 700; }
.panel-nav a:hover { background: #edf1ee; color: var(--ink); }

.user-name { color: var(--muted); font-size: 14px; }
.topbar-actions form { margin: 0; }

.shell {
    width: min(1240px, calc(100% - 48px));
    margin: 0 auto;
    padding: 54px 0 72px;
}

.hero {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 32px;
    margin-bottom: 34px;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(36px, 5vw, 58px); line-height: 1; letter-spacing: -.055em; }
h2 { margin: 3px 0 0; font-size: 22px; letter-spacing: -.035em; }
.muted { color: var(--muted); }
.eyebrow, .result-label { font-size: 11px; font-weight: 800; letter-spacing: .14em; color: var(--green); }

.button {
    min-height: 42px;
    border: 0;
    border-radius: 11px;
    padding: 0 17px;
    font-weight: 750;
    cursor: pointer;
}

.button-primary { background: var(--lime); color: var(--ink); }
.button-dark { background: var(--ink); color: white; }
.button-quiet { background: #edf1ee; color: var(--ink); }
.button:hover { transform: translateY(-1px); }

input, select {
    min-height: 46px;
    width: 100%;
    border: 1px solid #ccd4cf;
    border-radius: 11px;
    background: white;
    color: var(--ink);
    padding: 0 14px;
    outline: none;
}

input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(21, 95, 67, .11); }

.bin-search { width: min(440px, 100%); }
.bin-search label, .login-form label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 750; }
.compact input { min-width: 290px; }

.bin-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
    padding: 20px 24px;
    background: #e5f7ee;
    border: 1px solid #c9e8d8;
    border-radius: var(--radius);
}

.bin-result strong, .bin-result span { display: block; }
.bin-result-error { background: #fff0ef; border-color: #f1cfca; }
.result-meta span { padding: 7px 10px; border-radius: 999px; background: rgba(255,255,255,.68); font-size: 12px; }
.result-prefix { font-family: ui-monospace, monospace; }

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

.stat-card, .panel-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.stat-card { min-height: 150px; padding: 22px; display: flex; flex-direction: column; }
.stat-card > span { color: var(--muted); font-size: 13px; }
.stat-card strong { margin: auto 0 2px; font-size: 27px; letter-spacing: -.045em; }
.stat-card small { color: var(--muted); }
.accent-card { background: var(--lime); border-color: var(--lime); }
.accent-card > span, .accent-card small { color: #445020; }

.content-grid { display: grid; grid-template-columns: .88fr 1.4fr; gap: 14px; }
.panel-card { padding: 24px; min-width: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.count-badge { display: grid; place-items: center; min-width: 30px; height: 30px; border-radius: 999px; background: #edf1ee; font-size: 13px; font-weight: 800; }

.pos-list { display: grid; gap: 10px; }
.pos-item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid #edf0ee; }
.pos-item:last-child { border-bottom: 0; }
.bank-avatar { display: grid; place-items: center; flex: 0 0 40px; height: 40px; border-radius: 12px; background: #edf3ef; color: var(--green); font-weight: 800; font-size: 13px; }
.pos-main { min-width: 0; flex: 1; }
.pos-main strong, .pos-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-main span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.tag, .status { display: inline-flex; border-radius: 999px; padding: 5px 8px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.tag-default { background: #f0f6d9; color: #657519; }
.tag-success, .status-success { background: #e4f4eb; color: var(--green); }
.tag-muted { background: #edf0ee; color: var(--muted); }
.status-error { background: #fae8e6; color: var(--red); }
.status-info { background: #e7eff8; color: var(--blue); }
.status-waiting { background: #fbf1d9; color: var(--amber); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 0 10px 10px; text-align: left; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; }
td { padding: 14px 10px; border-top: 1px solid #edf0ee; }
td strong, td > span:not(.status) { display: block; }
td > span:not(.status) { margin-top: 3px; color: var(--muted); font-size: 11px; }
.align-right { text-align: right; }
.amount { font-weight: 800; white-space: nowrap; }
.empty-state { display: grid; min-height: 130px; place-items: center; color: var(--muted); border: 1px dashed #d7ddda; border-radius: 13px; }

.login-wrap { min-height: calc(100vh - 198px); display: grid; place-items: center; }
.login-card { width: min(640px, 100%); padding: clamp(28px, 6vw, 58px); border-radius: 28px; background: var(--ink); color: white; box-shadow: 0 26px 80px rgba(24, 32, 28, .18); }
.login-card h1 { margin-top: 18px; }
.login-card .muted { max-width: 480px; color: #aeb8b2; }
.login-form { margin-top: 34px; }
.login-fields { display: grid; gap: 16px; }
.login-form input { background: #29332e; color: white; border-color: #46534c; }
.login-form input::placeholder { color: #8d9a93; }
.login-form .button { min-height: 46px; }
.login-note { display: flex; align-items: center; gap: 8px; margin-top: 24px; color: #aeb8b2; font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--lime); box-shadow: 0 0 0 4px rgba(216, 255, 100, .12); }
.validation { display: block; margin: 7px 0; color: #ffaaa1; font-size: 13px; }

.page-heading { margin-bottom: 28px; }
.page-heading h1 { margin-top: 7px; font-size: clamp(34px, 5vw, 52px); }
.page-heading p { max-width: 680px; margin-bottom: 0; }
.management-grid { display: grid; grid-template-columns: minmax(280px, .55fr) minmax(0, 1.45fr); gap: 14px; align-items: start; }
.form-card { position: sticky; top: 92px; }
.list-card { min-width: 0; }
.stack-form { display: grid; gap: 17px; }
.stack-form > label { display: grid; gap: 8px; color: var(--ink); font-size: 13px; font-weight: 750; }
.stack-form .validation:empty { display: none; }
.check-row { display: flex; flex-wrap: wrap; gap: 18px; }
.check-item { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; font-weight: 700; cursor: pointer; }
.check-item input { width: 18px; min-height: 18px; margin: 0; accent-color: var(--green); }
.notice { margin-bottom: 14px; padding: 13px 16px; border: 1px solid; border-radius: 12px; font-size: 13px; font-weight: 650; }
.notice-success { color: var(--green); background: #e5f7ee; border-color: #c9e8d8; }
.api-key-notice code { display: inline-block; margin-top: 7px; padding: 6px 9px; border-radius: 7px; background: rgba(255,255,255,.76); color: var(--ink); word-break: break-all; }
.button-small { min-height: 34px; padding: 0 11px; font-size: 12px; white-space: nowrap; }
.button-danger { color: var(--red); background: #fae8e6; }
.button-success { color: var(--green); background: #e4f4eb; }
.list-card td form { margin: 0; }
.api-key-cell { display: flex; align-items: center; gap: 6px; min-width: 245px; }
.secret-value { display: block; width: 168px; overflow: hidden; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.icon-button { display: inline-grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--muted); cursor: pointer; }
.icon-button:hover { border-color: #b7c1bb; background: #f4f7f5; color: var(--ink); }
.icon-button:focus-visible { outline: 3px solid rgba(21, 95, 67, .16); outline-offset: 1px; }
.icon-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.icon-button[aria-pressed="true"] { color: var(--green); background: #e4f4eb; border-color: #c9e8d8; }
.icon-button.is-copied { color: var(--green); background: var(--lime); border-color: var(--lime); }

@media (max-width: 900px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .content-grid { grid-template-columns: 1fr; }
    .hero { align-items: stretch; flex-direction: column; }
    .bin-search { width: 100%; }
    .management-grid { grid-template-columns: 1fr; }
    .form-card { position: static; }
}

@media (max-width: 600px) {
    .topbar { height: 62px; padding: 0 16px; }
    .user-name { display: none; }
    .panel-nav { gap: 0; }
    .panel-nav a { padding: 8px 7px; font-size: 11px; }
    .shell { width: min(100% - 28px, 1240px); padding-top: 32px; }
    .stats { grid-template-columns: 1fr; }
    .stat-card { min-height: 128px; }
    .input-row { align-items: stretch; flex-direction: column; }
    .compact input { min-width: 0; }
    .bin-result { align-items: flex-start; flex-direction: column; }
    .result-meta { align-items: flex-start; flex-wrap: wrap; }
    .pos-tags { align-items: flex-end; flex-direction: column; }
    .login-card { border-radius: 22px; }
}
