* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f1f5f9;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Wraps sidebar + main content */
.app-layout {
    display: flex;
    flex: 1;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1e3a5f 0%, #0f172a 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
}

/* Sidebar Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 8px;
}
.brand-logo {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}
.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.brand-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
}
.brand-subtitle {
    font-size: 0.85rem;
    font-weight: 400;
    color: rgba(255,255,255,0.8);
}
.beta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
    box-shadow: 0 2px 8px rgba(102,126,234,0.5), 0 0 20px rgba(102,126,234,0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: beta-pulse 3s ease-in-out infinite;
}
.beta-flask-icon {
    width: 12px;
    height: 12px;
    animation: flask-wiggle 2s ease-in-out infinite;
}
@keyframes beta-pulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(102,126,234,0.5), 0 0 20px rgba(102,126,234,0.3); }
    50% { box-shadow: 0 2px 12px rgba(102,126,234,0.7), 0 0 30px rgba(102,126,234,0.5); }
}
@keyframes flask-wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.sidebar-nav {
    flex: 1;
    padding: 8px 12px;
    overflow-y: auto;
}
.nav-section {
    margin-bottom: 24px;
}
.nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.4);
    padding: 0 12px;
    margin-bottom: 8px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active { background: rgba(59, 130, 246, 0.3); color: white; }
.nav-icon { width: 20px; text-align: center; }
.nav-icon-svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.8;
}
.nav-item:hover .nav-icon-svg,
.nav-item.active .nav-icon-svg { opacity: 1; }

/* Main Content Area */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Navigation */
.topnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
}
.topnav-left { display: flex; align-items: center; gap: 8px; }
.topnav-right { display: flex; align-items: center; gap: 12px; }
.breadcrumb { font-size: 0.875rem; color: #64748b; }
.breadcrumb a { color: #3b82f6; text-decoration: none; }

/* User Dropdown */
.user-dropdown-wrapper {
    position: relative;
}
.user-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}
.user-trigger:hover { background: #f1f5f9; }
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}
.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
}
.admin-badge {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f5a623;
    color: white;
}
.chevron-icon {
    width: 16px;
    height: 16px;
    color: #94a3b8;
    transition: transform 0.15s;
}
.user-dropdown-menu.open ~ .user-trigger .chevron-icon,
.user-trigger:focus .chevron-icon { transform: rotate(180deg); }

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 260px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    z-index: 1000;
    overflow: hidden;
}
.user-dropdown-menu.open { display: block; }

