/* ========== Login Card ========== */
.wm-login-card[hidden],
.wm-layout[hidden] {
    display: none !important;
}

.wm-login-card {
    max-width: 440px;
    margin: 56px auto 72px;
    padding: 34px 32px 36px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 18px 46px rgba(24, 62, 120, .08);
}
.wm-login-inner {
    text-align: center;
}
.wm-login-logo {
    margin-bottom: 10px;
}
.wm-login-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(145deg, var(--primary), #0f62d8);
    font-size: 20px;
    font-weight: 800;
    box-shadow: 0 12px 22px rgba(22, 119, 255, .22);
}
.wm-login-inner h2 {
    margin: 12px 0 6px;
    color: var(--text-primary);
    font-size: 24px;
    line-height: 1.25;
    letter-spacing: 0;
}
.wm-login-inner p {
    margin: 0 0 22px;
    color: var(--text-muted);
    font-size: 14px;
}
.wm-login-form .wm-field {
    text-align: left;
    margin-bottom: 16px;
}
.wm-login-form .wm-field label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
}
.wm-login-form .wm-field input {
    width: 100%;
    height: 44px;
    padding: 0 13px;
    border: 1px solid #d8e2ef;
    border-radius: 8px;
    background: #fff;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}
.wm-login-form .wm-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(75,110,245,.12);
}
.wm-btn-primary {
    display: block;
    width: 100%;
    height: 44px;
    margin-top: 10px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: var(--primary);
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    transition: background .15s;
}
.wm-btn-primary:hover { background: var(--primary-hover); }
.wm-btn-primary:disabled { opacity: .65; cursor: wait; }

/* ========== Sidebar Layout ========== */
.wm-layout {
    display: flex;
    min-height: calc(100vh - 190px);
    margin: 20px auto;
    max-width: 1200px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    background: #fff;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.wm-sidebar {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-light);
    background: #fafbfd;
}
.wm-sidebar-user {
    padding: 24px 16px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
}
.wm-sidebar-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: #fff;
    background: var(--primary);
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 8px;
}
.wm-sidebar-email {
    color: var(--text-secondary);
    font-size: 13px;
    word-break: break-all;
}
.wm-sidebar-nav {
    flex: 1;
    padding: 12px 0;
}
.wm-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: color .15s, background .15s;
}
.wm-nav-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}
.wm-nav-item:hover {
    color: var(--primary);
    background: rgba(75,110,245,.06);
}
.wm-nav-item.active {
    color: var(--primary);
    background: var(--primary-light);
    font-weight: 700;
}
.wm-sidebar-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
}
.wm-sidebar-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    text-decoration: none;
    margin-bottom: 8px;
    transition: color .15s;
}
.wm-sidebar-link:hover { color: var(--primary); }
.wm-sidebar-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 8px 0;
    border: 0;
    background: none;
    color: var(--danger);
    font-size: 13px;
    cursor: pointer;
    transition: opacity .15s;
}
.wm-sidebar-logout:hover { opacity: .75; }

/* ========== Main Content ========== */
.wm-main {
    flex: 1;
    min-width: 0;
    padding: 24px 28px;
    overflow-y: auto;
}
.wm-section-header {
    margin-bottom: 18px;
}
.wm-section-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 20px;
}
.wm-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.wm-stat-item {
    padding: 16px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #fafbfd;
}
.wm-stat-item strong {
    display: block;
    margin-bottom: 4px;
    color: var(--primary);
    font-size: 24px;
}
.wm-stat-item span {
    color: var(--text-muted);
    font-size: 13px;
}

/* ========== Tab Panels ========== */
.wm-tab-panel {
    display: none;
}
.wm-tab-panel.active {
    display: block;
}

/* ========== Row Lists ========== */
.wm-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #fff;
    transition: box-shadow .15s;
}
.wm-row:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.wm-row + .wm-row {
    margin-top: 10px;
}
.wm-row strong {
    display: block;
    color: var(--text-primary);
    font-size: 15px;
}
.wm-row small {
    display: block;
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wm-row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.wm-row-btn {
    height: 28px;
    padding: 0 12px;
    border: 1px solid #bcd8ff;
    border-radius: 7px;
    color: var(--primary);
    background: #fff;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.wm-row-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.wm-badge {
    display: inline-block;
    min-width: 64px;
    padding: 5px 10px;
    border-radius: 14px;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
    color: var(--text-muted);
    background: #f1f5f9;
}
.wm-badge.s0 { color: #d97706; background: #fef3c7; }
.wm-badge.s1 { color: #16a34a; background: #f0fdf4; }
.wm-badge.s2,
.wm-badge.s3 { color: #dc2626; background: #fef2f2; }

/* ========== Modal ========== */
.wm-modal[hidden] { display: none !important; }
.wm-modal {
    position: fixed;
    inset: 0;
    z-index: 2500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.wm-modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .42);
}
.wm-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(620px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .22);
}
.wm-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--border-light);
}
.wm-modal-head h3 {
    margin: 0 0 4px;
    color: var(--text-primary);
    font-size: 20px;
}
.wm-modal-head p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
}
.wm-modal-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 7px;
    color: var(--text-muted);
    background: #f8fafc;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.wm-modal-close:hover { color: var(--text-primary); background: #eef2f7; }
