* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        linear-gradient(120deg, rgba(255,255,255,.88), rgba(255,0,0,.10) 48%, rgba(17,17,17,.06)),
        linear-gradient(135deg, #ffffff 0%, var(--surface) 52%, #e7e7e7 100%);
}
a { color: inherit; text-decoration: none; }
.shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 22px; padding: 22px; }
.glass {
    background: rgba(255, 255, 255, .54);
    border: 1px solid rgba(255, 255, 255, .72);
    box-shadow: 0 24px 80px rgba(42, 42, 80, .14), inset 0 1px 0 rgba(255,255,255,.75);
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
    border-radius: 8px;
}
.sidebar { min-height: calc(100vh - 44px); padding: 18px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 22px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; }
.brand-logo { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; }
nav { display: grid; gap: 8px; }
nav a, .ghost { padding: 12px 14px; border-radius: 8px; background: rgba(255,255,255,.44); border: 1px solid rgba(255,255,255,.5); }
.main { min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 20px; }
.page-actions { display: flex; align-items: center; gap: 10px; }
.table-search { width: min(260px, 46vw); }
.eyebrow { margin: 0 0 6px; color: var(--primary); text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 800; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(34px, 5vw, 64px); margin-bottom: 0; }
h2 { font-size: 20px; margin-bottom: 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { padding: 20px; }
.stat span { display: block; color: #5b5b70; margin-bottom: 10px; }
.stat strong { font-size: 38px; }
.panel { padding: 20px; }
.grid-two { display: grid; grid-template-columns: minmax(280px, 420px) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 12px; align-items: flex-start; }
.between { justify-content: space-between; }
label { display: grid; gap: 7px; font-weight: 700; font-size: 14px; }
input, textarea, select {
    width: 100%;
    border: 1px solid rgba(50, 50, 70, .14);
    border-radius: 8px;
    padding: 12px 13px;
    background: rgba(255,255,255,.74);
    color: var(--text);
    font: inherit;
}
.password-field { position: relative; display: block; }
.password-field input { padding-right: 48px; }
.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    background: transparent;
    color: var(--text);
    box-shadow: none;
}
.check-row { display: flex; align-items: center; gap: 10px; }
.check-row input { width: 18px; height: 18px; }
.prompt-editor { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; line-height: 1.45; }
.prompt-help { margin-top: 18px; }
select[multiple] { min-height: 120px; }
button {
    border: 0;
    border-radius: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary), #b80000);
    color: white;
    font-weight: 800;
    cursor: pointer;
}
button.danger { background: #e5484d; }
button.ghost { background: rgba(255,255,255,.42); color: var(--text); width: 100%; margin-top: auto; }
button.small { padding: 8px 10px; font-size: 13px; }
.icon-action {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 8px;
    font-size: 28px;
    line-height: 1;
}
button.icon-close {
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    margin: 0;
    border-radius: 8px;
    background: rgba(255,255,255,.68);
    color: var(--text);
    font-size: 22px;
    line-height: 1;
    box-shadow: none;
}
button.icon-close:hover { background: rgba(255,0,0,.1); color: var(--primary); }
.auth-panel { width: min(460px, 100%); margin: 12vh auto 0; padding: 28px; }
.auth-logo { display: block; width: 180px; margin: 0 auto 18px; border-radius: 8px; }
.alert { padding: 12px; border-radius: 8px; background: rgba(229, 72, 77, .14); color: #9f2028; }
.api-list, .chips { display: flex; flex-wrap: wrap; gap: 8px; }
code, .chips span { border-radius: 8px; padding: 8px 10px; background: rgba(255,255,255,.66); border: 1px solid rgba(255,255,255,.6); }
.badge-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.badge-thumb { width: 72px; height: 72px; border-radius: 8px; background: rgba(255,255,255,.5); overflow: hidden; }
.badge-thumb img { width: 100%; height: 100%; object-fit: cover; }
.edit-box { margin-top: 14px; }
.edit-box summary { cursor: pointer; font-weight: 800; margin-bottom: 12px; }
.wide { grid-column: 1 / -1; }
.table-panel { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid rgba(45,45,70,.08); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #5b5b70; background: rgba(255,255,255,.34); }
td small { display: block; max-width: 540px; margin-top: 4px; color: #5b5b70; line-height: 1.35; }
.actions { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.actions form { margin: 0; }
.status { display: inline-flex; border-radius: 8px; padding: 6px 9px; background: rgba(255,255,255,.66); border: 1px solid rgba(255,255,255,.62); font-size: 13px; font-weight: 800; }
.status-success { color: #0f7b3f; }
.status-api_error, .status-curl_error, .status-json_error, .status-empty_output, .status-config_error { color: #b80000; }
pre { max-width: 620px; max-height: 280px; overflow: auto; padding: 12px; border-radius: 8px; background: rgba(0,0,0,.78); color: #fff; white-space: pre-wrap; }
.modal {
    width: min(680px, calc(100vw - 28px));
    max-height: min(820px, calc(100vh - 28px));
    padding: 0;
    border: 0;
    color: var(--text);
}
.modal::backdrop { background: rgba(20,20,30,.34); backdrop-filter: blur(8px); }
.modal-form { padding: 20px; max-height: calc(100vh - 28px); overflow: auto; }
.modal-head { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 4px; }
.modal-head h2 { margin: 0; }

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; padding: 14px; }
    .sidebar { min-height: auto; position: static; }
    .stats-grid, .grid-two { grid-template-columns: 1fr; }
    .page-head { align-items: flex-start; gap: 14px; }
    .page-actions { width: 100%; justify-content: flex-end; }
    .badge-row { grid-template-columns: 60px minmax(0, 1fr); }
    .badge-row form { grid-column: 1 / -1; }
    h1 { font-size: 36px; }
}
