:root[data-theme="dark"] {
    --bg-primary: #0b1120;
    --bg-secondary: #141b2d;
    --bg-tertiary: #1e293b;
    --bg-card: #141e33;
    --bg-card-hover: #1e2c4a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.09);
    --border-glow: rgba(229, 72, 77, 0.25);
    --accent-coral: #e5484d;
    --accent-coral-hover: #dc3e43;
    --accent-blue: #3b82f6;
    --accent-teal: #14b8a6;
    --accent-green: #22c55e;
    --accent-amber: #f59e0b;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 25px rgba(229, 72, 77, 0.2);
}

:root[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: rgba(0, 0, 0, 0.09);
    --border-glow: rgba(229, 72, 77, 0.2);
    --accent-coral: #e5484d;
    --accent-coral-hover: #d93d42;
    --accent-blue: #2563eb;
    --accent-teal: #0d9488;
    --accent-green: #16a34a;
    --accent-amber: #d97706;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 20px rgba(229, 72, 77, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.app-layout, .app-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    position: relative;
    overflow: hidden;
}

.sidebar-logo, .brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary) !important;
}

.sidebar-title, .brand-info h2 {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary) !important;
}

/* Sidebar Backdrop for Mobile Drawer */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.68);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Top Navigation Bar */
.mobile-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    z-index: 50;
}

.mobile-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
}

.mobile-logo-mark {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--accent-coral) 0%, #b91c1c 100%);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 2px 8px rgba(229, 72, 77, 0.35);
}

.mobile-title {
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mobile-icon-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-icon-btn:hover, .mobile-icon-btn:active {
    background: var(--bg-card-hover);
    border-color: var(--accent-coral);
    color: var(--accent-coral);
}

.mobile-only {
    display: none !important;
}

/* Sidebar */
.sidebar {
    width: 270px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.sidebar-header {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary) !important;
    flex: 1;
    min-width: 0;
}

.sidebar-logo-mark {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-coral) 0%, #b91c1c 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 3px 10px rgba(229, 72, 77, 0.35);
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.02em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    color: var(--text-primary) !important;
}

.brand-badge-mini {
    font-size: 10px;
    font-weight: 700;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    padding: 2px 5px;
    border-radius: 4px;
    border: 1px solid rgba(56, 189, 248, 0.3);
    display: inline-block;
}

.sidebar-header-lang {
    width: 100%;
}

.lang-picker-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px 10px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    width: 100%;
}

.lang-picker-wrap:hover {
    border-color: var(--accent-coral);
    background: var(--bg-card);
}

.lang-globe-icon {
    font-size: 13px;
    line-height: 1;
    flex-shrink: 0;
}

.lang-picker-select {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0;
}

.lang-picker-select option {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 6px;
}

.header-ctrls {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.mobile-only-btn {
    display: none;
}

@media (max-width: 992px) {
    .mobile-only-btn {
        display: flex;
    }
}

.icon-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.icon-btn:hover {
    color: var(--accent-coral);
    border-color: var(--accent-coral);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.nav-group-label {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 10px 4px 10px;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: left;
}

.nav-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.nav-item.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent-coral) 0%, #b91c1c 100%);
    box-shadow: 0 4px 12px rgba(229, 72, 77, 0.35);
    font-weight: 700;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-brand-return {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(229, 72, 77, 0.12) 0%, rgba(185, 28, 28, 0.08) 100%);
    border: 1px solid rgba(229, 72, 77, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--accent-coral);
    font-size: 11.5px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar-brand-return:hover {
    background: linear-gradient(135deg, var(--accent-coral) 0%, #b91c1c 100%);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(229, 72, 77, 0.35);
}

.return-arrow {
    font-size: 12px;
}

.sidebar-quick-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 6px 10px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-link-btn:hover {
    color: var(--text-primary);
    border-color: var(--accent-coral);
}

.sidebar-link-btn.rate:hover {
    color: #f59e0b;
    border-color: #f59e0b;
}

.sidebar-link-btn.yt:hover {
    color: #ff4d4f;
    border-color: #ff0000;
}

.developer-credit {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: 3px 0;
}

.developer-credit strong {
    color: var(--text-primary);
}

.privacy-note {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--accent-green);
    font-weight: 600;
    padding: 2px 4px;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    background: var(--bg-primary);
}

/* Workspace Tier Status Bar */
.workspace-tier-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 10px;
}

