:root {
    --bg-app: #0F172A;
    /* Slate 900 */
    --bg-panel: #1E293B;
    /* Slate 800 */
    --bg-input: #0F172A;
    --bg-hover: #334155;
    /* Slate 700 */

    --border: #334155;
    --border-focus: #10B981;
    /* Primary Emerald */

    --text-main: #F8FAFC;
    --text-muted: #94A3B8;

    --primary: #10B981;
    /* Emerald 500 */
    --primary-hover: #059669;
    /* Emerald 600 */

    --m-get: #3B82F6;
    /* Blue */
    --m-post: #10B981;
    /* Emerald */
    --m-put: #F59E0B;
    /* Amber */
    --m-patch: #F59E0B;
    --m-del: #EF4444;
    /* Red */

    --font-sans: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Utilities */
.hidden {
    display: none !important;
}

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

.flex-fill {
    flex-grow: 1;
}

.full-width {
    width: 100%;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.ml-2 {
    margin-left: 0.5rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.pt-0 {
    padding-top: 0;
}

.border-bottom {
    border-bottom: 1px solid var(--border);
}

.text-muted {
    color: var(--text-muted);
}

.fs-sm {
    font-size: 0.85rem;
}

.font-semibold {
    font-weight: 600;
}

.font-mono {
    font-family: var(--font-mono);
}

.d-block {
    display: block;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row {
    display: flex;
    gap: 1rem;
}

.col {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.align-right {
    align-items: flex-end;
}

.flex-end {
    justify-content: flex-end;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
}

.brand h1 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.global-controls {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Layout */
.app-layout {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: var(--bg-app);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.schema-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.schema-item {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    border: 1px solid transparent;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.schema-item:hover {
    background: var(--bg-hover);
}

.schema-item.active {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--primary);
}

.schema-actions {
    display: none;
    gap: 0.25rem;
}

.schema-item:hover .schema-actions {
    display: flex;
}

/* Editor Overlay */
.schema-editor {
    position: absolute;
    inset: 0;
    background: var(--bg-panel);
    z-index: 10;
    display: flex;
    flex-direction: column;
}

.editor-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.editor-header h4 {
    font-size: 1rem;
    font-weight: 600;
}

.fields-list {
    flex-grow: 1;
    overflow-y: auto;
}

.field-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

/* Elements */
.inp {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
    font-family: var(--font-sans);
}

.inp:focus {
    border-color: var(--border-focus);
}

.inp.sm {
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
}

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' width='14' height='14' stroke='%2394A3B8' stroke-width='2' fill='none'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    padding-right: 1.5rem;
    cursor: pointer;
}

.btn {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    background: #475569;
}

.btn.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.btn.primary:hover {
    background: var(--primary-hover);
}

.btn.outline {
    background: transparent;
    border-color: var(--border);
}

.btn.outline:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn.text-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    padding: 0.25rem;
}

.btn.text-btn:hover {
    background: rgba(16, 185, 129, 0.1);
}

.btn.sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.2s;
}

.icon-btn:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-sans);
    text-transform: uppercase;
}

.status-badge {
    background: #334155;
    color: #fff;
}

.status-badge.s200 {
    background: rgba(16, 185, 129, 0.2);
    color: var(--primary);
}

.status-badge.sErr {
    background: rgba(239, 68, 68, 0.2);
    color: var(--m-del);
}

/* Swagger Workspace */
.workspace {
    flex-grow: 1;
    padding: 2rem;
    overflow-y: auto;
    background: var(--bg-app);
}

.workspace-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.workspace-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.api-docs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 1000px;
    margin: 0 auto;
}

.endpoint-block {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-panel);
    overflow: hidden;
    transition: border-color 0.2s;
}

.endpoint-block.m-GET {
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.03);
}

.endpoint-block.m-POST {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.03);
}

.endpoint-header {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    user-select: none;
}

.endpoint-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

.method-badge {
    min-width: 70px;
    text-align: center;
    color: #fff;
}

.m-GET .method-badge {
    background: var(--m-get);
}

.m-POST .method-badge {
    background: var(--m-post);
}

.endpoint-path {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.endpoint-desc {
    font-size: 0.85rem;
}

.toggle-btn {
    transition: transform 0.2s;
}

.endpoint-block.open .toggle-btn {
    transform: rotate(180deg);
}

.endpoint-body {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-app);
}

.params-col {
    font-size: 0.85rem;
}

.params-table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1rem;
}

.params-table th,
.params-table td {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.params-table th {
    color: var(--text-muted);
    font-weight: 500;
    border-top: 1px solid var(--border);
}

.endpoint-response {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

pre.response-pre {
    background: var(--bg-panel);
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
    color: #e2e8f0;
    border: 1px solid var(--border);
}

/* Syntax Highlighting */
.hl-key {
    color: #38bdf8;
}

/* Sky */
.hl-str {
    color: #a3e635;
}

/* Lime */
.hl-num {
    color: #f472b6;
}

/* Pink */
.hl-bool {
    color: #fbbf24;
}

/* Amber */
.hl-null {
    color: var(--text-muted);
    font-style: italic;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    border: 2px dashed var(--border);
    border-radius: 12px;
}