:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #142033;
    --muted: #6a7587;
    --line: #e3e8f0;
    --navy: #17243b;
    --blue: #2867d5;
    --blue-soft: #eaf1ff;
    --green: #16815d;
    --green-soft: #e6f7f0;
    --red: #c8384f;
    --red-soft: #fff0f2;
    --amber: #b77313;
    --amber-soft: #fff6df;
    --shadow: 0 18px 48px rgba(31, 46, 73, 0.09);
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 12% 4%, rgba(40, 103, 213, 0.09), transparent 23rem),
        linear-gradient(180deg, #f9fbff 0, var(--bg) 28rem);
    overflow-x: hidden;
}

button, input { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(40, 103, 213, 0.24);
    outline-offset: 2px;
}

.page-glow {
    position: fixed;
    z-index: -1;
    width: 26rem;
    height: 26rem;
    border-radius: 50%;
    filter: blur(1px);
    opacity: 0.4;
    pointer-events: none;
}

.page-glow-one { top: 12rem; left: -19rem; background: #d9e6ff; }
.page-glow-two { bottom: -18rem; right: -16rem; background: #d8f1ea; }

.topbar {
    height: 76px;
    padding: 0 clamp(20px, 5vw, 72px);
    border-bottom: 1px solid rgba(222, 228, 238, 0.9);
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 13px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: white;
    background: linear-gradient(145deg, #214f9f, #20314f);
    box-shadow: 0 8px 20px rgba(32, 64, 117, 0.22);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.8px;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { color: var(--muted); margin-top: 3px; font-size: 12px; }

.topbar-actions { display: flex; align-items: center; gap: 11px; }

.logout-form { margin: 0; }

.logout-button {
    height: 40px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    color: #56637a;
    background: var(--surface);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.logout-button:hover { color: var(--red); border-color: #efc4cc; background: var(--red-soft); }

.text-link {
    color: var(--blue);
    text-decoration: none;
    font-weight: 650;
    font-size: 13px;
    padding: 9px 12px;
    border-radius: 10px;
}

.text-link:hover { background: var(--blue-soft); }

.icon-button {
    width: 40px;
    height: 40px;
    padding: 10px;
    border-radius: 11px;
    color: #44536b;
    border: 1px solid var(--line);
    background: var(--surface);
    cursor: pointer;
}

.icon-button:hover { color: var(--blue); border-color: #bdcff0; }
.icon-button svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button.spinning svg { animation: spin 0.75s linear infinite; }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 42px; }

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

.eyebrow, .section-label {
    margin: 0 0 9px;
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.3px;
}

.hero h1 { margin: 0; max-width: 680px; font-size: clamp(30px, 4vw, 46px); line-height: 1.18; letter-spacing: -1px; }
.hero-copy { margin: 16px 0 0; max-width: 720px; color: var(--muted); font-size: 16px; line-height: 1.9; }

.live-summary { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; min-width: 190px; }

.status-pill {
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid transparent;
}

.status-pill.pending, .status-pill.neutral { color: #687285; background: #f0f3f7; border-color: #e0e5ec; }
.status-pill.online, .status-pill.allowed { color: var(--green); background: var(--green-soft); border-color: #bfe7d7; }
.status-pill.offline, .status-pill.blocked { color: var(--red); background: var(--red-soft); border-color: #f0c6ce; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(106, 117, 135, 0.1); }
.status-pill.online .status-dot { box-shadow: 0 0 0 4px rgba(22, 129, 93, 0.12); }
.status-pill.offline .status-dot { box-shadow: 0 0 0 4px rgba(200, 56, 79, 0.12); }

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

.metric-card {
    min-height: 108px;
    padding: 19px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: rgba(255, 255, 255, 0.94);
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 8px 24px rgba(32, 48, 73, 0.045);
}

.metric-card span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.metric-card strong { display: block; font-size: 15px; line-height: 1.35; }
.metric-card strong.value-blocked { color: var(--red); }
.metric-card strong.value-allowed { color: var(--green); }

.metric-icon {
    width: 43px;
    height: 43px;
    flex: 0 0 43px;
    border-radius: 13px;
    padding: 10px;
    display: grid;
    place-items: center;
}

.metric-icon svg, .secure-badge svg, .action-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.api-icon { color: var(--blue); background: var(--blue-soft); }
.access-icon { color: var(--red); background: var(--red-soft); }
.revision-icon { color: #7552c8; background: #f0ebff; }
.time-icon { color: var(--amber); background: var(--amber-soft); }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr); gap: 20px; }

.panel {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: var(--shadow);
}

.control-panel { padding: clamp(22px, 3.4vw, 36px); }
.activity-panel { padding: 27px; }

.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 27px; }
.panel-heading.compact { margin-bottom: 20px; }
.panel-heading h2 { margin: 0; font-size: 22px; }

.secure-badge {
    color: var(--green);
    background: var(--green-soft);
    border: 1px solid #c4eadb;
    border-radius: 10px;
    padding: 7px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.secure-badge svg { width: 16px; height: 16px; }

.session-banner {
    margin: -3px 0 24px;
    padding: 14px 15px;
    border: 1px solid #c5e8da;
    border-radius: 13px;
    color: #116c4d;
    background: linear-gradient(135deg, #f0fbf6, var(--green-soft));
    display: flex;
    align-items: flex-start;
    gap: 11px;
}

.session-check {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: white;
    background: var(--green);
    font-size: 13px;
    font-weight: 800;
}

.session-banner strong { display: block; font-size: 12px; }
.session-banner p { margin: 4px 0 0; color: #4e7f6d; font-size: 11px; line-height: 1.6; }

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.form-field { margin-bottom: 22px; }
.form-field label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 700; }
.form-field label span { color: var(--muted); font-weight: 400; }

.form-field input {
    width: 100%;
    height: 48px;
    border: 1px solid #d7dee9;
    border-radius: 12px;
    padding: 0 14px;
    color: var(--ink);
    background: var(--surface-soft);
    transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

.form-field input:hover { border-color: #bfcadd; }
.form-field input:focus { border-color: #7ea5e6; background: white; box-shadow: 0 0 0 4px rgba(40, 103, 213, 0.09); outline: none; }
.form-field input::placeholder { color: #9aa4b4; }

.input-with-action { position: relative; }
.input-with-action input { padding-left: 72px; direction: ltr; text-align: left; }
.input-with-action button {
    position: absolute;
    left: 7px;
    top: 7px;
    height: 34px;
    padding: 0 11px;
    border: 0;
    border-radius: 8px;
    background: #e9edf3;
    color: #4f5d72;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.field-help-row { min-height: 25px; margin-top: 7px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field-help-row small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.inline-action { padding: 3px 0; border: 0; background: transparent; color: var(--blue); font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.inline-action:hover { text-decoration: underline; }

.control-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; padding-top: 3px; }

.action-button {
    min-height: 78px;
    border: 1px solid transparent;
    border-radius: 15px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: right;
    cursor: pointer;
    transition: transform 0.16s, box-shadow 0.16s, opacity 0.16s;
}

.action-button:hover:not(:disabled) { transform: translateY(-2px); }
.action-button:disabled { cursor: wait; opacity: 0.58; }
.action-button.danger { color: #a7253b; background: var(--red-soft); border-color: #f0c3cc; }
.action-button.danger:hover:not(:disabled) { box-shadow: 0 10px 24px rgba(200, 56, 79, 0.13); }
.action-button.success { color: #116c4d; background: var(--green-soft); border-color: #bce5d5; }
.action-button.success:hover:not(:disabled) { box-shadow: 0 10px 24px rgba(22, 129, 93, 0.13); }
.action-button strong, .action-button small { display: block; }
.action-button strong { font-size: 14px; margin-bottom: 5px; }
.action-button small { font-size: 11px; opacity: 0.75; direction: ltr; text-align: right; }
.action-icon { width: 38px; height: 38px; flex: 0 0 38px; padding: 8px; border-radius: 11px; background: rgba(255, 255, 255, 0.68); }

.response-code { min-width: 44px; padding: 6px 9px; border-radius: 9px; text-align: center; color: var(--muted); background: #eef1f5; font-family: Consolas, monospace; font-size: 12px; font-weight: 700; }
.response-code.ok { color: var(--green); background: var(--green-soft); }
.response-code.error { color: var(--red); background: var(--red-soft); }

.result-box {
    min-height: 96px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--surface-soft);
}

.result-box.success { border-color: #bee4d5; background: var(--green-soft); color: #116c4d; }
.result-box.error { border-color: #f0c4cc; background: var(--red-soft); color: #a7253b; }
.result-box.loading { border-color: #c7d7f2; background: var(--blue-soft); color: #2158b7; }
.result-icon { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; border-radius: 50%; color: white; background: #8090a8; font-family: Georgia, serif; font-weight: 700; }
.result-box.success .result-icon { background: var(--green); }
.result-box.error .result-icon { background: var(--red); }
.result-box.loading .result-icon { background: var(--blue); animation: pulse 1s ease-in-out infinite; }
.result-box strong { font-size: 13px; }
.result-box p { margin: 7px 0 0; color: currentColor; opacity: 0.78; font-size: 12px; line-height: 1.75; word-break: break-word; }

.endpoint-list { margin-top: 26px; }
.endpoint-list h3 { margin: 0 0 12px; font-size: 13px; }
.endpoint-row { min-height: 45px; border-top: 1px solid #edf0f5; display: grid; grid-template-columns: 43px minmax(0, 1fr); align-items: center; gap: 9px; }
.endpoint-row:first-of-type { border-top: 0; }
.endpoint-row code { direction: ltr; text-align: left; color: #33435b; font: 11px Consolas, monospace; overflow: hidden; text-overflow: ellipsis; }
.endpoint-row small { grid-column: 2; color: var(--muted); font-size: 10px; margin-top: -11px; }
.method { width: 41px; padding: 4px; border-radius: 6px; direction: ltr; text-align: center; font: 700 9px Consolas, monospace; }
.method.get { color: #2561bd; background: var(--blue-soft); }
.method.put { color: #9d5d0c; background: var(--amber-soft); }

footer {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 0 0 28px;
    display: flex;
    justify-content: space-between;
    color: #8a94a4;
    font-size: 11px;
}

.login-body {
    display: grid;
    min-height: 100vh;
}

.login-shell {
    width: min(100% - 32px, 560px);
    margin: auto;
    padding: 42px 0;
}

.login-card {
    padding: clamp(26px, 5vw, 43px);
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 28px 70px rgba(31, 46, 73, 0.14);
}

.login-brand {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 31px;
}

.login-brand .brand-mark { flex: 0 0 48px; }
.login-brand .eyebrow { margin-top: 2px; margin-bottom: 7px; }
.login-brand h1 { margin: 0; font-size: 25px; letter-spacing: -0.35px; }
.login-brand p:last-child { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

.login-form { margin: 0; }

.login-validation {
    margin-bottom: 18px;
    padding: 11px 13px;
    border: 1px solid #efc4cc;
    border-radius: 11px;
    color: #a7253b;
    background: var(--red-soft);
    font-size: 12px;
}

.login-validation.validation-summary-valid,
.login-validation:empty { display: none; }
.login-validation ul { margin: 0; padding-right: 18px; }

.login-submit {
    width: 100%;
    min-height: 50px;
    margin-top: 2px;
    padding: 0 18px;
    border: 0;
    border-radius: 13px;
    color: white;
    background: linear-gradient(135deg, #2867d5, #204e9b);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    box-shadow: 0 12px 26px rgba(40, 103, 213, 0.22);
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
    transition: transform 0.16s, box-shadow 0.16s;
}

.login-submit:hover { transform: translateY(-1px); box-shadow: 0 15px 30px rgba(40, 103, 213, 0.27); }
.login-submit span { font-size: 18px; }

.login-security-note {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 11px;
}

.login-security-note svg { width: 17px; height: 17px; fill: none; stroke: var(--green); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.login-swagger-link {
    width: fit-content;
    margin: 14px auto 0;
    color: var(--blue);
    display: block;
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
}

.login-swagger-link:hover { text-decoration: underline; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(0.88); opacity: 0.72; } }

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

@media (max-width: 680px) {
    .topbar { height: 68px; padding: 0 16px; }
    .brand small, .text-link { display: none; }
    .logout-button { height: 36px; padding: 0 10px; font-size: 11px; }
    .brand-mark { width: 42px; height: 42px; border-radius: 12px; }
    .shell { width: min(100% - 26px, 1180px); padding-top: 36px; }
    .hero { align-items: flex-start; flex-direction: column; }
    .hero h1 { font-size: 31px; }
    .hero-copy { font-size: 14px; }
    .live-summary { min-width: 0; flex-direction: row; flex-wrap: wrap; }
    .metrics { grid-template-columns: 1fr; }
    .metric-card { min-height: 88px; }
    .control-panel, .activity-panel { padding: 21px 17px; }
    .panel-heading { flex-direction: column; }
    .control-actions { grid-template-columns: 1fr; }
    .field-help-row { align-items: flex-start; flex-direction: column; }
    footer { width: min(100% - 26px, 1180px); flex-direction: column; gap: 7px; }
    .login-shell { width: min(100% - 24px, 560px); padding: 24px 0; }
    .login-card { border-radius: 19px; }
    .login-brand { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