.tier-left-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tier-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.tier-subtext {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.tier-right-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ws-action-link {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 10px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ws-action-link:hover {
    color: var(--text-primary);
    border-color: var(--accent-coral);
}

.ws-action-link.star:hover {
    color: #f59e0b;
    border-color: #f59e0b;
}

.ws-action-link.key {
    color: var(--accent-coral);
    border-color: rgba(229, 72, 77, 0.3);
}

.ws-upgrade-cta {
    background: linear-gradient(135deg, var(--accent-coral) 0%, #b91c1c 100%);
    color: #ffffff !important;
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 6px;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(229, 72, 77, 0.35);
    transition: all 0.2s ease;
}

.ws-upgrade-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(229, 72, 77, 0.5);
}

/* Enhanced Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 36px 40px;
    max-width: 1080px;
    margin: 0 auto;
    width: 100%;
}

.welcome-hero-wrap {
    text-align: center;
    margin-bottom: 30px;
}

.welcome-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(229, 72, 77, 0.1);
    color: var(--accent-coral);
    border: 1px solid rgba(229, 72, 77, 0.25);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 14px;
}

.welcome-title {
    font-size: 2.3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.welcome-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 660px;
    margin: 0 auto 20px auto;
    line-height: 1.6;
}

.welcome-arch-bar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 14px;
}

.arch-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
}

.arch-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.arch-dot.green { background: var(--accent-green); }
.arch-dot.coral { background: var(--accent-coral); }

.arch-label {
    color: var(--text-muted);
    font-weight: 600;
}

.arch-val {
    color: var(--text-primary);
    font-weight: 700;
}

/* Quick-Tools Grid */
.welcome-tools-section {
    margin-top: 10px;
}

.welcome-section-header {
    margin-bottom: 16px;
}

.welcome-section-header h3 {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.welcome-section-header p {
    font-size: 13px;
    color: var(--text-secondary);
}

.welcome-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.welcome-tool-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.welcome-tool-card:hover {
    border-color: var(--accent-coral);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15), var(--shadow-glow);
    background: var(--bg-card-hover);
}

.wt-icon-badge {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.welcome-tool-card:hover .wt-icon-badge {
    transform: scale(1.1);
    background: rgba(229, 72, 77, 0.12);
    border-color: var(--accent-coral);
}

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

.wt-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.wt-desc {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wt-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    position: absolute;
    top: 10px;
    right: 10px;
}

.wt-tag.convert {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue);
}

.wt-tag.edit {
    background: rgba(20, 184, 166, 0.12);
    color: var(--accent-teal);
}

.wt-tag.secure {
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-amber);
}

.welcome-footer-bar {
    text-align: center;
    margin-top: 36px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
}

/* Workspace Interactive View */
.workspace {
    flex: 1;
    padding: 24px 36px;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.workspace-header {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
}

.workspace-title-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.ws-icon-badge {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: rgba(229, 72, 77, 0.12);
    color: var(--accent-coral);
    border: 1px solid rgba(229, 72, 77, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.tool-badge {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 4px;
}

.tool-badge.convert { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.tool-badge.edit { background: rgba(20, 184, 166, 0.15); color: var(--accent-teal); }
.tool-badge.secure { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }

.engine-active-pill {
    font-size: 11px;
    font-weight: 700;
    background: rgba(34, 197, 94, 0.12);
    color: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.25);
    padding: 3px 10px;
    border-radius: 20px;
}

.tool-description {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.tool-capability-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.capability-chip {
    font-size: 11.5px;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

/* Text & HTML Document Editor Workbench */
.text-input-area {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.text-editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 10px;
}

.editor-left-stats {
    display: flex;
    align-items: center;
    gap: 10px;
}

.editor-type-badge {
    font-size: 11.5px;
    font-weight: 700;
    background: rgba(229, 72, 77, 0.12);
    color: var(--accent-coral);
    padding: 3px 8px;
    border-radius: 4px;
}

.editor-counter {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.editor-right-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.text-editor-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.text-editor-btn:hover {
    color: var(--accent-coral);
    border-color: var(--accent-coral);
    background: var(--bg-card-hover);
}

#text-input {
    width: 100%;
    min-height: 250px;
    padding: 16px 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.65;
    resize: vertical;
    transition: all 0.2s ease;
    box-sizing: border-box;
    caret-color: var(--accent-coral);
}

#text-input::placeholder {
    color: var(--text-muted);
    opacity: 0.55;
    font-style: normal;
    transition: opacity 0.2s ease;
}

#text-input:focus {
    border-color: var(--accent-coral);
    outline: none;
    box-shadow: 0 0 18px rgba(229, 72, 77, 0.2);
}

#text-input:focus::placeholder {
    opacity: 0.35;
}

#text-input.code-mode {
    font-family: 'Consolas', 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 13.5px;
    line-height: 1.6;
    background: #0b1120;
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.35);
    caret-color: #38bdf8;
    tab-size: 4;
}

#text-input.code-mode::placeholder {
    color: #64748b;
    opacity: 0.65;
    font-family: 'Consolas', 'Menlo', 'Monaco', 'Courier New', monospace;
}

