﻿
    /* ═══════════════════════════════════════════════════════
       EMAIL SUBJECT GENERATOR — PREMIUM DESIGN (.esg-)
       ═══════════════════════════════════════════════════════ */

    .esg-wrapper { max-width: 1300px; margin: 0 auto; position: relative; font-family: 'Inter', sans-serif; padding-top: 40px; }
    .esg-bg-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 500px; z-index: 0; pointer-events: none; opacity: 0.4; }

    /* ── Hero ── */
    .esg-hero { text-align: center; position: relative; z-index: 1; margin-bottom: 40px; }
    .esg-hero-badge {
        display: inline-flex; align-items: center; gap: 7px;
        font-size: 12.5px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
        color: var(--primary-color); background: var(--primary-light);
        padding: 7px 18px; border-radius: 100px; margin-bottom: 20px; border: 1px solid rgba(99,102,241,0.2);
    }
    .esg-hero-title { font-size: clamp(34px, 5vw, 56px); font-weight: 900; line-height: 1.1; letter-spacing: -0.03em; color: var(--text-main); margin-bottom: 16px; }
    .esg-hero-title em { font-style: normal; background: linear-gradient(135deg, var(--primary-color), var(--primary-gradient-end)); -webkit-background-clip: text; background-clip: text; color: transparent; }
    .esg-hero-desc { font-size: 16px; color: var(--text-muted); font-weight: 500; max-width: 500px; margin: 0 auto; }

    /* ── Main Panel ── */
    .esg-panel {
        background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 32px;
        box-shadow: 0 20px 60px rgba(0,0,0,0.03); position: relative; z-index: 2; padding: clamp(24px, 4vw, 40px); margin-bottom: 60px;
    }

    /* ── Toolbar ── */
    .esg-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
    .esg-left { display: flex; align-items: center; gap: 12px; background: var(--bg-body); padding: 8px 12px; border-radius: 16px; border: 1px solid var(--border-color); flex-wrap: wrap; }
    .esg-sep { width: 1px; height: 24px; background: var(--border-color); }

    /* Select Wrapper */
    .tone-select-wrapper { position: relative; }
    
    /* Custom Dropdown System */
    .custom-dropdown-wrapper { position: relative; }
    .cd-trigger, .cd-header { display: flex; align-items: center; gap: 8px; background: transparent; border: none; font-size: 13.5px; font-weight: 700; color: var(--text-main); cursor: pointer; padding: 6px 10px; border-radius: 10px; transition: background 0.2s; white-space: nowrap; }
    .cd-trigger:hover, .cd-header:hover { background: var(--card-bg); }
    .cd-trigger.open { background: var(--card-bg); box-shadow: inset 0 0 0 1px var(--border-color); }
    .cd-icon { font-size: 16px; }
    .cd-chevron { width: 14px; height: 14px; color: var(--text-muted); transition: transform 0.2s; }
    .cd-trigger.open .cd-chevron { transform: rotate(180deg); }
    .cd-menu, .cd-body { position: absolute; top: calc(100% + 8px); left: 0; width: 220px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,0.08); z-index: 100; overflow: hidden; animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
    .custom-dropdown { position: relative; }
    .custom-dropdown .cd-body { display: none; padding-left: 24px; }
    .custom-dropdown.active .cd-body { display: block; }
    .cd-search-box { padding: 12px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 8px; background: var(--bg-body); }
    .cd-search-box input { border: none; background: transparent; outline: none; font-size: 13px; color: var(--text-main); width: 100%; font-family: inherit; }
    .cd-list { max-height: 250px; overflow-y: auto; padding: 8px; }
    .cd-list::-webkit-scrollbar { width: 4px; }
    .cd-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
    .cd-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; cursor: pointer; transition: all 0.2s; font-size: 13.5px; font-weight: 600; color: var(--text-main); }
    .cd-item:hover { background: var(--bg-body); }
    .cd-item.selected, .cd-item.active { background: var(--primary-light); color: var(--primary-color); }
    .cd-check { margin-left: auto; width: 14px; height: 14px; opacity: 0; color: var(--primary-color); }
    .cd-item.selected .cd-check, .cd-item.active .cd-check { opacity: 1; }
    .cd-no-results { padding: 16px; text-align: center; font-size: 13px; color: var(--text-muted); }

    @keyframes popIn { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

    /* Direction Btn */
    .dir-btn { background: transparent; border: none; padding: 6px; border-radius: 8px; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
    .dir-btn:hover { background: var(--card-bg); color: var(--text-main); }
    .dir-btn.rtl { color: var(--primary-color); background: var(--primary-light); }

    /* Usage Pill */
    .esg-usage-pill { display: flex; align-items: center; gap: 10px; background: var(--bg-body); padding: 8px 16px; border-radius: 100px; border: 1px solid var(--border-color); font-size: 13px; font-weight: 700; color: var(--text-main); }
    .rup-dots { display: flex; gap: 4px; }
    .rup-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); opacity: 0.2; }
    .rup-dot.used { opacity: 1; }
    .rup-warn { color: var(--danger); font-family: 'Space Mono', monospace; font-size: 12px; }

    /* ── Unified Editor Layout ── */
    .unified-editor { display: flex; border: 1px solid var(--border-color); border-radius: 24px; overflow: hidden; background: var(--card-bg); height: 650px; position: relative; box-shadow: 0 10px 30px rgba(0,0,0,0.02); }
    .ue-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }
    .ue-input { background: var(--card-bg); }
    .ue-output { background: var(--bg-body); }
    
    .ue-header { height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--border-color); background: rgba(255,255,255,0.01); }
    .ue-title { font-size: 14px; font-weight: 800; color: var(--text-main); display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
    .title-gradient { background: linear-gradient(135deg, var(--primary-color), var(--primary-gradient-end)); -webkit-background-clip: text; background-clip: text; color: transparent; }
    .ue-actions { display: flex; gap: 8px; }
    .ue-btn { background: transparent; border: none; font-size: 12px; font-weight: 700; color: var(--text-muted); cursor: pointer; padding: 6px 12px; border-radius: 8px; transition: all 0.2s; display: flex; align-items: center; gap: 6px; }
    .ue-btn:hover { background: var(--border-color); color: var(--text-main); }
    
    .form-inputs { flex: 1; padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 20px; }
    .input-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
    .input-group { display: flex; flex-direction: column; gap: 8px; }
    .ig-label { font-size: 13px; font-weight: 800; color: var(--text-main); display: flex; justify-content: space-between; }
    .input-lg { background: var(--bg-body); border: 1px solid var(--border-color); border-radius: 12px; padding: 12px 16px; font-size: 14px; font-weight: 600; color: var(--text-main); outline: none; transition: all 0.2s; }
    .input-lg:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-light); }
    .ue-textarea { flex: 1; width: 100%; min-height: 250px; background: var(--bg-body); border: 1px solid var(--border-color); border-radius: 16px; padding: 20px; font-size: 15px; font-weight: 500; color: var(--text-main); line-height: 1.6; resize: none; outline: none; transition: all 0.2s; }
    .ue-textarea:focus { border-color: var(--primary-color); box-shadow: 0 0 0 4px var(--primary-light); }

    /* Divider & Magic Button */
    .ue-divider { width: 1px; background: var(--border-color); position: relative; z-index: 10; display: flex; align-items: center; justify-content: center; }
    .magic-btn { position: absolute; width: 140px; height: 48px; background: linear-gradient(135deg, var(--primary-color), var(--primary-gradient-end)); border: none; border-radius: 100px; display: flex; align-items: center; justify-content: center; gap: 8px; color: white; font-size: 14px; font-weight: 800; cursor: pointer; transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); box-shadow: 0 8px 24px rgba(99,102,241,0.3), 0 0 0 6px var(--card-bg); }
    .magic-btn:hover:not(:disabled) { transform: scale(1.05); box-shadow: 0 12px 32px rgba(99,102,241,0.4), 0 0 0 6px var(--card-bg); }
    .magic-btn:active:not(:disabled) { transform: scale(0.95); }
    .magic-btn:disabled { background: var(--border-color); color: var(--text-muted); box-shadow: 0 0 0 6px var(--card-bg); cursor: not-allowed; }
    
    .magic-glow { position: absolute; inset: -2px; border-radius: 100px; background: linear-gradient(135deg, var(--primary-color), var(--primary-gradient-end), var(--primary-color)); background-size: 200% auto; filter: blur(10px); opacity: 0; transition: opacity 0.3s; z-index: -1; }
    .magic-btn:hover:not(:disabled) .magic-glow { opacity: 0.7; animation: shine 2s linear infinite; }
    @keyframes shine { to { background-position: 200% center; } }
    
    .mb-icon { width: 18px; height: 18px; }
    .shortcut-hint kbd { background: var(--bg-body); border: 1px solid var(--border-color); padding: 2px 6px; border-radius: 6px; font-family: 'Space Mono', monospace; font-size: 11px; font-weight: 700; }
    .streaming-cursor { display: inline-block; width: 2px; height: 16px; background-color: var(--primary-color); vertical-align: text-bottom; margin-left: 2px; animation: blink 1s step-end infinite; }
    @keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

    /* ── Mock Inbox Output ── */
    .mock-inbox { flex: 1; overflow-y: auto; padding: 24px; position: relative; }
    .ue-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px; color: var(--text-muted); }
    .uee-icon { width: 64px; height: 64px; border-radius: 20px; background: var(--card-bg); border: 1px solid var(--border-color); display: flex; align-items: center; justify-content: center; margin-bottom: 20px; color: var(--primary-color); font-size: 24px; box-shadow: 0 8px 24px rgba(0,0,0,0.03); }
    .uee-title { font-size: 18px; font-weight: 800; color: var(--text-main); margin-bottom: 8px; }
    .uee-desc { font-size: 14.5px; line-height: 1.6; max-width: 300px; }

    /* Email Rows */
    .inbox-list { display: flex; flex-direction: column; gap: 8px; }
    .inbox-row { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 16px; display: flex; align-items: center; gap: 16px; transition: all 0.2s; cursor: pointer; position: relative; overflow: hidden; }
    .inbox-row:hover { border-color: var(--primary-color); transform: translateX(4px); box-shadow: 0 4px 12px rgba(0,0,0,0.03); }
    .ir-dot { width: 10px; height: 10px; background: var(--primary-color); border-radius: 50%; flex-shrink: 0; }
    .ir-sender { font-weight: 800; font-size: 14px; color: var(--text-main); width: 80px; flex-shrink: 0; }
    .ir-subject { font-weight: 700; font-size: 14.5px; color: var(--text-main); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .ir-snippet { font-weight: 400; color: var(--text-muted); margin-left: 8px; }
    .ir-actions { opacity: 0; transition: opacity 0.2s; display: flex; gap: 8px; }
    .inbox-row:hover .ir-actions { opacity: 1; }
    .ir-copy-btn { background: var(--primary-light); border: none; color: var(--primary-color); font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.2s; }
    .ir-copy-btn:hover { background: var(--primary-color); color: white; }

    /* ── History Section ── */
    .esg-history-section { animation: fadeIn 0.4s ease; margin-top: 40px; }
    .dh-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
    .dh-title { font-size: 14px; font-weight: 800; color: var(--text-main); display: flex; align-items: center; gap: 8px; margin: 0; }
    .dh-clear-btn { background: transparent; border: none; font-size: 12.5px; font-weight: 700; color: #ef4444; cursor: pointer; padding: 4px 10px; border-radius: 6px; transition: background 0.2s; }
    .dh-clear-btn:hover { background: rgba(239,68,68,0.1); }
    .dh-list { display: flex; flex-direction: column; gap: 8px; max-height: 250px; overflow-y: auto; padding-right: 4px; }
    .dh-list::-webkit-scrollbar { width: 4px; }
    .dh-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
    .dh-item { display: flex; align-items: center; justify-content: space-between; background: var(--bg-body); border: 1px solid var(--border-color); border-radius: 12px; padding: 12px 16px; transition: all 0.2s; }
    .dh-item:hover { border-color: var(--primary-color); transform: translateX(4px); box-shadow: 0 4px 12px rgba(0,0,0,0.02); }
    .dh-info { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
    .dh-domain { font-size: 14px; font-weight: 700; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .dh-meta { display: flex; align-items: center; gap: 12px; }
    .dh-badge { background: var(--primary-light); color: var(--primary-color); padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
    .dh-date { font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
    .dh-delete-btn { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 6px; border-radius: 8px; transition: all 0.2s; display: flex; align-items: center; }
    .dh-delete-btn:hover { background: rgba(239,68,68,0.1); color: #ef4444; }

    /* Limit Warning */
    .limit-warning { display: none; margin: 24px 0; padding: 16px 20px; background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2); border-radius: 16px; align-items: flex-start; gap: 12px; }
    .limit-warning.show { display: flex; }
    .lw-ico { color: var(--danger); flex-shrink: 0; }
    .lw-text { font-size: 14px; color: var(--danger); line-height: 1.5; font-weight: 500; }
    .lw-link { display: inline-flex; align-items: center; gap: 4px; color: var(--danger); text-decoration: underline; font-weight: 700; margin-top: 4px; }

    @keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

    /* ── Responsive ── */
    @media (max-width: 900px) {
        .unified-editor { flex-direction: column; height: auto; min-height: 600px; }
        .ue-pane { width: 100%; height: 350px; }
        .ue-divider { width: 100%; height: 1px; }
        .magic-btn { box-shadow: 0 4px 16px rgba(99,102,241,0.3), 0 0 0 6px var(--card-bg); }
        .magic-btn:hover:not(:disabled) { transform: scale(1.05); box-shadow: 0 6px 24px rgba(99,102,241,0.4), 0 0 0 6px var(--card-bg); }
    }
    @media (max-width: 600px) {
        .esg-toolbar { flex-direction: column; align-items: stretch; }
        .esg-left { flex-wrap: wrap; justify-content: space-between; }
        .shortcut-hint { display: none; }
        .cd-menu { width: 100%; left: 0; right: 0; }
    }

    /* ═══════════════════════════════════════════════════════
       BENTO BOX FEATURES (.console-features)
       ═══════════════════════════════════════════════════════ */
    .console-features { margin-top: 50px; width: 100%; }
    .bento-features-cluster { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-flow: dense; grid-auto-rows: minmax(130px, auto); gap: 20px; width: 100%; position: relative; z-index: 2; }
    .bento-card { background: rgba(255, 255, 255, 0.015); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--border-color); border-radius: 24px; padding: 28px; display: flex; flex-direction: column; align-items: flex-start; position: relative; overflow: hidden; transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: 0 4px 20px rgba(0,0,0,0.02); }
    .bento-card::after { content: ''; position: absolute; inset: 0; border-radius: 24px; background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 100%); pointer-events: none; }
    .bento-card:hover { transform: translateY(-4px) scale(1.01); border-color: var(--primary-color); box-shadow: 0 12px 30px rgba(0,0,0,0.06); }
    .bento-card-content { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100%; gap: 12px; }
    
    .dashed-ring-wrapper { position: relative; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 8px; width: 44px; height: 44px; }
    .dashed-ring-wrapper::before { content: ''; position: absolute; top: -5px; left: -5px; right: -5px; bottom: -5px; border: 1px dashed var(--border-color); border-radius: 16px; opacity: 0.5; transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1); z-index: 0; transform-origin: center center; }
    .bento-card:hover .dashed-ring-wrapper::before { opacity: 1; transform: scale(1.1) rotate(180deg); border-color: var(--primary-color); }
    
    .bc-icon-wrapper { width: 44px; height: 44px; border-radius: 12px; background: var(--bg-body); border: 1px solid var(--border-color); display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: all 0.4s ease; margin-bottom: 0; position: relative; z-index: 1; }
    .bento-card:hover .bc-icon-wrapper { background: linear-gradient(135deg, var(--primary-color), var(--border-color)); color: white; border-color: transparent; transform: scale(1.1) rotate(4deg); }
    .bc-icon-wrapper i, .bc-icon-wrapper svg { width: 18px; height: 18px; }

    .bc-title { font-size: 16px; font-weight: 800; color: var(--text-main); margin: 0; }
    .bc-desc { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; margin: 0; font-weight: 500; }
    
    .bc-wide-top { grid-column: span 2; }
    .bc-tall { grid-row: span 2; }
    .bc-wide-mid { grid-column: span 2; }
    .bc-wide-top .bento-card-content, .bc-wide-mid .bento-card-content { justify-content: center; }
    .bc-wide-top .bc-desc, .bc-wide-mid .bc-desc { max-width: 85%; }

    @media (max-width: 900px) {
        .bento-features-cluster { grid-template-columns: repeat(2, 1fr); }
        .bc-wide-top, .bc-wide-mid { grid-column: span 2; }
        .bc-tall { grid-row: span 1; grid-column: span 1; }
    }
    @media (max-width: 600px) {
        .bento-features-cluster { grid-template-columns: 1fr; }
        .bc-wide-top, .bc-wide-mid, .bc-tall { grid-column: span 1; }
        .bc-wide-top .bc-desc, .bc-wide-mid .bc-desc { max-width: 100%; }
    }
