/* ── SparkProof AI — DEWA Compliance UI ── */

:root {
    --bg: #0f0f11;
    --bg-secondary: #1a1a1f;
    --bg-tertiary: #232329;
    --text: #e8e8ed;
    --text-secondary: #8e8e93;
    --accent: #ff9f0a;
    --accent-hover: #ffb340;
    --accent-glow: rgba(255, 159, 10, 0.15);
    --green: #30d158;
    --red: #ff453a;
    --blue: #0a84ff;
    --border: #2c2c30;
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 900px;
    margin: 0 auto;
}

/* ── Header ── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.header-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo-img {
    width: 28px;
    height: 28px;
}

.header h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 8px;
    transition: all 0.15s;
}
.header-link:hover {
    color: var(--text);
    background: var(--bg-tertiary);
}

.lang-toggle {
    background: none;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s;
}
.lang-toggle:hover { color: var(--text); border-color: var(--text-secondary); }

.auth-btn {
    font-size: 13px;
    font-weight: 600;
    color: var(--bg);
    background: var(--accent);
    text-decoration: none;
    padding: 6px 16px;
    border-radius: 8px;
    transition: all 0.15s;
}
.auth-btn:hover { background: var(--accent-hover); }
.auth-btn.logged-in {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.admin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s;
}
.admin-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-glow);
}

.header-status {
    display: flex;
    align-items: center;
    margin-left: 4px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: background 0.3s;
}

.status-dot.online { background: var(--green); }
.status-dot.offline { background: var(--red); }

/* ── Chat Area ── */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    scroll-behavior: smooth;
}

/* ── Welcome Screen ── */
.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 60vh;
    gap: 16px;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 8px;
}

.welcome h2 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.welcome p {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 480px;
    line-height: 1.5;
}

.quick-questions {
    margin-top: 24px;
    width: 100%;
    max-width: 600px;
}

.quick-questions h3 {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.quick-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-secondary);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.quick-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.quick-label {
    font-weight: 500;
    line-height: 1.3;
}

.welcome-features {
    display: flex;
    gap: 24px;
    margin-top: 28px;
    flex-wrap: wrap;
    justify-content: center;
}

.feature {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ── Messages ── */
.messages {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--blue);
    color: white;
}

.message.assistant .message-avatar {
    background: var(--accent-glow);
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-role {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.message-text {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message.user .message-text {
    background: var(--bg-secondary);
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* ── Sources ── */
.sources {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.sources-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.source-item {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.source-item::before {
    content: '📄';
    font-size: 12px;
}

/* ── Loading ── */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ── Input Area ── */
.input-area {
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.input-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 150px;
    line-height: 1.5;
}

textarea::placeholder {
    color: var(--text-secondary);
}

#sendBtn {
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: var(--radius-sm);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

#sendBtn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

#sendBtn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    padding: 0 4px;
}

.powered-by, .char-count {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ── Error ── */
.error-message {
    background: rgba(255, 69, 58, 0.1);
    border: 1px solid rgba(255, 69, 58, 0.3);
    color: var(--red);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.error-message.rate-limit {
    background: rgba(255, 159, 10, 0.1);
    border-color: rgba(255, 159, 10, 0.3);
    color: var(--accent);
}

.error-message.offline {
    background: rgba(142, 142, 147, 0.1);
    border-color: rgba(142, 142, 147, 0.3);
    color: var(--text-secondary);
}

/* ── Markdown Content ── */
.message-text h1, .message-text h2, .message-text h3, .message-text h4 {
    margin-top: 12px;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text);
}

.message-text h1 { font-size: 18px; }
.message-text h2 { font-size: 16px; }
.message-text h3 { font-size: 15px; color: var(--accent); }

.message-text p {
    margin-bottom: 8px;
    line-height: 1.7;
}

.message-text ul, .message-text ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message-text li {
    margin-bottom: 4px;
    line-height: 1.6;
}

.message-text code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    color: var(--accent);
}

.message-text pre {
    background: var(--bg-tertiary);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 8px 0;
    border: 1px solid var(--border);
}

.message-text pre code {
    background: transparent;
    padding: 0;
    color: var(--text);
}

.message-text strong {
    color: var(--text);
    font-weight: 600;
}

.message-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 13px;
}

.message-text th, .message-text td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}

.message-text th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--accent);
}

.message-text blockquote {
    border-left: 3px solid var(--accent);
    margin: 8px 0;
    padding: 4px 12px;
    color: var(--text-secondary);
    background: var(--accent-glow);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ── Scrollbar ── */
.chat-area::-webkit-scrollbar {
    width: 6px;
}

.chat-area::-webkit-scrollbar-track {
    background: transparent;
}

.chat-area::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .header { padding: 0 12px; height: 48px; }
    .chat-area { padding: 16px; }
    .input-area { padding: 12px 16px 16px; }
    .welcome h2 { font-size: 22px; }
    .header-link { padding: 6px 8px; font-size: 12px; }
    .quick-grid { grid-template-columns: 1fr; }
    .welcome-features { flex-direction: column; gap: 8px; }
    .header h1 { font-size: 15px; }
    .auth-btn { padding: 5px 10px; font-size: 12px; }
}

/* ═══════════════════════════════════════════════════════════
   ── Photo Upload ──
   ═══════════════════════════════════════════════════════════ */

.photo-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.photo-btn:hover { background: var(--accent-glow); transform: scale(1.1); }

.photo-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}
.photo-preview img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid var(--accent);
}
.photo-remove {
    background: var(--red);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.photo-label {
    font-size: 12px;
    color: var(--accent);
    font-weight: 500;
}
.chat-photo-thumb {
    max-width: 200px;
    max-height: 150px;
    border-radius: var(--radius-sm);
    margin: 8px 0;
    border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   ── Tool Pages (Calculator / Checklist) ──
   ═══════════════════════════════════════════════════════════ */

.tool-page {
    max-width: 960px;
}
.tool-page .app {
    height: auto;
    min-height: 100vh;
}
.tool-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}
.tool-hero {
    text-align: center;
    margin-bottom: 32px;
}
.tool-hero h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}
.tool-hero p {
    color: var(--text-secondary);
    font-size: 15px;
}

