/* WP Agentic Writer Settings V2 — Stitch implementation */
:root {
    --aw2-canvas: #f7f9ff;
    --aw2-surface: #ffffff;
    --aw2-surface-soft: #edf4ff;
    --aw2-surface-mid: #e7eff9;
    --aw2-border: #d3dbe5;
    --aw2-border-soft: #e1e9f3;
    --aw2-text: #171c20;
    --aw2-muted: #54606a;
    --aw2-primary: #004971;
    --aw2-primary-2: #006295;
    --aw2-primary-soft: #cce5ff;
    --aw2-success: #005112;
    --aw2-success-soft: #e1f8df;
    --aw2-error: #ba1a1a;
    --aw2-error-soft: #ffdad6;
    --aw2-warning: #8a4b00;
    --aw2-warning-soft: #ffefd6;
    --aw2-rail: #2c3338;
    --aw2-rail-active: #2271b1;
    --aw2-radius-sm: 4px;
    --aw2-radius: 8px;
    --aw2-radius-lg: 12px;
    --aw2-radius-full: 999px;
    --aw2-font:
        Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --aw2-mono: "JetBrains Mono", SFMono-Regular, Consolas, monospace;
}

#wpcontent {
    padding-left: 0 !important;
}
#wpbody-content {
    padding-bottom: 0;
}

.wpaw2-settings * {
    box-sizing: border-box;
}
.wpaw2-settings {
    margin: 0;
    color: var(--aw2-text);
    background: var(--aw2-canvas);
    font-family: var(--aw2-font);
    min-height: calc(100vh - 32px);
}
.wpaw2-settings button,
.wpaw2-settings input,
.wpaw2-settings select,
.wpaw2-settings textarea {
    font: inherit;
}
.wpaw2-settings a {
    color: var(--aw2-primary);
    text-decoration: none;
}
.wpaw2-settings h1,
.wpaw2-settings h2,
.wpaw2-settings h3,
.wpaw2-settings p {
    margin: 0;
}

.wp-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: calc(100vh - 32px);
}
.wp-rail {
    background: var(--aw2-rail);
    color: #fff;
    padding: 18px 12px;
    overflow-y: auto;
}
.wp-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: 16px;
}
.wp-logo-mark {
    width: 36px;
    height: 36px;
    border-radius: var(--aw2-radius);
    background: #fff;
    display: grid;
    place-items: center;
    color: var(--aw2-primary);
    font-weight: 800;
}
.wp-logo small {
    display: block;
    color: #c8d1d8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
}
.wp-logo strong {
    display: block;
    font-size: 16px;
    line-height: 20px;
}
.rail-group {
    margin: 16px 0;
}
.rail-group-title {
    padding: 0 8px 8px;
    color: #bac4cc;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}
.rail-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    padding: 8px 10px;
    border-radius: var(--aw2-radius-sm);
    cursor: pointer;
    text-align: left;
    font-weight: 600;
}
.rail-link:hover,
.rail-link[aria-selected="true"] {
    background: var(--aw2-rail-active);
    color: #fff;
}
.rail-pill {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: var(--aw2-radius-full);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 11px;
    text-align: center;
}