#text-input.code-mode:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
}

[data-theme="light"] #text-input.code-mode {
    background: #f8fafc;
    color: #0284c7;
    border-color: rgba(2, 132, 199, 0.3);
    caret-color: #0284c7;
}

[data-theme="light"] #text-input.code-mode::placeholder {
    color: #94a3b8;
    opacity: 0.75;
}

/* Webpage Capture Box */
.webpage-capture-info {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.capture-preview {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.capture-details h3 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.capture-url {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-coral);
    word-break: break-all;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed rgba(229, 72, 77, 0.35);
    border-radius: 14px;
    padding: 36px 20px;
    text-align: center;
    background: rgba(229, 72, 77, 0.02);
    cursor: pointer;
    transition: all 0.2s ease;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--accent-coral);
    background: rgba(229, 72, 77, 0.06);
    transform: translateY(-2px);
}

.drop-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(229, 72, 77, 0.1);
    color: var(--accent-coral);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px auto;
    transition: transform 0.2s ease;
}

.drop-zone:hover .drop-icon-wrap {
    transform: scale(1.1);
}

.drop-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.drop-subtext {
    font-size: 12.5px;
    color: var(--text-muted);
}

.drop-accepted {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Options Panel */
.options-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}

.options-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.option-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.option-field label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.option-field input, .option-field select, .option-field textarea {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.option-field input:focus, .option-field select:focus, .option-field textarea:focus {
    border-color: var(--accent-coral);
    outline: none;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--accent-coral) 0%, #b91c1c 100%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(229, 72, 77, 0.4);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(229, 72, 77, 0.55);
}

.btn-primary.btn-large {
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-coral);
    color: var(--accent-coral);
}

.text-btn {
    background: transparent;
    border: none;
    color: var(--accent-coral);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* Tech Guarantee Card inside Workspace */
.ws-tech-guarantee {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(34, 197, 94, 0.06);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.tech-guarantee-icon {
    font-size: 18px;
    flex-shrink: 0;
}

/* File List */
.file-list-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
}

.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.file-list-header h3 {
    font-size: 13px;
    font-weight: 700;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 13px;
}

.file-item-remove {
    background: transparent;
    border: none;
    color: var(--accent-coral);
    cursor: pointer;
    font-size: 14px;
}

/* Progress & Results */
.progress-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
}