/* ── Calculator Tabs ── */
.calc-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    justify-content: center;
    flex-wrap: wrap;
}
.calc-tab {
    padding: 10px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.calc-tab:hover { border-color: var(--accent); color: var(--text); }
.calc-tab.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.calc-panel { display: none; }
.calc-panel.active { display: block; }

/* ── Form Styles ── */
.calc-form {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--accent);
}
.calc-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}
.calc-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.calc-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.calc-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text);
    border: 1px solid var(--border);
}
.calc-btn.secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ── Calculator Results ── */
.calc-result { min-height: 20px; }
.result-grid {
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 20px;
    display: grid;
    gap: 8px;
}
.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
}
.result-key {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}
.result-val {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.result-val.val-good { color: var(--green); }
.result-val.val-bad { color: var(--red); }
.result-val.val-ref { color: var(--accent); font-size: 12px; }
.result-val.val-note { color: var(--blue); font-size: 13px; }
.result-error {
    padding: 16px;
    background: rgba(255, 69, 58, 0.1);
    border: 1px solid rgba(255, 69, 58, 0.3);
    border-radius: var(--radius-sm);
    color: var(--red);
    text-align: center;
}
.result-loading {
    padding: 16px;
    text-align: center;
    color: var(--accent);
}

/* ── Appliance List (Load Calculator) ── */
.appliance-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.appliance-row {
    display: grid;
    grid-template-columns: 2fr 1fr 0.5fr auto;
    gap: 8px;
    align-items: center;
}
.appliance-row input {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    outline: none;
}
.appliance-row input:focus { border-color: var(--accent); }
.app-remove {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}
.app-remove:hover { background: var(--red); color: white; border-color: var(--red); }
.add-appliance-btn {
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-secondary);
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    width: 100%;
    transition: all 0.2s;
}
.add-appliance-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   ── Checklists ──
   ═══════════════════════════════════════════════════════════ */

.checklist-selector h3 {
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 20px;
}
.checklist-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
.checklist-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 28px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}
.checklist-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(255, 159, 10, 0.1);
}
.card-icon { font-size: 48px; }
.card-title { font-size: 16px; font-weight: 600; }
.card-desc { font-size: 13px; color: var(--text-secondary); }

/* ── Checklist View ── */
.checklist-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.back-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.back-btn:hover { border-color: var(--accent); color: var(--accent); }
.checklist-header h3 { flex: 1; font-size: 20px; }
.checklist-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
}
.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s, background 0.3s;
    width: 0;
}
.progress-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.project-info-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}
.project-input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    outline: none;
}
.project-input:focus { border-color: var(--accent); }

