.fc-workspace-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--fc-line);
}

.fc-workspace-toolbar h2 {
    margin: 0;
    font-size: 1.22rem;
}

.fc-workspace-toolbar p {
    margin: 4px 0 0;
}

.fc-workspace-header {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(280px, 520px) auto;
    align-items: end;
    gap: 18px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--fc-line);
}

.fc-workspace-header h1,
.fc-workspace-header h2 {
    margin: 0;
    font-size: clamp(1.35rem, 2.4vw, 2rem);
    letter-spacing: -0.03em;
}

.fc-workspace-header p {
    margin: 4px 0 0;
}

.fc-workspace-content {
    min-width: 0;
    padding: 18px;
}

.fc-workspace-page .fc-workspace-content {
    padding: 20px;
}

.fc-cell-value {
    display: block;
    min-height: 70px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--fc-text);
    cursor: default;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.fc-cell-value:hover {
    border-color: color-mix(in srgb, var(--fc-secondary) 35%, transparent);
    background: color-mix(in srgb, var(--fc-primary) 8%, transparent);
}

.fc-cell-value::after {
    content: "Double-click to edit";
    display: block;
    margin-top: 5px;
    color: var(--fc-muted);
    font-size: 0.72rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.fc-cell-value:hover::after,
.fc-cell-value:focus-visible::after {
    opacity: 1;
}

.fc-grid-wrap {
    width: 100%;
    overflow: auto;
    border: 1px solid var(--fc-line);
    border-radius: 10px;
}

.fc-grid {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
}

.fc-grid th,
.fc-grid td {
    min-width: 150px;
    max-width: 360px;
    border-right: 1px solid var(--fc-line);
    border-bottom: 1px solid var(--fc-line);
    padding: 0;
    vertical-align: top;
}

.fc-grid th:last-child,
.fc-grid td:last-child {
    border-right: 0;
}

.fc-grid tr:last-child td {
    border-bottom: 0;
}

.fc-grid th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 11px 12px;
    background: var(--fc-panel-soft);
    color: var(--fc-text);
    font-size: 0.88rem;
    text-align: left;
    white-space: nowrap;
}

