:root {
    --bg-dark: #0d1117;
    --bg-panel: #161b22;
    --bg-input: #0d1117;
    --bg-hover: #21262d;

    --border: #30363d;
    --text-main: #c9d1d9;
    --text-muted: #8b949e;

    --primary: #238636;
    --primary-hover: #2ea043;

    --m-get: #58a6ff;
    --m-post: #3fb950;
    --m-put: #d29922;
    --m-patch: #e3b341;
    --m-del: #f85149;

    --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-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    font-size: 0.9rem;
}

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

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

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

.full-width {
    width: 100%;
}

.full-height {
    height: 100%;
}

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

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

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

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

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

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

.p-4 {
    padding: 1rem;
}

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

.text-left {
    text-align: left;
}

.w-full {
    width: 100%;
}

.relative {
    position: relative;
}

/* Layout */
.app-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    border-right: 1px solid var(--border);
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

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

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

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

.history-item {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.1s;
}

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

.hist-method {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    width: 45px;
}

.hist-url {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    color: var(--text-muted);
}

/* Method Colors */
.m-GET {
    color: var(--m-get);
}

.m-POST {
    color: var(--m-post);
}

.m-PUT {
    color: var(--m-put);
}

.m-PATCH {
    color: var(--m-patch);
}

.m-DELETE {
    color: var(--m-del);
}

/* Workspace */
.workspace {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.request-bar {
    display: flex;
    padding: 1rem;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-panel);
    align-items: stretch;
}

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

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

.inp.select {
    font-family: var(--font-sans);
    cursor: pointer;
    font-weight: 600;
    appearance: none;
    padding-right: 1.5rem;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' width='14' height='14' stroke='%238b949e' 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;
}

.method-select {
    width: 110px;
}

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

.btn:hover {
    background: #30363d;
}

.btn.primary {
    background: var(--primary);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.1);
    font-weight: 600;
    padding: 0.5rem 1.5rem;
}

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

.btn.ghost {
    background: transparent;
    border-color: transparent;
}

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

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

.btn.text-btn:hover {
    background: rgba(88, 166, 255, 0.1);
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
}

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

/* Panels */
.panels-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}

.panel {
    display: flex;
    flex-direction: column;
    min-height: 100px;
    flex: 1;
}

.scroll-y {
    overflow-y: auto;
    padding: 1rem;
}

/* Resizer */
.resizer {
    height: 4px;
    background: var(--border);
    cursor: row-resize;
    transition: background 0.2s;
}

.resizer:hover,
.resizer:active {
    background: var(--m-get);
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 1rem;
    gap: 1.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.75rem 0;
    cursor: pointer;
    position: relative;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--text-main);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-pane {
    display: none;
    height: 100%;
    flex-direction: column;
}

.tab-pane.active {
    display: flex;
}

.badge {
    background: var(--bg-hover);
    color: var(--text-main);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.7rem;
}

/* KV Editor */
.kv-editor {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.kv-header {
    display: grid;
    grid-template-columns: 1fr 1fr 30px;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.kv-row {
    display: grid;
    grid-template-columns: 1fr 1fr 30px;
    gap: 0.5rem;
    align-items: center;
}

/* Forms */
.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.split-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.radio-group {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    color: var(--text-muted);
}

.radio-group input {
    accent-color: var(--primary);
}

.code-editor {
    width: 100%;
    height: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: #e6edf3;
    padding: 1rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    resize: none;
    outline: none;
    flex-grow: 1;
    min-height: 200px;
}

.code-editor:focus {
    border-color: var(--m-get);
}

/* Response Meta */
.response-meta {
    display: flex;
    gap: 1rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    align-items: center;
    padding-right: 1rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.status {
    font-weight: 700;
}

.status.s2xx {
    color: var(--m-post);
}

.status.s3xx {
    color: var(--m-patch);
}

.status.s4xx {
    color: var(--m-put);
}

.status.s5xx {
    color: var(--m-del);
}

.status.sErr {
    color: var(--m-del);
}

/* Loader */
.loader-overlay {
    position: absolute;
    inset: 0;
    background: rgba(13, 17, 23, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(88, 166, 255, 0.2);
    border-top-color: var(--m-get);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    opacity: 0.6;
}

/* Code response */
pre {
    background: transparent;
    padding: 0.5rem;
    margin: 0;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    overflow-x: auto;
    color: #e6edf3;
}

.code-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--bg-panel);
    border-radius: 6px;
}

.headers-table {
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

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

.headers-table th {
    color: var(--text-muted);
    font-weight: 600;
    background: var(--bg-hover);
}

/* Syntax */
.json-key {
    color: #79c0ff;
}

.json-str {
    color: #a5d6ff;
}

.json-num {
    color: #79c0ff;
}

.json-bool {
    color: #ff7b72;
}

.json-null {
    color: var(--text-muted);
    font-style: italic;
}