.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.admin-top {
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--aw2-border);
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 32px;
    z-index: 5;
}
.crumb {
    color: var(--aw2-muted);
    font-size: 13px;
}
.top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.page {
    width: min(1120px, calc(100% - 48px));
    margin: 24px auto 0;
    padding-bottom: 48px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 8px 14px;
    border: 1px solid var(--aw2-border);
    border-radius: var(--aw2-radius-sm);
    background: var(--aw2-surface);
    color: var(--aw2-text);
    cursor: pointer;
    font-weight: 700;
}
.btn:hover {
    border-color: var(--aw2-primary);
}
.btn-primary {
    background: var(--aw2-primary);
    border-color: var(--aw2-primary);
    color: #fff;
}
.btn-danger {
    color: var(--aw2-error);
}
.btn-small {
    min-height: 30px;
    padding: 5px 10px;
    font-size: 12px;
}
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr);
    gap: 16px;
    margin-bottom: 18px;
}
.hero-card,
.panel,
.tile {
    background: var(--aw2-surface);
    border: 1px solid var(--aw2-border-soft);
    border-radius: var(--aw2-radius-lg);
}
.hero-card {
    position: relative;
    padding: 28px;
    overflow: hidden;
}
.hero-card::after {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    right: -80px;
    top: -100px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        var(--aw2-primary-soft),
        transparent 70%
    );
}
.eyebrow {
    color: var(--aw2-primary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 800;
    margin-bottom: 8px;
}
.hero h1 {
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.05;
    max-width: 660px;
}
.hero-copy {
    margin-top: 12px;
    color: var(--aw2-muted);
    font-size: 15px;
    line-height: 1.6;
    max-width: 660px;
}
.status-panel {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.workflow {
    display: grid;
    gap: 8px;
}
.workflow-step {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 9px;
    background: var(--aw2-surface-soft);
    border-radius: var(--aw2-radius);
}
.step-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--aw2-primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
}
.step-label {
    font-weight: 700;
}
.step-state {
    color: var(--aw2-muted);
    font-size: 12px;
}

.tabs-wrap {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
.tab-sidebar {
    background: var(--aw2-surface);
    border: 1px solid var(--aw2-border-soft);
    border-radius: var(--aw2-radius-lg);
    padding: 12px;
    position: sticky;
    top: 82px;
}
.tab-group + .tab-group {
    margin-top: 14px;
}
.tab-group-title {
    padding: 7px 8px;
    color: var(--aw2-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
}
.tab-btn {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--aw2-text);
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border-radius: var(--aw2-radius);
    cursor: pointer;
    text-align: left;
    font-weight: 700;
}
.tab-btn:hover,
.tab-btn[aria-selected="true"] {
    background: var(--aw2-surface-soft);
    color: var(--aw2-primary);
}
.tab-count {
    color: var(--aw2-muted);
    font-size: 12px;
}
.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}
.section-head h2 {
    font-size: 24px;
}
.section-head p {
    color: var(--aw2-muted);
    margin-top: 5px;
    line-height: 1.5;
}

.panel {
    margin-bottom: 14px;
    overflow: hidden;
}
.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding: 18px 20px;
    border-bottom: 1px solid var(--aw2-border-soft);
}
.panel-title h3 {
    font-size: 16px;
}
.panel-title p {
    color: var(--aw2-muted);
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.5;
}
.panel-body {
    padding: 20px;
}
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.field {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
}
.field label,
.field-label {
    font-size: 13px;
    font-weight: 800;
    color: var(--aw2-text);
}
.help {
    color: var(--aw2-muted);
    font-size: 12px;
    line-height: 1.45;
}
.field-control {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--aw2-border);
    border-radius: var(--aw2-radius-sm);
    background: var(--aw2-surface);
    color: var(--aw2-text);
}
textarea.field-control {
    min-height: 82px;
    resize: vertical;
}
.password-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}
.switch-row,
.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.switch-row input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.switch {
    width: 42px;
    height: 24px;
    border-radius: var(--aw2-radius-full);
    background: var(--aw2-border);
    position: relative;
    flex: 0 0 auto;
    transition: background 0.18s ease;
}
.switch::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    top: 3px;
    left: 3px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.18s ease;
}
input[type="checkbox"]:checked + .switch {
    background: var(--aw2-primary);
}
input[type="checkbox"]:checked + .switch::after {
    transform: translateX(18px);
}
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}
.chip-list {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}
.chip {
    border: 1px solid var(--aw2-border);
    border-radius: var(--aw2-radius-full);
    padding: 5px 9px;
    background: var(--aw2-surface);
    color: var(--aw2-muted);
    font-size: 12px;
    font-weight: 700;
}
.chip.on {
    background: var(--aw2-primary-soft);
    color: var(--aw2-primary);
    border-color: var(--aw2-primary-soft);
}
.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: var(--aw2-radius-full);
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 800;
    color: var(--aw2-muted);
    background: var(--aw2-surface-soft);
}
.status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}
.status.connected {
    color: var(--aw2-success);
    background: var(--aw2-success-soft);
}
.status.warn {
    color: var(--aw2-warning);
    background: var(--aw2-warning-soft);
}
.status.error {
    color: var(--aw2-error);
    background: var(--aw2-error-soft);
}
.metric-card,
.preset-card,
.guide-card {
    padding: 16px;
    background: var(--aw2-surface-soft);
    border: 1px solid transparent;
    border-radius: var(--aw2-radius);
}
.preset-card {
    text-align: left;
    cursor: pointer;
    width: 100%;
}
.preset-card:hover,
.preset-card.active {
    border-color: var(--aw2-primary);
    background: #fff;
}
.metric-value {
    font-family: var(--aw2-mono);
    font-size: 22px;
    font-weight: 800;
    color: var(--aw2-primary);
}
.metric-label {
    color: var(--aw2-muted);
    font-size: 12px;
    margin-top: 3px;
}
.progress {
    height: 8px;
    border-radius: var(--aw2-radius-full);
    background: var(--aw2-surface-mid);
    overflow: hidden;
}
.progress > span {
    display: block;
    height: 100%;
    background: var(--aw2-primary);
}
.ds-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
preset-card h3 {
    font-size: 15px;
    argin-bottom: 8px;
}
.prse-meta {
    colo: var(--aw2-muted);
    font-sze: 12px;
    line-height: 1.5;
}
.metri.ds-table th,
.ds-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--aw2-border-soft);
    text-align: left;
    vertical-align: top;
}
.ds-table th {
    background: var(--aw2-surface-soft);
    color: var(--aw2-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 11px;
}
.ds-table tbody tr:hover {
    background: rgba(0, 73, 113, 0.035);
}
.code,
.command {
    font-family: var(--aw2-mono);
    background: var(--aw2-surface-soft);
    border: 1px solid var(--aw2-border-soft);
    border-radius: var(--aw2-radius-sm);
    padding: 3px 6px;
}
.command {
    display: block;
    padding: 10px;
    overflow-x: auto;
}
.custom-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.4fr) minmax(150px, 1fr) 130px auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
/* Hide default WP admin notices on our settings page */
.wpaw2-settings > .notice,
.wpaw2-settings > .settings-error,
.wpaw2-settings .notice.settings-error {
    display: none !important;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 76px;
    max-width: 360px;
    background: var(--aw2-surface);
    border: 1px solid var(--aw2-border);
    border-left: 4px solid var(--aw2-primary);
    border-radius: var(--aw2-radius);
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--aw2-text);
    z-index: 9999;
    opacity: 0;
    transform: translateY(10px);
    transition:
        opacity 250ms ease,
        transform 250ms ease;
    pointer-events: none;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

@media (max-width: 1080px) {
    .wp-shell {
        grid-template-columns: 1fr;
    }
    .wp-rail {
        position: static;
        display: none;
    }
    .admin-top {
        top: 32px;
    }
    .hero,
    .tabs-wrap {
        grid-template-columns: 1fr;
    }
    .tab-sidebar {
        position: static;
    }
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 720px) {
    .admin-top {
        height: auto;
        padding: 14px 16px;
        align-items: flex-start;
        flex-direction: column;
    }
    .page {
        width: calc(100% - 24px);
        margin-top: 14px;
    }
    .hero-card,
    .panel-body {
        padding: 16px;
    }
    .panel-head,
    .section-head {
        flex-direction: column;
    }
    .grid-2,
    .grid-3,
    .grid-4,
    .checkbox-grid,
    .custom-row {
        grid-template-columns: 1fr;
    }
    .password-row {
        grid-template-columns: 1fr;
    }
}