.fc-grid th span {
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

.fc-grid td input,
.fc-grid td textarea,
.fc-grid td select {
    min-width: 150px;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.fc-grid td select {
    min-height: 70px;
    color: var(--fc-text) !important;
    background-color: var(--fc-bg) !important;
    color-scheme: dark;
}

.fc-grid td textarea {
    min-height: 70px;
}

.fc-grid td .fc-system-cell {
    background: color-mix(in srgb, var(--fc-primary) 14%, var(--fc-panel));
}

.fc-grid-empty {
    padding: 22px;
    color: var(--fc-muted);
    text-align: center;
}

.fc-text-editor {
    width: 100%;
    min-height: 430px;
    font: 0.9rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre;
}

.fc-empty-state {
    padding: 42px 20px;
    color: var(--fc-muted);
    text-align: center;
}

.fc-empty-state strong {
    display: block;
    margin-bottom: 6px;
    color: var(--fc-text);
}

.fc-empty-state p {
    margin: 5px 0 16px;
}

.fc-alert {
    margin-bottom: 18px;
    border: 1px solid color-mix(in srgb, var(--fc-danger) 45%, transparent);
    border-radius: 10px;
    padding: 12px 14px;
    background: color-mix(in srgb, var(--fc-danger) 24%, var(--fc-panel));
    color: var(--fc-danger);
}

.fc-alert.fc-success {
    border-color: color-mix(in srgb, var(--fc-success) 40%, transparent);
    background: color-mix(in srgb, var(--fc-success) 16%, var(--fc-panel));
    color: var(--fc-success);
}

.fc-alert.fc-warning {
    border-color: color-mix(in srgb, var(--fc-warning) 40%, transparent);
    background: color-mix(in srgb, var(--fc-warning) 18%, var(--fc-panel));
    color: var(--fc-warning);
}

.fc-status {
    min-height: 24px;
    margin-top: 14px;
    color: var(--fc-muted);
}

.fc-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
    background: color-mix(in srgb, var(--fc-bg-deep) 78%, transparent);
}

.fc-modal {
    width: min(620px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    background: var(--fc-panel);
    border: 1px solid var(--fc-line);
    border-radius: 16px;
    box-shadow: var(--fc-shadow);
}

.fc-modal-header,
.fc-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
}

.fc-modal-header {
    border-bottom: 1px solid var(--fc-line);
}

.fc-modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.fc-modal-body {
    padding: 18px;
}

.fc-modal-body textarea {
    min-height: 220px;
    resize: vertical;
    white-space: pre-wrap;
}

.fc-modal-footer {
    justify-content: flex-end;
    border-top: 1px solid var(--fc-line);
}

.fc-tree-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.fc-tree-toolbar p {
    margin: 0;
    color: var(--fc-muted);
}

.fc-tree-list,
.fc-tree-children {
    display: grid;
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.fc-tree {
    min-width: 0;
    padding: 4px 0;
}

.fc-tree-children {
    position: relative;
    margin: 7px 0 0 18px;
    padding-left: 20px;
}

.fc-tree-children::before {
    position: absolute;
    top: -7px;
    bottom: 18px;
    left: 4px;
    width: 1px;
    background: var(--fc-line);
    content: "";
}

.fc-tree-node {
    min-width: 0;
}

.fc-tree-node-row {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--fc-line);
    border-radius: 10px;
    background: color-mix(in srgb, var(--fc-panel-soft) 88%, transparent);
    cursor: default;
}

.fc-tree-node-row:hover,
.fc-tree-node-row:focus-within {
    border-color: color-mix(in srgb, var(--fc-secondary) 48%, transparent);
    background: color-mix(in srgb, var(--fc-primary) 24%, var(--fc-panel-soft));
}

.fc-tree-children .fc-tree-node-row::before {
    position: absolute;
    top: 19px;
    left: -21px;
    width: 21px;
    height: 1px;
    background: var(--fc-line);
    content: "";
}

.fc-tree-toggle {
    display: inline-flex;
    flex: 0 0 28px;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-height: 28px;
    margin: 0;
    padding: 2px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--fc-secondary);
    font-size: 1rem;
    line-height: 1;
}

.fc-tree-toggle:hover {
    border-color: var(--fc-line);
    background: color-mix(in srgb, var(--fc-primary) 12%, transparent);
}

.fc-tree-toggle.is-leaf {
    visibility: hidden;
    pointer-events: none;
}

.fc-tree-label {
    display: block;
    min-width: 0;
    flex: 1;
    padding: 2px 0;
    color: var(--fc-text);
    cursor: pointer;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.fc-tree-label strong {
    display: block;
    font-size: 0.96rem;
}

.fc-tree-label small {
    display: block;
    margin-top: 2px;
    color: var(--fc-muted);
    font-size: 0.78rem;
}

.fc-tree-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px 14px;
    margin: 8px 0 0 36px;
    padding: 10px 12px;
    border-left: 2px solid color-mix(in srgb, var(--fc-secondary) 28%, transparent);
    color: var(--fc-muted);
    font-size: 0.84rem;
}

.fc-tree-detail {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.fc-tree-detail strong {
    display: block;
    margin-bottom: 2px;
    color: var(--fc-text);
    font-size: 0.76rem;
}

.fc-tree-node.is-collapsed > .fc-tree-children {
    display: none;
}

.fc-tree-empty {
    padding: 22px;
    border: 1px dashed var(--fc-line);
    border-radius: 10px;
    color: var(--fc-muted);
    text-align: center;
}

@media (max-width: 1100px) {
    .fc-workspace-header {
        grid-template-columns: minmax(200px, 1fr) minmax(240px, 1fr);
    }
}

@media (max-width: 640px) {
    .fc-workspace-toolbar,
    .fc-tree-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .fc-workspace-header {
        display: flex;
        align-items: stretch;
        flex-direction: column;
        gap: 13px;
        padding: 16px;
    }

    .fc-workspace-content {
        padding: 12px;
    }

    .fc-tree-children {
        margin-left: 10px;
        padding-left: 14px;
    }

    .fc-tree-children .fc-tree-node-row::before {
        left: -15px;
        width: 15px;
    }

    .fc-tree-details {
        grid-template-columns: 1fr;
        margin-left: 36px;
    }
}