@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg: #f1f0f7;
    --surface: #ffffff;
    --surface-soft: #f7f6fc;
    --surface-muted: #f1eff8;
    --border: #e7e3f3;
    --ink: #353148;
    --ink-soft: #8c88a2;
    --accent: #a65ce9;
    --accent-strong: #8f46d5;
    --accent-soft: #f0e3ff;
    --teal: #11a796;
    --orange: #f3b441;
    --pink: #ff6e7b;
    --cyan: #49bbe5;
    --shadow-soft: 0 18px 34px rgba(48, 36, 91, 0.06);
    --radius-xl: 26px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Poppins', sans-serif;
    -webkit-font-smoothing: antialiased;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(460px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: var(--shadow-soft);
    padding: 28px;
    display: grid;
    gap: 14px;
}

.login-brand {
    padding: 0;
}

.login-card h1 {
    margin: 0;
    font-size: 1.7rem;
    letter-spacing: -0.01em;
}

.login-card p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.login-form {
    display: grid;
    gap: 12px;
    margin-top: 4px;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 18px;
    padding: 16px;
}

.sidebar {
    background: var(--surface);
    border-radius: 30px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 32px);
    gap: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 10px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    position: relative;
}

.dot {
    position: absolute;
    border-radius: 999px;
}

.dot-a {
    width: 32px;
    height: 32px;
    left: 0;
    top: 16px;
    background: #a65ce9;
}

.dot-b {
    width: 20px;
    height: 20px;
    right: 2px;
    top: 16px;
    background: #8ec7f2;
}

.dot-c {
    width: 12px;
    height: 12px;
    left: 14px;
    top: 0;
    background: #f0d58d;
}

.dot-d {
    width: 16px;
    height: 16px;
    left: 28px;
    top: 0;
    background: #e98b80;
}

.brand-title {
    margin: 0;
    font-size: 2rem;
    line-height: 1;
    letter-spacing: -0.02em;
    font-weight: 700;
}

.brand-subtitle {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: var(--ink-soft);
}

.sidebar-links {
    display: grid;
    gap: 8px;
}

