:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --text: #1f2933;
    --muted: #6f7b86;
    --line: #dfe4e8;
    --nav: #1f2937;
    --nav-soft: #2a3646;
    --accent: #346b78;
    --accent-soft: #e8f0f2;
    --danger: #b14c4c;
    --danger-soft: #f6eaea;
    --warning: #8b6b22;
    --warning-soft: #f7f1df;
    --success: #367457;
    --success-soft: #e7f1eb;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 270px; background: var(--nav); color: #e8edf2; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; padding: 22px 16px; z-index: 40; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 38px; height: 38px; background: #dbe7e9; color: #234b55; display: grid; place-items: center; font-weight: 800; letter-spacing: -.03em; }
.brand-name { font-weight: 750; font-size: 17px; }
.brand-sub { font-size: 11px; color: #8fa0ad; margin-top: 1px; }
.main-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 30px; }
.main-nav.compact { margin-top: 8px; }
.nav-link { min-height: 42px; display: flex; align-items: center; gap: 12px; padding: 10px 11px; color: #b9c5ce; border-left: 3px solid transparent; border-radius: 0; }
.nav-link i { width: 20px; font-size: 17px; }
.nav-link:hover, .nav-link.active { background: var(--nav-soft); color: white; border-left-color: #7fb1ba; }
.nav-link span:nth-child(2) { flex: 1; }
.nav-count { min-width: 24px; text-align: right; font-size: 12px; color: #8fa0ad; }
.nav-section-title { margin: 26px 11px 4px; text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 700; color: #6e7f8c; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto !important; }.status-dot.is-ok{background:#64b287}.status-dot.is-muted{background:#6e7f8c}
.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.main-content { margin-left: 270px; min-width: 0; flex: 1; }
.topbar { height: 72px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 28px; position: sticky; top: 0; z-index: 30; }
.topbar-spacer { flex: 1; }.icon-button { width: 38px; height: 38px; border: 0; background: transparent; color: #52606b; display: grid; place-items: center; }.icon-button:hover{background:#eef1f3}
.sidebar-toggle { display:none; }.user-chip{display:flex;align-items:center;gap:10px;margin-left:12px;padding-left:14px;border-left:1px solid var(--line)}.avatar{width:34px;height:34px;background:#dfe7ea;color:#315761;display:grid;place-items:center;font-size:12px;font-weight:800}.user-chip-text{display:flex;flex-direction:column;font-size:12px}.user-chip-text span{color:var(--muted);font-size:10px;text-transform:uppercase;letter-spacing:.08em}
.content-area { padding: 30px; max-width: 1700px; margin: 0 auto; }
.page-heading { display:flex;justify-content:space-between;gap:24px;align-items:flex-start;margin-bottom:26px }.page-heading h1{font-size:30px;margin:4px 0 5px;font-weight:720;letter-spacing:-.03em}.page-heading p{margin:0;color:var(--muted);max-width:720px}.eyebrow{font-size:11px;text-transform:uppercase;letter-spacing:.12em;font-weight:750;color:#71808c}
.btn { border-radius: 2px; font-weight:650; }.btn-primary{background:var(--accent);border-color:var(--accent)}.btn-primary:hover{background:#285864;border-color:#285864}.btn-outline-secondary{border-color:#cfd6db;color:#52606b;background:#fff}.btn-outline-secondary:hover{background:#eef1f3;color:#27313a;border-color:#c6ced4}
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 0; }
.stat-grid { display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:18px }.stat-card{background:var(--panel);border:1px solid var(--line);padding:20px;display:grid;grid-template-columns:auto 1fr;grid-template-areas:'icon value' 'icon label' 'icon small';column-gap:14px;transition:.15s}.stat-card:hover{border-color:#b6c2c9;transform:translateY(-1px)}.stat-card.highlight{border-top:3px solid var(--accent)}.stat-card.danger-soft{border-top:3px solid var(--danger)}.stat-icon{grid-area:icon;width:42px;height:42px;background:#eef2f3;display:grid;place-items:center;color:var(--accent);font-size:18px}.stat-value{grid-area:value;font-size:27px;font-weight:750;line-height:1}.stat-label{grid-area:label;font-weight:700;margin-top:5px}.stat-card small{grid-area:small;color:var(--muted);margin-top:3px}
.dashboard-grid{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(340px,.7fr);gap:18px}.panel-header{display:flex;justify-content:space-between;gap:20px;padding:20px 22px;border-bottom:1px solid var(--line)}.panel-header h2{font-size:18px;margin:0 0 3px}.panel-header p{margin:0;color:var(--muted);font-size:13px}.panel-header a{font-size:13px;color:var(--accent);font-weight:700}.thread-list{display:flex;flex-direction:column}.thread-row{display:flex;gap:13px;padding:16px 18px;border-bottom:1px solid #edf0f2;position:relative}.thread-row:last-child{border-bottom:0}.thread-row:hover{background:#f8fafb}.thread-row.unread:before{content:'';position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--accent)}.thread-avatar{width:38px;height:38px;background:#e3e9ec;color:#4a5f69;display:grid;place-items:center;font-size:13px;font-weight:800;flex:0 0 auto}.thread-avatar.large{width:46px;height:46px;font-size:15px}.thread-main{min-width:0;flex:1}.thread-meta{display:flex;justify-content:space-between;gap:14px}.thread-meta span{color:var(--muted);font-size:12px;white-space:nowrap}.thread-company{font-size:11px;color:#8a96a0;margin-top:2px;text-transform:uppercase;letter-spacing:.04em}.thread-subject{font-weight:700;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.thread-preview{font-size:13px;color:var(--muted);margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.thread-tags{display:flex;gap:8px;margin-top:9px;align-items:center}.status-pill{display:inline-flex;align-items:center;font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.05em;padding:5px 7px;background:#eef1f3;color:#596873;height:max-content;white-space:nowrap}.status-prepared{background:var(--accent-soft);color:#2f6772}.status-decision{background:var(--danger-soft);color:#964242}.status-awaiting{background:var(--warning-soft);color:#7e621f}.status-fyi{background:#eef1f3;color:#596873}.priority-label{font-size:11px;color:var(--danger);font-weight:700}.focus-panel{padding-bottom:18px}.focus-number{padding:20px 22px;border-bottom:1px solid var(--line);display:flex;align-items:baseline;gap:10px}.focus-number strong{font-size:30px}.focus-number span{font-size:12px;color:var(--muted)}.focus-item{display:flex;gap:12px;padding:16px 22px}.focus-item i{color:var(--accent);font-size:18px}.focus-item div{display:flex;flex-direction:column;gap:3px}.focus-item strong{font-size:13px}.focus-item span{font-size:12px;color:var(--muted);line-height:1.45}
.inbox-layout{display:grid;grid-template-columns:minmax(540px,1.15fr) minmax(320px,.85fr);gap:18px;min-height:650px}.inbox-list-panel{overflow:hidden}.category-tabs{display:flex;gap:0;border-bottom:1px solid var(--line);padding:0 14px;overflow:auto}.category-tab{padding:14px 12px 12px;border-bottom:2px solid transparent;color:var(--muted);font-size:12px;font-weight:700;white-space:nowrap}.category-tab.active{color:var(--accent);border-bottom-color:var(--accent)}.inbox-placeholder{display:grid;place-items:center;align-content:center;text-align:center;color:var(--muted);padding:40px}.inbox-placeholder i{font-size:42px;color:#adb8bf}.inbox-placeholder h3{color:var(--text);font-size:18px;margin:14px 0 6px}.inbox-placeholder p{max-width:320px;font-size:13px}.empty-state{padding:70px 25px;display:flex;flex-direction:column;align-items:center;color:var(--muted);gap:7px}.empty-state i{font-size:36px}
.thread-toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}.back-link{font-size:13px;font-weight:700;color:#56636d}.toolbar-actions{display:flex;gap:8px}.thread-detail-grid{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(320px,.55fr);gap:18px}.message-header{padding:22px;display:flex;gap:14px;align-items:flex-start;border-bottom:1px solid var(--line)}.message-header h1{font-size:20px;margin:1px 0 5px;letter-spacing:-.02em}.message-header .status-pill{margin-left:auto}.message-from{font-size:12px;color:var(--muted)}.message-body{padding:28px 28px 36px;line-height:1.7;font-size:14px;white-space:normal}.context-panel{padding:22px}.ai-badge{display:inline-flex;align-items:center;gap:7px;font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.06em;color:var(--accent)}.summary-text{font-size:14px;line-height:1.55;margin:12px 0 0}.context-divider{height:1px;background:var(--line);margin:22px 0}.context-panel h3{font-size:14px;margin:0 0 10px}.context-list{display:flex;flex-direction:column}.context-item{padding:10px 0;border-bottom:1px solid #edf0f2;display:flex;flex-direction:column;gap:2px}.context-item span{font-size:10px;text-transform:uppercase;letter-spacing:.07em;color:var(--muted)}.context-item strong{font-size:12px}.source-note{display:flex;gap:8px;align-items:flex-start;margin-top:16px;padding:10px;background:#f6f8f9;color:#60717b;font-size:11px}.composer{margin-top:18px;padding:22px}.composer-header{display:flex;justify-content:space-between;align-items:flex-start;gap:18px}.composer-header h2{font-size:18px;margin:5px 0 0}.confidence{font-size:11px;background:var(--success-soft);color:var(--success);padding:6px 8px;font-weight:700}.quick-actions{display:flex;gap:7px;flex-wrap:wrap;margin:18px 0 10px}.quick-actions button{border:1px solid #d7dde1;background:#fff;padding:7px 10px;font-size:12px;color:#4d5c65}.quick-actions button:hover{background:#f0f4f5;border-color:#b9c6cc}.draft-editor{width:100%;border:1px solid #cfd6da;border-radius:0;padding:16px;resize:vertical;font:14px/1.6 inherit;color:var(--text);background:#fff}.draft-editor:focus{outline:2px solid rgba(52,107,120,.12);border-color:#8aaab1}.custom-instruction{margin-top:10px;display:flex;align-items:center;border:1px solid #d5dde1;background:#f8fafb}.custom-instruction i{margin-left:12px;color:var(--accent)}.custom-instruction input{border:0;background:transparent;flex:1;padding:10px;outline:0;font-size:13px}.custom-instruction button{border:0;border-left:1px solid #d5dde1;background:white;padding:10px 14px;font-size:12px;font-weight:700;color:var(--accent)}.composer-footer{display:flex;justify-content:space-between;gap:20px;align-items:center;margin-top:16px}.composer-note{font-size:11px;color:var(--muted);display:flex;gap:7px;align-items:center}.composer-buttons{display:flex;gap:8px}
.table-panel{overflow:hidden}.table{margin:0}.table thead th{background:#f6f8f9;text-transform:uppercase;letter-spacing:.06em;font-size:10px;color:#72808a;border-bottom:1px solid var(--line);padding:13px 18px}.table tbody td{padding:15px 18px;font-size:13px;border-color:#edf0f2}.table-sub{font-size:11px;color:var(--muted);margin-top:2px}.simple-status{display:inline-flex;padding:5px 7px;font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.05em}.simple-status.ok{background:var(--success-soft);color:var(--success)}.simple-status.pending{background:var(--warning-soft);color:var(--warning)}.settings-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.setting-card{padding:20px;display:grid;grid-template-columns:auto 1fr auto;gap:16px;align-items:start}.setting-icon{width:44px;height:44px;background:#eef2f3;display:grid;place-items:center;color:var(--accent);font-size:19px}.setting-card h2{font-size:17px;margin:1px 0 5px}.setting-card p{font-size:12px;color:var(--muted);line-height:1.5;margin:0 0 10px}.setting-card .btn{align-self:center}
.login-page{background:#edf1f3}.login-shell{min-height:100vh;display:grid;grid-template-columns:1.05fr .95fr}.login-brand-panel{background:#1f2937;color:white;display:grid;place-items:center;padding:60px}.login-brand-content{width:min(520px,100%)}.login-brand-content .brand{margin-bottom:80px}.login-brand-content h1{font-size:50px;line-height:1.02;letter-spacing:-.045em;margin:0 0 22px}.login-brand-content>p{color:#b7c3cc;font-size:17px;line-height:1.6;max-width:500px;margin-bottom:32px}.login-feature{display:flex;gap:12px;align-items:center;color:#d1d9df;margin-top:13px;font-size:13px}.login-feature i{color:#8db9c1}.login-form-panel{display:grid;place-items:center;padding:40px;background:#f7f9fa}.login-card{width:min(420px,100%);background:white;border:1px solid var(--line);padding:38px}.login-card h2{font-size:28px;margin:4px 0 6px}.login-card p{font-size:13px}.form-control{border-radius:0;border-color:#ccd4d9;padding:11px 12px}.form-control:focus{box-shadow:0 0 0 3px rgba(52,107,120,.10);border-color:#8aaab1}.form-label{font-size:12px;font-weight:700}.small-alert{font-size:12px;border-radius:0}.demo-hint{text-align:center;color:var(--muted);font-size:11px;margin-top:14px}.mobile-login-brand{display:none}
@media (max-width: 1050px){.sidebar{transform:translateX(-100%);transition:.2s}.sidebar-open .sidebar{transform:translateX(0)}.main-content{margin-left:0}.sidebar-toggle{display:grid}.stat-grid{grid-template-columns:1fr 1fr}.dashboard-grid,.thread-detail-grid,.inbox-layout{grid-template-columns:1fr}.inbox-placeholder{display:none}.settings-grid{grid-template-columns:1fr}.login-shell{grid-template-columns:1fr}.login-brand-panel{display:none}.mobile-login-brand{display:flex;margin-bottom:32px}.login-form-panel{min-height:100vh}}
@media (max-width: 680px){.content-area{padding:18px 14px}.topbar{padding:0 12px;height:62px}.user-chip-text{display:none}.page-heading{flex-direction:column}.page-heading .btn{width:100%}.stat-grid{grid-template-columns:1fr}.thread-row{padding:14px 12px}.thread-row>.status-pill{display:none}.dashboard-grid{grid-template-columns:1fr}.thread-detail-grid{grid-template-columns:1fr}.message-header{padding:16px}.message-header .status-pill{display:none}.message-body{padding:20px 16px}.composer{padding:16px}.composer-footer{flex-direction:column;align-items:stretch}.composer-buttons{display:grid;grid-template-columns:1fr}.quick-actions{flex-wrap:nowrap;overflow:auto;padding-bottom:4px}.quick-actions button{white-space:nowrap}.settings-grid{grid-template-columns:1fr}.setting-card{grid-template-columns:auto 1fr}.setting-card .btn{grid-column:1/-1;width:100%}.login-card{padding:28px 22px}.login-form-panel{padding:18px}.category-tabs{padding:0 5px}.inbox-layout{display:block}}

/* FlexiInbox 0.2.0 - IMAP settings */
.system-status-strip { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:0; padding:0; overflow:hidden; }
.system-status-strip > div { padding:16px 18px; border-right:1px solid var(--line, #e5e7eb); display:flex; flex-direction:column; gap:5px; }
.system-status-strip > div:last-child { border-right:0; }
.system-status-strip span:first-child { font-size:12px; color:#6b7280; text-transform:uppercase; letter-spacing:.04em; }
.simple-status.error { color:#b42318; }
.status-dot.is-error { background:#d92d20; }
.setting-card-wide { grid-column:1 / -1; align-items:flex-start; }
.setting-card-body { flex:1; min-width:0; width:100%; }
.setting-card-title { display:flex; justify-content:space-between; gap:20px; }
.empty-inline { padding:14px 16px; background:#f8fafc; border:1px solid #e5e7eb; color:#667085; margin-top:16px; }
.mailbox-settings-list { margin-top:16px; border:1px solid #e5e7eb; }
.mailbox-settings-row { display:grid; grid-template-columns:minmax(240px,1fr) minmax(160px,.6fr) auto; align-items:center; gap:18px; padding:13px 15px; border-bottom:1px solid #e5e7eb; }
.mailbox-settings-row:last-child { border-bottom:0; }
.mailbox-settings-main { display:flex; align-items:center; gap:10px; min-width:0; }
.mailbox-settings-main > div { display:flex; flex-direction:column; min-width:0; }
.mailbox-settings-main span:not(.status-dot), .mailbox-sync-info { color:#667085; font-size:13px; }
.mailbox-settings-actions { display:flex; align-items:center; gap:8px; }
.mailbox-settings-actions form { margin:0; }
.sync-error { color:#b42318; }
.imap-form { margin-top:14px; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px 18px; }
.form-label { font-size:13px; font-weight:650; color:#344054; margin-bottom:6px; }
.form-label small { font-weight:400; color:#98a2b3; }
.settings-form-footer { margin-top:20px; padding-top:16px; border-top:1px solid #e5e7eb; display:flex; align-items:center; justify-content:space-between; gap:18px; color:#667085; font-size:13px; }
.settings-form-footer > div { display:flex; gap:8px; }
.conversation-stack { display:flex; flex-direction:column; gap:14px; padding-top:18px; }
.conversation-message { border:1px solid #e5e7eb; background:#fff; }
.conversation-message.outbound { background:#f8fafc; }
.conversation-message-head { padding:12px 16px; border-bottom:1px solid #e5e7eb; display:flex; justify-content:space-between; align-items:flex-start; gap:15px; }
.conversation-message-head > div { display:flex; flex-direction:column; }
.conversation-message-head span, .conversation-message-head time { font-size:12px; color:#667085; }
.conversation-message .message-body { padding:18px 16px; }
.composer-empty { display:flex; align-items:center; justify-content:space-between; gap:24px; }
.composer-empty p { margin:6px 0 0; color:#667085; }
@media (max-width: 900px) {
  .system-status-strip { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .system-status-strip > div:nth-child(2) { border-right:0; }
  .system-status-strip > div:nth-child(-n+2) { border-bottom:1px solid #e5e7eb; }
  .mailbox-settings-row { grid-template-columns:1fr; gap:10px; }
  .mailbox-settings-actions { justify-content:flex-start; flex-wrap:wrap; }
  .form-grid { grid-template-columns:1fr; }
  .settings-form-footer, .composer-empty { align-items:flex-start; flex-direction:column; }
}
