:root {
  --bg: #f6f8fc; --panel: #fff; --text: #1f1f1f; --muted: #5f6368; --line: #eceff1; --hover: #eaebef;
  --nav-active: #d3e3fd; --compose: #c2e7ff; --search: #eaf1fb; --read-row: #f2f6fc; --sel-row: #c2dbff;
  --blue: #0b57d0; --star: #f4b400; --accent: #FFD517; --danger: #b3261e;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Roboto, Arial, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
input, textarea { font: inherit; color: inherit; }
.ms { font-family: 'Material Symbols Outlined'; font-size: 20px; line-height: 1; font-weight: normal; font-style: normal; letter-spacing: normal; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; font-variation-settings: 'FILL' 0, 'wght' 400, 'opsz' 20; }
.grow { flex: 1; }
.err { color: var(--danger); }

/* botão-ícone redondo */
.ib { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.ib:hover:not(:disabled) { background: rgba(68,71,70,.08); }
.ib:disabled { opacity: .38; cursor: default; }
.ib.sm { width: 28px; height: 28px; }
.ib.sm .ms { font-size: 18px; }
.chk input { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--muted); }
.pill { border: 1px solid #747775; border-radius: 18px; padding: 8px 18px; font-weight: 500; color: var(--blue); }
.pill:hover { background: #e9eef6; }
.pill.primary { background: var(--blue); color: #fff; border-color: var(--blue); }

/* logo */
.logo { display: flex; align-items: center; gap: 8px; font-size: 22px; color: var(--muted); padding-right: 30px; width: 198px; flex: none; }
.logo-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #1f1f1f; font-weight: 700; font-size: 18px; display: inline-flex; align-items: center; justify-content: center; }

/* login */
.login { height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--panel); border-radius: 28px; padding: 36px; max-width: 420px; width: 100%; }
.login-card .logo { width: auto; margin-bottom: 8px; }
.login-card p { color: var(--muted); }

/* topo */
.app { height: 100%; display: flex; flex-direction: column; }
.top { height: 64px; display: flex; align-items: center; padding: 8px 8px 8px 8px; flex: none; }
.top > .ib { margin: 0 4px; }
.search { flex: 1; max-width: 720px; height: 48px; background: var(--search); border-radius: 24px; display: flex; align-items: center; padding: 0 4px; }
.search:focus-within { background: #fff; box-shadow: 0 1px 1px 0 rgba(65,69,73,.3), 0 1px 3px 1px rgba(65,69,73,.15); }
.search input { flex: 1; border: 0; background: transparent; outline: none; font-size: 16px; height: 100%; padding: 0 4px; }
.search input::-webkit-search-cancel-button { display: none; }
.top-right { margin-left: auto; padding: 0 12px; position: relative; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #7b1fa2; color: #fff; font-size: 15px; font-weight: 500; }
.account-menu { position: absolute; right: 8px; top: 44px; background: #e9eef6; border-radius: 28px; padding: 24px; min-width: 300px; z-index: 30; text-align: center; box-shadow: 0 4px 8px 3px rgba(60,64,67,.15); }
.acc-name { font-size: 20px; margin-bottom: 4px; }
.acc-mail { color: var(--muted); margin-bottom: 16px; }

/* corpo */
.body { flex: 1; display: flex; min-height: 0; }
.side { width: 256px; flex: none; display: flex; flex-direction: column; min-height: 0; transition: width .15s; }
.compose-btn { margin: 8px 0 16px 8px; height: 56px; min-width: 56px; align-self: flex-start; border-radius: 16px; background: var(--compose); display: inline-flex; align-items: center; gap: 12px; padding: 0 20px 0 16px; font-weight: 500; color: #001d35; }
.compose-btn:hover { box-shadow: 0 1px 3px 0 rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15); }
.compose-btn .ms { font-size: 24px; }
.folders { overflow-y: auto; padding-right: 16px; flex: 1; }
.folders:hover { scrollbar-color: #c4c7c5 transparent; }
.fitem { height: 32px; display: flex; align-items: center; border-radius: 0 16px 16px 0; padding: 0 12px 0 26px; cursor: pointer; color: #202124; gap: 16px; white-space: nowrap; }
.fitem:hover { background: var(--hover); }
.fitem.active { background: var(--nav-active); font-weight: 700; color: #001d35; }
.fitem .ms { font-size: 20px; color: #444746; }
.fitem.active .ms { font-variation-settings: 'FILL' 1; color: #001d35; }
.fitem .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.fitem .fcount { font-size: 12px; font-weight: 700; }
.fitem .tw { width: 20px; margin-left: -22px; margin-right: -14px; color: var(--muted); font-size: 18px; }
.side-label { padding: 16px 0 8px 26px; font-size: 16px; font-weight: 500; }
.app.collapsed .side { width: 72px; }
.app.collapsed .compose-btn .lbl, .app.collapsed .fname, .app.collapsed .fcount, .app.collapsed .side-label, .app.collapsed .tw { display: none; }
.app.collapsed .compose-btn { padding: 0 16px; }
.app.collapsed .fitem { padding: 0; justify-content: center; border-radius: 16px; margin-left: 12px; width: 56px; }

.main { flex: 1; min-width: 0; background: var(--panel); border-radius: 16px; margin: 0 16px 16px 0; display: flex; flex-direction: column; overflow: hidden; }
.view { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.toolbar { height: 48px; display: flex; align-items: center; padding: 0 8px 0 8px; flex: none; }
.bulk { display: inline-flex; }
.page-info { color: var(--muted); font-size: 12px; padding: 0 8px; }

/* lista estilo Gmail */
.list { flex: 1; overflow-y: auto; }
.row { display: flex; align-items: center; height: 40px; padding: 0 16px 0 8px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; background: var(--read-row); }
.row.unread { background: #fff; }
.row.selected { background: var(--sel-row); }
.row:hover { box-shadow: inset 1px 0 0 #dadce0, inset -1px 0 0 #dadce0, 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15); z-index: 1; }
.row .chk { width: 32px; height: 32px; }
.row .star { width: 32px; height: 32px; }
.row .star.on .ms { color: var(--star); font-variation-settings: 'FILL' 1; }
.row .sender { width: 168px; flex: none; padding: 0 16px 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #202124; }
.row .content { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #202124; }
.row .snippet { color: var(--muted); }
.row .clip { color: var(--muted); font-size: 18px; margin-left: 8px; }
.row .date { width: 72px; flex: none; text-align: right; font-size: 12px; color: #202124; padding-left: 8px; }
.row.unread .sender, .row.unread .subj, .row.unread .date { font-weight: 700; }
.row .hover-acts { display: none; position: absolute; right: 8px; background: inherit; }
.row:hover .hover-acts { display: flex; }
.row:hover .date { visibility: hidden; }
.row .hover-acts .ib { width: 36px; height: 36px; }
.list-msg { padding: 24px; color: var(--muted); text-align: center; }

/* leitura */
.read-body { flex: 1; overflow-y: auto; padding: 0 0 24px; }
.r-subject { font-size: 22px; font-weight: 400; margin: 12px 24px 16px 72px; word-break: break-word; }
.r-msg { display: flex; padding: 0 24px 0 16px; gap: 16px; }
.r-avatar { width: 40px; height: 40px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.r-main { flex: 1; min-width: 0; }
.r-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.r-name { font-weight: 700; }
.r-email { color: var(--muted); font-size: 12px; }
.r-date { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.r-to { color: var(--muted); font-size: 12px; margin-top: 2px; word-break: break-word; }
.r-frame { width: 100%; border: 0; margin-top: 16px; min-height: 200px; display: block; }
.r-atts { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; padding-top: 16px; border-top: 1px solid var(--line); }
.r-att { width: 180px; border: 1px solid #dadce0; border-radius: 8px; padding: 10px 12px; display: flex; align-items: center; gap: 8px; font-size: 13px; text-align: left; }
.r-att:hover { background: var(--bg); }
.r-att span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-actions { display: flex; gap: 12px; margin: 24px 0 0 72px; flex-wrap: wrap; }
.r-actions .pill { color: #444746; display: inline-flex; align-items: center; gap: 8px; }
.r-actions .pill .ms { font-size: 20px; }

/* resposta inline */
.inline-reply { margin: 16px 24px 0 72px; border-radius: 8px; box-shadow: 0 1px 2px 0 rgba(60,64,67,.3), 0 2px 6px 2px rgba(60,64,67,.15); padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.inline-reply .ir-to { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.inline-reply input { border: 0; border-bottom: 1px solid var(--line); outline: none; padding: 6px 0; flex: 1; }
.inline-reply textarea { border: 0; outline: none; resize: vertical; min-height: 140px; padding: 6px 0; }

/* janela de composição (canto inferior direito) */
.compose { position: fixed; right: 16px; bottom: 0; width: 540px; max-width: calc(100vw - 32px); background: #fff; border-radius: 8px 8px 0 0; box-shadow: 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12), 0 5px 5px -3px rgba(0,0,0,.2); z-index: 20; display: flex; flex-direction: column; }
.compose-head { height: 40px; background: #f2f6fc; border-radius: 8px 8px 0 0; display: flex; align-items: center; padding: 0 8px 0 16px; font-weight: 500; font-size: 14px; cursor: pointer; }
.compose.min .compose-main { display: none; }
.compose.min { width: 280px; }
.compose-main { display: flex; flex-direction: column; height: min(560px, 80vh); padding: 0 16px; }
.cf { border: 0; border-bottom: 1px solid var(--line); outline: none; padding: 8px 0; }
.cbody { flex: 1; border: 0; outline: none; resize: none; padding: 12px 0; font-size: 14px; }
.cfiles { display: flex; flex-wrap: wrap; gap: 6px; }
.cfile { background: var(--bg); border-radius: 4px; padding: 4px 8px; font-size: 12px; display: inline-flex; gap: 6px; align-items: center; }
.cfile button { color: var(--muted); }
.compose-foot { display: flex; align-items: center; gap: 4px; padding: 12px 0; }
.send { background: var(--blue); color: #fff; border-radius: 18px; height: 36px; padding: 0 24px; font-weight: 500; margin-right: 8px; }
.send:hover { box-shadow: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15); }
.send:disabled { opacity: .6; cursor: wait; }
.cstatus { color: var(--muted); font-size: 12px; }

.toast { position: fixed; left: 24px; bottom: 24px; background: #1f1f1f; color: #f2f2f2; padding: 14px 24px; border-radius: 4px; z-index: 40; max-width: 90vw; box-shadow: 0 3px 5px -1px rgba(0,0,0,.2); }

@media (max-width: 800px) {
  .logo { width: auto; padding-right: 8px; }
  .logo-text { display: none; }
  .side { position: fixed; top: 64px; bottom: 0; left: 0; background: var(--bg); z-index: 15; transform: translateX(-100%); transition: transform .2s; }
  .app.mobile-open .side { transform: none; box-shadow: 0 0 16px rgba(0,0,0,.2); }
  .main { margin: 0; border-radius: 0; }
  .row .sender { width: 110px; }
  .row .star { display: none; }
  .r-subject, .r-actions, .inline-reply { margin-left: 16px; }
  .compose { right: 0; max-width: 100vw; width: 100vw; }
}
