.fmt {
    --fmt-accent: #c9a227;
    --fmt-accent-soft: #fdf8c8;
    --fmt-border: #d9d8e2;
    --fmt-border-strong: #b6b5c4;
    --fmt-surface: #fff;
    --fmt-muted: #6b6a78;
    --fmt-danger: #b42318;
    --fmt-danger-bg: #fdecea;
    --fmt-ok: #15803d;
    --fmt-ok-bg: #eaf7ee;
    --fmt-warn: #92400e;
    --fmt-warn-bg: #fdf3e3;
    --fmt-info: #1d4ed8;
    --fmt-info-bg: #eaf0fd;
    --fmt-py: #1d4ed8;
    --fmt-py-bg: #eaf0fd;
    --fmt-radius: 10px;
    --fmt-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

    max-width: 1100px;
    margin: 0 auto 2rem;
}

.fmt [hidden] {
    display: none !important;
}

.fmt-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
    background: var(--fmt-surface);
    border: 1px solid var(--fmt-border);
    border-radius: var(--fmt-radius);
    padding: 0.9rem 1rem;
    margin-bottom: 0.9rem;
}

.fmt-toolbar-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem 1.25rem;
    align-items: flex-start;
}

.fmt-toolbar-actions {
    align-items: center;
    margin-left: auto;
}

.fmt-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.fmt-field-label {
    font-size: 0.82rem;
    color: var(--fmt-muted);
}

.fmt-select {
    border: 1px solid var(--fmt-border-strong);
    border-radius: 6px;
    padding: 0.4rem 0.5rem;
    background: var(--fmt-surface);
    font: inherit;
    min-height: 36px;
}

.fmt-check {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.1rem 0.5rem;
    align-items: center;
    max-width: 22rem;
    cursor: pointer;
}

.fmt-check input {
    grid-row: 1;
    width: 16px;
    height: 16px;
    margin: 0;
}

.fmt-hint {
    grid-column: 2;
    font-size: 0.875rem;
    color: var(--fmt-muted);
    line-height: 1.4;
}

.fmt-btn,
.fmt-file-btn {
    border: 1px solid var(--fmt-border-strong);
    border-radius: 6px;
    background: var(--fmt-surface);
    color: inherit;
    font: inherit;
    padding: 0.45rem 0.85rem;
    min-height: 36px;
    cursor: pointer;
}

.fmt-btn:hover:not(:disabled),
.fmt-file-btn:hover {
    border-color: var(--fmt-accent);
    background: var(--fmt-accent-soft);
}

.fmt-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.fmt-btn-quiet {
    color: var(--fmt-muted);
}

.fmt-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.fmt-file-btn:focus-within,
.fmt-file-input:focus + .fmt-file-btn {
    outline: 2px solid var(--focus-otl-color, var(--fmt-accent));
    outline-offset: 2px;
}

.fmt-banner,
.fmt-error {
    border: 1px solid var(--fmt-border);
    border-left-width: 4px;
    border-radius: var(--fmt-radius);
    padding: 0.8rem 1rem;
    margin-bottom: 0.9rem;
}

.fmt-banner-title {
    margin: 0 0 0.35rem;
    font-weight: 600;
}

.fmt-banner-list {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--fmt-muted);
    font-size: 0.88rem;
    line-height: 1.6;
}

.fmt-banner-lang {
    border-left-color: var(--fmt-py);
    background: var(--fmt-py-bg);
}

.fmt-banner-lang .fmt-banner-title {
    color: var(--fmt-py);
}

.fmt-banner-loose {
    border-left-color: var(--fmt-warn);
    background: var(--fmt-warn-bg);
}

.fmt-banner-loose .fmt-banner-title {
    color: var(--fmt-warn);
}

.fmt-banner-ok {
    border-left-color: var(--fmt-ok);
    background: var(--fmt-ok-bg);
}

.fmt-banner-ok .fmt-banner-title {
    color: var(--fmt-ok);
}

.fmt-error {
    border-left-color: var(--fmt-danger);
    background: var(--fmt-danger-bg);
}

.fmt-error-title {
    margin: 0;
    color: var(--fmt-danger);
    font-weight: 600;
}

.fmt-error-code {
    margin: 0.5rem 0 0;
    padding: 0.6rem 0.75rem;
    background: var(--fmt-surface);
    border: 1px solid var(--fmt-border);
    border-radius: 6px;
    font-family: var(--fmt-mono);
    font-size: 0.85rem;
    line-height: 1.45;
    overflow-x: auto;
    white-space: pre;
}

.fmt-panes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
}

.fmt-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.fmt-pane-title {
    font-size: 0.82rem;
    color: var(--fmt-muted);
    margin-bottom: 0.3rem;
}

.fmt-pane-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.fmt-pane-head .fmt-pane-title {
    margin-bottom: 0;
}

.fmt-views {
    display: flex;
    gap: 0.25rem;
}

.fmt-view {
    border: 1px solid var(--fmt-border-strong);
    background: var(--fmt-surface);
    color: var(--fmt-muted);
    font: inherit;
    font-size: 0.8rem;
    padding: 0.2rem 0.7rem;
    min-height: 28px;
    border-radius: 999px;
    cursor: pointer;
}

.fmt-view:hover {
    border-color: var(--fmt-accent);
}

