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

:root {
    --primary: #7c3aed;
    --primary-hover: #6d28d9;
    --primary-light: #f5f3ff;
    --primary-glow: rgba(124, 58, 237, 0.15);
    --secondary: #06b6d4;
    --accent: #f59e0b;
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #1f1f36;
    --bg-input: #16162a;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #2d2d4a;
    --border-focus: #7c3aed;
    --success: #10b981;
    --error: #ef4444;
    --shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    --radius: 16px;
    --radius-sm: 10px;
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(245, 158, 11, 0.04) 0%, transparent 50%);
    background-attachment: fixed;
}

body.auth-page {
    justify-content: center;
    padding: 1rem;
}

.container {
    width: 100%;
    max-width: 820px;
}

/* ═══ Top Bar ═══ */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1.5rem;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
}

.top-bar .logo-section {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.top-bar .logo-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.top-bar .logo-text {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.top-bar .logo-text span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.top-bar .user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-bar .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.top-bar .user-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.top-bar .logout-btn {
    padding: 0.4rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.top-bar .logout-btn:hover {
    border-color: var(--error);
    color: var(--error);
    background: rgba(239, 68, 68, 0.08);
}

/* ═══ Header ═══ */
header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.logo-main {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

header h1 span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: var(--text-secondary);
    margin-top: 0.4rem;
    font-size: 1rem;
}

/* ═══ Converter Card ═══ */
.converter-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2rem 2.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

/* ═══ Mode Toggle ═══ */
.mode-toggle {
    display: flex;
    background: var(--bg-input);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}

.mode-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    border-radius: 9px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mode-btn .icon { font-size: 1.1rem; }

.mode-btn.active {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(124, 58, 237, 0.2);
}

.mode-btn:hover:not(.active) { color: var(--text-secondary); }

/* ═══ Upload Zone ═══ */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 14px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg-input);
    position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(124, 58, 237, 0.06);
}

.upload-zone .upload-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-glow);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 24px;
}

.upload-zone h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.upload-zone p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.upload-zone .browse-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.upload-zone input[type="file"] { display: none; }

.upload-zone .accepted-formats {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 6px;
}

.upload-zone .accepted-formats span {
    display: inline-block;
    background: var(--bg-card);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ═══ File Info ═══ */
.file-info {
    display: none;
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: rgba(124, 58, 237, 0.08);
    border-radius: 12px;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(124, 58, 237, 0.15);
}

.file-info.visible { display: flex; }

.file-info .file-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.file-info .file-details { flex: 1; min-width: 0; }

.file-info .file-name {
    font-weight: 600;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-info .file-size {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.file-info .file-remove {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-card);
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
    flex-shrink: 0;
}

.file-info .file-remove:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

/* ═══ Convert Button ═══ */
.convert-btn {
    width: 100%;
    margin-top: 1.5rem;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.convert-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255,255,255,0.06), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s;
}

.convert-btn:hover::before { transform: translateX(100%); }

.convert-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(124, 58, 237, 0.35);
}

.convert-btn:active:not(:disabled) { transform: translateY(0); }

.convert-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.convert-btn .btn-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.convert-btn.loading .btn-text { display: none; }
.convert-btn.loading .btn-spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ Progress Bar ═══ */
.progress-container {
    display: none;
    margin-top: 1.5rem;
}

.progress-container.visible { display: block; animation: fadeUp 0.25s ease; }

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 10px;
    transition: width 0.4s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    text-align: center;
}

/* ═══ Result Section ═══ */
.result-section {
    display: none;
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(16, 185, 129, 0.06);
    border-radius: 12px;
    border: 1px solid rgba(16, 185, 129, 0.2);
    text-align: center;
}

.result-section.visible { display: block; animation: fadeUp 0.3s ease; }

.result-section .result-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.result-section h3 {
    color: var(--success);
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
}

.result-section p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.75rem 2rem;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.download-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

/* ═══ Error ═══ */
.error-msg {
    display: none;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    color: var(--error);
    font-size: 0.9rem;
    text-align: center;
}

.error-msg.visible { display: block; animation: shakeIn 0.35s ease; }

@keyframes shakeIn {
    0% { opacity: 0; transform: translateX(-8px); }
    25% { transform: translateX(4px); }
    50% { transform: translateX(-3px); }
    75% { transform: translateX(1px); }
    100% { opacity: 1; transform: translateX(0); }
}

