* {
    box-sizing: border-box;
}

.ec-editor {
    position: relative;
    border: 1px solid #303030;
    background: #181818;
}

.ec-editor-label {
    display: block;
    padding: 10px 12px;
    border-bottom: 1px solid #2d2d2d;
    background: #1d1d1d;
    color: #f1f1f1;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.ec-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 1px solid #2d2d2d;
    background: #222222;
}

.ec-toolbar-spacer {
    flex: 1 1 auto;
}

.ec-btn,
.ec-input,
.ec-panel,
.ec-modal-panel,
.ec-dropzone,
.ec-workspace,
.ec-rich,
.ec-bbcode,
.ec-output,
.ec-swatch,
.ec-panel-item,
.ec-emoji-btn,
.submit-btn,
.ec-tools-value,
.ec-meta-item,
.ec-drop-overlay,
.ec-preview-table,
.ec-media-preview,
.ec-media-check,
.ec-domain-chip {
    border-radius: 0;
}

.ec-btn {
    background: #262626;
    color: #e6e6e6;
    border: 1px solid #363636;
    padding: 8px 10px;
    min-width: 44px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.2;
}

.ec-btn:hover,
.ec-panel-item:hover,
.ec-emoji-btn:hover {
    background: #333333;
}

.ec-btn.is-active {
    background: #303030;
    border-color: #5a5a5a;
}

.ec-toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
}

.ec-btn-small {
    min-width: 0;
    padding: 6px 8px;
}

.ec-underline {
    text-decoration: underline;
}

.ec-panels {
    position: relative;
    background: #1c1c1c;
}

.ec-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid #2c2c2c;
    background: #1c1c1c;
}

.ec-panel[hidden],
.ec-modal[hidden] {
    display: none !important;
}

.ec-panel-list {
    gap: 0;
}

.ec-panel-item {
    background: #222222;
    color: #e4e4e4;
    border: 1px solid #303030;
    padding: 8px 10px;
    text-align: left;
    cursor: pointer;
}

.ec-swatch {
    width: 28px;
    height: 28px;
    border: 1px solid #505050;
    cursor: pointer;
    padding: 0;
}

.ec-emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(38px, 1fr));
    gap: 6px;
    width: 100%;
}

.ec-emoji-btn {
    background: #222222;
    color: #ffffff;
    border: 1px solid #303030;
    padding: 8px 0;
    cursor: pointer;
    text-align: center;
}

.ec-workspace {
    position: relative;
    background: #111111;
    border-bottom: 1px solid #2c2c2c;
    min-height: var(--ec-editor-height, 260px);
}

.ec-workspace.is-dragover {
    outline: 1px dashed #7a7a7a;
    outline-offset: -1px;
    background: transparent;
}

.ec-drop-overlay {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 220px;
    background: #0f0f0f;
    border: 1px solid #505050;
    color: #f0f0f0;
    font-size: 12px;
    text-align: center;
    padding: 6px 9px;
    pointer-events: none;
    opacity: 0.96;
}

.ec-rich,
.ec-bbcode {
    width: 100%;
    min-height: var(--ec-editor-height, 260px);
    height: var(--ec-editor-height, 260px);
    background: #111111;
    color: #ececec;
    border: 0;
    padding: 12px;
    outline: none;
    resize: vertical;
    font-size: 14px;
    line-height: 1.5;
}

.ec-rich {
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.ec-rich[data-placeholder]:empty::before {
    content: attr(data-placeholder);
    color: #777777;
}

.ec-bbcode {
    font-family: Consolas, "Courier New", monospace;
    display: none;
}

.ec-footer {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #1b1b1b;
}

.ec-footer-left,
.ec-footer-center,
.ec-footer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ec-footer-center {
    justify-content: center;
}

.ec-footer-actions {
    justify-content: flex-end;
}

.ec-status {
    color: #b9b9b9;
    font-size: 12px;
}

.ec-meta-item {
    color: #d6d6d6;
    font-size: 12px;
    border: 1px solid #303030;
    background: #141414;
    padding: 5px 8px;
}

.ec-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
}

.ec-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
}

.ec-modal-panel {
    position: relative;
    z-index: 1;
    width: min(860px, calc(100vw - 32px));
    margin: 40px auto;
    background: #171717;
    border: 1px solid #353535;
}

.ec-modal-header,
.ec-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid #2e2e2e;
    background: #1d1d1d;
}

.ec-modal-footer {
    border-top: 1px solid #2e2e2e;
    border-bottom: 0;
}

.ec-modal-title {
    color: #f1f1f1;
    font-size: 15px;
    font-weight: 700;
}

.ec-modal-body {
    padding: 12px;
}

.ec-modal-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    gap: 14px;
}

.ec-modal-col {
    min-width: 0;
}

.ec-modal-row {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
}

.ec-modal-row:last-child {
    margin-bottom: 0;
}

.ec-modal-row-block {
    border: 1px solid #2f2f2f;
    background: #101010;
    padding: 10px;
}

.ec-modal-label {
    color: #cfcfcf;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.ec-input {
    width: 100%;
    background: #101010;
    color: #ececec;
    border: 1px solid #363636;
    padding: 9px 10px;
}

.ec-dropzone,
.ec-media-preview,
.ec-media-check {
    border: 1px solid #343434;
    background: #101010;
    padding: 12px;
    color: #d6d6d6;
}

.ec-dropzone {
    min-height: 86px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ec-media-check.is-valid {
    color: #a6f0a2;
    border-color: #295829;
}

.ec-media-check.is-invalid {
    color: #ff9b9b;
    border-color: #6a2c2c;
}

.ec-media-preview {
    min-height: 190px;
    overflow: auto;
}

.ec-media-help {
    margin-top: 10px;
    color: #a8a8a8;
    font-size: 12px;
    line-height: 1.45;
}

.ec-approved-domains {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ec-domain-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid #343434;
    background: #111111;
    color: #dfdfdf;
    padding: 6px 8px;
    font-size: 12px;
}

.ec-tools-value {
    border: 1px solid #343434;
    background: #0f0f0f;
    color: #e4e4e4;
    padding: 8px 10px;
}

.ec-tools-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ec-preview-table {
    width: 100%;
    border-collapse: collapse;
    margin: 4px 0;
}

.ec-preview-table td {
    border: 1px solid #5a5a5a;
    padding: 6px 8px;
}

.ec-image-preview,
.ec-video-preview {
    display: block;
    max-width: 100%;
    border: 1px solid #323232;
    background: #090909;
}

.ec-video-preview {
    width: 100%;
    max-height: 280px;
}

.ec-media-chip {
    display: inline-block;
    border: 1px solid #3a3a3a;
    background: #0f0f0f;
    color: #f0f0f0;
    padding: 6px 8px;
}

.bb-spoiler {
    background: #2b2b2b;
    color: #2b2b2b;
    padding: 2px 4px;
}

.bb-spoiler:hover {
    color: #f0f0f0;
}

blockquote,
pre {
    margin: 6px 0;
    padding: 10px;
    border-left: 3px solid #4a4a4a;
    background: #0e0e0e;
}

@media (max-width: 900px) {
    .ec-modal-grid,
    .ec-footer {
        grid-template-columns: 1fr;
    }

    .ec-footer-center,
    .ec-footer-actions {
        justify-content: flex-start;
    }
}


.ec-editor:focus-within {
    border-color: #4a4a4a;
}