.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-coral), #f59e0b);
    transition: width 0.2s ease;
}

.results-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.results-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.results-check {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    display: flex;
    align-items: center;
    justify-content: center;
}

.results-rating-card {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 10px;
    padding: 14px 18px;
    margin: 16px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.rating-card-text {
    font-size: 12px;
    color: var(--text-primary);
}

.btn-rate-highlight {
    background: #f59e0b;
    color: #000;
    font-weight: 700;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}

/* Modals & Helpers */
.hidden {
    display: none !important;
}

.stats-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.stats-modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    width: 90%;
    max-width: 520px;
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.stats-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stats-metrics-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.stat-val {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-coral);
}

.stat-title {
    font-size: 11px;
    color: var(--text-muted);
}

.stats-modal-close {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    pointer-events: auto;
    z-index: 10;
    transition: all 0.2s ease;
}

.stats-modal-close:hover {
    background: rgba(229, 72, 77, 0.15);
    border-color: var(--accent-coral);
    color: var(--accent-coral);
    transform: scale(1.05);
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--accent-coral);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 2000;
    font-size: 13px;
    font-weight: 600;
}

/* ==========================================================================
   Responsive Mobile & Tablet Optimization (Modern Fluid Experience)
   ========================================================================== */

@media (max-width: 992px) {
    .sidebar {
        width: 240px;
    }
    .welcome-screen {
        padding: 28px 24px;
    }
    .workspace {
        padding: 20px 24px;
    }
    .welcome-tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    body.drawer-open {
        overflow: hidden;
    }

    .app-layout {
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
    }

    /* Mobile Backdrop */
    .sidebar-backdrop {
        display: block;
    }

    /* Mobile Topbar */
    .mobile-topbar {
        display: flex;
    }

    .mobile-only {
        display: inline-flex !important;
    }

    /* Off-Canvas Sidebar Drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 290px;
        max-width: 85vw;
        height: 100%;
        height: 100dvh;
        z-index: 1100;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.28s ease;
        box-shadow: none;
        background: var(--bg-secondary);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 12px 0 35px rgba(0, 0, 0, 0.65);
    }

    .sidebar-header {
        padding: 14px 16px;
    }

    .sidebar-nav {
        padding: 12px 10px;
        gap: 10px;
    }

    .nav-item {
        padding: 10px 14px;
        font-size: 13.5px;
    }

    /* Main Content Area */
    .main-content {
        height: calc(100vh - 53px);
        height: calc(100dvh - 53px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Workspace Tier Status Bar */
    .workspace-tier-bar {
        padding: 10px 14px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .tier-left-info {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    .tier-subtext {
        font-size: 11px;
        text-align: right;
    }

    .tier-right-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    .ws-action-link, .ws-upgrade-cta {
        flex: 1 1 calc(33.333% - 6px);
        min-width: 70px;
        text-align: center;
        justify-content: center;
        font-size: 11px;
        padding: 6px 4px;
        white-space: nowrap;
    }

    .ws-upgrade-cta {
        flex: 1 1 100%;
        padding: 8px 12px;
        font-size: 12px;
    }

    /* Welcome Screen Mobile */
    .welcome-screen {
        padding: 20px 14px 30px 14px;
    }

    .welcome-hero-wrap {
        margin-bottom: 22px;
    }

    .welcome-badge-pill {
        font-size: 11px;
        padding: 3px 10px;
        margin-bottom: 10px;
        flex-wrap: wrap;
        justify-content: center;
        line-height: 1.4;
    }

    .welcome-title {
        font-size: clamp(1.4rem, 5.5vw, 1.85rem);
        letter-spacing: -0.02em;
        margin-bottom: 8px;
    }

    .welcome-subtitle {
        font-size: 12.5px;
        line-height: 1.5;
        margin-bottom: 14px;
        padding: 0 4px;
    }

    .welcome-arch-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 10px;
    }

    .arch-item {
        font-size: 11px;
        padding: 6px 8px;
        justify-content: flex-start;
    }

    .welcome-tools-section {
        margin-top: 6px;
    }

    .welcome-section-header h3 {
        font-size: 14.5px;
    }

    .welcome-section-header p {
        font-size: 12px;
    }

    .welcome-tools-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .welcome-tool-card {
        padding: 12px 14px;
        min-height: 64px;
    }

    .wt-icon-badge {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .wt-title {
        font-size: 13.5px;
    }

    .wt-desc {
        font-size: 11.5px;
        white-space: normal;
    }

    .wt-tag {
        font-size: 9.5px;
        top: 8px;
        right: 8px;
    }

    /* Workspace Interactive View Mobile */
    .workspace {
        padding: 14px 12px 30px 12px;
        gap: 14px;
    }

    .workspace-header {
        padding: 14px 14px;
        border-radius: 12px;
    }

    .workspace-title-row {
        gap: 12px;
        align-items: flex-start;
    }

    .ws-icon-badge {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }

    #tool-title {
        font-size: 1.2rem;
    }

    .tool-description {
        font-size: 12px;
        margin-top: 3px;
    }

    .engine-active-pill {
        font-size: 10px;
        padding: 2px 8px;
    }

    .tool-capability-chips {
        gap: 6px;
        margin-top: 10px;
        padding-top: 10px;
    }

    .capability-chip {
        font-size: 10.5px;
        padding: 3px 8px;
    }

    /* Text & HTML Editor */
    .text-input-area {
        padding: 14px;
        border-radius: 12px;
    }

    .text-editor-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding-bottom: 10px;
    }

    .editor-left-stats {
        justify-content: space-between;
        width: 100%;
    }

    .editor-right-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        width: 100%;
    }

    .text-editor-btn {
        padding: 7px 6px;
        font-size: 11px;
        text-align: center;
        justify-content: center;
    }

    #text-input {
        min-height: 180px;
        padding: 12px;
        font-size: 14px;
    }

    /* Webpage Capture Box */
    .webpage-capture-info {
        padding: 14px;
        gap: 12px;
    }

    .capture-preview {
        width: 40px;
        height: 40px;
    }

    .capture-url {
        font-size: 12.5px;
    }

    /* Drop Zone */
    .drop-zone {
        padding: 24px 14px;
        border-radius: 12px;
    }

    .drop-icon-wrap {
        width: 44px;
        height: 44px;
        margin-bottom: 8px;
    }

    .drop-text {
        font-size: 14.5px;
    }

    .drop-subtext {
        font-size: 12px;
    }

    /* Options Panel */
    .options-panel {
        padding: 14px;
        border-radius: 12px;
    }

    .options-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        font-size: 12.5px;
    }

    .options-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .option-field input, .option-field select, .option-field textarea {
        padding: 10px 12px;
        font-size: 14px;
    }

    /* Buttons */
    .btn-primary.btn-large {
        padding: 14px 18px;
        font-size: 14.5px;
        border-radius: 10px;
    }

    /* Tech Guarantee Box */
    .ws-tech-guarantee {
        padding: 10px 12px;
        font-size: 11px;
        line-height: 1.45;
        gap: 10px;
    }

    .tech-guarantee-icon {
        font-size: 16px;
    }

    /* Results Panel */
    .results-container {
        padding: 16px 14px;
        border-radius: 12px;
    }

    .results-header {
        gap: 10px;
        margin-bottom: 12px;
    }

    .results-header h3 {
        font-size: 14px;
    }

    .results-meta {
        font-size: 11.5px;
    }

    .results-rating-card {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
        margin: 12px 0;
    }

    .rating-card-left {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .btn-rate-highlight {
        width: 100%;
        text-align: center;
        padding: 9px 14px;
        font-size: 12.5px;
    }

    /* Telemetry Modal */
    .stats-modal-card {
        width: 94%;
        max-width: 440px;
        padding: 16px;
        max-height: 88vh;
        overflow-y: auto;
        border-radius: 12px;
    }

    .stats-metrics-row {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-box {
        padding: 10px 6px;
    }

    .stat-val {
        font-size: 1.2rem;
    }

    .stat-title {
        font-size: 10px;
    }

    /* Toast */
    .toast {
        left: 14px;
        right: 14px;
        bottom: 14px;
        padding: 10px 14px;
        font-size: 12px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .workspace-tier-bar {
        padding: 8px 10px;
    }

    .tier-right-actions {
        gap: 4px;
    }

    .ws-action-link {
        flex: 1 1 calc(50% - 4px);
        font-size: 10.5px;
        padding: 6px 2px;
    }

    .welcome-arch-bar {
        grid-template-columns: 1fr;
    }

    .arch-item {
        font-size: 11px;
    }

    .welcome-tool-card {
        padding: 10px 12px;
    }

    .wt-title {
        font-size: 13px;
    }

    .wt-tag {
        position: static;
        align-self: flex-start;
        margin-top: 4px;
        display: inline-block;
    }

    .welcome-tool-card {
        flex-wrap: wrap;
    }

    .editor-right-actions {
        grid-template-columns: 1fr;
    }
}

/* Pro Badge Styles */
.pro-tag {
    margin-left: auto;
    font-size: 9px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.wt-tag.pro {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.25));
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
    font-weight: 800;
}

.tier-pill.starter {
    background: rgba(229, 72, 77, 0.12);
    color: var(--accent-coral);
    border: 1px solid rgba(229, 72, 77, 0.3);
    font-weight: 700;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
}

.tier-pill.pro {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.3));
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.5);
    font-weight: 800;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
}