.user-dropdown-header {
    padding: 16px 16px 12px;
}
.dropdown-user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
}
.dropdown-user-email {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 2px;
}
.dropdown-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 0;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.875rem;
    color: #475569;
    text-decoration: none;
    transition: background 0.15s;
    cursor: pointer;
}
.dropdown-item:hover { background: #f8fafc; }
.dropdown-item-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.dropdown-item.admin-only-item .dropdown-item-icon {
    color: #f5a623;
}
.dropdown-logout {
    color: #dc3545;
}
.dropdown-logout .dropdown-item-icon {
    color: #dc3545;
}
.dropdown-logout:hover { background: #fef2f2; }

/* Page Content */
.page-content { flex: 1; padding: 24px; }
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 1.5rem; font-weight: 600; color: #1e293b; margin-bottom: 4px; }
.page-header p { color: #64748b; font-size: 0.875rem; }
.page-header a { color: #3b82f6; text-decoration: none; }
.page-header a:hover { text-decoration: underline; }

/* Welcome Hero */
.welcome-hero {
    text-align: center;
    padding: 60px 24px 48px;
    background: linear-gradient(135deg, #1e3a5f 0%, #3b82f6 100%);
    color: white;
    border-radius: 16px;
    margin-bottom: 32px;
}
.welcome-hero-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
}
.welcome-hero h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.welcome-hero p {
    font-size: 1.125rem;
    opacity: 0.9;
}

/* Welcome CTA Cards */
.welcome-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}
.welcome-card {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    padding: 28px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, transform 0.2s;
    position: relative;
}
.welcome-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}
.welcome-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.welcome-card-icon svg {
    width: 24px;
    height: 24px;
}
.welcome-card-icon.blue { background: #dbeafe; color: #3b82f6; }
.welcome-card-icon.green { background: #dcfce7; color: #16a34a; }
.welcome-card-icon.purple { background: #f3e8ff; color: #8b5cf6; }
.welcome-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}
.welcome-card p {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.5;
    flex: 1;
}
.welcome-card-arrow {
    font-size: 1.25rem;
    color: #3b82f6;
    margin-top: 16px;
    align-self: flex-end;
    transition: transform 0.15s;
}
.welcome-card:hover .welcome-card-arrow { transform: translateX(4px); }

@media (max-width: 900px) { .welcome-cards { grid-template-columns: 1fr; } }

/* Admin Panel Grid */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.admin-card {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    padding: 28px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.2s, transform 0.2s;
}
.admin-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}
.admin-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.admin-card-icon svg {
    width: 24px;
    height: 24px;
}
.admin-card-icon.blue { background: #dbeafe; color: #3b82f6; }
.admin-card-icon.purple { background: #f3e8ff; color: #8b5cf6; }
.admin-card-icon.orange { background: #ffedd5; color: #f97316; }
.admin-card-icon.green { background: #dcfce7; color: #16a34a; }
.admin-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}
.admin-card p {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.5;
}
@media (max-width: 640px) { .admin-grid { grid-template-columns: 1fr; } }

/* Content Cards (Dashboard stats) */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.card-title { font-size: 0.875rem; font-weight: 500; color: #64748b; }
.card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}
.card-icon svg {
    width: 20px;
    height: 20px;
}
.card-icon.blue { background: #dbeafe; color: #3b82f6; }
.card-icon.green { background: #dcfce7; color: #16a34a; }
.card-icon.purple { background: #f3e8ff; color: #8b5cf6; }
.card-icon.orange { background: #ffedd5; color: #f97316; }
.card-value { font-size: 1.75rem; font-weight: 600; color: #1e293b; }
.card-change { font-size: 0.75rem; margin-top: 4px; }
.card-change.positive { color: #16a34a; }
.card-change.negative { color: #dc2626; }


.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
    border: none;
    cursor: pointer;
}
.btn-primary { background: #3b82f6; color: white; }
.btn-primary:hover { background: #2563eb; }
.btn-secondary { background: #f1f5f9; color: #475569; }
.btn-secondary:hover { background: #e2e8f0; }
.quick-links {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}
.main-content-area {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.placeholder { text-align: center; padding: 60px 20px; }
.placeholder-icon { font-size: 4rem; margin-bottom: 20px; }
.placeholder h3 { font-size: 1.25rem; color: #1e293b; margin-bottom: 8px; }
.placeholder p { color: #64748b; max-width: 400px; margin: 0 auto 24px; }

/* Download page (SPA route) */
.download-container { max-width: 900px; margin: 0 auto; }
.download-hero {
    text-align: center;
    padding: 48px 24px;
    background: linear-gradient(135deg, #1e3a5f 0%, #3b82f6 100%);
    color: white;
    border-radius: 16px;
    margin-bottom: 32px;
}
.download-hero h2 { font-size: 2rem; margin-bottom: 8px; }
.download-hero p { font-size: 1.125rem; opacity: 0.9; }
.download-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.download-cards .card h3 { font-size: 1.125rem; margin-bottom: 8px; color: #1e293b; }
.download-cards .card ol { padding-left: 20px; margin-top: 12px; }
.download-cards .card li { margin-bottom: 8px; color: #475569; line-height: 1.5; }
.download-cards .card code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 0.875rem; }
.download-cards .card strong { color: #1e293b; }
.card-subtitle { color: #64748b; font-size: 0.875rem; line-height: 1.5; margin-bottom: 12px; }
.install-details { margin-top: 16px; padding-top: 16px; border-top: 1px solid #e2e8f0; }
.install-details > strong { display: block; margin-bottom: 8px; color: #1e293b; font-size: 0.875rem; }
.install-details ol { padding-left: 20px; }
.install-details li { margin-bottom: 8px; color: #475569; line-height: 1.5; }
.code-block {
    display: block;
    margin-top: 6px;
    padding: 8px 12px;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}
.inline-link { color: #3b82f6; text-decoration: none; font-weight: 500; }
.inline-link:hover { text-decoration: underline; }
.how-to {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 24px;
}
.how-to h3 { font-size: 1.125rem; margin-bottom: 12px; color: #1e293b; }
.how-to p { color: #475569; line-height: 1.5; }
.how-to ol { padding-left: 20px; }
.how-to li { margin-bottom: 8px; color: #475569; line-height: 1.5; }
kbd {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.875rem;
    border: 1px solid #cbd5e1;
}
@media (max-width: 640px) { .download-cards { grid-template-columns: 1fr; } }

/* How to Use Page */
.howto-container { max-width: 900px; margin: 0 auto; }
.howto-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 16px;
    margin-top: 8px;
}
.howto-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}
.howto-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.howto-step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}
.howto-step-content h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}
.howto-step-content p {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.5;
}
.howto-step-img {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 12px;
    border: 1px solid #e2e8f0;
}
.howto-tip {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 12px;
    font-size: 0.875rem;
    color: #475569;
    line-height: 1.5;
}
.howto-tip-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Whitelist Admin Page */
.whitelist-container { max-width: 900px; }
.whitelist-toggle-card h3 { font-size: 1.125rem; color: #1e293b; }
.whitelist-toggle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.whitelist-version-info {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    font-size: 0.75rem;
    color: #94a3b8;
}
.whitelist-error {
    padding: 16px;
    background: #fef2f2;
    color: #991b1b;
    border-radius: 8px;
    border: 1px solid #fecaca;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
    cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 26px;
    transition: background 0.2s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: #3b82f6; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }

/* Whitelist form */
.whitelist-add-form {
    display: flex;
    gap: 8px;
    align-items: center;
}
.whitelist-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s;
}
.whitelist-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.15); }

/* Whitelist table */
.whitelist-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.whitelist-table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid #e2e8f0;
    color: #64748b;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.whitelist-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
}
.whitelist-table code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
}
.whitelist-table tbody tr:hover { background: #f8fafc; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #f1f5f9; color: #64748b; }

/* Danger button (small) */
.btn-danger-sm {
    padding: 4px 10px;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-danger-sm:hover { background: #fee2e2; border-color: #fca5a5; }

/* Writing Editor */
.editor-layout {
    display: flex;
    gap: 24px;
    min-height: 500px;
}
.editor-input-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.editor-results-panel {
    width: 340px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Quill container */
.editor-quill-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.editor-quill-wrapper .ql-toolbar {
    border: none;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
.editor-quill-wrapper .ql-container {
    border: none;
    flex: 1;
    font-size: 0.95rem;
    font-family: inherit;
}
.editor-quill-wrapper .ql-editor {
    min-height: 400px;
    padding: 20px;
    line-height: 1.7;
}
.editor-quill-wrapper .ql-editor.ql-blank::before {
    color: #94a3b8;
    font-style: normal;
}

/* Editor footer (char count + button) */
.editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-top: 12px;
}
.editor-char-count {
    font-size: 0.8rem;
    color: #94a3b8;
}
.editor-char-count.over-limit { color: #dc2626; font-weight: 600; }
.editor-analyze-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
}
.editor-analyze-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.editor-analyze-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Score ring */
.editor-score-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    text-align: center;
}
.editor-score-ring {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 12px;
}
.editor-score-ring svg {
    transform: rotate(-90deg);
    width: 100px;
    height: 100px;
}
.editor-score-ring .ring-bg {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 8;
}
.editor-score-ring .ring-fg {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease, stroke 0.5s;
}
.editor-score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}
.editor-score-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 12px;
}
.editor-tone-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
    background: #f1f5f9;
    color: #475569;
}

/* Suggestions & Rewrites panels */
.editor-section-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.editor-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.editor-section-count {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 9999px;
    background: #e2e8f0;
    color: #64748b;
}

/* Individual suggestion item */
.editor-suggestion {
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: opacity 0.3s, max-height 0.3s;
    overflow: hidden;
}
.editor-suggestion.dismissed {
    opacity: 0;
    max-height: 0;
    padding: 0 12px;
    margin-bottom: 0;
    border-color: transparent;
}
.editor-suggestion-category {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 6px;
}
.editor-suggestion-category.spelling { background: #fef3c7; color: #92400e; }
.editor-suggestion-category.grammar { background: #dbeafe; color: #1e40af; }
.editor-suggestion-category.punctuation { background: #f3e8ff; color: #6b21a8; }
.editor-suggestion-category.clarity { background: #dcfce7; color: #166534; }
.editor-suggestion-category.style { background: #e0e7ff; color: #3730a3; }
.editor-suggestion-category.word\ choice { background: #fce7f3; color: #9d174d; }
.editor-suggestion-text {
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 4px;
    line-height: 1.4;
}
.editor-suggestion-text .original {
    text-decoration: line-through;
    color: #dc2626;
    background: #fef2f2;
    padding: 0 3px;
    border-radius: 2px;
}
.editor-suggestion-text .replacement {
    color: #16a34a;
    background: #f0fdf4;
    padding: 0 3px;
    border-radius: 2px;
    font-weight: 500;
}
.editor-suggestion-explanation {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 8px;
}
.editor-suggestion-actions {
    display: flex;
    gap: 6px;
}
.editor-btn-accept {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #16a34a;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}
.editor-btn-accept:hover { background: #15803d; }
.editor-btn-dismiss {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #f1f5f9;
    color: #64748b;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}
.editor-btn-dismiss:hover { background: #e2e8f0; }

/* Spelling group card */
.editor-spelling-group {
    border-left: 3px solid #f59e0b;
}
.editor-spelling-fix {
    font-size: 0.85rem;
    color: #475569;
    padding: 4px 0;
    line-height: 1.4;
}
.editor-spelling-fix .original {
    text-decoration: line-through;
    color: #dc2626;
    background: #fef2f2;
    padding: 0 3px;
    border-radius: 2px;
}
.editor-spelling-fix .replacement {
    color: #16a34a;
    background: #f0fdf4;
    padding: 0 3px;
    border-radius: 2px;
    font-weight: 500;
}

/* Rewrite item */
.editor-rewrite {
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: opacity 0.3s, max-height 0.3s;
    overflow: hidden;
}
.editor-rewrite.dismissed {
    opacity: 0;
    max-height: 0;
    padding: 0 12px;
    margin-bottom: 0;
    border-color: transparent;
}
.editor-rewrite-original {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 6px;
    line-height: 1.4;
    font-style: italic;
}
.editor-rewrite-arrow {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 6px;
}
.editor-rewrite-text {
    font-size: 0.85rem;
    color: #1e293b;
    margin-bottom: 4px;
    line-height: 1.4;
    font-weight: 500;
}
.editor-rewrite-reason {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 8px;
}
.editor-btn-rewrite {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #3b82f6;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}
.editor-btn-rewrite:hover { background: #2563eb; }

/* Summary bar */
.editor-summary {
    font-size: 0.8rem;
    color: #64748b;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    line-height: 1.4;
}

/* Skeleton loading */
.editor-skeleton {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.editor-skeleton-line {
    height: 14px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
    margin-bottom: 10px;
}
.editor-skeleton-line:last-child { margin-bottom: 0; }
.editor-skeleton-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    margin: 0 auto 12px;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Empty state */
.editor-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}
.editor-empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}
.editor-empty-state p {
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Welcome card color for editor */
.welcome-card-icon.amber { background: #fef3c7; color: #d97706; }

/* Responsive: stack panels on narrow screens */
@media (max-width: 900px) {
    .editor-layout {
        flex-direction: column;
    }
    .editor-results-panel {
        width: 100%;
    }
}

/* Print stylesheet — How to Use page */
@media print {
    /* Hide site chrome */
    .sidebar,
    .topnav,
    .page-header {
        display: none !important;
    }

    /* Full-width layout */
    .app-layout {
        display: block !important;
    }
    .main-wrapper {
        margin: 0 !important;
        padding: 0 !important;
    }
    .page-content {
        padding: 0 !important;
        margin: 0 !important;
    }
    .howto-container {
        max-width: 100% !important;
        margin: 0 !important;
    }

    /* Print header */
    .howto-container::before {
        content: "WinnieGrammar — How to Use";
        display: block;
        font-size: 24pt;
        font-weight: 700;
        margin-bottom: 16pt;
        color: #000;
    }

    /* Clean step cards for print */
    .howto-step {
        box-shadow: none !important;
        border: 1px solid #ccc;
        border-radius: 4px !important;
        padding: 12pt !important;
        break-inside: avoid;
        margin-bottom: 10pt;
    }
    .howto-steps {
        gap: 0 !important;
    }

    /* Step number badge — solid black circle for print */
    .howto-step-number {
        background: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Text colors for print */
    .howto-step-content h4 {
        color: #000 !important;
    }
    .howto-step-content p {
        color: #333 !important;
    }
    .howto-section-title {
        color: #000 !important;
    }

    /* Images — fit on page, avoid splitting across pages */
    .howto-step-img {
        max-width: 100% !important;
        border: 1px solid #999 !important;
        border-radius: 4px !important;
        break-inside: avoid;
    }

    /* Tips section */
    .howto-tip {
        box-shadow: none !important;
        border: 1px solid #ccc;
        border-radius: 4px !important;
        break-inside: avoid;
        color: #333 !important;
    }

    /* General print cleanup */
    body {
        background: white !important;
        font-size: 11pt;
    }
    a {
        color: #000 !important;
        text-decoration: none !important;
    }
}
