/* SBA Operations Dashboard — Styles */

:root {
    --primary: #1B4F8A;
    --secondary: #2E75B6;
    --bg: #F8F9FA;
    --card-bg: #FFFFFF;
    --text: #1A1A1A;
    --text-secondary: #666666;
    --border: #E0E0E0;
    --error: #DC3545;
    --disabled: #9CA3AF;
    --green: #16A34A;
    --yellow: #D97706;
    --red: #DC2626;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a {
    color: var(--secondary);
    text-decoration: none;
}

/* ── Top Navigation ── */

.top-nav {
    background-color: var(--primary);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 56px;
}

.nav-logo {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-user {
    font-size: 14px;
    opacity: 0.9;
}

.nav-logout {
    color: #fff;
    font-size: 14px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.nav-logout:hover {
    opacity: 1;
}

/* ── Login Page ── */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    color: var(--primary);
    font-size: 24px;
    margin-bottom: 4px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.error-message {
    background: #FEF2F2;
    color: var(--error);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input,
.form-group textarea,
.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: #fff;
}

.form-group input:focus,
.form-group textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(46, 117, 182, 0.1);
}

.form-group textarea {
    resize: vertical;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background-color: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 4px;
}

.btn-login:hover {
    background-color: var(--secondary);
}

/* ── Dashboard ── */

.dashboard-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px;
}

.dashboard-header {
    margin-bottom: 28px;
}

.dashboard-header h1 {
    font-size: 26px;
    color: var(--text);
}

.dashboard-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin-top: 4px;
}

/* ── Tool Cards Grid ── */

.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.tool-card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
    position: relative;
}
.tool-card[draggable="true"] { cursor: grab; user-select: none; }
.tool-card[draggable="true"]:active { cursor: grabbing; }
.tool-card--drag-over { border-left: 3px solid var(--primary); }
.tool-card--dragging { opacity: 0.5; }
.tool-card .drag-grip {
    position: absolute; top: 8px; right: 8px;
    opacity: 0; font-size: 12px; color: var(--text-secondary);
    transition: opacity 0.2s;
}
.tool-card:hover .drag-grip { opacity: 0.4; }

.tool-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.tool-card--disabled {
    opacity: 0.55;
}

.tool-card--disabled:hover {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.tool-card__icon {
    width: 44px;
    height: 44px;
    background: var(--bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    color: var(--primary);
    font-size: 20px;
}

.tool-card--disabled .tool-card__icon {
    color: var(--disabled);
}

.tool-card__body {
    flex: 1;
}

.tool-card__title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.tool-card__desc {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
}

.tool-card__footer {
    margin-top: 18px;
}

.btn-open {
    display: inline-block;
    padding: 8px 20px;
    background-color: var(--primary);
    color: #fff;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.btn-open:hover {
    background-color: var(--secondary);
    color: #fff;
}

.btn-coming-soon {
    display: inline-block;
    padding: 8px 20px;
    background-color: var(--border);
    color: var(--disabled);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: default;
}

/* ── Stub Page ── */

.stub-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 56px);
    padding: 20px;
}

.stub-card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    padding: 48px;
    text-align: center;
    max-width: 480px;
}

.stub-icon {
    font-size: 40px;
    color: var(--primary);
    margin-bottom: 16px;
}

.stub-card h1 {
    font-size: 22px;
    margin-bottom: 8px;
}

.stub-card p {
    color: var(--text-secondary);
    font-size: 14px;
}

.stub-status {
    margin-top: 12px;
    font-style: italic;
    color: var(--disabled);
}