.fmt-view.is-active {
    background: var(--fmt-accent-soft);
    border-color: var(--fmt-accent);
    color: inherit;
    font-weight: 600;
}

.fmt-tree {
    overflow: auto;
    white-space: normal;
}

.fmt-node {
    line-height: 1.55;
}

.fmt-branch-body {
    padding-left: 1.1rem;
    border-left: 1px dotted var(--fmt-border-strong);
    margin-left: 0.3rem;
}

.fmt-branch > summary {
    cursor: pointer;
    list-style: revert;
}

.fmt-node-meta {
    color: var(--fmt-muted);
    font-size: 0.82rem;
}

.fmt-area {
    width: 100%;
    min-height: 22rem;
    resize: vertical;
    border: 1px solid var(--fmt-border-strong);
    border-radius: var(--fmt-radius);
    padding: 0.75rem;
    background: var(--fmt-surface);
    color: inherit;
    font-family: var(--fmt-mono);
    font-size: 0.86rem;
    line-height: 1.55;
    tab-size: 2;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}

.fmt-area:focus {
    outline: 2px solid var(--focus-otl-color, var(--fmt-accent));
    outline-offset: 1px;
}

.fmt-area-wrap {
    --fmt-gutter-w: 3ch;
    position: relative;
    min-width: 0;
    border: 1px solid var(--fmt-border-strong);
    border-radius: var(--fmt-radius);
    background: var(--fmt-surface);
    overflow: hidden;
}

.fmt-area-wrap:focus-within {
    outline: 2px solid var(--focus-otl-color, var(--fmt-accent));
    outline-offset: 1px;
}

.fmt-area-wrap > .fmt-area {
    display: block;
    border: 0;
    border-radius: 0;
    padding-left: calc(var(--fmt-gutter-w) + 1.8rem);
}

.fmt-area-wrap > .fmt-area:focus {
    outline: 0;
}

.fmt-area-wrap:has(> .fmt-area[hidden]) {
    display: none;
}

.fmt-gutter {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--fmt-gutter-w);
    padding: 0.75rem 0.45rem 0.75rem 0.6rem;
    box-sizing: content-box;
    border-right: 1px solid var(--fmt-border);
    background: #faf9fb;
    color: var(--fmt-muted);
    font-family: var(--fmt-mono);
    font-size: 0.86rem;
    line-height: 1.55;
    text-align: right;
    white-space: pre;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.fmt-stats {
    margin: 0.6rem 0 0;
    font-size: 0.84rem;
    color: var(--fmt-muted);
    min-height: 1.2em;
}

.fmt-samples {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.8rem;
}

.fmt-samples-label {
    font-size: 0.84rem;
    color: var(--fmt-muted);
}

.fmt-sample {
    border: 1px dashed var(--fmt-border-strong);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.82rem;
    padding: 0.3rem 0.8rem;
    min-height: 32px;
    cursor: pointer;
}

.fmt-sample:hover {
    border-style: solid;
    border-color: var(--fmt-accent);
    background: var(--fmt-accent-soft);
}

.fmt-privacy {
    margin: 1.1rem 0 0;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--fmt-border);
    border-radius: var(--fmt-radius);
    background: var(--fmt-surface);
    color: var(--fmt-muted);
    font-size: 0.86rem;
    line-height: 1.55;
}

.fmt-privacy .fa {
    color: var(--fmt-ok);
    margin-right: 0.35rem;
}

.fmt-about h3 {
    margin-top: 1.4rem;
}

@media (max-width: 860px) {
    .fmt-panes {
        grid-template-columns: 1fr;
    }

    .fmt-area {
        min-height: 15rem;
    }

    .fmt-toolbar-actions {
        margin-left: 0;
    }
}

.fmt-banner-list:empty {
    display: none;
}

.fmt-banner-warn {
    border-left-color: var(--fmt-warn);
    background: var(--fmt-warn-bg);
}

.fmt-banner-warn .fmt-banner-title {
    color: var(--fmt-warn);
}

.fmt-banner-err {
    border-left-color: var(--fmt-danger);
    background: var(--fmt-danger-bg);
}

.fmt-banner-err .fmt-banner-title {
    color: var(--fmt-danger);
}

.fmt-report {
    margin-top: 0.9rem;
    border: 1px solid var(--fmt-border);
    border-radius: var(--fmt-radius);
    background: var(--fmt-surface);
    padding: 0.8rem 1rem;
}

.fmt-report-title {
    margin: 0 0 0.5rem;
    font-weight: 600;
}

.fmt-report-list {
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 22rem;
    overflow-y: auto;
    font-family: var(--fmt-mono);
    font-size: 0.82rem;
    line-height: 1.6;
}

.fmt-report-list li {
    padding: 0.15rem 0 0.15rem 0.6rem;
    border-left: 3px solid transparent;
}

.fmt-lvl-tehlike {
    border-left-color: var(--fmt-danger);
    color: var(--fmt-danger);
    font-weight: 600;
    background: var(--fmt-danger-bg);
}

.fmt-lvl-hata {
    border-left-color: var(--fmt-danger);
    color: var(--fmt-danger);
}

.fmt-lvl-uyari {
    border-left-color: var(--fmt-warn);
    color: var(--fmt-warn);
}

.fmt-lvl-bilgi {
    border-left-color: var(--fmt-border-strong);
    color: var(--fmt-muted);
}