.tier-pill.team {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.3));
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.5);
    font-weight: 800;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
}

/* ==========================================================================
   Visual PDF Page Organizer Card Grid
   ========================================================================== */
.org-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
    user-select: none;
}

.org-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-coral);
    box-shadow: var(--shadow-md);
}

.org-card.deleted {
    opacity: 0.35;
    border: 1px dashed var(--border-color);
    filter: grayscale(1);
}

.org-card.deleted .org-badge {
    background: #ef4444 !important;
    text-decoration: line-through;
}

.org-thumb-wrap {
    width: 100%;
    aspect-ratio: 1 / 1.35;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.org-thumb-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.2s ease;
}

.org-card-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.org-badge {
    font-size: 10.5px;
    font-weight: 800;
    color: #fff;
    background: var(--accent-coral);
    padding: 2px 7px;
    border-radius: 10px;
}

.org-rot-tag {
    font-size: 9.5px;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.org-actions {
    display: flex;
    gap: 4px;
    width: 100%;
    justify-content: center;
}

.org-action-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 4px 7px;
    font-size: 11px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.org-action-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-coral);
    color: var(--accent-coral);
}

.org-action-btn.danger:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* Signature Pad Tabs & Active states */
.sig-color-btn.active {
    box-shadow: 0 0 0 2px var(--accent-coral);
}

/* ==========================================================================
   Full Right-to-Left (RTL) Layout System for Arabic
   ========================================================================== */
[dir="rtl"] {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Tahoma", "Cairo", "Almarai", sans-serif;
    text-align: right;
}

[dir="rtl"] .sidebar {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

[dir="rtl"] .sidebar-title {
    letter-spacing: normal;
}

[dir="rtl"] .nav-item {
    text-align: right;
}

[dir="rtl"] .pro-tag,
[dir="rtl"] .wt-tag {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .tier-left-info {
    text-align: right;
}

[dir="rtl"] .workspace-title-row {
    text-align: right;
}

[dir="rtl"] .tool-description {
    text-align: right;
}

[dir="rtl"] .options-title {
    text-align: right;
}

[dir="rtl"] .option-field label {
    text-align: right;
}

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

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

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

[dir="rtl"] .results-header {
    text-align: right;
}

[dir="rtl"] .results-rating-card {
    text-align: right;
}

[dir="rtl"] .return-arrow {
    transform: rotate(90deg);
}