:root { --primary: #2563eb; --bg: #f3f4f6; --border: #e5e7eb; --text: #1f2937; --text-light: #6b7280; --danger: #ef4444; --success: #2563eb; }
        body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background-color: #e5e7eb; display: flex; justify-content: center; height: 100vh; overflow: hidden; }
        
        .app-container { width: 98%; max-width: 1300px; background-color: #ffffff; height: 100%; display: flex; flex-direction: column; box-shadow: 0 0 20px rgba(0,0,0,0.1); position: relative; }
        .header { background-color: var(--primary); color: white; padding: 15px; text-align: center; font-size: 16px; font-weight: bold; box-shadow: 0 2px 4px rgba(0,0,0,0.1); z-index: 10; }
        
        .import-section { padding: 15px; border-bottom: 1px solid var(--border); background: #fafafa; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
        .shop-link { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; border-radius: 6px; background: var(--primary); color: #fff; font-size: 13px; font-weight: 600; line-height: 20px; text-decoration: none; white-space: nowrap; transition: filter 0.2s; }
        .shop-link:hover { filter: brightness(0.92); }
        .shop-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
        .btn-full { background: var(--primary); color: white; border: none; padding: 10px; border-radius: 6px; font-weight: bold; cursor: pointer; font-size: 14px;}
        .btn-full:active { opacity: 0.8; }
        .textarea-box { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 6px; box-sizing: border-box; font-size: 13px; resize: none; outline: none; white-space: nowrap; overflow-x: auto;}
        .textarea-box:focus { border-color: var(--primary); }
        .group-select { padding: 8px; border: 1px solid var(--border); border-radius: 4px; outline: none; flex: 1; font-size:13px;}

        .toolbar { display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 15px; background: #fff; border-bottom: 1px solid var(--border); align-items: center; justify-content: space-between; }
        .tb-top-row { display: flex; align-items: center; gap: 8px; }
        .select-all-label { display: flex; align-items: center; gap: 4px; font-weight: bold; font-size: 14px; cursor: pointer; color: var(--text); white-space: nowrap; }
        .view-select { background: #eff6ff; color: var(--primary); border-color: #bfdbfe; outline: none; cursor:pointer; padding: 6px 8px; border-radius: 4px; font-size: 13px; font-weight:bold;}
        .group-filter-select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; outline: none; background: #fff; font-weight: bold; color: var(--primary); cursor: pointer;}
        .search-input-mini { flex: 1; min-width: 150px; max-width: 250px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; outline: none; }
        .search-input-mini:focus { border-color: var(--primary); }
        .tb-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end;}
        .tool-btn { padding: 6px 12px; font-size: 13px; border: 1px solid var(--border); background: #fff; border-radius: 4px; cursor: pointer; color: var(--text); font-weight: bold; transition: background 0.2s;}
        .tool-btn:hover { background: var(--bg); }
        .btn-del { color: var(--danger); border-color: #fca5a5; background: #fef2f2; }
        .btn-del:hover { background: #fee2e2; }

        .main-workspace { display: flex; flex: 1; overflow: hidden; background: var(--bg); }
        .workspace-list { flex: 1; overflow-y: auto; padding: 15px; padding-bottom: 80px; transition: 0.2s; }
        .workspace-reader { width: 0; display: none; background: #fff; border-left: 1px solid var(--border); flex-direction: column; transition: 0.2s; overflow: hidden; }
        
        .main-workspace.is-split .workspace-list { width: 420px; flex: none; border-right: 1px solid var(--border); padding-right: 10px; }
        .main-workspace.is-split .workspace-reader { display: flex; flex: 1; }

        
        .group-section { margin-bottom: 15px; background: #fff; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
        .group-header { padding: 12px 15px; background: #f9fafb; cursor: pointer; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid transparent; transition: background 0.2s; user-select: none;}
        .group-header:hover { background: #f3f4f6; }
        .group-header.is-open { border-bottom-color: var(--border); }
        .group-title { font-size: 14px; font-weight: bold; color: var(--text); display: flex; align-items: center; gap: 8px; }
        .group-body { padding: 12px; display: none; background: var(--bg); }
        .group-body.is-open { display: block; }
        
        
        .group-action-btn { border: none; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: bold; cursor: pointer; transition: 0.2s; outline: none; }
        .rename-btn { background: #e0e7ff; color: #4f46e5; }
        .rename-btn:hover { background: #c7d2fe; }
        .delete-btn { background: #fee2e2; color: #ef4444; }
        .delete-btn:hover { background: #fca5a5; }
        .group-count-badge { font-size: 12px; color: var(--primary); background: #eff6ff; padding: 4px 10px; border-radius: 12px; font-weight: bold; display: flex; align-items: center; gap: 6px;}
        .toggle-icon { display: inline-block; transition: transform 0.2s; font-size: 10px; }
        .group-header:not(.is-open) .toggle-icon { transform: rotate(-90deg); }

        
        .group-body .acc-card { background: #fff; border-radius: 6px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--border); display: flex; flex-direction: column; content-visibility: auto; contain-intrinsic-size: auto 60px; }
        .group-body .acc-card:last-child { margin-bottom: 0; }

        .action-btn { padding: 6px 16px; text-align: center; border: none; border-radius: 4px; font-size: 12px; font-weight: bold; color: white; cursor: pointer; white-space: nowrap;}
        .action-btn:disabled { opacity: 0.6; cursor: not-allowed; }
        .icon-btn { cursor: pointer; padding: 4px 6px; font-size: 14px; border-radius: 4px; display: flex; align-items: center; justify-content: center; border: 1px solid transparent; background: #f9fafb; color:var(--text-light);}
        .icon-btn:hover { background: var(--bg); border-color: var(--border); color:var(--text);}

        .inline-list-area { display: none; flex-direction: column; margin-top: 10px; padding: 12px; gap: 8px; background: #f9fafb; border: 1px solid var(--border); border-radius: 6px; }
        .inline-mail-card { background: #fff; border: 1px solid var(--border); border-radius: 4px; padding: 10px; cursor: pointer; transition: 0.2s; }
        .inline-mail-card:hover { border-color: var(--primary); }
        .inline-mail-subj { font-size: 13px; font-weight: bold; color: var(--text); margin-bottom: 4px; line-height:1.4;}
        .inline-mail-time { font-size: 11px; color: var(--text-light); margin-bottom: 8px; }
        .inline-view-btn { width: 100%; padding: 6px; background: #eff6ff; color: var(--primary); border: 1px solid #bfdbfe; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: bold; transition: 0.2s;}
        .inline-view-btn:hover { background: #bfdbfe; }

        .ws-header { padding: 12px 20px; background: #f9fafb; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
        .ws-title { font-size: 14px; font-weight: bold; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right:10px;}
        .ws-mail-content { flex: 1; display: flex; flex-direction: column; background: #fff; } 
        .ws-content-header { padding: 15px 20px; border-bottom: 1px solid var(--border); background: #fff; }

        .modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 9999; display: none; align-items: center; justify-content: center; }
        .modal-content { background: #fff; width: 90%; max-width: 1000px; height: 80vh; border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 25px rgba(0,0,0,0.2); animation: fadeIn 0.2s; }
        .modal-content-small { height: auto; max-height: 85vh; max-width: 500px; padding: 20px; box-sizing: border-box; overflow:visible;}
        @keyframes fadeIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }
        .modal-header { padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: #f9fafb;}
        .modal-title { font-size: 16px; font-weight: bold; color: var(--text); }
        .modal-close { width: 32px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; color: var(--text-light); transition: 0.2s;}
        .modal-close:hover { background: #e5e7eb; color: var(--danger); }
        .modal-body-split { display: flex; flex: 1; overflow: hidden; }
        .modal-sidebar { width: 300px; border-right: 1px solid var(--border); background: #fafafa; overflow-y: auto; display: flex; flex-direction: column;}
        .sidebar-mail-item { padding: 15px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.2s; }
        .sidebar-mail-item:hover { background: #f3f4f6; }
        .sidebar-mail-item.active { background: #eff6ff; border-left: 4px solid var(--primary); padding-left: 11px; }
        .sidebar-subj { font-size: 14px; font-weight: bold; color: var(--text); margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4;}
        .sidebar-time { font-size: 12px; color: var(--text-light); }
        .modal-main { flex: 1; display: flex; flex-direction: column; background: #fff; }
        
        .mobile-drag-handle { display: none; }
        .modal-content.hide-sidebar .modal-sidebar { display: none !important; }
        .modal-content.hide-sidebar .mobile-drag-handle { display: none !important; }

        
        @media (max-width: 768px) {
            .toolbar { flex-direction: column; align-items: stretch; padding: 12px; gap: 10px; }
            .tb-top-row { flex-wrap: nowrap; width: 100%; gap: 5px; justify-content:flex-start; overflow-x: auto; padding-bottom: 2px;}
            .view-select, .group-filter-select { flex: 1; min-width: 80px; padding: 6px 2px; font-size: 12px;}
            .search-input-mini { max-width: 100%; width: 100%; box-sizing: border-box; }
            .tb-actions { justify-content: space-between; width: 100%; gap: 6px; }
            .tb-actions .tool-btn { flex: 1; padding: 8px 2px; font-size: 12px; text-align: center; }
            
            
            .app-container { width: 100%; max-width: none; border-radius: 0; box-shadow: none; }
            
            
            .workspace-list { padding: 8px 0 !important; padding-bottom: 100px !important; }
            .main-workspace.is-split .workspace-list { padding: 8px 0 !important; width: 100% !important; flex: 1 !important; }
            .main-workspace.is-split .workspace-reader { display: none !important; }
            
            
            .group-section { margin-bottom: 8px; border-radius: 0; border-left: none; border-right: none; box-shadow: none; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
            .group-header { padding: 10px 12px; }
            
            .group-body { padding: 4px 0px; }
            
            
            .group-body .acc-card { border-radius: 0; border-left: none; border-right: none; padding: 10px 8px; margin-bottom: 4px; box-shadow: none; border-color: #f3f4f6;}
            
            
            .inline-list-area { border: none; background: #fff; padding: 4px 0; border-top: 1px solid var(--border); border-radius: 0; }
            .inline-mail-card { border-radius: 0; border-left: none; border-right: none; margin-bottom: 4px; border-color: #eee;}

            .modal-body-split { flex-direction: column; }
            .modal-sidebar { width: 100%; height: 40%; border-right: none; border-bottom: none; }
            .mobile-drag-handle { display: flex; justify-content: center; align-items: center; height: 12px; background: #f3f4f6; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); box-shadow: 0 3px 5px -1px rgba(0,0,0,0.05); z-index: 10;}
            .mobile-drag-handle::before { content: ''; width: 40px; height: 4px; background: #d1d5db; border-radius: 2px;}
        }

.account-row,.account-label,.account-icons,.group-buttons,.account-actions{display:flex;align-items:center}
.account-row{justify-content:space-between;gap:10px;margin-bottom:8px}
.account-label{min-width:0;flex:1;gap:8px;font-size:14px;font-weight:bold;color:var(--text)}
.account-label input{width:16px;height:16px;flex-shrink:0;margin:0}
.account-label span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.account-icons,.group-buttons{gap:6px;flex-shrink:0}
.account-actions{gap:8px;padding-left:24px;flex-wrap:wrap}
.latest{background:var(--success)}.history{background:#1d4ed8}.collapse{background:#6b7280}
.delete-icon,.folder-junk{color:var(--danger)}.folder-inbox{color:var(--success)}
.empty-message{text-align:center;padding:15px;color:#9ca3af;font-size:13px}
.main-empty{padding:40px;font-size:14px}
.reader-subject{font-size:16px;font-weight:bold;margin-bottom:6px;overflow-wrap:anywhere}
.reader-from,.reader-date{font-size:12px;color:var(--text-light);margin-top:4px;overflow-wrap:anywhere}
#contentHeader{padding:15px 20px;border-bottom:1px solid var(--border)}
.ws-mail-content,.modal-main{min-height:0;min-width:0;overflow:hidden}
.workspace-reader{min-width:0}.ws-content-header{max-height:30vh;overflow:auto}
iframe{min-height:0}.inline-mail-card.active{background:#e0f2fe;border-color:#bae6fd}
.sidebar-mail-item{text-align:left;border:0;border-bottom:1px solid var(--border);background:none;font:inherit;flex-shrink:0}
.remember-choice{display:flex;align-items:center;gap:6px;margin:0 0 15px;font-size:12px;color:var(--text-light)}
#toast{position:fixed;bottom:30px;left:50%;transform:translate(-50%,12px);padding:12px 20px;border-radius:8px;background:#1f2937;color:#fff;font-size:13px;z-index:20000;opacity:0;transition:.2s;pointer-events:none;max-width:85vw;overflow-wrap:anywhere}
#toast.visible{opacity:1;transform:translate(-50%,0)}
button:focus-visible,[tabindex]:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
@media(max-width:768px){.group-header{gap:6px}.group-title{overflow-wrap:anywhere;min-width:0}.group-buttons{gap:4px}.group-action-btn{padding:4px 7px}.group-count-badge{padding:4px 7px}.modal-content{height:90dvh}.modal-content-small{height:auto}.ws-title,.modal-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}