/* ── Checklist Sections ── */
.cl-section {
    margin-bottom: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.cl-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    background: var(--bg-tertiary);
    transition: background 0.2s;
}
.cl-section-header:hover { background: rgba(255,159,10,0.05); }
.cl-section-header h4 { flex: 1; font-size: 15px; font-weight: 600; }
.cl-ref { font-size: 12px; color: var(--accent); font-weight: 500; }
.cl-section-count { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.cl-chevron {
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}
.cl-section.collapsed .cl-chevron { transform: rotate(-90deg); }
.cl-section.collapsed .cl-items { display: none; }

.cl-items { padding: 8px 18px 14px; }
.cl-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    border-bottom: 1px solid rgba(44,44,48,0.5);
    transition: background 0.1s;
}
.cl-item:last-child { border-bottom: none; }
.cl-item:hover { background: rgba(255,255,255,0.02); }
.cl-item input[type="checkbox"] { display: none; }
.cl-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-top: 1px;
}
.cl-item input:checked + .cl-checkbox {
    background: var(--green);
    border-color: var(--green);
}
.cl-item input:checked + .cl-checkbox::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: 700;
}
.cl-item input:checked ~ .cl-text {
    color: var(--text-secondary);
    text-decoration: line-through;
}
.cl-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
}

.checklist-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}
.checklist-actions .calc-btn { flex: 1; }

.checklist-notes {
    margin-top: 20px;
}
.checklist-notes label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}
.checklist-notes textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    outline: none;
}
.checklist-notes textarea:focus { border-color: var(--accent); }

/* ── Mobile responsive for tools ── */
@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; gap: 12px; }
    .appliance-row { grid-template-columns: 1fr 80px 50px auto; }
    .checklist-actions { flex-direction: column; }
    .project-info-bar { flex-direction: column; }
    .checklist-header { flex-direction: column; align-items: flex-start; }
    .calc-tabs { gap: 4px; }
    .calc-tab { padding: 8px 14px; font-size: 13px; }
}

/* ── RTL (Arabic) Support ── */
[dir="rtl"] {
    font-family: 'Segoe UI', Tahoma, 'Arial', sans-serif;
}

[dir="rtl"] .header {
    flex-direction: row-reverse;
}

[dir="rtl"] .header-brand {
    flex-direction: row-reverse;
}

[dir="rtl"] .header-nav {
    flex-direction: row-reverse;
}

[dir="rtl"] .message {
    flex-direction: row-reverse;
}

[dir="rtl"] .message-content {
    text-align: right;
}

[dir="rtl"] .message-text {
    direction: rtl;
}

[dir="rtl"] .input-wrapper {
    flex-direction: row-reverse;
}

[dir="rtl"] .input-footer {
    flex-direction: row-reverse;
}

[dir="rtl"] .quick-grid {
    direction: rtl;
}

[dir="rtl"] .quick-btn {
    text-align: right;
}

[dir="rtl"] .welcome-features .feature {
    flex-direction: row-reverse;
}

[dir="rtl"] .sources {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .photo-preview {
    flex-direction: row-reverse;
}

[dir="rtl"] textarea {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .status-dot {
    margin-left: 0;
    margin-right: 6px;
}

/* ── Feedback buttons ── */
.feedback-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.feedback-label {
    font-size: 12px;
    color: var(--text-secondary);
}
.feedback-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.feedback-btn:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}
.feedback-done {
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
}

/* ── Usage badge ── */
.usage-badge {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 3px 10px;
    border-radius: 12px;
    margin-right: 8px;
    border: 1px solid var(--border);
}
.usage-badge.low {
    color: var(--red);
    border-color: rgba(255, 69, 58, 0.3);
    background: rgba(255, 69, 58, 0.1);
}
.usage-badge.unlimited {
    color: var(--green);
    border-color: rgba(48, 209, 88, 0.3);
    background: rgba(48, 209, 88, 0.1);
}

/* ── Soft paywall ── */
.soft-paywall {
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(255,159,10,0.05) 100%);
    border: 1px solid rgba(255,159,10,0.2);
    border-radius: var(--radius);
}
.paywall-icon {
    font-size: 48px;
    margin-bottom: 12px;
}
.soft-paywall h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}
.soft-paywall p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}
.paywall-btn {
    display: inline-block;
    padding: 12px 28px;
    background: var(--accent);
    color: #000;
    font-weight: 700;
    font-size: 15px;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s;
}
.paywall-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255,159,10,0.3);
}
.paywall-dismiss {
    display: block;
    margin: 12px auto 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
}
.paywall-dismiss:hover {
    color: var(--text);
}

/* ── Onboarding tour ── */
.onboard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
}
.onboard-tooltip {
    position: absolute;
    width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: 0 8px 32px rgba(255, 159, 10, 0.2);
    z-index: 10001;
}
.onboard-text {
    font-size: 14px;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 12px;
}
.onboard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.onboard-step {
    font-size: 12px;
    color: var(--text-secondary);
}
.onboard-next {
    padding: 6px 16px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.onboard-next:hover {
    background: var(--accent-hover);
}
.onboard-highlight {
    position: relative;
    z-index: 10001;
    box-shadow: 0 0 0 4px var(--accent), 0 0 16px rgba(255,159,10,0.4);
    border-radius: 8px;
}