.wm-site-form {
    display: grid;
    gap: 14px;
    padding: 20px 22px 22px;
}
.wm-site-form label {
    display: grid;
    gap: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 800;
}
.wm-site-form input,
.wm-site-form select,
.wm-site-form textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 13px;
    border: 1px solid #d8e2ef;
    border-radius: 8px;
    background: #fff;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}
.wm-site-form textarea {
    min-height: 160px;
    resize: vertical;
    line-height: 1.7;
}
.wm-site-form input:focus,
.wm-site-form select:focus,
.wm-site-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(75,110,245,.12);
}
.wm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
}
.wm-btn-ghost,
.wm-btn-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 96px;
    margin-top: 0;
    flex: 0 0 auto;
}
.wm-btn-inline { padding: 0 18px; }
.wm-btn-ghost {
    height: 42px;
    padding: 0 18px;
    border: 1px solid #d8e2ef;
    border-radius: 8px;
    color: var(--text-secondary);
    background: #fff;
    font-weight: 800;
    cursor: pointer;
}
.wm-btn-ghost:hover { color: var(--primary); border-color: var(--primary); }

/* ========== Article Form ========== */
.wm-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 200px 200px;
    gap: 12px;
}
.wm-article-form label {
    display: grid;
    gap: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
}
.wm-article-form input,
.wm-article-form select,
.wm-article-form textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 13px;
    border: 1px solid #d8e2ef;
    border-radius: 8px;
    background: #fff;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}
.wm-article-form input:focus,
.wm-article-form select:focus,
.wm-article-form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(75,110,245,.12);
}
.wm-article-form textarea {
    min-height: 220px;
    margin-top: 12px;
    resize: vertical;
}
.wm-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}
.wm-form-actions button {
    height: 42px;
    padding: 0 24px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: var(--primary);
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    transition: background .15s;
}
.wm-form-actions button:hover { background: var(--primary-hover); }
.wm-form-actions button:disabled { opacity: .65; cursor: wait; }

/* ========== Empty State ========== */
.wm-empty {
    padding: 36px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    text-align: center;
}

/* ========== Toast ========== */
.wm-toast {
    position: fixed;
    right: 22px;
    top: 78px;
    z-index: 3000;
    max-width: 340px;
    padding: 12px 14px;
    border-radius: 8px;
    color: #fff;
    background: #172033;
    box-shadow: var(--shadow-md);
    font-weight: 700;
    font-size: 14px;
}
.wm-toast.error { background: #f04438; }
.wm-toast.success { background: #16a34a; }

/* ========== Responsive ========== */
@media (max-width: 900px) {
    .wm-layout {
        flex-direction: column;
        min-height: auto;
    }
    .wm-sidebar {
        width: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }
    .wm-sidebar-user {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 16px;
        text-align: left;
    }
    .wm-sidebar-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
        margin-bottom: 0;
    }
    .wm-sidebar-nav {
        display: flex;
        flex-wrap: wrap;
        padding: 8px 12px;
        gap: 0;
    }
    .wm-nav-item {
        padding: 8px 14px;
    }
    .wm-sidebar-actions {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 16px;
    }
    .wm-sidebar-link { margin-bottom: 0; }
    .wm-main { padding: 16px; }
    .wm-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .wm-form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .wm-login-card { margin: 24px 12px; padding: 24px 18px; }
    .wm-layout { margin: 12px; border-radius: 8px; }
    .wm-stat-grid { grid-template-columns: 1fr; }
    .wm-row { grid-template-columns: 1fr; }
    .wm-row-actions { justify-content: flex-start; }
    .wm-modal { padding: 12px; align-items: flex-end; }
    .wm-modal-dialog { max-height: calc(100vh - 24px); }
    .wm-modal-actions { flex-direction: column-reverse; }
    .wm-btn-ghost,
    .wm-btn-inline { width: 100%; flex: none; }
}
