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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace;
    background: #1e1e2e;
    color: #cdd6f4;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    padding: 0 24px;
    background: linear-gradient(180deg, #1e1e2e 0%, #181825 100%);
    border-bottom: 1px solid #313244;
    position: relative;
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 24px;
    height: 52px;
}

header h1 {
    font-size: 16px;
    color: #cdd6f4;
    letter-spacing: -0.3px;
    white-space: nowrap;
    font-weight: 700;
}

header h1 a {
    color: inherit;
    text-decoration: none;
}

header h1 a:hover {
    opacity: 0.8;
}

header h1 span {
    color: #a6e3a1;
}

header p { font-size: 12px; color: #6c7086; margin-top: 2px; }

nav.page-nav {
    display: flex;
    gap: 6px;
    align-items: center;
    height: 100%;
    padding: 8px 0;
}

nav.page-nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 18px;
    font-size: 13px;
    font-weight: 500;
    color: #6c7086;
    text-decoration: none;
    border-radius: 999px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    background: transparent;
}

nav.page-nav a .nav-icon {
    font-size: 14px;
}

nav.page-nav a:hover {
    color: #cdd6f4;
    background: rgba(205, 214, 244, 0.08);
}

nav.page-nav a.active {
    color: #cdd6f4;
    background: #313244;
    border-color: #45475a;
}

/* Nav dropdown */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-btn {
    display: flex;
    align-items: center;
    padding: 6px 18px;
    font-size: 13px;
    font-weight: 500;
    color: #6c7086;
    text-decoration: none;
    border-radius: 999px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
}

.nav-dropdown-btn:hover {
    color: #cdd6f4;
    background: rgba(205, 214, 244, 0.08);
}

.nav-chevron {
    font-size: 16px;
    line-height: 1;
    vertical-align: middle;
    margin-left: 3px;
}

.nav-dropdown-btn.active {
    color: #cdd6f4;
    background: #313244;
    border-color: #45475a;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: #1e1e2e;
    border: 1px solid #45475a;
    border-radius: 8px;
    padding: 4px;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 300;
}

.nav-dropdown-menu.open {
    display: flex;
    flex-direction: column;
}

.nav-dropdown-menu a {
    padding: 8px 14px !important;
    border-radius: 6px !important;
    font-size: 13px;
    color: #a6adc8;
    text-decoration: none;
    transition: background 0.15s;
}

.nav-dropdown-menu a:hover {
    background: rgba(137, 180, 250, 0.08);
    color: #cdd6f4;
}

.nav-dropdown-menu a.active {
    color: #89b4fa;
    background: rgba(137, 180, 250, 0.06);
}

header select {
    background: #89b4fa;
    color: #1e1e2e;
    border: none;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-left: 4px;
}

header select:hover { background: #74c7ec; }
header select:focus { background: #74c7ec; outline: none; }

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editors {
    display: flex;
    flex: 1;
    min-height: 0;
    max-height: 45vh;
}

.editor-panel {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #313244;
}

.editor-panel:last-child { border-right: none; }

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    min-height: 34px;
    background: #181825;
    border-bottom: 1px solid #313244;
    font-size: 12px;
    color: #a6adc8;
    font-weight: 600;
}

.panel-header button {
    background: #89b4fa;
    color: #1e1e2e;
    border: none;
    padding: 4px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.panel-header button:hover { background: #74c7ec; }

.help-btn {
    background: #45475a !important;
    color: #cdd6f4 !important;
    margin-right: 6px;
}

.help-btn:hover { background: #585b70 !important; }

.help-panel {
    background: #181825;
    border-bottom: 1px solid #313244;
    max-height: 180px;
    overflow-y: auto;
}

.help-table {
    width: auto;
    border-collapse: collapse;
    font-size: 11px;
}

.help-table td {
    padding: 2px 6px;
    vertical-align: top;
}

.help-table td:first-child {
    color: #a6e3a1;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    white-space: nowrap;
}

.help-table td:last-child {
    color: #6c7086;
}

.help-table td.actions {
    color: #f9e2af;
    font-size: 10px;
    font-style: italic;
}

.help-section td {
    color: #89b4fa !important;
    font-weight: 600;
    padding-top: 6px;
}

.help-header td {
    color: #a6adc8 !important;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 4px;
    border-bottom: 1px solid #313244;
}

textarea {
    flex: 1;
    background: #1e1e2e;
    color: #cdd6f4;
    border: none;
    padding: 12px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    outline: none;
    tab-size: 4;
}

.bottom-panels {
    display: flex;
    flex: 1;
    min-height: 200px;
    border-top: none;
}

.drag-handle {
    height: 6px;
    background: #313244;
    cursor: row-resize;
    flex-shrink: 0;
    transition: background 0.15s;
}

.drag-handle:hover, .drag-handle.dragging {
    background: #89b4fa;
}

.output-panel, .fs-panel {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.output-panel { border-right: 1px solid #313244; }

pre {
    flex: 1;
    padding: 10px 12px;
    overflow: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
}

#fs-tree {
    font-size: 13px;
    line-height: 1.7;
    padding: 12px 16px;
    color: #585b70;
}

.fs-dir { color: #89b4fa; font-weight: 600; }
.fs-file { color: #cdd6f4; }
.fs-clickable { cursor: default; transition: color 0.15s; }
.fs-clickable:hover { color: #89b4fa; }
.fs-size { color: #585b70; font-size: 11px; }
.fs-tree-line { white-space: pre; }

.fs-tooltip {
    position: fixed;
    z-index: 300;
    background: #1e1e2e;
    border: 1px solid #45475a;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    min-width: 200px;
    max-height: 50vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.fs-tooltip-path {
    padding: 6px 12px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 11px;
    color: #89b4fa;
    font-weight: 600;
    background: #181825;
    border-bottom: 1px solid #313244;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fs-tooltip-content {
    padding: 8px 12px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 11px;
    line-height: 1.5;
    color: #cdd6f4;
    margin: 0;
    white-space: pre-wrap;
    overflow-y: auto;
    flex: 1;
}

.success { color: #a6e3a1; }
.error { color: #f38ba8; }
.log { color: #94e2d5; }
.info { color: #6c7086; }

/* Floating back-to-top button (used on long docs pages) */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #313244;
    color: #a6adc8;
    border: 1px solid #45475a;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, background 0.15s, color 0.15s;
    z-index: 400;
    font-family: inherit;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.back-to-top:hover {
    background: #45475a;
    color: #cdd6f4;
}

/* Inline hint next to a panel label (e.g. "Cedar Policy — editable") */
.panel-hint {
    color: #6c7086;
    font-weight: 400;
    font-size: 11px;
}

/* GitHub icon link in the main nav header */
.nav-github {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-left: auto;
    color: #6c7086;
    text-decoration: none;
    border-radius: 999px;
    transition: color 0.15s, background 0.15s;
}

.nav-github:hover {
    color: #cdd6f4;
    background: rgba(205, 214, 244, 0.08);
}

.nav-github svg {
    display: block;
}