/* ═══ Features ═══ */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 2rem;
}

.feature {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 1.5rem 1.25rem;
    text-align: center;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.feature:hover {
    transform: translateY(-3px);
    border-color: rgba(124, 58, 237, 0.3);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.feature .feature-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-glow);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    font-size: 1.3rem;
}

.feature h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.feature p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ═══ Footer ═══ */
footer {
    margin-top: 2.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ════════════════════════════════════════════
   AUTH PAGES
   ════════════════════════════════════════════ */

.auth-container {
    width: 100%;
    max-width: 420px;
    animation: fadeUp 0.5s ease;
}

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

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 2.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    margin-bottom: 1.5rem;
}

.auth-logo .logo-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.auth-logo h1 span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-card h2 {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
}

.auth-sub {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    transition: all 0.2s;
    outline: none;
}

.form-group input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.auth-error {
    display: block;
    font-size: 0.85rem;
    color: var(--error);
    margin-bottom: 0.75rem;
    min-height: 1.2em;
}

.auth-success {
    display: block;
    font-size: 0.85rem;
    color: var(--success);
    margin-bottom: 0.75rem;
    min-height: 1.2em;
}

.auth-warning {
    padding: 0.6rem 1rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 10px;
    color: #fbbf24;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    text-align: center;
}

.auth-btn {
    width: 100%;
    padding: 0.85rem;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35);
}

.auth-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.auth-switch {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover { text-decoration: underline; }

/* ═══ Dashboard ═══ */
.dashboard {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.dashboard h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.conv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.conv-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.conv-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.conv-table tr:hover td {
    background: rgba(124, 58, 237, 0.03);
}

.conv-table .dir-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
}

.dir-badge.pdf2word {
    background: rgba(124, 58, 237, 0.12);
    color: #a78bfa;
}

.dir-badge.word2pdf {
    background: rgba(6, 182, 212, 0.12);
    color: #22d3ee;
}

/* ═══ Responsive ═══ */
/* ════════════════════════════════════════════
   TOOL GRID (DASHBOARD)
   ════════════════════════════════════════════ */

.tool-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    color: var(--text);
    width: 100%;
}

.tool-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 16px 40px rgba(124, 58, 237, 0.15);
    background: var(--bg-card-hover);
}

.tool-card:active {
    transform: translateY(-1px);
}

.tool-card-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.tool-card h3 {
    font-size: 1rem;
    font-weight: 700;
}

.tool-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ═══ Usage Bar ═══ */
.usage-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.25rem;
    margin-bottom: 2rem;
    font-size: 0.85rem;
}

.usage-bar span {
    color: var(--text-secondary);
}

.pro-link {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

.pro-link:hover { opacity: 0.8; }

.top-bar-center {
    display: flex;
    align-items: center;
    gap: 8px;
}

.usage-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.pro-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(234,179,8,0.1));
    border: 1px solid rgba(245,158,11,0.3);
    color: #fbbf24;
    text-decoration: none;
    font-weight: 600;
    display: none;
}

/* ═══ Tool View ═══ */
#tool-view {
    animation: fadeUp 0.35s ease;
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.back-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.back-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(124,58,237,0.06);
}

.tool-header-text {
    flex: 1;
}

.tool-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.tool-header-sub {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 400;
}

.tool-header-spacer { width: 80px; }

.tool-section {
    animation: fadeUp 0.35s ease;
}

.tool-description {
    margin-bottom: 1.5rem;
}

.tool-description h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.tool-description p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ═══ Background Remover ═══ */
.bg-result {
    display: none;
    margin-top: 1.5rem;
}

.bg-result.visible { display: block; animation: fadeUp 0.3s ease; }

.bg-result h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
}