.sidebar-link {
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: #4c4861;
    text-align: left;
    padding: 11px 12px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.sidebar-link:hover {
    border-color: var(--border);
    background: #f9f8fd;
}

.sidebar-link.is-active {
    background: #ede1fd;
    border-color: #ecdfff;
    color: var(--accent-strong);
    font-weight: 600;
}

.link-icon {
    width: 18px;
    height: 18px;
    position: relative;
    display: inline-block;
    opacity: 0.78;
}

.link-icon::before,
.link-icon::after {
    content: '';
    position: absolute;
}

.icon-grid::before {
    inset: 0;
    border: 2px solid #a9a2c0;
    border-radius: 4px;
}

.icon-grid::after {
    left: 8px;
    top: 1px;
    width: 2px;
    height: 14px;
    background: #a9a2c0;
    box-shadow: -6px 0 0 #a9a2c0;
}

.icon-settings::before {
    left: 2px;
    top: 2px;
    width: 14px;
    height: 14px;
    border: 2px solid #a9a2c0;
    border-radius: 999px;
}

.icon-settings::after {
    left: 7px;
    top: -1px;
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, transparent 0%, #a9a2c0 12%, #a9a2c0 22%, transparent 22%, transparent 78%, #a9a2c0 78%, #a9a2c0 88%, transparent 100%);
}

.menu-tree {
    overflow: auto;
    padding-right: 4px;
    flex: 1;
}

.menu-group {
    margin-bottom: 15px;
}

.menu-group h3 {
    margin: 0 0 7px;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: #9d98b5;
    padding-left: 6px;
}

.menu-item {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: #4b4860;
    padding: 9px 10px;
    text-align: left;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.menu-item:hover {
    background: #f7f5fd;
    border-color: #ece7f7;
}

.menu-item.is-active {
    background: #efe4ff;
    border-color: #eadbff;
    color: #8c46d1;
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px 10px 8px;
    border-top: 1px solid #f0edf7;
}

.sidebar-footer p {
    margin: 0;
    font-size: 0.83rem;
    font-weight: 600;
}

.sidebar-footer small {
    margin-top: 4px;
    display: block;
    color: var(--ink-soft);
    font-size: 0.75rem;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
    padding: 2px 6px 2px 2px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 16px;
}

.page-headline h1 {
    margin: 4px 0 0;
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-headline p {
    margin: 6px 0 0;
    color: var(--ink-soft);
    font-size: 0.92rem;
}

.topbar-tools {
    display: none;
}

.search-shell {
    width: min(480px, 47vw);
    position: relative;
    display: block;
}

.search-shell input {
    width: 100%;
    border: 1px solid #ece8f6;
    background: #efedf5;
    height: 56px;
    border-radius: 18px;
    padding: 0 44px 0 16px;
    color: #625d79;
    font-size: 0.92rem;
}

.search-shell input:focus {
    outline: none;
    border-color: #d9cdee;
    background: #f3f0f9;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 16px;
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.search-icon::before {
    content: '';
    position: absolute;
    left: 1px;
    top: 1px;
    width: 12px;
    height: 12px;
    border: 2px solid #6f6b84;
    border-radius: 999px;
}

.search-icon::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 1px;
    width: 8px;
    height: 2px;
    background: #6f6b84;
    transform: rotate(45deg);
    transform-origin: center;
}

.tool-button {
    width: 42px;
    height: 42px;
    border: 1px solid #ebe6f4;
    border-radius: 12px;
    background: var(--surface);
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tool-glyph {
    width: 20px;
    height: 20px;
    position: relative;
    display: inline-block;
}

.tool-glyph::before,
.tool-glyph::after {
    content: '';
    position: absolute;
}

.icon-message .tool-glyph::before {
    left: 1px;
    top: 2px;
    width: 16px;
    height: 12px;
    border: 2px solid #6f6985;
    border-radius: 4px;
}

.icon-message .tool-glyph::after {
    left: 5px;
    top: 14px;
    width: 7px;
    height: 7px;
    border-left: 2px solid #6f6985;
    border-bottom: 2px solid #6f6985;
    transform: skew(-28deg);
}

.icon-bell .tool-glyph::before {
    left: 3px;
    top: 2px;
    width: 14px;
    height: 13px;
    border: 2px solid #6f6985;
    border-radius: 8px 8px 6px 6px;
}

.icon-bell .tool-glyph::after {
    left: 8px;
    bottom: 1px;
    width: 4px;
    height: 4px;
    background: #6f6985;
    border-radius: 999px;
}

.tool-badge {
    position: absolute;
    top: -8px;
    right: -7px;
    min-width: 21px;
    height: 21px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tool-badge.amber {
    background: var(--orange);
}

.tool-badge.cyan {
    background: var(--cyan);
}

.avatar-pill {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(140deg, #48455c, #212133);
    color: #f7f7fb;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
}

.strip-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.strip-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 9px 12px;
    font-size: 0.82rem;
    color: #625e78;
    box-shadow: var(--shadow-soft);
}

.strip-button {
    cursor: pointer;
    font-weight: 600;
    color: #6b6685;
}

.strip-pill.is-ok {
    background: #e8f9f4;
    border-color: #cdece3;
    color: #128d79;
}

.strip-pill.is-missing {
    background: #fff0f3;
    border-color: #f6d3da;
    color: #d46b80;
}

.base-url-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.base-url-pill code {
    font-family: 'JetBrains Mono', monospace;
    color: #4a4660;
    font-size: 0.77rem;
}

.page-view {
    display: none;
}

.page-view.is-active {
    display: block;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.kpi-card {
    border-radius: 20px;
    padding: 16px;
    color: #fff;
    box-shadow: var(--shadow-soft);
}

.kpi-card p {
    margin: 0;
    opacity: 0.92;
    font-size: 0.84rem;
}

.kpi-card strong {
    margin-top: 5px;
    display: block;
    font-size: 1.45rem;
    font-weight: 700;
}

.kpi-card span {
    margin-top: 3px;
    display: block;
    font-size: 0.78rem;
    opacity: 0.86;
}

.kpi-teal {
    background: linear-gradient(135deg, #0cbba2 0%, #11a796 92%);
}

.kpi-orange {
    background: linear-gradient(135deg, #ff8f5d 0%, #f3b441 92%);
}

.kpi-purple {
    background: linear-gradient(135deg, #8a56d6 0%, #5b466f 92%);
}

.panel-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    min-height: 580px;
    display: flex;
    flex-direction: column;
}

.panel-single {
    min-height: 440px;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid #f2eff9;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.55rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.panel-header p {
    margin: 4px 0 0;
    color: var(--ink-soft);
    font-size: 0.84rem;
}

.method-badge {
    border-radius: 999px;
    background: #ecfbf8;
    border: 1px solid #bee9e2;
    color: #108977;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    padding: 6px 10px;
    text-transform: uppercase;
}

.status-pill {
    margin-left: auto;
    border-radius: 999px;
    padding: 7px 11px;
    border: 1px solid #ddd7eb;
    background: #f5f2fc;
    color: #7f7b97;
    font-size: 0.76rem;
    font-weight: 600;
}

.status-pill.status-ok {
    background: #e8f9f5;
    border-color: #c8ece4;
    color: #0f8f79;
}

.status-pill.status-warn {
    background: #fff5e8;
    border-color: #f7dfb8;
    color: #ca8b26;
}

.status-pill.status-error {
    background: #ffecef;
    border-color: #f6cad0;
    color: #db5d72;
}

.panel-body {
    padding: 18px 20px 20px;
    display: grid;
    gap: 16px;
}

.endpoint-info {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.88rem;
}

.form-section {
    display: grid;
    gap: 8px;
}

.form-section h3 {
    margin: 0;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: #968eb1;
}

.params-grid {
    display: grid;
    gap: 9px;
}

.param-row {
    border: 1px solid #ece8f6;
    border-radius: 14px;
    background: #faf9fd;
    padding: 10px;
    display: grid;
    gap: 7px;
}

.param-row label {
    margin: 0;
    font-size: 0.83rem;
    font-weight: 600;
    color: #4f4b64;
    display: flex;
    align-items: center;
    gap: 6px;
}

.required-dot {
    color: #e66d83;
}

.param-meta {
    margin: 0;
    font-size: 0.75rem;
    color: #9892b0;
}

input,
select {
    width: 100%;
    border: 1px solid #e7e2f1;
    background: #ffffff;
    color: #555069;
    border-radius: 10px;
    padding: 10px;
    font-size: 0.88rem;
}

input:focus,
select:focus {
    outline: none;
    border-color: #ccb8eb;
    box-shadow: 0 0 0 3px rgba(166, 92, 233, 0.13);
}

.input-inline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.btn-primary,
.btn-secondary,
.btn-muted {
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.87rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(130deg, #b469ee 0%, #9952de 95%);
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(130deg, #a85ee6 0%, #8d45d2 95%);
}

.btn-primary:disabled {
    opacity: 0.68;
    cursor: wait;
}

.btn-secondary {
    background: #f1eef8;
    color: #5f5a77;
    border: 1px solid #e5def1;
}

.btn-muted {
    background: #f8f6fc;
    color: #7b7693;
    border: 1px solid #ece6f5;
}

.custom-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 8px;
    align-items: end;
}

.response-area {
    padding: 16px 20px 20px;
    display: grid;
    gap: 8px;
    min-height: 0;
    overflow: auto;
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#table-meta {
    margin: 0;
    color: #7a7692;
    font-size: 0.86rem;
}

.table-shell {
    border: 1px solid #ebe6f6;
    border-radius: 14px;
    background: #ffffff;
    padding: 10px;
    overflow: auto;
}

.table-shell .dataTables_wrapper {
    font-size: 0.86rem;
    color: #4f4a66;
}

.table-shell .dataTables_filter input,
.table-shell .dataTables_length select {
    border: 1px solid #ddd7ea;
    border-radius: 8px;
    background: #fff;
    color: #58536e;
    padding: 5px 7px;
    margin-left: 6px;
}

.table-shell table.dataTable {
    border-collapse: collapse !important;
    width: 100% !important;
}

.table-shell table.dataTable thead th {
    background: #f5f2fb;
    color: #625d79;
    border-bottom: 1px solid #e8e2f4 !important;
    font-weight: 600;
    font-size: 0.8rem;
}

.table-shell table.dataTable tbody td {
    border-bottom: 1px solid #f0ecf7;
    color: #49455f;
    font-size: 0.81rem;
    vertical-align: top;
    max-width: 360px;
    word-break: break-word;
}

.table-shell .dataTables_paginate .paginate_button.current {
    border: 1px solid #d8c9ef !important;
    background: #ede1fd !important;
    color: #7e44c7 !important;
    border-radius: 8px;
}

.table-shell .dataTables_paginate .paginate_button:hover {
    border: 1px solid #e1d5f2 !important;
    background: #f6f0ff !important;
    color: #6f40ae !important;
}

.response-area h3 {
    margin: 0;
    color: #8f88a8;
    font-size: 0.74rem;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.response-area pre {
    margin: 0;
    background: #f8f7fd;
    border: 1px solid #eae5f6;
    border-radius: 12px;
    padding: 11px;
    color: #46425b;
    font-size: 0.76rem;
    line-height: 1.45;
    overflow: auto;
    max-height: 290px;
    font-family: 'JetBrains Mono', monospace;
}

.settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

.notes-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 10px;
    color: #615c77;
    font-size: 0.9rem;
}

.notes-list li {
    padding-left: 18px;
    position: relative;
    line-height: 1.45;
}

.notes-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #b270ef;
}

.hint {
    margin: 0;
    font-size: 0.8rem;
    color: #8d88a7;
}

.hint code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.74rem;
}

.message {
    margin: 2px 0 0;
    font-size: 0.9rem;
    min-height: 24px;
}

.message.success {
    color: #0d977f;
}

.message.error {
    color: #dc5d73;
}

@media (max-width: 1320px) {
    .panel-grid {
        grid-template-columns: 1fr;
    }

    .panel {
        min-height: 460px;
    }

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

@media (max-width: 1120px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        min-height: auto;
    }

    .topbar {
        flex-direction: column;
    }

    .topbar-tools {
        width: 100%;
    }

    .search-shell {
        width: 100%;
        max-width: none;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .app-shell {
        padding: 10px;
        gap: 10px;
    }

    .sidebar {
        border-radius: 20px;
    }

    .main-content {
        padding: 0;
        gap: 12px;
    }

    .page-headline h1 {
        font-size: 1.65rem;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
        margin-bottom: 10px;
    }

    .panel-header,
    .panel-body,
    .response-area {
        padding-left: 14px;
        padding-right: 14px;
    }

    .custom-row {
        grid-template-columns: 1fr;
    }

    .strip-row {
        gap: 8px;
    }

    .strip-pill {
        width: 100%;
    }
}