.btn-back {
    display: inline-block;
    margin-top: 24px;
    padding: 10px 24px;
    background-color: var(--primary);
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-back:hover {
    background-color: var(--secondary);
    color: #fff;
}

/* ── Tool Page Common ── */

.tool-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.tool-page-header {
    margin-bottom: 24px;
}

.tool-page-header h1 {
    font-size: 24px;
    margin-top: 8px;
}

.tool-page-header h1 i {
    margin-right: 8px;
    color: var(--secondary);
}

.tool-page-header p {
    color: var(--text-secondary);
    margin-top: 4px;
}

.back-link {
    font-size: 13px;
    color: var(--text-secondary);
}

.back-link:hover {
    color: var(--primary);
}

/* ── Summary Cards (Token Monitor) ── */

.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.summary-card__label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.summary-card__value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

/* ── Panels & Tables ── */

.panel {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.panel__header h2 {
    font-size: 18px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--bg);
}

.data-table tbody tr:hover {
    background: var(--bg);
}

.table-empty {
    text-align: center;
    color: var(--disabled);
    padding: 24px !important;
}

.date-range-selector {
    display: flex;
    gap: 4px;
}

.date-btn {
    padding: 6px 14px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.date-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.log-filters {
    display: flex;
    gap: 8px;
}

.filter-select {
    padding: 6px 10px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
}

/* ── Status Monitor ── */

.status-banner {
    padding: 14px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.banner-green {
    background: #DCFCE7;
    color: var(--green);
}

.banner-yellow {
    background: #FEF3C7;
    color: var(--yellow);
}

.banner-red {
    background: #FEE2E2;
    color: var(--red);
}

.banner-gray {
    background: var(--bg);
    color: var(--disabled);
}

.status-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.last-updated {
    font-size: 13px;
    color: var(--text-secondary);
}

.btn-refresh {
    padding: 8px 16px;
    font-size: 13px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-refresh:hover {
    background: var(--secondary);
}

.btn-refresh:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.status-section {
    margin-bottom: 24px;
}

.status-section h2 {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 13px;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.status-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.up { background: var(--green); }
.status-dot.degraded { background: var(--yellow); }
.status-dot.down { background: var(--red); }
.status-dot.unknown { background: var(--disabled); }

.status-card__info {
    flex: 1;
    min-width: 0;
}

.status-card__name {
    font-weight: 600;
    font-size: 14px;
}

.status-card__meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.status-card__business {
    font-size: 11px;
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--text-secondary);
}

.incidents-list {
    font-size: 13px;
}

.incident-item {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--bg);
    align-items: center;
}

.incident-item:last-child {
    border-bottom: none;
}

.incident-time {
    color: var(--text-secondary);
    font-size: 12px;
    min-width: 140px;
}

/* ── Social Media Tool ── */

.social-layout {
    display: grid;
    grid-template-columns: 40% 60%;
    gap: 24px;
    align-items: start;
}

.social-inputs {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.social-output {
    min-height: 400px;
}

.image-mode-toggle {
    display: flex;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.mode-btn {
    flex: 1;
    padding: 8px 6px;
    font-size: 12px;
    border: none;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.mode-btn.active {
    background: var(--primary);
    color: #fff;
}

.mode-btn i {
    margin-right: 4px;
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
    color: var(--text-secondary);
}

.upload-zone:hover {
    border-color: var(--secondary);
}

.upload-zone i {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
}

.upload-hint {
    font-size: 12px;
    color: var(--disabled);
}

.upload-preview {
    position: relative;
    display: inline-block;
}

.upload-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 6px;
}

.btn-remove-image {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 12px;
}

.provider-toggle {
    display: flex;
    gap: 12px;
}

.provider-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}

.provider-option input[type="radio"] {
    accent-color: var(--primary);
}

.btn-generate {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-generate:hover {
    background: var(--secondary);
}

.btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.output-placeholder {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 60px 24px;
    text-align: center;
    color: var(--disabled);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.output-placeholder i {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
}

.output-hint {
    font-size: 13px;
    margin-top: 4px;
}

.versions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.versions-header h3 {
    font-size: 16px;
}

.btn-regenerate {
    padding: 6px 14px;
    font-size: 13px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-regenerate:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.version-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    margin-bottom: 12px;
}

.version-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.version-card__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.version-card__chars {
    font-size: 12px;
    color: var(--disabled);
}

.version-card__text {
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    margin-bottom: 12px;
}

.btn-copy {
    padding: 6px 14px;
    font-size: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: var(--secondary);
}

.btn-copy.copied {
    background: var(--green);
}

.generated-image-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    margin-bottom: 16px;
    text-align: center;
}

.generated-image-card img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 6px;
}

.generated-image-actions {
    margin-top: 10px;
}

.btn-download {
    display: inline-block;
    padding: 8px 16px;
    font-size: 13px;
    background: var(--primary);
    color: #fff;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-download:hover {
    background: var(--secondary);
    color: #fff;
}

/* ── Dashboard Settings ── */

.settings-section {
    margin-top: 40px;
    max-width: 400px;
}

.settings-section h2 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--text);
}

.settings-section h2 i {
    margin-right: 6px;
    color: var(--secondary);
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-select {
    flex: 1;
}

.settings-saved {
    font-size: 13px;
    color: var(--green);
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
}

.settings-saved.visible {
    opacity: 1;
}

/* ── User Admin ── */

.ua-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.btn-add-user {
    padding: 10px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-add-user:hover {
    background: var(--secondary);
}

.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.role-owner { background: #1B4F8A; }
.role-admin { background: #2E75B6; }
.role-content { background: #28a745; }
.role-warehouse { background: #fd7e14; }

.status-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: #DCFCE7;
    color: var(--green);
}

.status-inactive {
    background: #F3F4F6;
    color: #6B7280;
}

.actions-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-select {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.btn-deactivate {
    padding: 4px 12px;
    font-size: 12px;
    background: transparent;
    border: 1px solid var(--red);
    color: var(--red);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-deactivate:hover {
    background: var(--red);
    color: #fff;
}

.btn-reactivate {
    padding: 4px 12px;
    font-size: 12px;
    background: transparent;
    border: 1px solid var(--green);
    color: var(--green);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-reactivate:hover {
    background: var(--green);
    color: #fff;
}

.btn-delete-user {
    padding: 4px 12px;
    font-size: 12px;
    background: transparent;
    border: 1px solid #c0392b;
    color: #c0392b;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-delete-user:hover {
    background: #c0392b;
    color: #fff;
}

.ua-you-label {
    font-size: 12px;
    color: var(--disabled);
    font-style: italic;
}

.btn-tool-access {
    padding: 4px 10px;
    border: 1px solid var(--secondary);
    border-radius: 4px;
    background: #fff;
    color: var(--secondary);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.btn-tool-access:hover {
    background: var(--secondary);
    color: #fff;
}

/* ── Permissions Modal ── */

.perm-hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.perm-list {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.perm-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.perm-item:hover {
    background: var(--bg);
}

.perm-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.perm-default input[type="checkbox"] {
    accent-color: #9CA3AF;
}

.perm-override input[type="checkbox"] {
    accent-color: var(--secondary);
}

.perm-tool-name {
    flex: 1;
    font-size: 14px;
}

.perm-badge-override {
    font-size: 11px;
    background: #DBEAFE;
    color: var(--secondary);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.perm-actions {
    display: flex;
    gap: 8px;
}

.perm-actions .btn-vs-primary,
.perm-actions .btn-vs-secondary {
    flex: 1;
    justify-content: center;
    font-size: 13px;
}

.ua-success {
    background: #DCFCE7;
    color: var(--green);
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Modal */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 0;
}

.modal-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 32px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.ua-password-note {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-style: italic;
}

.ua-form-error {
    background: #FEF2F2;
    color: var(--error);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 12px;
}

.btn-create-user {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-create-user:hover {
    background: var(--secondary);
}

.btn-create-user:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Spinner ── */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Responsive ── */

@media (max-width: 1024px) {
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .social-layout {
        grid-template-columns: 1fr;
    }

    .status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .tools-grid,
    .summary-cards,
    .status-grid {
        grid-template-columns: 1fr;
    }

    .top-nav {
        padding: 0 16px;
    }

    .dashboard-container,
    .tool-page-container {
        padding: 20px 16px;
    }

    .date-range-selector {
        flex-wrap: wrap;
    }

    .panel__header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ══════════════════════════════
   VOICE STUDIO
   ══════════════════════════════ */

/* Profile Cards Grid */

.vs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.vs-card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    padding: 24px;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    display: flex;
    flex-direction: column;
}

.vs-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
    transform: translateY(-2px);
}

.vs-card--create {
    border: 2px dashed var(--border);
    background: transparent;
    box-shadow: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 160px;
}

.vs-card--create:hover {
    border-color: var(--secondary);
    box-shadow: none;
}

.vs-card--create .vs-card__icon {
    color: var(--secondary);
    background: rgba(46, 117, 182, 0.08);
}

.vs-card__icon {
    width: 44px;
    height: 44px;
    background: var(--bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    color: var(--primary);
    font-size: 20px;
}

.vs-card__title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.vs-card__biz {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vs-card__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.vs-card__date {
    font-size: 12px;
    color: var(--text-secondary);
}

.vs-card__footer {
    margin-top: auto;
    padding-top: 14px;
}

.vs-version-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
}

/* Detail View */

.vs-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.vs-detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-vs-primary {
    padding: 10px 20px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-vs-primary:hover { background: var(--secondary); }
.btn-vs-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-vs-secondary {
    padding: 10px 20px;
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-vs-secondary:hover {
    border-color: var(--primary);
    background: rgba(27, 79, 138, 0.04);
}

.btn-vs-small {
    padding: 4px 12px;
    background: transparent;
    color: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-vs-small:hover {
    border-color: var(--secondary);
    background: rgba(46, 117, 182, 0.06);
}

.vs-detail-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 24px;
    align-items: start;
}

.vs-detail-main {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.vs-detail-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.vs-detail-title-row h2 {
    font-size: 20px;
}

/* Guide Display */

.vs-guide-display {
    font-size: 14px;
    line-height: 1.7;
}

.vs-guide-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--bg);
}

.vs-guide-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.vs-guide-section h4 {
    color: var(--primary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.vs-guide-section p,
.vs-guide-section ul {
    color: var(--text);
}

.vs-guide-section ul {
    padding-left: 20px;
}

.vs-guide-section li {
    margin-bottom: 4px;
}

.vs-guide-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.spinner-dark {
    border-color: rgba(0, 0, 0, 0.15);
    border-top-color: var(--primary);
}

/* Guide Edit */

.vs-guide-textarea {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    line-height: 1.6;
    resize: vertical;
    background: #FAFBFC;
}

.vs-guide-textarea:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(46, 117, 182, 0.1);
}

.vs-edit-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.vs-changelog-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
}

.vs-changelog-input:focus {
    outline: none;
    border-color: var(--secondary);
}

/* Version History Sidebar */

.vs-sidebar {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.vs-sidebar h3 {
    font-size: 15px;
    margin-bottom: 16px;
    color: var(--text);
}

.vs-version-list {
    max-height: 500px;
    overflow-y: auto;
}

.vs-version-item {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    background: var(--bg);
    transition: background 0.15s;
}

.vs-version-item--active {
    background: rgba(46, 117, 182, 0.06);
    border: 1px solid rgba(46, 117, 182, 0.15);
}

.vs-version-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.vs-version-changelog {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.4;
}

.vs-version-date {
    font-size: 11px;
    color: var(--text-secondary);
}

.vs-version-actions {
    margin-top: 8px;
}

.vs-empty {
    color: var(--disabled);
    font-size: 13px;
    text-align: center;
    padding: 16px 0;
}

/* Interview Modal Options */

.vs-interview-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.vs-interview-option {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.vs-interview-option:hover {
    border-color: var(--secondary);
    background: rgba(46, 117, 182, 0.03);
}

.vs-interview-option i {
    color: var(--secondary);
    font-size: 18px;
    margin-bottom: 6px;
    display: block;
}

.vs-interview-option h4 {
    font-size: 15px;
    margin-bottom: 4px;
}

.vs-interview-option p {
    font-size: 13px;
    color: var(--text-secondary);
}

.vs-category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.vs-category-btn {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.vs-category-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(27, 79, 138, 0.03);
}
.vs-category-btn--general {
    grid-column: 1 / -1;
    background: rgba(27, 79, 138, 0.04);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}
.vs-category-btn--general i { margin-right: 6px; }

/* Validation */

.vs-validation-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 16px;
}

.vs-validation-prompt {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
}

.vs-validation-prompt h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text);
}

.vs-validation-prompt textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    margin-top: 8px;
}

.vs-side-by-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 12px;
}

.vs-side-col {
    padding: 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.vs-side-col--user {
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
}

.vs-side-col--ai {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
}

.vs-side-col h5 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* ══════════════════════════════
   VOICE INTERVIEW PAGE
   ══════════════════════════════ */

.vi-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 24px;
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

/* Setup */

.vi-setup-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
    margin-top: 40px;
}

.vi-setup-icon {
    font-size: 40px;
    color: var(--secondary);
    margin-bottom: 16px;
}

.vi-setup-card h1 {
    font-size: 24px;
    margin-bottom: 4px;
}

.vi-setup-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.vi-setup-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.vi-type-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
    margin-bottom: 20px;
}

.vi-type-option {
    cursor: pointer;
}

.vi-type-option input { display: none; }

.vi-type-card {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
}

.vi-type-option input:checked + .vi-type-card {
    border-color: var(--primary);
    background: rgba(27, 79, 138, 0.04);
}

.vi-type-card i {
    color: var(--secondary);
    margin-right: 8px;
}

.vi-type-card strong {
    font-size: 14px;
}

.vi-type-card span {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    margin-left: 26px;
}

.vi-quick-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    margin-top: 8px;
}

.vi-quick-toggle input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

.vi-start-btn {
    width: 100%;
    margin-bottom: 12px;
    padding: 14px;
    font-size: 16px;
}

.vi-cancel-link {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Interview */

.vi-interview-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    margin-top: 40px;
}

.vi-progress {
    margin-bottom: 24px;
}

.vi-progress-bar {
    height: 4px;
    background: var(--bg);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.vi-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.vi-progress-text {
    font-size: 12px;
    color: var(--text-secondary);
}

.vi-category-badge {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(46, 117, 182, 0.08);
    color: var(--secondary);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.vi-question {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 20px;
    color: var(--text);
}

.vi-answer-input {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: 20px;
}

.vi-answer-input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(46, 117, 182, 0.1);
}

/* Mic recording wrapper */
.vi-answer-wrapper {
    position: relative;
    margin-bottom: 8px;
}
.vi-answer-wrapper .vi-answer-input {
    margin-bottom: 0;
    padding-right: 52px;
}
.vi-mic-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.2s;
}
.vi-mic-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(27, 79, 138, 0.04);
}
.vi-mic-btn.vi-mic-active {
    background: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
    animation: mic-pulse 1.2s ease-in-out infinite;
}
.vi-mic-btn.vi-mic-transcribing {
    opacity: 0.6;
    pointer-events: none;
}
@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(231, 76, 60, 0); }
}
.vi-mic-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #e74c3c;
    margin-bottom: 12px;
    padding-left: 2px;
}
.vi-mic-recording i {
    animation: mic-blink 1s step-end infinite;
    margin-right: 4px;
    font-size: 10px;
}
@keyframes mic-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
.vi-mic-time {
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
}

.vi-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.vi-skip-btn {
    font-size: 13px;
    padding: 8px 16px;
}

/* Complete */

.vi-complete-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
    margin-top: 40px;
}

.vi-complete-header i {
    font-size: 48px;
    color: var(--green);
    margin-bottom: 16px;
}

.vi-complete-header h2 {
    margin-bottom: 8px;
}

.vi-complete-header p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.vi-complete-card .btn-vs-primary {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

/* Review */

.vi-review-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    margin-top: 20px;
}

.vi-review-card h2 {
    margin-bottom: 8px;
}

.vi-review-summary {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
    padding: 12px;
    background: #FEF3C7;
    border-radius: 6px;
}

.vi-review-content {
    margin-bottom: 20px;
}

.vi-review-actions {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

/* ── Voice Studio Responsive ── */

@media (max-width: 1024px) {
    .vs-detail-layout {
        grid-template-columns: 1fr;
    }

    .vs-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .vs-side-by-side {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .vs-grid {
        grid-template-columns: 1fr;
    }

    .vs-detail-actions {
        width: 100%;
    }

    .vs-detail-actions button {
        flex: 1;
        text-align: center;
    }

    .vi-container {
        padding: 16px;
    }

    .vi-setup-card,
    .vi-interview-card,
    .vi-complete-card,
    .vi-review-card {
        padding: 24px;
        margin-top: 16px;
    }

    .vi-question {
        font-size: 17px;
    }

    .vi-nav {
        flex-wrap: wrap;
    }
}

/* ══════════════════════════════════════════
   Social Media — Scheduling Panel
   ══════════════════════════════════════════ */

#scheduling-panel {
    margin-top: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
}

.version-card__actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-use-this {
    background: none;
    border: 1px solid var(--secondary);
    color: var(--secondary);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.btn-use-this:hover {
    background: var(--secondary);
    color: #fff;
}

/* Token status bar */
.sched-token-bar {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 14px;
}

.sched-token-bar a {
    color: inherit;
    text-decoration: underline;
}

.sched-token-warning {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FCD34D;
}

.sched-token-expiring {
    background: #FED7AA;
    color: #9A3412;
    border: 1px solid #FB923C;
}

.sched-token-ok {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #6EE7B7;
    padding: 6px 14px;
    font-size: 12px;
}

.sched-token-error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FCA5A5;
}

.sched-token-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

/* Platform selector */
.sched-platform {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.sched-both-link {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    margin-right: 4px;
}
.sched-both-link:hover { text-decoration: underline; }

.sched-platform-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
}

.sched-platform-option input[type="checkbox"] {
    accent-color: var(--primary);
}

.sched-platform-option i {
    font-size: 16px;
}

/* Selected version preview */
.sched-selected {
    background: #F8F9FA;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}

.sched-selected-label {
    font-weight: 600;
    margin-right: 6px;
}

#sched-selected-text {
    color: var(--text-secondary);
}

.sched-selected-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.btn-edit-version {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 12px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn-edit-version:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.sched-edit-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    margin-top: 4px;
}
.sched-edit-textarea:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(46, 117, 182, 0.1);
}
.sched-edit-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}
.sched-edit-charcount {
    font-size: 12px;
    color: var(--text-muted);
}
.sched-edit-btns {
    display: flex;
    gap: 6px;
}
.btn-sm {
    padding: 4px 12px !important;
    font-size: 12px !important;
}

/* Action buttons */
.sched-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

/* Flash messages */
.sched-flash {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 12px;
}

.sched-flash-success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #6EE7B7;
}

.sched-flash-error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FCA5A5;
}

.sched-flash-info {
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #93C5FD;
}

/* Confirm modal */
.sched-confirm-preview {
    background: #F8F9FA;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.sched-confirm-platforms {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.sched-confirm-platforms i {
    margin-right: 4px;
}

/* History */
.sched-history {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.sched-history-toggle {
    background: none;
    border: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 4px 0;
}

.sched-history-toggle:hover {
    color: var(--primary);
}

.sched-history-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 10px;
}

.sched-history-table {
    width: 100%;
    min-width: 480px;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: fixed;
}

.sched-history-table col.col-date    { width: 15%; }
.sched-history-table col.col-plat    { width: 12%; }
.sched-history-table col.col-status  { width: 12%; }
.sched-history-table col.col-content { width: 45%; }
.sched-history-table col.col-image   { width: 8%; }
.sched-history-table col.col-action  { width: 8%; }

.sched-history-table th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.sched-history-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.sched-history-cell-content {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sched-history-date {
    white-space: nowrap;
    color: var(--text-secondary);
}

.sched-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    min-width: 52px;
    text-align: center;
}

.sched-status-published { background: #D1FAE5; color: #065F46; }
.sched-status-scheduled { background: #DBEAFE; color: #1E40AF; }
.sched-status-failed { background: #FEE2E2; color: #991B1B; cursor: help; }
.sched-status-cancelled { background: #F3F4F6; color: #6B7280; }
.sched-status-draft { background: #F3F4F6; color: #6B7280; }

.btn-cancel-sm {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 6px;
    font-size: 12px;
}

.btn-cancel-sm:hover {
    color: var(--red);
}

.sched-reauth {
    margin-top: 12px;
    text-align: right;
    font-size: 12px;
}

.sched-reauth a {
    color: var(--text-secondary);
}

.sched-reauth a:hover {
    color: var(--primary);
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 400px;
}

.toast-show { transform: translateX(0); }
.toast-hide { transform: translateX(120%); }

.toast-success { background: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; }
.toast-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.toast-info { background: #DBEAFE; color: #1E40AF; border: 1px solid #93C5FD; }

.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 16px;
    cursor: pointer;
    margin-left: auto;
    padding: 0 2px;
    opacity: 0.6;
}
.toast-close:hover { opacity: 1; }

/* History detail rows */
.history-row:hover { background: #f8f9fa; }

.history-detail-inner {
    padding: 12px 4px;
}

.history-detail-content {
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 10px;
    white-space: pre-wrap;
}

.history-detail-image {
    margin-bottom: 10px;
}

.history-detail-image img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.history-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.history-detail-error {
    color: #991B1B;
}

/* Schedule image upload */
.sched-image-upload {
    margin-bottom: 12px;
}

.sched-image-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    display: block;
}

.sched-image-label i {
    margin-right: 4px;
    color: var(--secondary);
}

.sched-upload-zone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-secondary);
    font-size: 13px;
}

.sched-upload-zone:hover,
.sched-upload-zone.dragover {
    border-color: var(--secondary);
    background: rgba(46, 117, 182, 0.04);
}

.sched-upload-zone i {
    font-size: 20px;
    display: block;
    margin-bottom: 6px;
    color: var(--secondary);
}

.sched-upload-preview {
    position: relative;
    display: inline-block;
}

.sched-upload-preview img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.sched-preview-btns {
    position: absolute;
    top: -6px;
    right: -6px;
    display: flex;
    gap: 4px;
}

.btn-edit-image {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--secondary);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.btn-edit-image:hover {
    background: var(--primary);
}

.sched-upload-preview .btn-remove-image {
    position: static;
}

.sched-image-note {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.sched-filename {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.sched-filename code {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-light, #f0f2f5);
    padding: 2px 6px;
    border-radius: 3px;
    user-select: all;
}

.sched-filename .btn-copy-filename {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 11px;
}

.sched-filename .btn-copy-filename:hover {
    color: var(--primary);
}

.sched-btn-wrapper {
    position: relative;
}

.sched-btn-wrapper[title] button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Post to Both note */
.sched-both-note {
    background: #EBF5FF;
    border: 1px solid #BFDBFE;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    color: #1E40AF;
    margin-bottom: 12px;
}

.sched-both-note i {
    margin-right: 4px;
}

/* ══════════════════════════════════════════
   Blog Studio
   ══════════════════════════════════════════ */

.bs-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.bs-filters {
    display: flex;
    gap: 6px;
}

.bs-filter-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.bs-filter-btn.active,
.bs-filter-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.bs-actions {
    display: flex;
    gap: 8px;
}

.bs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.bs-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
}

.bs-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.bs-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.bs-card__title {
    font-size: 16px;
    margin-bottom: 8px;
    line-height: 1.3;
}

.bs-card__meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.bs-card__meta i {
    margin-right: 3px;
}

.bs-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.bs-type-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: #E8F0FE;
    color: var(--primary);
}

.bs-type-product_review { background: #FEF3C7; color: #92400E; }
.bs-type-destination { background: #D1FAE5; color: #065F46; }
.bs-type-technique { background: #E0E7FF; color: #3730A3; }
.bs-type-gear_comparison { background: #FCE7F3; color: #9D174D; }
.bs-type-student_spotlight { background: #FEE2E2; color: #991B1B; }
.bs-type-general { background: #E8F0FE; color: var(--primary); }

.bs-status-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.bs-status-interview { background: #DBEAFE; color: #1E40AF; }
.bs-status-drafting { background: #FEF3C7; color: #92400E; }
.bs-status-review { background: #E0E7FF; color: #3730A3; }
.bs-status-published { background: #D1FAE5; color: #065F46; }
.bs-status-archived { background: #F3F4F6; color: #6B7280; }

.bs-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.bs-empty i {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.4;
    display: block;
}

.bs-empty h3 {
    font-size: 18px;
    margin-bottom: 6px;
    color: var(--text);
}

.bs-modal {
    max-width: 560px;
}

.bs-modal-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.form-hint {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 12px;
}

/* ── Blog Editor ── */

.be-container {
    max-width: 1400px;
}

.be-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.be-title-row h1 {
    flex: 1;
}

.be-meta-row {
    display: flex;
    gap: 14px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.be-meta-row i {
    margin-right: 3px;
}

.be-tabs {
    display: flex;
    gap: 2px;
    margin: 20px 0 16px;
    background: var(--border);
    border-radius: 8px;
    padding: 3px;
}

.be-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
}

.be-tab.active {
    background: var(--card-bg);
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.be-tab i {
    margin-right: 5px;
}

.be-panel {
    min-height: 300px;
}

/* Interview panel */

.be-interview-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.be-interview-progress .vi-progress-bar {
    flex: 1;
}

.be-questions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.be-question {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.be-question-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.be-question-num {
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.be-question-cat {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.3px;
}

.be-voice-badge {
    color: var(--secondary);
    font-size: 12px;
}

.be-question-text {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    line-height: 1.4;
}

.be-answer-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.15s;
}

.be-answer-input:focus {
    outline: none;
    border-color: var(--secondary);
}

.be-interview-actions {
    margin-top: 20px;
    text-align: center;
}

/* Outline panel */

.be-outline-tree {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
}

.be-outline-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.be-outline-item:last-child {
    border-bottom: none;
}

.be-outline-h3 {
    padding-left: 30px;
}

.be-outline-level {
    font-size: 11px;
    font-weight: 700;
    color: var(--secondary);
    background: #E8F0FE;
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.be-outline-heading {
    font-size: 14px;
}

.be-gap-section {
    margin-top: 20px;
    background: #FEF3C7;
    border-radius: 8px;
    padding: 16px;
}

.be-gap-section h3 {
    font-size: 14px;
    margin-bottom: 10px;
    color: #92400E;
}

.be-gap-item {
    font-size: 13px;
    padding: 6px 0;
    color: #78350F;
}

.be-gap-item i {
    margin-right: 6px;
    color: #D97706;
}

.be-outline-actions {
    margin-top: 20px;
    text-align: center;
}

/* Editor panel */

.be-editor-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    min-height: 500px;
}

.be-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #F8F9FA;
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    border-bottom: none;
}

.be-editor-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    flex: 1;
}

.be-word-count {
    font-size: 12px;
    color: var(--text-secondary);
}

.btn-sm {
    padding: 4px 10px !important;
    font-size: 12px !important;
}

.be-md-textarea {
    width: 100%;
    min-height: 480px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 0 0 8px 8px;
    font-family: "Consolas", "Monaco", monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    tab-size: 4;
}

.be-md-textarea:focus {
    outline: none;
    border-color: var(--secondary);
}

.be-preview-content {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 0 0 8px 8px;
    min-height: 480px;
    max-height: 600px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.7;
}

.be-preview-content h1 { font-size: 24px; margin: 16px 0 8px; }
.be-preview-content h2 { font-size: 20px; margin: 14px 0 8px; color: var(--primary); }
.be-preview-content h3 { font-size: 16px; margin: 12px 0 6px; }
.be-preview-content p { margin-bottom: 10px; }
.be-preview-content ul, .be-preview-content ol { margin: 8px 0 8px 20px; }
.be-preview-content li { margin-bottom: 4px; }

/* SEO bar */

.be-seo-bar {
    margin-top: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.be-seo-score {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin: 12px 0;
}

.be-seo-score-num {
    font-size: 36px;
    font-weight: 800;
}

.be-seo-score-label {
    font-size: 16px;
    color: var(--text-secondary);
}

.seo-good .be-seo-score-num { color: var(--green); }
.seo-ok .be-seo-score-num { color: var(--yellow); }
.seo-poor .be-seo-score-num { color: var(--red); }

.be-seo-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.be-seo-metric {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: #F8F9FA;
    border-radius: 6px;
    font-size: 13px;
}

.be-seo-metric span {
    color: var(--text-secondary);
}

/* Output panel */

.be-output-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.be-output-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
}

.be-output-card h3 {
    font-size: 15px;
    margin-bottom: 6px;
}

.be-output-card h3 i {
    margin-right: 6px;
    color: var(--secondary);
}

.be-output-card > p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.be-status-actions {
    display: flex;
    gap: 8px;
}

.be-snippet {
    background: #F8F9FA;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    margin-top: 10px;
    position: relative;
}

.be-snippet-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--secondary);
    margin-bottom: 6px;
}

.be-snippet-text {
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.btn-copy-sm {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    padding: 4px;
}

.btn-copy-sm:hover {
    color: var(--primary);
}

/* ── Blog Studio Responsive ── */

@media (max-width: 1024px) {
    .be-editor-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .bs-grid {
        grid-template-columns: 1fr;
    }

    .bs-action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .be-tabs {
        flex-wrap: wrap;
    }

    .form-row {
        flex-direction: column;
    }

    .be-output-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Image Editor Modal ── */

.modal-card--wide {
    max-width: 900px;
    width: 95vw;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.img-editor-layout {
    display: flex;
    gap: 20px;
}

.img-editor-canvas-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: #1a1a1a;
    border-radius: 8px;
    padding: 12px;
    position: relative;
}

.img-editor-canvas-wrap canvas {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.img-editor-controls {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.img-editor-section {
    background: var(--bg);
    border-radius: 8px;
    padding: 12px;
}

.img-editor-section h4 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.img-editor-section h4 i {
    color: var(--secondary);
    font-size: 12px;
}

.img-editor-aspect-btns {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.aspect-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s;
}

.aspect-btn:hover {
    border-color: var(--secondary);
    color: var(--secondary);
}

.aspect-btn.active {
    background: var(--secondary);
    color: #fff;
    border-color: var(--secondary);
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.slider-row input[type="range"] {
    flex: 1;
    accent-color: var(--secondary);
    height: 6px;
}

.slider-val {
    font-size: 12px;
    font-weight: 600;
    color: var(--secondary);
    min-width: 28px;
    text-align: right;
}

.btn-reset-slider {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
}

.btn-reset-slider:hover {
    color: var(--error);
    background: #fef2f2;
}

.img-editor-text-row {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.img-editor-text-row .form-select {
    font-size: 12px;
    padding: 5px 8px;
}

.img-editor-section .form-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
}

.img-editor-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.img-editor-actions .btn-vs-primary,
.img-editor-actions .btn-vs-secondary {
    width: 100%;
    justify-content: center;
    font-size: 13px;
}

/* ── Underwater Correction ── */

.uw-detect-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    background: var(--bg);
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.uw-detect-bar .spinner-sm {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.uw-detect-found {
    background: #ECFDF5;
    color: #065F46;
}

.uw-detect-found i {
    color: #10B981;
}

.uw-detect-none {
    background: var(--bg);
    color: var(--text-secondary);
}

.uw-detect-none i {
    color: var(--text-secondary);
}

.uw-detect-error {
    background: #FEF2F2;
    color: #991B1B;
}

.uw-detect-error i {
    color: var(--red);
}

.uw-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 0;
    color: var(--text);
}

.uw-toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--secondary);
}

.uw-control-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 8px 0 4px;
    font-weight: 500;
}

@media (max-width: 700px) {
    .img-editor-layout {
        flex-direction: column;
    }

    .img-editor-controls {
        width: 100%;
    }

    .img-editor-canvas-wrap {
        position: sticky;
        top: 0;
        z-index: 10;
        min-height: 120px;
        padding: 8px;
        border-radius: 8px 8px 0 0;
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }

    .img-editor-canvas-wrap canvas {
        max-height: 200px;
        width: auto;
    }

    .modal-card--wide {
        max-width: 100%;
        margin: 0;
        padding: 0;
        border-radius: 0;
        max-height: none;
    }

    .modal-card--wide .modal-header {
        position: sticky;
        top: 0;
        z-index: 11;
        background: var(--card-bg);
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
        margin-bottom: 0;
    }

    .modal-card--wide .modal-header h2 {
        font-size: 16px;
    }

    .img-editor-controls {
        padding: 12px 16px;
    }

    .img-editor-section {
        padding: 10px;
    }

    .img-editor-actions {
        position: sticky;
        bottom: 0;
        background: var(--card-bg);
        padding: 12px 16px;
        border-top: 1px solid var(--border);
        margin: 0 -16px;
        width: calc(100% + 32px);
    }
}

/* ── PWA / Mobile enhancements ── */

@media (max-width: 600px) {
    /* Scheduling panel: stack platform options and buttons */
    .sched-platform {
        flex-direction: column;
    }

    .sched-selected {
        flex-direction: column;
    }

    .sched-selected-header {
        flex-direction: column;
        gap: 8px;
    }

    /* Post history table: horizontal scroll on narrow screens */
    .sched-history-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Status monitor cards: full width, larger tap targets */
    .status-card {
        padding: 16px;
    }

    .status-card .status-indicator {
        width: 14px;
        height: 14px;
    }

    /* Nav: prevent long names from breaking layout */
    .nav-user {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    /* Extra-small: tighter padding */
    .tool-page-container {
        padding: 12px 10px;
    }

    .social-layout .panel {
        padding: 16px;
    }

    /* Stack action buttons vertically */
    .form-actions {
        flex-direction: column;
    }

    .form-actions button {
        width: 100%;
    }
}

/* ════════════════════════════════
   DASHBOARD — Ask Claude Bar
   ════════════════════════════════ */
.ask-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 8px 12px 8px 16px;
    margin-bottom: 20px;
    transition: border-color 0.2s;
}
.ask-bar:focus-within { border-color: var(--primary); }
.ask-bar__icon { color: var(--primary); font-size: 18px; flex-shrink: 0; }
.ask-bar__input {
    flex: 1; border: none; outline: none;
    font-size: 15px; background: transparent;
    font-family: inherit; color: var(--text);
}
.ask-bar__input::placeholder { color: var(--text-secondary); }
.ask-bar__btn {
    background: var(--primary); color: #fff; border: none;
    border-radius: 8px; padding: 8px 16px; cursor: pointer;
    font-size: 14px; flex-shrink: 0; transition: background 0.15s;
}
.ask-bar__btn:hover { background: #164070; }
.ask-bar__btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ask-bar__hint {
    font-size: 11px; color: var(--text-secondary); flex-shrink: 0;
    opacity: 0.6;
}

/* ════════════════════════════════
   DASHBOARD — User Dropdown Menu
   ════════════════════════════════ */
.nav-user-menu { position: relative; }
.nav-user-trigger {
    cursor: pointer; font-size: 14px; opacity: 0.9;
    display: flex; align-items: center; gap: 6px; color: #fff;
    transition: opacity 0.15s;
}
.nav-user-trigger:hover { opacity: 1; }
.nav-user-dropdown {
    display: none; position: absolute; right: 0; top: 36px;
    background: #fff; border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15); min-width: 180px; z-index: 200;
    overflow: hidden;
}
.nav-user-dropdown.show { display: block; }
.nav-user-dropdown__item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; color: var(--text); font-size: 14px;
    text-decoration: none; transition: background 0.15s;
}
.nav-user-dropdown__item:hover { background: var(--bg); }
.nav-user-dropdown__item i { width: 16px; color: var(--text-secondary); }

/* ════════════════════════════════
   DASHBOARD — Tool Filter
   ════════════════════════════════ */
.tools-filter {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 16px; max-width: 320px;
}
.tools-filter i { color: var(--text-secondary); font-size: 14px; }
.tools-filter input {
    flex: 1; border: 1px solid var(--border); border-radius: 6px;
    padding: 6px 10px; font-size: 13px; font-family: inherit;
    outline: none; background: var(--card-bg); color: var(--text);
}
.tools-filter input:focus { border-color: var(--primary); }

/* ════════════════════════════════
   DASHBOARD — Reset Order Link
   ════════════════════════════════ */
.tools-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
}
.reset-order {
    font-size: 12px; color: var(--secondary); cursor: pointer;
    text-decoration: none; opacity: 0.7; transition: opacity 0.15s;
}
.reset-order:hover { opacity: 1; text-decoration: underline; }