.bg-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.bg-panel {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.bg-panel h4 {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.bg-panel img {
    width: 100%;
    display: block;
    max-height: 400px;
    object-fit: contain;
    background: repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 0 0 / 20px 20px;
}

#bgDownloadBtn {
    display: block;
    margin: 0 auto;
}

/* ═══ Invoice Generator ═══ */
/* ─── INVOICE GENERATOR ─── */

.inv-wrap {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

/* ── Form ── */
.inv-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.inv-form .inv-fld {
    margin-bottom: 0;
}

.inv-form .inv-fld label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.15rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.inv-form .inv-fld input,
.inv-form .inv-fld select,
.inv-form .inv-fld textarea {
    width: 100%;
    padding: 0.45rem 0.6rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.inv-form .inv-fld input:focus,
.inv-form .inv-fld select:focus,
.inv-form .inv-fld textarea:focus {
    border-color: var(--primary);
}

.inv-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.25rem 0;
}

.inv-row {
    display: grid;
    gap: 0.5rem;
}

.inv-row-2 { grid-template-columns: 1fr 1fr; }
.inv-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* Items */
.inv-item-row {
    display: grid;
    grid-template-columns: 1fr 50px 70px auto;
    gap: 4px;
    margin-bottom: 4px;
    align-items: center;
}

.inv-item-row input {
    padding: 0.4rem 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.8rem;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s;
}

.inv-item-row input:focus {
    border-color: var(--primary);
}

.inv-remove-item {
    width: 26px;
    height: 26px;
    border: none;
    background: rgba(239,68,68,0.08);
    border-radius: 5px;
    color: var(--error);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}

.inv-remove-item:hover {
    background: rgba(239,68,68,0.2);
}

.inv-add-item {
    padding: 0.3rem 0.8rem;
    border: 1px dashed var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    width: 100%;
}

.inv-add-item:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ── Preview ── */
.inv-preview {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    min-height: 400px;
    position: sticky;
    top: 1rem;
}

.inv-paper {
    padding: 1.75rem 1.75rem 1.25rem;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    color: #1e293b;
    min-height: 400px;
    font-size: 0.82rem;
}

.inv-paper-hd {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary, #6366f1);
}

.inv-company {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
}

.inv-addr {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 2px;
}

.inv-paper-rgt {
    text-align: right;
}

.inv-big-label {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary, #6366f1);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.inv-num {
    font-size: 0.82rem;
    color: #64748b;
    margin-top: 2px;
}

.inv-num span {
    color: #1e293b;
    font-weight: 600;
}

.inv-paper-body {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.inv-paper-col:last-child {
    text-align: right;
    flex-shrink: 0;
}

.inv-paper-col .inv-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin-top: 0.5rem;
    margin-bottom: 0.2rem;
}

.inv-paper-col .inv-label:first-child {
    margin-top: 0;
}

.inv-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
}

.inv-sub {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 1px;
    line-height: 1.4;
}

.inv-sub strong {
    color: #1e293b;
    font-weight: 600;
}

/* Table */
.inv-tbl {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
}

.inv-tbl th {
    background: #f1f5f9;
    padding: 0.45rem 0.6rem;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid #e2e8f0;
}

.inv-tbl td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.inv-tbl td:first-child { font-weight: 500; }
.inv-tbl td:nth-child(2) { text-align: center; color: #64748b; }
.inv-tbl td:nth-child(3) { text-align: right; color: #64748b; }
.inv-tbl td:nth-child(4) { text-align: right; font-weight: 600; }

/* Totals */
.inv-totals-box {
    margin-left: auto;
    width: 220px;
    margin-bottom: 1rem;
}

.inv-tl {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.8rem;
    color: #475569;
}

.inv-tl span:last-child {
    font-weight: 600;
}

.inv-tl-total {
    font-size: 1rem;
    font-weight: 800;
    color: #1e293b;
    border-top: 2px solid var(--primary, #6366f1);
    padding-top: 0.4rem;
    margin-top: 0.2rem;
}

.inv-tl-total span:last-child {
    color: var(--primary, #6366f1);
    font-size: 1.05rem;
}

/* Notes */
.inv-note {
    background: #f8fafc;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 900px) {
    .inv-wrap {
        grid-template-columns: 1fr;
    }
    .inv-preview {
        position: static;
    }
}

@media (max-width: 640px) {
    .inv-row-3 {
        grid-template-columns: 1fr;
    }
    .inv-item-row {
        grid-template-columns: 1fr 55px 70px auto;
    }
}

/* ═══ Video Converter ═══ */
.video-preview {
    margin-top: 1.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.video-preview video {
    width: 100%;
    max-height: 320px;
    display: block;
    background: #000;
}
.video-meta {
    display: flex;
    gap: 1rem;
    padding: 0.6rem 0.85rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
}
.video-meta span {
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border);
}
.video-meta-note {
    padding: 0.4rem 0.85rem 0.6rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ── Mode tabs ── */
.video-mode-tabs {
    display: none;
    gap: 0.5rem;
    margin-top: 1.5rem;
    background: var(--bg-input);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid var(--border);
}
.video-mode-tabs.visible { display: flex; }
.video-mode-btn {
    flex: 1;
    padding: 0.7rem 0.5rem;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    font-family: inherit;
}
.video-mode-btn.active {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3), 0 0 0 1px rgba(124,58,237,0.2);
}
.video-mode-btn:hover:not(.active) { color: var(--text-secondary); }

/* ── Info card ── */
.yt-info {
    display: none;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 14px;
    animation: fadeUp 0.3s ease;
}
.yt-info-icon {
    font-size: 2rem;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}
.yt-info-details {
    min-width: 0;
    flex: 1;
}
.yt-info-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.yt-info-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
    font-weight: 500;
}
.yt-info.visible { display: flex; }

/* ═══ Pro Modal ═══ */
.pro-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.pro-modal-overlay.visible { display: flex; }

.pro-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    max-width: 440px;
    width: 100%;
    text-align: center;
    position: relative;
    box-shadow: var(--shadow);
    animation: fadeUp 0.3s ease;
}

.pro-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-input);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pro-modal-close:hover {
    background: rgba(239,68,68,0.1);
    color: var(--error);
}

.pro-modal-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.pro-modal h2 {
    font-size: 1.5rem;
    font-weight: 800;
}

.pro-modal-sub {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.pro-features {
    list-style: none;
    text-align: left;
    margin-bottom: 1.5rem;
}

.pro-features li {
    padding: 0.4rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.pro-price {
    margin-bottom: 1.5rem;
}

.pro-price-amount {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text);
}

.pro-price-period {
    font-size: 1rem;
    color: var(--text-muted);
}

.pro-cta {
    display: block;
    padding: 0.85rem;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s;
}

.pro-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(124,58,237,0.35);
}

.pro-modal-foot {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

.pro-plan-toggle {
    display: flex;
    gap: 6px;
    margin-bottom: 1.25rem;
    background: var(--bg-input);
    border-radius: 10px;
    padding: 4px;
}
.pro-plan-btn {
    flex: 1;
    padding: 0.6rem 0.5rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.pro-plan-btn.active {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.pro-plan-btn:first-child {
    border-radius: 8px 0 0 8px;
}
.pro-plan-btn:last-child {
    border-radius: 0 8px 8px 0;
}
.pro-badge-save {
    display: inline-block;
    background: rgba(16,185,129,0.15);
    color: #10b981;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 2px;
}

/* ═══ Image Converter ═══ */
.img-editor {
    display: none;
    margin-top: 1.5rem;
}
.img-editor.visible { display: block; }

.img-preview-area {
    margin-bottom: 1.5rem;
}

.img-preview-container {
    position: relative;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    max-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-preview-container img {
    max-width: 100%;
    max-height: 400px;
    display: block;
}

.img-preview-container canvas {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.img-preview-container.canvas-active canvas {
    display: block;
}

.img-info-bar {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 12px 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.img-controls {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}

.img-controls h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.img-control-row {
    margin-bottom: 1rem;
}

.img-control-row label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.img-control-row select,
.img-control-row input[type="number"],
.img-control-row input[type="text"] {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.img-control-row select:focus,
.img-control-row input:focus {
    border-color: var(--primary);
}

.img-control-row input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-card);
    height: 6px;
    border-radius: 3px;
    outline: none;
}

.img-control-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid var(--bg-card);
}

#imgQualityVal {
    color: var(--primary);
    font-weight: 600;
}

.img-dims-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.img-dims-inputs input[type="number"] {
    width: 80px;
    flex-shrink: 0;
}

.img-dims-sep {
    color: var(--text-muted);
    font-size: 1rem;
    flex-shrink: 0;
}

.img-lock-btn,
.img-reset-dims {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.img-lock-btn:hover,
.img-reset-dims:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.img-lock-btn.locked {
    border-color: var(--primary);
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary);
}

.img-target-size {
    display: flex;
    gap: 6px;
    align-items: center;
}

.img-target-size input {
    flex: 1;
    min-width: 0;
}

.img-target-size select {
    width: 70px;
    flex-shrink: 0;
    padding: 0.55rem 0.5rem;
}

.img-apply-target {
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
}

.img-apply-target:hover {
    background: var(--primary);
    color: #fff;
}

.img-target-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    min-height: 1em;
}

.img-crop-controls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.img-crop-btn {
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.img-crop-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.img-crop-btn.active {
    border-color: var(--primary);
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary);
}

.img-crop-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.img-size-estimate {
    text-align: center;
    font-size: 0.8rem;
    color: var(--success);
    margin-top: 0.5rem;
    min-height: 1.2em;
}

@media (min-width: 769px) {
    .img-editor.visible {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
    .img-preview-area {
        margin-bottom: 0;
    }
    .img-controls {
        align-self: start;
        position: sticky;
        top: 1rem;
    }
}

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
    .tool-grid {
        grid-template-columns: 1fr;
    }

    .bg-comparison {
        grid-template-columns: 1fr;
    }

    .invoice-layout {
        grid-template-columns: 1fr;
    }

    .invoice-preview {
        position: static;
    }

    .video-actions {
        flex-direction: column;
    }

    .inv-row-2,
    .inv-row-3 {
        grid-template-columns: 1fr;
    }

    .inv-item-row {
        grid-template-columns: 1fr 0.7fr 0.8fr auto;
        gap: 4px;
    }
}

@media (max-width: 640px) {
    body {
        padding: 1rem 0.75rem;
    }

    .top-bar {
        padding: 0.6rem 1rem;
        flex-wrap: wrap;
        gap: 8px;
    }

    .top-bar .user-name { display: none; }

    .top-bar-center { order: 3; width: 100%; justify-content: center; }

    .converter-card {
        padding: 1.25rem;
    }

    header h1 { font-size: 1.6rem; }

    .mode-btn {
        font-size: 0.8rem;
        padding: 0.6rem 0.4rem;
    }

    .mode-btn .icon { font-size: 0.9rem; }

    .upload-zone { padding: 1.5rem 1rem; }

    .file-info { flex-wrap: wrap; }

    .features {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .auth-card { padding: 1.5rem; }

    .conv-table { font-size: 0.75rem; }
    .conv-table th, .conv-table td { padding: 0.4rem 0.5rem; }
}

/* ═══ Web Page Tool ═══ */
.wp-url-box { margin-bottom: 1rem; }
.wp-url-box label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--text-secondary); }
.wp-url-box input { width: 100%; padding: 0.7rem 1rem; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 0.95rem; outline: none; transition: border-color 0.2s; }
.wp-url-box input:focus { border-color: var(--border-focus); }
.wp-options { margin-bottom: 1rem; }
.wp-mode-tabs { display: flex; gap: 0.5rem; }
.wp-mode-btn { flex: 1; padding: 0.6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text-secondary); cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
.wp-mode-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.wp-mode-btn:hover:not(.active) { background: var(--bg-card-hover); }
.wp-preview-box { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; max-height: 400px; overflow: auto; margin-top: 0.75rem; }
.wp-preview-box pre { white-space: pre-wrap; word-break: break-word; font-size: 0.8rem; line-height: 1.5; color: var(--text); }
.wp-result { margin-top: 1rem; }
.wp-result-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.wp-copy-btn { padding: 0.6rem 1.2rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text); cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
.wp-copy-btn:hover { background: var(--bg-card-hover); }

/* ═══ QR Code Tool ═══ */
.qr-scan-text-wrap { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 0.5rem; }
.qr-scan-text-wrap code { flex: 1; word-break: break-all; font-size: 0.85rem; color: var(--text); }
.qr-scan-text-wrap .download-btn { flex-shrink: 0; }
#qrScannerContainer video { border-radius: var(--radius-sm); }
#qrStopScanner:hover { opacity: 0.85; }
.qr-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.qr-tab-btn { flex: 1; padding: 0.6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text-secondary); cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
.qr-tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.qr-tab-btn:hover:not(.active) { background: var(--bg-card-hover); }
.qr-panel { margin-top: 0.5rem; }
.qr-fld { margin-bottom: 0.75rem; }
.qr-fld label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--text-secondary); }
.qr-fld textarea, .qr-fld select { width: 100%; padding: 0.6rem 0.8rem; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 0.9rem; outline: none; }
.qr-fld textarea:focus, .qr-fld select:focus { border-color: var(--border-focus); }
.qr-fld input[type="range"] { width: 100%; accent-color: var(--primary); }
.qr-output { text-align: center; margin-top: 1rem; }
.qr-output canvas { max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.qr-output .download-btn { margin-top: 0.75rem; }

/* ═══ Diff Checker ═══ */
.dc-mode-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.dc-mode-btn { flex: 1; padding: 0.6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text-secondary); cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
.dc-mode-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.dc-mode-btn:hover:not(.active) { background: var(--bg-card-hover); }
.dc-editors { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1rem; }
.dc-editor-pane label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--text-secondary); }
.dc-editor-pane textarea { width: 100%; padding: 0.6rem 0.8rem; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 0.85rem; font-family: 'Consolas', 'Courier New', monospace; outline: none; resize: vertical; }
.dc-editor-pane textarea:focus { border-color: var(--border-focus); }
.dc-paste-btn { margin-top: 0.35rem; padding: 0.35rem 0.7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text-secondary); cursor: pointer; font-size: 0.75rem; }
.dc-paste-btn:hover { background: var(--bg-card-hover); }
.dc-stats { font-size: 0.85rem; color: var(--text-secondary); margin: 0.5rem 0; }
.dc-result { margin-top: 0.75rem; }
.dc-output { max-height: 500px; overflow: auto; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.dc-diff-table { width: 100%; border-collapse: collapse; font-family: 'Consolas', 'Courier New', monospace; font-size: 0.8rem; }
.dc-diff-table td { padding: 0.2rem 0.5rem; vertical-align: top; }
.dc-diff-lineno { color: var(--text-muted); text-align: right; min-width: 2.5rem; user-select: none; border-right: 1px solid var(--border); }
.dc-diff-lineno-a { background: rgba(239, 68, 68, 0.08); }
.dc-diff-lineno-b { background: rgba(16, 185, 129, 0.08); }
.dc-diff-cell { white-space: pre-wrap; word-break: break-all; }
.dc-diff-add { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.dc-diff-rem { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.dc-diff-eq { color: var(--text); }
.dc-diff-word .dc-diff-add { border-radius: 3px; padding: 0 2px; }
.dc-diff-word .dc-diff-rem { border-radius: 3px; padding: 0 2px; text-decoration: line-through; }

/* ═══ Data Visualizer ═══ */
.dv-controls { margin-top: 1rem; }
.dv-fld { margin-bottom: 0.75rem; }
.dv-fld label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--text-secondary); }
.dv-fld select, .dv-fld input { width: 100%; padding: 0.6rem 0.8rem; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 0.9rem; outline: none; }
.dv-fld select:focus, .dv-fld input:focus { border-color: var(--border-focus); }
.dv-chart-wrap { text-align: center; margin-top: 1rem; }
.dv-chart-wrap canvas { max-width: 100%; max-height: 500px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.5rem; background: var(--bg-input); }
.dv-chart-wrap .download-btn { margin-top: 0.75rem; }

@media (max-width: 600px) {
    .dc-editors { grid-template-columns: 1fr; }
}

/* ═══ Currency & Unit Converter ═══ */
.cc-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.cc-tab-btn { flex: 1; padding: 0.6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card); color: var(--text-secondary); cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
.cc-tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.cc-tab-btn:hover:not(.active) { background: var(--bg-card-hover); }
.cc-panel { margin-top: 0.5rem; }
.cc-status { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; background: var(--bg-input); border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.85rem; color: var(--text-secondary); }
.cc-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cc-status-loading { background: var(--accent); animation: ccPulse 1s ease-in-out infinite; }
.cc-status-ok { background: var(--success); }
.cc-status-err { background: var(--error); }
@keyframes ccPulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }
.cc-input-row { display: flex; gap: 0.75rem; margin-bottom: 1rem; }
.cc-input-group { flex: 1; }
.cc-input-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--text-secondary); }
.cc-input-group input, .cc-input-group select { width: 100%; padding: 0.6rem 0.8rem; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 0.95rem; outline: none; }
.cc-input-group input:focus, .cc-input-group select:focus { border-color: var(--border-focus); }
.cc-matrix { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 0.75rem; }
.cc-matrix-header, .cc-matrix-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1.5fr; gap: 0; padding: 0.5rem 0.75rem; font-size: 0.85rem; align-items: center; }
.cc-matrix-header { background: var(--bg-card); font-weight: 600; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.cc-matrix-row { border-bottom: 1px solid var(--border); color: var(--text); transition: background 0.15s; }
.cc-matrix-row:last-child { border-bottom: none; }
.cc-matrix-row:hover { background: var(--bg-card-hover); }
.cc-matrix-row-base { background: rgba(124, 58, 237, 0.08); }
.cc-matrix-row-base:hover { background: rgba(124, 58, 237, 0.12); }
.cc-matrix-flag { font-size: 1rem; }
.cc-matrix-code { color: var(--text-muted); font-family: monospace; }
.cc-matrix-rate { color: var(--text-muted); font-family: monospace; }
.cc-matrix-converted { font-weight: 600; font-family: monospace; color: var(--primary); }
.cc-updated { font-size: 0.75rem; color: var(--text-muted); text-align: right; }
.cc-result-box { text-align: center; padding: 1.5rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 1rem; }
.cc-result-value { font-size: 2rem; font-weight: 800; color: var(--primary); }
.cc-result-label { display: block; font-size: 0.9rem; color: var(--text-secondary); margin-top: 0.25rem; }
.cc-unit-matrix { display: none; }
.cc-unit-matrix h4 { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.5rem; }

@media (max-width: 600px) {
    .cc-matrix-header, .cc-matrix-row { grid-template-columns: 2fr 1fr 1fr 1.5fr; font-size: 0.75rem; padding: 0.4rem 0.5rem; }
    .cc-input-row { flex-direction: column; gap: 0.5rem; }
}

/* ── AI Assistant ── */
.ai-status { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.75rem; }
.ai-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #666; flex-shrink: 0; }
.ai-model-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; font-size: 0.85rem; }
.ai-model-row select { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 0.35rem 0.6rem; font-size: 0.85rem; }
.ai-tabs { display: flex; gap: 0.25rem; margin-bottom: 1rem; flex-wrap: wrap; }
.ai-tab { padding: 0.5rem 1rem; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-secondary); border-radius: 8px; cursor: pointer; font-size: 0.85rem; font-weight: 500; transition: all 0.15s; }
.ai-tab:hover { border-color: var(--primary); color: var(--text); }
.ai-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.ai-panel label { display: block; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.35rem; margin-top: 0.5rem; }
.ai-panel textarea { width: 100%; box-sizing: border-box; background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem; font-size: 0.9rem; font-family: inherit; resize: vertical; }
.ai-panel textarea:focus { outline: none; border-color: var(--primary); }
.ai-btn { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 0.5rem; padding: 0.6rem 1.5rem; background: linear-gradient(135deg, #7c3aed, #8b5cf6); color: #fff; border: none; border-radius: 10px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: opacity 0.15s; font-family: inherit; }
.ai-btn:hover { opacity: 0.9; }
.ai-btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.ai-option-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.ai-option-row select { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 0.35rem 0.6rem; font-size: 0.85rem; }
.ai-output { margin-top: 0.75rem; padding: 1rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; font-size: 0.9rem; line-height: 1.6; white-space: pre-wrap; }
.ai-btn-secondary { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1rem; background: var(--bg-card); color: var(--text); border: 1px solid var(--border); border-radius: 8px; font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.ai-btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.ai-btn-small { width: 24px; height: 24px; border: none; background: rgba(239,68,68,0.1); border-radius: 50%; color: var(--error); font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.ai-btn-small:hover { background: rgba(239,68,68,0.2); }
.ai-img-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }

/* Speed Test */
.speed-status { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 1rem; }
.speed-results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.speed-metric { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; text-align: center; }
.speed-label { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.3rem; text-transform: uppercase; letter-spacing: 0.05em; }
.speed-value { font-size: 1.8rem; font-weight: 700; background: linear-gradient(135deg, #6366f1, #a855f7); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1.2; }
.speed-unit { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.1rem; }
.speed-bar-container { height: 6px; background: var(--border); border-radius: 3px; margin-bottom: 1rem; overflow: hidden; }
.speed-bar { height: 100%; width: 0%; background: linear-gradient(90deg, #6366f1, #a855f7); border-radius: 3px; transition: width 0.4s ease; }
.speed-info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-bottom: 0.5rem; }
.speed-info-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem; text-align: center; }
.speed-info-card .speed-info-icon { font-size: 1.2rem; margin-bottom: 0.2rem; }
.speed-info-card .speed-info-label { font-size: 0.7rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.speed-info-card .speed-info-value { font-size: 1rem; font-weight: 600; color: var(--text); margin-top: 0.15rem; }
.speed-info-card .speed-info-sub { font-size: 0.7rem; color: var(--text-secondary); }
