/* My AI Word Editor — Core v1.1.0 */

.maiw-wrap,
.maiw-wrap *{
    box-sizing:border-box;
}

.maiw-wrap{
    max-width:1500px;
    margin:20px auto;
    border:1px solid #d1d5db;
    border-radius:16px;
    background:#fff;
    font-family:Arial, sans-serif;
    overflow:hidden;
    color:#111827;
}

.maiw-top{
    background:#1f2937;
    color:#fff;
    padding:14px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    font-size:22px;
    font-weight:bold;
}

.maiw-version{
    font-size:12px;
    opacity:.75;
    margin-left:8px;
}

.maiw-top-actions{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
}

.maiw-titlebar{
    padding:10px;
    border-bottom:1px solid #d1d5db;
    background:#f9fafb;
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
}

.maiw-titlebar label{
    font-weight:bold;
}

.maiw-toolbar{
    padding:10px;
    border-bottom:1px solid #d1d5db;
    background:#f3f4f6;
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    align-items:center;
}

.maiw-tool,
.maiw-btn{
    background:#2563eb;
    color:#fff;
    border:none;
    border-radius:8px;
    padding:8px 12px;
    cursor:pointer;
    font-size:14px;
    line-height:1.1;
    text-decoration:none;
    min-height:34px;
}

.maiw-tool:hover,
.maiw-btn:hover{
    background:#1d4ed8;
}

.maiw-btn.secondary,
.maiw-tool.secondary{
    background:#374151;
}

.maiw-btn.secondary:hover,
.maiw-tool.secondary:hover{
    background:#111827;
}

.maiw-btn.danger{
    background:#dc2626;
}

.maiw-btn.danger:hover{
    background:#991b1b;
}

.maiw-btn.wide{
    width:100%;
    display:block;
    margin-top:8px;
}

.maiw-save-btn{
    background:#16a34a;
}

.maiw-save-btn:hover{
    background:#15803d;
}

.maiw-input,
.maiw-select,
.maiw-textarea{
    padding:8px;
    border-radius:8px;
    border:1px solid #cbd5e1;
    background:#fff;
    font-size:14px;
    max-width:100%;
}

.maiw-input.wide,
.maiw-textarea.wide{
    width:100%;
}

.maiw-textarea{
    width:100%;
    resize:vertical;
    min-height:80px;
}

.maiw-color-label{
    display:flex;
    align-items:center;
    gap:5px;
    font-size:12px;
    color:#111827;
}

.maiw-color{
    width:42px;
    height:34px;
    border:1px solid #cbd5e1;
    border-radius:8px;
    padding:2px;
    background:#fff;
    cursor:pointer;
}

.maiw-divider{
    width:1px;
    height:32px;
    background:#cbd5e1;
    margin:0 2px;
}

.maiw-main{
    display:flex;
    min-height:680px;
}

.maiw-sidebar{
    width:310px;
    border-right:1px solid #d1d5db;
    padding:10px;
    background:#f9fafb;
    overflow:auto;
}

.maiw-panel{
    border:1px solid #e5e7eb;
    background:#fff;
    border-radius:12px;
    padding:12px;
    margin-bottom:12px;
}

.maiw-panel h3{
    margin:0 0 10px;
    font-size:17px;
}

.maiw-panel label{
    display:block;
    font-size:13px;
    font-weight:bold;
    margin:8px 0 4px;
}

.maiw-editor-shell{
    flex:1;
    padding:30px;
    background:#eef2f7;
    overflow:auto;
}

.maiw-editor{
    background:#fff;
    padding:44px;
    border-radius:10px;
    min-height:620px;
    outline:none;
    border:1px solid #d1d5db;
    color:#111827;
    line-height:1.65;
    max-width:900px;
    margin:0 auto;
    box-shadow:0 12px 32px rgba(15,23,42,.08);
}

.maiw-editor:focus{
    border-color:#2563eb;
    box-shadow:0 0 0 3px rgba(37,99,235,.15), 0 12px 32px rgba(15,23,42,.08);
}

.maiw-editor img{
    max-width:100%;
    height:auto;
    border-radius:8px;
}

.maiw-editor table{
    width:100%;
    border-collapse:collapse;
}

.maiw-editor td,
.maiw-editor th{
    border:1px solid #d1d5db;
    padding:6px;
}

.maiw-ai-actions{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    margin-top:8px;
}

.maiw-ai-output{
    min-height:90px;
    max-height:220px;
    overflow:auto;
    padding:10px;
    border:1px solid #d1d5db;
    border-radius:8px;
    background:#f9fafb;
    font-size:13px;
    margin-top:10px;
}

.maiw-small-status,
.maiw-save-status{
    font-size:12px;
    color:#4b5563;
}

.maiw-save-status.good{
    color:#15803d;
    font-weight:bold;
}

.maiw-save-status.bad{
    color:#dc2626;
    font-weight:bold;
}

.maiw-token-grid{
    display:grid;
    grid-template-columns:1fr auto;
    gap:6px 10px;
    font-size:13px;
}

.maiw-token-grid strong{
    text-align:right;
}

.maiw-login-required{
    max-width:600px;
    margin:20px auto;
    padding:16px;
    background:#fff3cd;
    border:1px solid #ffecb5;
    border-radius:10px;
}

@media(max-width:900px){
    .maiw-wrap{
        margin:0;
        border-radius:0;
        border-left:none;
        border-right:none;
    }

    .maiw-top{
        font-size:18px;
        align-items:flex-start;
        flex-direction:column;
    }

    .maiw-top-actions{
        width:100%;
    }

    .maiw-top-actions .maiw-btn{
        flex:1;
    }

    .maiw-main{
        flex-direction:column;
    }

    .maiw-sidebar{
        width:100%;
        border-right:none;
        border-bottom:1px solid #d1d5db;
        max-height:none;
    }

    .maiw-editor-shell{
        padding:12px;
    }

    .maiw-editor{
        max-width:none;
        padding:20px;
        min-height:480px;
    }

    .maiw-toolbar{
        gap:6px;
        overflow-x:auto;
    }

    .maiw-tool,
    .maiw-btn,
    .maiw-input,
    .maiw-select{
        font-size:13px;
        padding:7px 9px;
    }

    .maiw-divider{
        display:none;
    }
}
