:root {
  /* KiQHub palette — shared with KiQHub Office (office/server/static/css/office.css) */
  --indigo: #4C5BD4; --blue: #3563E9; --navy: #0f1629; --ink: #1f2328; --muted: #6b7280; --line: #e0e3e8; --bg: #f3f4f6; --panel: #fff; --tint: #eef1ff;
  --ok: #0f7b3f; --err: #c42b1c; --warn: #b35c00; --radius: 10px; --side: 250px; --list: 380px;
  --font-ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
}
[data-theme=dark] { --navy: #e8eaed; --ink: #d9dce1; --muted: #9aa1ab; --line: #3a3f47; --bg: #1b1d21; --panel: #25282d; --tint: rgba(96, 153, 255, .16); }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased; color: var(--ink); background: var(--bg); }
a { color: var(--indigo); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 60px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }

/* layout */
/* one row as tall as the screen (minmax 0): the columns scroll inside it — an auto row grew to the whole message list, and
   inside the fixed .frame nothing could scroll */
.shell { display: grid; grid-template-columns: var(--side) var(--list) 1fr; grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; }
.shell.single { grid-template-columns: var(--side) 1fr; }
.side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow: auto; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 10px; font-weight: 700; font-size: 17px; letter-spacing: -.2px; color: var(--navy); }
.brand .prod { font-weight: 400; color: var(--muted); }
.mark { width: 30px; height: 30px; border-radius: 8px; background: url(/static/img/kiqmail-icon.svg) center/cover; display: inline-block; flex: none; }
.side-compose { margin: 6px 14px 12px; height: 38px; justify-content: center; border-radius: 10px; font-size: 14px; background: linear-gradient(135deg, #5b6cf0, #4C5BD4); box-shadow: 0 6px 18px rgba(76, 91, 212, .30); }
.side-compose:hover { filter: none; box-shadow: 0 8px 22px rgba(76, 91, 212, .40); }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 16px; cursor: pointer; border-radius: 0; color: var(--ink); text-decoration: none; }
.nav-item:hover { background: var(--tint); }
.nav-item.active { background: var(--tint); color: var(--indigo); font-weight: 700; }
.nav-item .badge { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--indigo); color: #fff; border-radius: 999px; padding: 1px 7px; }
.nav-item .badge.err { background: var(--err); }
.nav-group { padding: 10px 16px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.nav-group button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.side .foot { margin-top: auto; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid transparent; background: var(--indigo); color: #fff; font-weight: 700; cursor: pointer; font-size: 13px; }
.btn:hover { filter: brightness(.95); }
.btn.ghost { background: var(--panel); color: var(--navy); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--indigo); color: var(--indigo); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.danger { background: var(--err); }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; display: inline-grid; place-items: center; color: var(--ink); }
.icon-btn:hover { border-color: var(--indigo); color: var(--indigo); }
.icon-btn.active { background: var(--tint); color: var(--indigo); border-color: var(--indigo); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.field input:not([type]), .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=url], .field input[type=number], .field input[type=time], .field select, .field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-size: 14px; }
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px var(--tint); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.help { font-size: 12px; color: var(--muted); }
.msg-ok { color: var(--ok); font-size: 13px; } .msg-err { color: var(--err); font-size: 13px; }

/* list */
.list { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.list-head { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.list-head input { flex: 1; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.list-body { overflow: auto; flex: 1; min-height: 0; }
.item { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: start; }
.item:hover { background: var(--tint); }
.item.active { background: var(--tint); box-shadow: inset 3px 0 0 var(--indigo); }
.item .who { font-weight: 700; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item.unread .who::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); margin-right: 6px; vertical-align: middle; }
.item .subj { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item.unread .subj { font-weight: 600; }
.item .snip { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .when { font-size: 11px; color: var(--muted); white-space: nowrap; }
.item .flags { font-size: 11px; color: var(--warn); }
.item .cnt { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; }
.compact .item { padding: 6px 12px; } .compact .item .snip { display: none; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* reader */
.reader { display: flex; flex-direction: column; min-width: 0; overflow: auto; }
.reader-head { padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.reader-head h2 { margin: 0; font-size: 18px; color: var(--navy); }
.tools { display: flex; gap: 6px; flex-wrap: wrap; }
.mailmsg { margin: 14px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.mailmsg .mhead { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; cursor: pointer; }
.mailmsg .mhead b { color: var(--navy); }
.mailmsg .mhead .meta { font-size: 12px; color: var(--muted); }
.mailmsg .mbody { padding: 16px; overflow-x: auto; }
.mailmsg .mbody.plain { white-space: pre-wrap; font-family: inherit; }
.mailmsg.collapsed .mbody { display: none; }
/* the clicked email's tools sit on its header line (Trash | Reply · Reply all · Forward); others show them on hover */
.mpill-line { position: relative; height: 0; z-index: 4; }
.mpill { position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 2px; padding: 3px 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 90%, transparent); -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(15, 23, 42, .12); opacity: 0; pointer-events: none; transition: opacity .15s; }
.mpill-line.on .mpill, .mailmsg:hover .mpill, .mpill:focus-within { opacity: 1; pointer-events: auto; }
.mpill button { display: inline-grid; place-items: center; width: 34px; height: 28px; padding: 0; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; }
.mpill button:hover { background: rgba(15, 23, 42, .07); color: var(--ink); }
.mpill button.danger:hover { color: #dc2626; background: rgba(220, 38, 38, .08); }
.mpill button:focus-visible { outline: 2px solid var(--indigo); outline-offset: 1px; }
.mpill-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
[data-theme=dark] .mpill { background: color-mix(in srgb, var(--panel) 85%, #000); box-shadow: 0 4px 14px rgba(0, 0, 0, .35); }
[data-theme=dark] .mpill button:hover { background: rgba(255, 255, 255, .08); }
.imgbar { background: var(--tint); padding: 6px 12px; font-size: 12px; display: flex; justify-content: space-between; align-items: center; }
.atts { padding: 8px 16px 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.att { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; text-decoration: none; color: var(--ink); }
.aibox { margin: 0 20px 14px; background: var(--tint); border-radius: var(--radius); padding: 12px 16px; white-space: pre-wrap; font-size: 13px; }

/* compose */
.overlay { position: fixed; inset: 0; background: rgba(16, 36, 59, .35); z-index: 20; display: grid; place-items: end center; }
.compose { width: min(760px, 100%); max-height: 92vh; background: var(--panel); border-radius: 14px 14px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.2); display: flex; flex-direction: column; }
.compose .chead { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-weight: 700; color: var(--navy); }
.compose .cbody { padding: 12px 16px; overflow: auto; }
.compose .cline { display: flex; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); padding: 6px 0; }
.compose .cline label { width: 60px; font-size: 12px; color: var(--muted); }
.compose .cline input, .compose .cline select { flex: 1; border: 0; background: none; padding: 4px 0; }
.compose .cline input:focus { outline: none; }
.compose textarea { width: 100%; min-height: 220px; border: 0; padding: 12px 0; resize: vertical; background: none; }
.compose textarea:focus { outline: none; }
.compose .cfoot { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fnprev { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 6px; font-size: 12px; color: var(--muted); }

/* settings */
.settings { padding: 24px 28px; max-width: 900px; overflow: auto; }
.settings h1 { font-size: 24px; color: var(--navy); margin: 0 0 4px; }
.tabs { display: flex; gap: 6px; margin: 16px 0 20px; flex-wrap: wrap; }
.tab { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 600; }
.tab.active { background: var(--navy); color: var(--panel); border-color: var(--navy); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card h3 { margin: 0 0 8px; color: var(--navy); font-size: 16px; }
.acct-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.acct-row:last-child { border-bottom: 0; }
.acct-row .grow { flex: 1; min-width: 0; }
.acct-row .sub { font-size: 12px; color: var(--muted); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatch.active { box-shadow: 0 0 0 2px var(--indigo); }
.toggle { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.toggle input { width: 18px; height: 18px; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-bottom: 12px; }
.preset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; background: var(--panel); text-align: left; }
.preset.active { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--tint); }
.preset b { display: block; color: var(--navy); }
.preset span { font-size: 12px; color: var(--muted); }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: min(420px, 100%); padding: 28px; }
.auth h1 { margin: 0 0 4px; color: var(--navy); font-size: 26px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
[data-theme=dark] .toast { background: #fff; color: #10243b; }

.mobile-bar { display: none; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 15; transform: translateX(-100%); transition: .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .list, .reader, .settings { display: none; }
  .shell[data-pane=list] .list, .shell[data-pane=reader] .reader, .shell[data-pane=settings] .settings { display: flex; }
  .shell[data-pane=settings] .settings { display: block; }
  .list { border-right: 0; }
  .mobile-bar { display: flex; }
}

/* ---- hub panes (calendar / notes) ---- */
.hubpane { display: flex; flex-direction: column; min-width: 0; overflow: auto; background: var(--bg); }
.hub-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px 8px; flex-wrap: wrap; }
.hub-head h1 { margin: 0; font-size: 22px; color: var(--navy); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 8px 20px; }
.cal-dow { background: var(--panel); padding: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); text-align: center; font-weight: 700; }
.cal-day { background: var(--panel); min-height: 86px; padding: 4px 6px; cursor: pointer; font-size: 12px; }
.cal-day.other { opacity: .45; } .cal-day.today .num { background: var(--indigo); color: #fff; border-radius: 50%; }
.cal-day.sel { box-shadow: inset 0 0 0 2px var(--indigo); }
.cal-day .num { display: inline-block; width: 22px; height: 22px; line-height: 22px; text-align: center; font-weight: 700; color: var(--navy); }
.cal-ev { color: #fff; border-radius: 4px; padding: 1px 5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.agenda { margin: 8px 20px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.agenda h3 { margin: 0 0 8px; color: var(--navy); font-size: 15px; }
.agenda-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); cursor: pointer; }
.notes-cols { display: grid; grid-template-columns: 320px 1fr; flex: 1; min-height: 0; }
.notes-list { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.note-edit { display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.note-title { border: 0; padding: 14px 20px 4px; font-size: 22px; font-weight: 800; color: var(--navy); background: none; }
.note-body { border: 0; padding: 8px 20px 20px; flex: 1; resize: none; background: none; font-size: 15px; line-height: 1.6; }
.note-title:focus, .note-body:focus { outline: none; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.card.featured { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--tint); }
.price { font-size: 30px; font-weight: 800; color: var(--navy); letter-spacing: -1px; } .price span { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.list { list-style: none; padding: 0; margin: 10px 0 14px; } .list li { padding: 4px 0 4px 22px; position: relative; font-size: 13px; } .list li::before { content: '✓'; position: absolute; left: 0; color: var(--ok); font-weight: 800; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--tint); color: var(--indigo); }
.badge.ok { background: #e6f7f0; color: #0b6b4c; } .badge.warn { background: #fdf1ef; color: #8e2b20; }
[data-theme=dark] .badge.ok { background: #123b2c; color: #7de0b6; } [data-theme=dark] .badge.warn { background: #3b1b17; color: #f2a59a; }
@media (max-width: 980px) { .shell[data-pane=hub] .hubpane { display: flex; } .hubpane { display: none; } .notes-cols { grid-template-columns: 1fr; } .note-edit { display: none; } .grid3 { grid-template-columns: 1fr; } .cal-day { min-height: 56px; } .cal-ev { display: none; } .cal-day .num { font-size: 12px; } }
/* free kiqmail.net mailbox */
.addr-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); overflow: hidden; }
.addr-input input { flex: 1; border: 0 !important; padding: 9px 10px; background: none; font-size: 15px; min-width: 0; } .addr-input input:focus { outline: none; box-shadow: none !important; }
.addr-input span { padding: 9px 12px; color: var(--muted); background: var(--bg); border-left: 1px solid var(--line); white-space: nowrap; }
.addr-input:focus-within { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--tint); }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; margin: 2px 2px 0 0; } .chip:hover { border-color: var(--indigo); color: var(--indigo); }
.usage { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); } .usage-bar { width: 90px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; display: inline-block; } .usage-bar i { display: block; height: 100%; }
.nav-item.promo { margin: 4px 10px; border-radius: 10px; background: var(--tint); color: var(--indigo); font-weight: 600; font-size: 13px; }
.nav-item.alert { margin: 4px 10px; border-radius: 10px; background: #fdf1ef; color: #8e2b20; font-size: 12px; } [data-theme=dark] .nav-item.alert { background: #3b1b17; color: #f2a59a; }
.managed-tag { font-size: 11px; font-weight: 700; color: var(--indigo); background: var(--tint); border-radius: 999px; padding: 1px 7px; margin-left: 6px; }

/* Sign in with Apple / Google (brand rules: Apple black, Google white with grey border) */
.idp-buttons { margin: 4px 0 12px; display: grid; gap: 10px; }
.idp-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 44px; border-radius: 10px; font-weight: 600; font-size: 15px; text-decoration: none; }
.idp-apple { background: #000; color: #fff !important; } .idp-apple:hover { background: #1a1a1a; }
.idp-google { background: #fff; color: #1f1f1f !important; border: 1px solid #747775; } .idp-google:hover { background: #f8f9fa; }
[data-theme=dark] .idp-apple { background: #fff; color: #000 !important; } [data-theme=dark] .idp-apple:hover { background: #e8e8e8; }
.idp-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin-top: 4px; } .idp-or::before, .idp-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
/* footers */
.footer-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.footer-thumb { width: 260px; max-height: 90px; overflow: hidden; background: #fff; border-radius: 8px; padding: 8px; transform-origin: left top; flex: none; }
.footer-thumb table { transform: scale(.6); transform-origin: left top; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tpl { text-align: left; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 12px; cursor: pointer; color: var(--ink); }
.tpl:hover { border-color: var(--indigo); } .tpl b { display: block; color: var(--navy); } .tpl span { font-size: 12px; color: var(--muted); }
.footer-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 14px; }
.footer-preview { position: sticky; top: 10px; } .mail-mock { background: #fff; color: #334155; border: 1px solid var(--line); border-radius: 10px; padding: 20px; overflow-x: auto; }
.title-input { font-size: 20px; font-weight: 800; border: 1px solid transparent; border-radius: 8px; padding: 4px 8px; background: none; color: var(--navy); }
.title-input:hover, .title-input:focus { border-color: var(--line); outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; } .chip.on { background: var(--indigo); color: #fff; border-color: var(--indigo); }
/* referrals */
.ref-link { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; } .ref-link input { flex: 1; min-width: 220px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 14px; }
.ref-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 14px; } .ref-stats div { background: var(--bg); border-radius: 10px; padding: 12px; text-align: center; }
.ref-stats b { display: block; font-size: 24px; color: var(--navy); } .ref-stats span { font-size: 12px; color: var(--muted); }
.ref-progress .bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin-bottom: 6px; } .ref-progress .bar i { display: block; height: 100%; background: var(--indigo); }
@media (max-width: 980px) { .footer-editor { grid-template-columns: 1fr; } .footer-thumb { width: 180px; } .ref-stats { grid-template-columns: 1fr; } }
.footer-editor > div { min-width: 0; } .row > .field { min-width: 0; }
.footer-editor input[type=file] { max-width: 100%; font-size: 12px; }
.img-row { display: flex; align-items: center; gap: 10px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--indigo); margin-bottom: 4px; }

/* KiQHub Office look: line icons, softer rows */
.nav-ico { flex: none; color: var(--muted); }
.nav-item { border-radius: 8px; margin: 1px 8px; padding: 7px 10px; }
.nav-item.active .nav-ico, .nav-item:hover .nav-ico { color: var(--indigo); }
.side-compose .nav-ico { color: #fff; }
.nav-group { padding: 12px 18px 4px; }
.btn .nav-ico { color: inherit; width: 16px; height: 16px; }
.icon-btn .nav-ico { color: inherit; }

/* ═════════════ KiQHub Office "glass" skin — same look as KiQHub Office (office/server/static/css/skins.css) ═════════════ */
@font-face{font-family:'Inter';font-style:normal;font-weight:400;font-display:swap;src:url(/static/fonts/inter/inter-400-normal-latin.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Inter';font-style:normal;font-weight:400;font-display:swap;src:url(/static/fonts/inter/inter-400-normal-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:'Inter';font-style:normal;font-weight:500;font-display:swap;src:url(/static/fonts/inter/inter-500-normal-latin.woff2) format('woff2')}
@font-face{font-family:'Inter';font-style:normal;font-weight:600;font-display:swap;src:url(/static/fonts/inter/inter-600-normal-latin.woff2) format('woff2');unicode-range:U+0000-00FF,U+2000-206F,U+20AC}
@font-face{font-family:'Inter';font-style:normal;font-weight:600;font-display:swap;src:url(/static/fonts/inter/inter-600-normal-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA,U+1E00-1E9F,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:'Inter';font-style:normal;font-weight:700;font-display:swap;src:url(/static/fonts/inter/inter-700-normal-latin.woff2) format('woff2');unicode-range:U+0000-00FF,U+2000-206F,U+20AC}
@font-face{font-family:'Inter';font-style:normal;font-weight:700;font-display:swap;src:url(/static/fonts/inter/inter-700-normal-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA,U+1E00-1E9F,U+2C60-2C7F,U+A720-A7FF}
:root {
  --font-ui: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --glass: rgba(255, 255, 255, .64); --glass-strong: rgba(255, 255, 255, .80); --glass-rim: rgba(255, 255, 255, .78);
  --glass-edge: rgba(15, 23, 42, .08); --glass-blur: saturate(1.7) blur(22px); --topbar-h: 48px;
  --shadow-2: 0 8px 24px rgba(30, 41, 59, .10), 0 1px 3px rgba(30, 41, 59, .06);
}
[data-theme=dark] {
  --glass: rgba(26, 29, 36, .70); --glass-strong: rgba(30, 33, 41, .82); --glass-rim: rgba(255, 255, 255, .07);
  --glass-edge: rgba(255, 255, 255, .06); --glass-blur: saturate(1.5) blur(22px); --bg: #121419; --panel: #1c1f26; --line: #30353f;
}
body { font-family: var(--font-ui); font-size: 13.5px; letter-spacing: -0.003em;
  background: radial-gradient(1100px 520px at 0% -8%, rgba(76, 91, 212, .18), transparent 62%), radial-gradient(900px 560px at 100% -4%, rgba(168, 85, 247, .10), transparent 58%),
              radial-gradient(700px 500px at 60% 110%, rgba(56, 189, 248, .10), transparent 60%), linear-gradient(180deg, #f4f6fb 0%, #e9edf5 100%);
  background-attachment: fixed; }
[data-theme=dark] body { background: radial-gradient(1000px 520px at 0% -10%, rgba(76, 91, 212, .22), transparent 60%), radial-gradient(900px 600px at 100% 0%, rgba(168, 85, 247, .14), transparent 58%), linear-gradient(180deg, #15171c, #0f1115); background-attachment: fixed; }

/* frame: Office top bar + the mail shell under it */
.frame { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.frame > .shell { height: auto; flex: 1; min-height: 0; }
.topbar { height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 8px; position: relative; z-index: 30;
  background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); color: var(--ink);
  border-bottom: 1px solid var(--glass-edge); box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .55); }
[data-theme=dark] .topbar { box-shadow: none; color: #eceef2; }
.k-icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.k-icon-btn:hover { background: rgba(15, 23, 42, .06); }
[data-theme=dark] .k-icon-btn:hover { background: rgba(255, 255, 255, .07); }
.tb-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--navy); font-size: 15.5px; font-weight: 600; letter-spacing: -.2px; padding: 4px 8px 4px 4px; border-radius: 9px; }
.tb-brand b { color: var(--indigo); font-weight: 700; }
.tb-brand .mark { width: 26px; height: 26px; border-radius: 7px; }
.apptabs { display: flex; gap: 2px; padding: 3px; border-radius: 12px; margin-left: 6px; background: rgba(15, 23, 42, .045); box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .05); }
[data-theme=dark] .apptabs { background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
.apptab { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px 0 7px; border-radius: 9px; color: var(--ink); opacity: .85; text-decoration: none; font-weight: 500; white-space: nowrap; }
.apptab img { width: 20px; height: 20px; border-radius: 5px; }
.apptab:hover { background: rgba(255, 255, 255, .7); opacity: 1; }
.apptab.on { background: #fff; color: var(--tab-color); font-weight: 600; opacity: 1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 6px 16px color-mix(in srgb, var(--tab-color) 22%, transparent), inset 0 0 0 1px rgba(255, 255, 255, .9); }
[data-theme=dark] .apptab:hover { background: rgba(255, 255, 255, .07); }
[data-theme=dark] .apptab.on { background: rgba(255, 255, 255, .11); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .10), 0 0 18px color-mix(in srgb, var(--tab-color) 35%, transparent); }
.apptab.off { opacity: .5; }
.tb-spacer { flex: 1; }
.tb-btn.ai { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; font-weight: 600; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, #7c3aed, #db2777); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), inset 0 -1px 0 rgba(0, 0, 0, .1), 0 4px 14px rgba(124, 58, 237, .30); }
.tb-btn.ai .ico { color: #fff; } .tb-btn.ai .ico .ic-d { fill: #fff; opacity: .35; }
.tb-avatar { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; background: #ca5010; color: #fff; font: 600 12px var(--font-ui); cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
  padding: 0; display: inline-grid; place-items: center; line-height: 1; letter-spacing: 0; flex: none; }   /* initials centred (no button padding) */
[data-theme=dark] .tb-avatar { border-color: #2a2f38; }
.tb-apps { position: relative; }
.apps-pop { position: absolute; top: 42px; left: 0; width: 360px; padding: 14px; border-radius: 16px; z-index: 50;
  background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-rim); box-shadow: var(--shadow-2); }
.apps-pop-h b { display: block; font-size: 15px; color: var(--navy); } .apps-pop-h span { font-size: 12px; color: var(--muted); }
.apps-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.app-tile { display: grid; grid-template-columns: 34px 1fr; column-gap: 10px; align-items: center; padding: 10px; border-radius: 12px; text-decoration: none; color: var(--ink); background: rgba(255, 255, 255, .6); box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .05); }
[data-theme=dark] .app-tile { background: rgba(255, 255, 255, .05); }
.app-tile img { width: 34px; height: 34px; grid-row: span 2; }
.app-tile b { font-size: 13px; } .app-tile span { font-size: 11.5px; color: var(--muted); }
.app-tile:hover { background: #fff; } [data-theme=dark] .app-tile:hover { background: rgba(255, 255, 255, .1); }
.app-tile.off { opacity: .55; }

/* side bar: light glass, the chosen view is a white pill (Office file side bar) */
.side { background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border-right: 1px solid var(--glass-edge); }
@media (min-width: 981px) { .side .brand { display: none; } .side-compose { margin-top: 12px; } }
.nav-item { margin: 1px 8px; padding: 7px 10px; border-radius: 9px; color: var(--ink); font-weight: 500; }
.nav-item:hover { background: rgba(15, 23, 42, .05); }
.nav-item.active { background: rgba(255, 255, 255, .92); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, .06); }
[data-theme=dark] .nav-item:hover { background: rgba(255, 255, 255, .06); }
[data-theme=dark] .nav-item.active { background: rgba(255, 255, 255, .10); color: #fff; box-shadow: none; }
.nav-item .badge { background: transparent; color: var(--muted); font-weight: 600; }
.nav-group { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; padding: 14px 18px 4px; }
.side .foot { border-top-color: var(--glass-edge); }

/* list + reader: floating glass cards on the canvas */
.list { background: transparent; border-right: 0; padding: 10px 6px 10px 10px; gap: 8px; }
.list-head { border: 1px solid var(--glass-rim); border-radius: 14px; background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: 0 6px 18px rgba(30, 41, 59, .06); }
.list-head input { background: rgba(255, 255, 255, .9); border: 0; box-shadow: inset 0 1px 2px rgba(15, 23, 42, .07), inset 0 0 0 1px rgba(15, 23, 42, .14); border-radius: 11px; }
[data-theme=dark] .list-head input { background: rgba(255, 255, 255, .07); box-shadow: none; }
.list-body { background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-rim); border-radius: 16px;
  box-shadow: 0 10px 30px rgba(30, 41, 59, .08), 0 1px 2px rgba(30, 41, 59, .06), inset 0 1px 0 rgba(255, 255, 255, .95); }
[data-theme=dark] .list-body { box-shadow: 0 14px 36px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .05); }
.item { border-bottom-color: var(--glass-edge); }
.item:hover { background: rgba(15, 23, 42, .035); }
.item.active { background: color-mix(in srgb, var(--indigo) 10%, transparent); box-shadow: inset 3px 0 0 var(--indigo); }
[data-theme=dark] .item:hover { background: rgba(255, 255, 255, .04); }
.reader { background: transparent; padding: 10px 10px 10px 4px; }
.reader-head { border: 1px solid var(--glass-rim); border-radius: 16px; background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: 0 6px 18px rgba(30, 41, 59, .06); }
.card { background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border: 1px solid var(--glass-rim); border-radius: 14px;
  box-shadow: 0 6px 18px rgba(30, 41, 59, .06), inset 0 1px 0 rgba(255, 255, 255, .9); }
[data-theme=dark] .card { box-shadow: 0 10px 28px rgba(0, 0, 0, .3); }
.settings h1 { font-size: 22px; font-weight: 600; }
.tab { background: var(--glass-strong); border-color: var(--glass-edge); font-weight: 500; }
.tab.active { background: color-mix(in srgb, var(--indigo) 12%, #fff); color: color-mix(in srgb, var(--indigo) 82%, #000); border-color: color-mix(in srgb, var(--indigo) 26%, transparent); font-weight: 600; }
[data-theme=dark] .tab.active { background: color-mix(in srgb, var(--indigo) 26%, transparent); color: #fff; }
.btn { border-radius: 10px; font-weight: 600; }
.btn:not(.ghost):not(.danger) { background: var(--indigo); box-shadow: 0 4px 14px color-mix(in srgb, var(--indigo) 35%, transparent); }
.btn.ghost { background: rgba(255, 255, 255, .7); border-color: rgba(15, 23, 42, .10); }
[data-theme=dark] .btn.ghost { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .14); }
.icon-btn { border-radius: 9px; background: rgba(255, 255, 255, .7); }
[data-theme=dark] .icon-btn { background: rgba(255, 255, 255, .06); }
.mobile-bar { background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border-bottom-color: var(--glass-edge); }

/* KiQHub icons (office/server/static/css/icons.css): flat duotone = tone surface under the ink */
:root {
  --t-blue: #3a76f0; --t-indigo: #5b5bd6; --t-violet: #8b5cf6; --t-teal: #0fa3a0; --t-green: #14a46b;
  --t-amber: #eda01a; --t-orange: #f0703c; --t-rose: #e5486a; --t-slate: #64748b; --ic-tint: .3;
}
[data-theme=dark] { --t-blue: #5b93ff; --t-indigo: #8285ff; --t-violet: #a67cff; --t-teal: #2cc7c0; --t-green: #2fc585; --t-amber: #f7b83a; --t-orange: #ff8a57; --t-rose: #ff6b8b; --t-slate: #8f9bb0; --ic-tint: .36; }
.ico { flex: none; overflow: visible; }
.ico .ic-o { fill: currentColor; }
.ico .ic-d { fill: var(--ic-tone, currentColor); opacity: var(--ic-tint); }
.ico[data-tone=blue] { --ic-tone: var(--t-blue); } .ico[data-tone=indigo] { --ic-tone: var(--t-indigo); } .ico[data-tone=violet] { --ic-tone: var(--t-violet); }
.ico[data-tone=teal] { --ic-tone: var(--t-teal); } .ico[data-tone=green] { --ic-tone: var(--t-green); } .ico[data-tone=amber] { --ic-tone: var(--t-amber); }
.ico[data-tone=orange] { --ic-tone: var(--t-orange); } .ico[data-tone=rose] { --ic-tone: var(--t-rose); } .ico[data-tone=slate] { --ic-tone: var(--t-slate); }
.nav-ico { color: var(--ink); }
.nav-item.active .nav-ico, .nav-item:hover .nav-ico { color: var(--ink); }
.topbar .ico .ic-d { fill: currentColor; opacity: .25; }
.side-compose .ico .ic-d, .btn .ico .ic-d { fill: currentColor; opacity: .3; }
.side-compose .nav-ico { color: #fff; }

@media (max-width: 980px) {
  .apptab .lbl, .tb-btn.ai .lbl { display: none; }
  .apptab { padding: 0 6px; }
  .tb-brand > span:last-child { display: none; }
  .apps-pop { width: min(360px, calc(100vw - 20px)); }
  .list, .reader { padding: 0; } .list-body, .list-head, .reader-head { border-radius: 0; border-left: 0; border-right: 0; }
}
/* emails are documents: like KiQHub Office's studio skin ("documents stay on white paper"), HTML mail keeps a white
   page in dark mode so senders' own colours stay readable */
[data-theme=dark] .mailmsg .mbody:not(.plain) { background: #fff; color: #1f2328; margin: 10px 12px 12px; border-radius: 10px; }
[data-theme=dark] .fnprev > div { background: #fff; color: #1f2328; padding: 10px; border-radius: 10px; }

/* ═════════ mailbox tiles (instead of coloured dots) — glossy KiQHub app-tile style ═════════ */
.mbx-tile { --c: #4C5BD4; display: inline-grid; place-items: center; flex: none; color: #fff; font-weight: 700; line-height: 1; position: relative; overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 64%, #fff) 0%, var(--c) 60%, color-mix(in srgb, var(--c) 72%, #000) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28), 0 1px 2px rgba(16, 24, 40, .22); }
.mbx-tile::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 44%; background: linear-gradient(180deg, rgba(255, 255, 255, .34), rgba(255, 255, 255, 0)); }
.nav-item .mbx-tile { margin-right: 2px; }
.reader-acct { display: flex; align-items: center; gap: 6px; }
.item { grid-template-columns: 18px 1fr auto; }

/* language menu on the sign-in screen (KiQHub .langpick) */
.langpick { display: flex; align-items: center; gap: 6px; margin-top: 14px; color: var(--muted); }
.langpick select { border: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer; padding: 4px 2px; }

/* ═════════ settings — KiQHub Office account-menu style ═════════ */
.settings { padding: 0; max-width: none; overflow: hidden; display: flex; flex-direction: column; }
.settings .mobile-bar { margin: 0; }
.set-layout { display: grid; grid-template-columns: 270px 1fr; height: 100%; min-height: 0; }
.set-nav { overflow: auto; padding: 14px 10px; border-right: 1px solid var(--glass-edge); background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
.set-me { display: flex; gap: 12px; align-items: center; padding: 10px 10px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--glass-edge); }
.set-me b { display: block; font-size: 14px; color: var(--navy); } .set-me small { display: block; color: var(--muted); font-size: 12px; }
.tb-avatar.big { width: 44px; height: 44px; font-size: 15px; flex: none; cursor: default; }
.plan-pill { display: inline-block; margin-top: 5px; padding: 2px 9px; border-radius: 99px; background: #eef1ff; color: #4C5BD4; font-size: 11.5px; font-weight: 600; }
[data-theme=dark] .plan-pill { background: rgba(130, 133, 255, .18); color: #c7c8ff; }
.set-group { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 12px 10px 4px; }
.set-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font: 500 13.5px var(--font-ui); cursor: pointer; text-align: left; }
.set-item:hover { background: rgba(15, 23, 42, .05); }
.set-item.on { background: rgba(255, 255, 255, .92); font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, .06); }
[data-theme=dark] .set-item:hover { background: rgba(255, 255, 255, .06); }
[data-theme=dark] .set-item.on { background: rgba(255, 255, 255, .10); box-shadow: none; }
.set-body { overflow: auto; padding: 22px 28px 40px; max-width: 900px; }
.set-body h1 { font-size: 22px; font-weight: 600; color: var(--navy); margin: 0 0 14px; }
.list-card { padding: 4px 0; }
.list-card.inset { border: 1px solid var(--glass-edge); border-radius: 12px; margin: 10px 0; background: rgba(255, 255, 255, .5); }
[data-theme=dark] .list-card.inset { background: rgba(255, 255, 255, .03); }
.mbx-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 16px; border: 0; background: transparent; text-align: left; cursor: pointer; color: var(--ink); font: inherit; }
.mbx-row + .mbx-row { border-top: 1px solid var(--glass-edge); }
.mbx-row:hover { background: rgba(15, 23, 42, .03); }
[data-theme=dark] .mbx-row:hover { background: rgba(255, 255, 255, .03); }
.mbx-row b { color: var(--navy); } .mbx-row .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.mbx-row .row-tools { display: flex; gap: 4px; opacity: .6; } .mbx-row:hover .row-tools { opacity: 1; }
.mbx-add { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; border: 1.5px dashed color-mix(in srgb, var(--indigo) 45%, transparent); color: var(--indigo); }
.mbx-row.add b { color: var(--indigo); }
.managed-tag { margin-left: 8px; padding: 1px 7px; border-radius: 99px; background: #e6f4ec; color: #0b7348; font-size: 11px; font-weight: 600; }
.set-row, .k-switch-row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; }
.set-row + .set-row, .set-row + .k-switch-row, .k-switch-row + .k-switch-row, .k-switch-row + .set-row { border-top: 1px solid var(--glass-edge); }
.set-row b, .k-switch-row .lbl { display: block; color: var(--navy); font-weight: 600; }
.set-row small, .k-switch-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.k-switch-row { cursor: pointer; }
.k-switch { appearance: none; -webkit-appearance: none; width: 40px; height: 24px; border-radius: 99px; background: #cfd5df; position: relative; cursor: pointer; flex: none; transition: background .15s; }
.k-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .15s; }
.k-switch:checked { background: var(--indigo); } .k-switch:checked::after { transform: translateX(16px); }
[data-theme=dark] .k-switch { background: #3d4450; }
.k-seg { display: inline-flex; background: rgba(15, 23, 42, .06); border-radius: 9px; padding: 3px; gap: 2px; flex: none; }
.k-seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font: 500 13px var(--font-ui); cursor: pointer; }
.k-seg button.on { background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .12); font-weight: 600; }
[data-theme=dark] .k-seg { background: rgba(255, 255, 255, .06); } [data-theme=dark] .k-seg button.on { background: rgba(255, 255, 255, .14); }
.set-select { padding: 8px 10px; border-radius: 10px; border: 0; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .14); background: rgba(255, 255, 255, .9); font: inherit; color: var(--ink); min-width: 190px; }
[data-theme=dark] .set-select { background: rgba(255, 255, 255, .07); box-shadow: none; }
.set-note { display: flex; gap: 10px; align-items: center; margin: 10px 16px; padding: 10px 12px; border-radius: 10px; background: #f3edff; color: #5b21b6; font-size: 13px; }
[data-theme=dark] .set-note { background: rgba(166, 124, 255, .14); color: #d9ccff; }
.form-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; } .form-head h3 { margin: 0; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 10px; }
.preset { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--glass-edge); background: rgba(255, 255, 255, .6); cursor: pointer; color: var(--ink); font: inherit; text-align: left; }
.preset.active { border-color: color-mix(in srgb, var(--indigo) 50%, transparent); background: #eef1ff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--indigo) 14%, transparent); }
[data-theme=dark] .preset { background: rgba(255, 255, 255, .04); } [data-theme=dark] .preset.active { background: rgba(130, 133, 255, .16); }
@media (max-width: 980px) {
  .set-layout { grid-template-columns: 1fr; }
  .set-nav { display: flex; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--glass-edge); }
  .set-nav .set-me, .set-nav .set-group { display: none; }
  .set-item { width: auto; flex: none; }
  .set-body { padding: 16px; }
  .set-row { flex-wrap: wrap; }
}
.set-body .grow, .mbx-row .grow { flex: 1; min-width: 0; }
.tb-avatar.big { display: grid; place-items: center; padding: 0; }

/* ---------------------------------------------------------------- account menu (avatar) — KiQHub Office's .k-menu, glass skin */
.k-menu-backdrop { position: fixed; inset: 0; z-index: 90; }
.k-menu { position: fixed; z-index: 91; min-width: 290px; max-width: min(360px, calc(100vw - 16px)); max-height: calc(100vh - 64px); overflow: auto;
  padding: 5px; border-radius: 14px; color: var(--ink); background: rgba(255, 255, 255, .95); border: 1px solid rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: saturate(1.8) blur(26px); backdrop-filter: saturate(1.8) blur(26px); outline: none; animation: kpop .08s ease-out;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .07), 0 20px 44px -14px rgba(15, 23, 42, .32), 0 4px 12px -4px rgba(15, 23, 42, .12), inset 0 1px 0 rgba(255, 255, 255, .95); }
[data-theme=dark] .k-menu { background: rgba(34, 37, 44, .96); border-color: rgba(255, 255, 255, .08);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .4), 0 20px 44px -14px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .06); }
.k-menu.acct-menu { top: 54px; right: 10px; }
.k-menu.acct-sub { min-width: 210px; z-index: 92; }
@keyframes kpop { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.k-menu-item { display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 8px 0 4px; border-radius: 9px; cursor: default; white-space: nowrap; user-select: none; font-size: 13.5px; }
.k-menu-item:hover, .k-menu-item.active { background: color-mix(in srgb, var(--indigo) 12%, transparent); }
.k-menu-item:has(small) { padding-top: 5px; padding-bottom: 5px; }
.k-menu-check { width: 18px; flex: none; display: flex; justify-content: center; color: var(--indigo); }
.k-menu-icon { width: 20px; flex: none; display: flex; justify-content: center; }
.k-menu-icon .flip { display: flex; transform: scaleX(-1); }
.k-menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.k-menu-label small { display: block; font-size: 11.5px; color: var(--muted); margin-top: -1px; overflow: hidden; text-overflow: ellipsis; }
.k-menu-item.accent .k-menu-label { color: var(--indigo); font-weight: 600; }
.k-menu-item.accent .k-menu-label small { white-space: normal; font-weight: 400; }
.k-menu-sub { color: var(--muted); display: flex; }
.k-menu-header { padding: 8px 10px 3px; font-size: 11px; font-weight: 650; letter-spacing: .02em; color: var(--muted); }
.k-menu-sep { height: 1px; background: rgba(15, 23, 42, .08); margin: 4px 8px; }
[data-theme=dark] .k-menu-sep { background: rgba(255, 255, 255, .08); }
.acct-card { display: flex; gap: 12px; padding: 10px 10px 8px; align-items: center; }
.acct-avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #ca5010; color: #fff; font: 600 16px var(--font-ui); box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0, 0, 0, .15); }
.acct-who { min-width: 0; display: flex; flex-direction: column; }
.acct-who b { color: var(--navy); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.acct-who > span { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.acct-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 5px; }
.acct-kind { font-size: 11px; color: var(--muted); }
.k-badge { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 9px; font-size: 11px; font-weight: 600; }
.k-badge.accent { background: color-mix(in srgb, var(--indigo) 14%, transparent); color: var(--indigo); }
.tb-avatar.open { box-shadow: 0 0 0 3px color-mix(in srgb, var(--indigo) 30%, transparent); }
@media (max-width: 600px) { .k-menu.acct-menu { right: 8px; left: 8px; min-width: 0; max-width: none; } }

/* sign in with KiQ ID */
.btn.kiqid-btn { text-decoration: none; width: 100%; justify-content: center; gap: 12px; height: 52px; font-size: 15px; background: linear-gradient(135deg, #4c5bd4, #7c3aed); border: 0; }
.kiqid-mark { width: 32px; height: 32px; border-radius: 8px; flex: none; background: url(/static/img/kiqid-icon.svg) center/cover; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .5); }
.set-item .set-ext { margin-left: auto; color: var(--muted); font-size: 12px; }
.app-row-icon { width: 40px; height: 40px; border-radius: 11px; flex: none; }
.app-row { cursor: default; }

/* the search in the top bar, like KiQHub's (KiQMail on its own); inside KiQHub and on phones it stays above the message list */
.tb-search { position: relative; display: flex; align-items: center; width: min(420px, 34vw); margin-right: 4px; }
.tb-search .ico { position: absolute; left: 11px; opacity: .55; pointer-events: none; }
.tb-search input { width: 100%; height: 34px; padding: 0 12px 0 34px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg, #fff); color: var(--ink); font: inherit; font-size: 14px; outline: none; -webkit-appearance: none; appearance: none; }
.tb-search input:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px color-mix(in srgb, var(--indigo) 18%, transparent); }
[data-theme=dark] .tb-search input { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); color: #eceef2; }
.list-head-title { display: none; }
@media (min-width: 981px) {   /* KiQMail on its own: the search is in the top bar — the list's head names the folder instead */
  html:not(.embed) .list-head input { display: none; }
  html:not(.embed) .list-head-title { display: block; flex: 1; min-width: 0; font-size: 15px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 4px; }
}
@media (max-width: 980px) { .tb-search { display: none; } }

/* New message: a window in the middle of the screen, a little towards the top (not docked at the bottom) */
.overlay.compose-overlay { place-items: start center; padding: 7vh 16px 16px; }
.compose.compose-win { border-radius: 16px; max-height: 86vh; box-shadow: 0 24px 64px rgba(16, 24, 40, .28); }
@media (max-width: 600px) { .overlay.compose-overlay { padding: 0; place-items: stretch; } .compose.compose-win { border-radius: 0; max-height: none; height: 100%; } }
/* KiQ AI inside the message being written: a small button floating in the corner of the text, and its suggestion card */
.ctext { position: relative; }
.ctext textarea { padding-bottom: 46px; min-height: 260px; }
.kai-fab-row { position: absolute; right: 20px; bottom: 12px; display: flex; gap: 6px; align-items: center; z-index: 2; }
.kai-fab { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 11px 0 9px; border-radius: 999px; border: 0; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600; color: #fff; background: linear-gradient(135deg, #7c3aed, #db2777); opacity: .6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 4px 14px rgba(124, 58, 237, .30); transition: transform .15s, box-shadow .15s; }
.kai-fab.ready, .kai-fab:hover, .kai-fab:focus-visible, .kai-fab:disabled, .ctext:focus-within .kai-fab { opacity: 1; }
.kai-fab:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 6px 18px rgba(124, 58, 237, .40); }
.kai-fab:disabled { cursor: progress; transform: none; }
.kai-fab .ico { color: #fff; } .kai-fab .ico .ic-d { fill: #fff; opacity: .35; }
.kai-spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: kai-spin .8s linear infinite; }
@keyframes kai-spin { to { transform: rotate(360deg); } }
.kai-undo { height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-size: 12px; cursor: pointer; box-shadow: 0 2px 8px rgba(16, 24, 40, .08); }
.kai-pop { position: absolute; right: 0; bottom: 48px; width: min(440px, 100%); z-index: 3; padding: 10px 12px 12px; border-radius: 14px; background: var(--panel);
  border: 1px solid color-mix(in srgb, #7c3aed 25%, var(--line)); box-shadow: 0 18px 48px rgba(16, 24, 40, .22); }
.kai-head { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.kai-head .ico { color: #7c3aed; } .kai-head b { color: #7c3aed; }
.kai-mode { flex: 1; color: var(--muted); font-size: 12px; }
.kai-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 5px; border-radius: 6px; }
.kai-x:hover { background: var(--bg); color: var(--ink); }
.kai-note { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.kai-hint { margin: 8px 0 2px; font-size: 13px; line-height: 1.45; color: var(--ink); }
.kai-text { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg); white-space: pre-wrap; font-size: 13.5px; line-height: 1.5; max-height: min(200px, 28vh); overflow: auto; }
.kai-text.busy { opacity: .45; }
.kai-acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.kai-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.kai-chips button { height: 26px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--ink); font: inherit; font-size: 12px; cursor: pointer; }
.kai-chips button:hover:not(:disabled) { border-color: #7c3aed; color: #7c3aed; }
.kai-switch { display: inline-block; margin-top: 8px; font-size: 12px; }
@media (max-width: 600px) { .kai-pop { width: auto; left: 0; } .kai-chips { margin-left: 0; } }
/* Settings › Mailboxes › your @kiqmail.net address: change it (delete + choose a new one) */
.danger-zone { margin-top: 18px; padding: 14px 16px; border: 1px solid color-mix(in srgb, #dc2626 28%, var(--line)); border-radius: 12px; background: color-mix(in srgb, #dc2626 4%, var(--panel)); }
.danger-zone .help { margin: 6px 0 10px; }
.pw-zone { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.pw-zone .help { margin: 6px 0 10px; }
.btn.danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn.ghost.danger { background: transparent; color: #dc2626; border-color: color-mix(in srgb, #dc2626 45%, transparent); }
.btn.danger:disabled { opacity: .45; }
/* KiQ AI Agent (static/js/agent.js) */
.agent-card .agent-head { display: flex; gap: 10px; align-items: center; cursor: pointer; border-radius: 10px; }
.agent-card.open .agent-head { margin-bottom: 10px; }
.agent-card .agent-head:focus-visible { outline: 2px solid var(--indigo); outline-offset: 4px; }
.agent-caret { display: inline-grid; place-items: center; width: 18px; flex: none; color: var(--muted); transition: transform .2s ease; }
.agent-caret.folded { transform: rotate(-90deg); }
.agent-note { margin-top: 0; }
.agent-card .agent-head .sub { font-size: 12.5px; color: var(--muted); }
.agent-body { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; }
.agent-body textarea { width: 100%; }
.agent-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.set-note.warn { background: color-mix(in srgb, #d97706 10%, var(--panel)); }
.agent-page { overflow: auto; padding: 18px 22px; display: block; }
.agent-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.agent-top h2 { margin: 0; flex: 1; font-size: 20px; }
.agent-page .chips { margin-bottom: 12px; }
.agent-item { margin-bottom: 10px; }
.agent-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12.5px; margin-bottom: 6px; }
.agent-acct { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.agent-acct .dot { width: 9px; height: 9px; border-radius: 50%; }
.agent-text { white-space: pre-wrap; font: inherit; font-size: 14px; line-height: 1.5; margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--bg); max-height: 360px; overflow: auto; }
.badge.prio-high { background: #dc2626; color: #fff; }
.badge.prio-low { background: var(--line); color: var(--muted); }

/* Sidebar › All inboxes: the arrow after its name folds Unread … Trash away and back, smoothly */
.nav-caret { display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; margin-left: -5px; padding: 0; border: 0; border-radius: 6px; background: none;
  color: var(--muted); cursor: pointer; transition: transform .28s cubic-bezier(.2, .8, .2, 1), background .15s, color .15s; }
.nav-caret:hover { background: rgba(15, 23, 42, .07); color: var(--ink); }
[data-theme=dark] .nav-caret:hover { background: rgba(255, 255, 255, .08); }
.nav-caret.folded { transform: rotate(-90deg); }
.nav-fold { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .3s cubic-bezier(.2, .8, .2, 1), opacity .22s ease; }
.nav-fold > div { overflow: hidden; min-height: 0; }
.nav-fold.folded { grid-template-rows: 0fr; opacity: 0; }
.nav-fold.folded .nav-item { pointer-events: none; }
/* Sidebar › Mailboxes: grab one and move it up or down — the others slide out of its way, it settles into place on release */
.side-mbx { display: flow-root; position: relative; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.side-mbxs.sorting .side-mbx { transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
.side-mbxs.sorting .side-mbx.lifted { transition: none; z-index: 5; }
.side-mbxs .side-mbx.settling { transition: transform .22s cubic-bezier(.2, .8, .2, 1); z-index: 5; }
.side-mbx > .nav-item { transition: box-shadow .22s, background .22s; }
.side-mbx.lifted > .nav-item, .side-mbx.settling > .nav-item { background: var(--panel); box-shadow: 0 10px 28px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .08); }
.side-mbx.lifted > .nav-item { cursor: grabbing; }
[data-theme=dark] .side-mbx.lifted > .nav-item, [data-theme=dark] .side-mbx.settling > .nav-item { background: #2a2f3a; box-shadow: 0 10px 28px rgba(0, 0, 0, .45); }
html.kq-grabbing, html.kq-grabbing * { cursor: grabbing !important; }
.nav-item .grip { flex: none; width: 8px; height: 14px; margin-left: auto; opacity: 0; color: var(--muted); transition: opacity .15s;
  background: radial-gradient(circle, currentColor 1.1px, transparent 1.5px) 0 0 / 4px 4.67px; cursor: grab; }
.nav-item .badge + .grip { margin-left: 4px; }
@media (hover: hover) { .side-mbx:hover .grip { opacity: .75; } }
/* New message on a phone: the whole screen, above the top bar */
@media (max-width: 600px) { .overlay.compose-overlay { z-index: 35; } }

/* ═════════ 0.9.11 ═════════ */
/* KiQ AI's mark: an email the agent answered, or wrote and sent */
.kai-mark { width: 16px; height: 16px; border-radius: 4px; flex: none; vertical-align: -3px; box-shadow: 0 1px 3px rgba(124, 58, 237, .35); }
.kai-chip { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px 0 3px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: #7c3aed; vertical-align: 1px;
  background: linear-gradient(var(--panel), var(--panel)) padding-box, linear-gradient(135deg, #7c3aed, #db2777) border-box; border: 1px solid transparent; white-space: nowrap; }
.kai-chip img { border-radius: 4px; }
[data-theme=dark] .kai-chip { color: #c4b5fd; }
.kai-replied { display: flex; align-items: center; gap: 5px; color: #7c3aed !important; font-weight: 600; margin-top: 2px; }
.kai-replied img { border-radius: 3px; }
.mailmsg.by-agent { border-color: color-mix(in srgb, #7c3aed 35%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, #7c3aed 8%, transparent); }
.item-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.item-marks { display: flex; gap: 5px; align-items: center; justify-content: flex-end; }
.item-marks:empty { display: none; }
.aibox.thinking { display: flex; align-items: center; gap: 8px; color: #7c3aed; font-weight: 600; }
.aibox.thinking img { border-radius: 5px; animation: kai-pulse 1.2s ease-in-out infinite; }
@keyframes kai-pulse { 50% { transform: scale(.86); opacity: .6; } }
/* sender initials (reader everywhere, list on phones) */
.ava { --c: #4C5BD4; width: 36px; height: 36px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 13.5px; letter-spacing: .2px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 72%, #fff), var(--c) 55%, color-mix(in srgb, var(--c) 80%, #000)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25), 0 2px 6px color-mix(in srgb, var(--c) 30%, transparent); }
.mailmsg .mhead { align-items: flex-start; }
.mailmsg .mhead .ava { margin-right: 2px; }
.mhead-who { flex: 1; min-width: 0; }
.who-ava { position: relative; margin-top: 2px; display: inline-flex; }
.who-ava .ava { display: none; }
.empty-art { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 20px; color: var(--indigo);
  background: linear-gradient(160deg, color-mix(in srgb, var(--indigo) 16%, var(--panel)), color-mix(in srgb, #7c3aed 10%, var(--panel))); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--indigo) 18%, transparent); }
/* phone parts: hidden on wider screens */
.m-head, .m-actions, .mnav, .note-back, .side-scrim { display: none; }

/* Office-style menu sliding up from the bottom (phones) */
.sheet-back { position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, .32); display: flex; align-items: flex-end; justify-content: center; animation: sheet-fade .16s ease-out; }
.sheet { width: min(520px, 100%); max-height: 80vh; overflow: auto; padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0;
  background: color-mix(in srgb, var(--panel) 98%, transparent); -webkit-backdrop-filter: saturate(1.8) blur(26px); backdrop-filter: saturate(1.8) blur(26px);
  box-shadow: 0 -18px 50px rgba(15, 23, 42, .25), inset 0 1px 0 rgba(255, 255, 255, .7); animation: sheet-up .22s cubic-bezier(.2, .8, .2, 1); }
[data-theme=dark] .sheet { background: rgba(30, 33, 41, .96); box-shadow: 0 -18px 50px rgba(0, 0, 0, .5); }
@media (min-width: 981px) { .sheet-back { align-items: center; } .sheet { border-radius: 18px; padding-bottom: 10px; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes sheet-fade { from { opacity: 0; } to { opacity: 1; } }
.sheet-grab { display: block; width: 38px; height: 5px; border-radius: 3px; background: rgba(15, 23, 42, .18); margin: 4px auto 8px; }
[data-theme=dark] .sheet-grab { background: rgba(255, 255, 255, .2); }
.sheet-title { padding: 2px 10px 8px; font-weight: 700; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.sheet-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 0 10px; border: 0; border-radius: 13px; background: transparent; color: var(--ink); font: 500 15.5px var(--font-ui); text-align: left; cursor: pointer; }
.sheet-item:hover, .sheet-item:active { background: color-mix(in srgb, var(--indigo) 10%, transparent); }
.sheet-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--indigo) 10%, var(--panel)); color: var(--indigo); }
.sheet-item.ai .sheet-ico { background: none; }
.sheet-item.ai .sheet-ico img { border-radius: 8px; box-shadow: 0 3px 10px rgba(124, 58, 237, .35); }
.sheet-item.danger { color: #dc2626; } .sheet-item.danger .sheet-ico { background: color-mix(in srgb, #dc2626 10%, var(--panel)); color: #dc2626; }
.sheet-sep { height: 1px; margin: 5px 12px; background: var(--glass-edge, var(--line)); }
.sheet-cancel { width: 100%; height: 48px; margin-top: 8px; border: 0; border-radius: 14px; background: rgba(15, 23, 42, .06); color: var(--ink); font: 600 15.5px var(--font-ui); cursor: pointer; }
[data-theme=dark] .sheet-cancel { background: rgba(255, 255, 255, .07); }

/* ── phones (one pane at a time): bottom bar like KiQHub Office's, a big title over the list, avatars, reader actions at the bottom ── */
@media (max-width: 980px) {
  :root { --mnav-h: calc(64px + env(safe-area-inset-bottom)); }
  .cal > .mobile-bar { display: none; }
  .shell.single { grid-template-columns: 1fr; }   /* Calendar, Notes, KiQ AI and Settings use the whole width (the side bar is a drawer here) */
  .frame > .shell { padding-bottom: var(--mnav-h); }
  .mnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 18; height: var(--mnav-h); align-items: flex-start; justify-content: space-around;
    padding: 6px max(6px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--panel) 96%, transparent); -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5); border-top: 1px solid var(--glass-edge, var(--line)); }
  .mnav-item { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 50px; padding: 4px 2px 2px; border: 0; background: none;
    color: var(--muted); font: 600 10.5px/1.2 var(--font-ui); -webkit-tap-highlight-color: transparent; cursor: pointer; }
  .mnav-item .nav-ico { color: var(--muted); }
  .mnav-item.on, .mnav-item.on .nav-ico { color: var(--indigo); }
  .mnav-item.on .ico .ic-d { opacity: .45; }
  .mnav-ico { position: relative; display: grid; place-items: center; height: 26px; }
  .mnav-kai { border-radius: 7px; filter: saturate(.75); opacity: .85; }
  .mnav-item.on .mnav-kai { filter: none; opacity: 1; box-shadow: 0 3px 10px rgba(124, 58, 237, .4); }
  .mnav-badge { position: absolute; top: -4px; left: 14px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e5486a; color: #fff; font: 700 10.5px/18px var(--font-ui); font-style: normal; text-align: center; box-shadow: 0 0 0 2px var(--panel); }
  .mnav-new { flex: none; width: 56px; height: 56px; margin: -18px 4px 0; border: 0; border-radius: 19px; display: grid; place-items: center; color: #fff; cursor: pointer;
    background: linear-gradient(135deg, #4c5bd4, #7c3aed); box-shadow: 0 10px 22px rgba(76, 91, 212, .42), inset 0 1px 0 rgba(255, 255, 255, .25); -webkit-tap-highlight-color: transparent; }
  .mnav-new .ico .ic-o, .mnav-new .nav-ico { fill: #fff; color: #fff; } .mnav-new .ico .ic-d { fill: #fff; opacity: .3; }
  .mnav-new:active { transform: scale(.95); }
  .side.open { z-index: 40; }
  .side { background: var(--panel); -webkit-backdrop-filter: none; backdrop-filter: none; width: min(300px, 84vw); padding-bottom: env(safe-area-inset-bottom); }
  .side-scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(15, 23, 42, .34); animation: sheet-fade .16s ease-out; }
  .toast { bottom: calc(var(--mnav-h) + 14px); }
  .menu-btn { display: none !important; }
  .mobile-bar { min-height: 52px; } .mobile-bar b { font-size: 18px; letter-spacing: -.2px; color: var(--navy); }
  /* message list */
  .list > .mobile-bar { display: none; }
  .m-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 10px; }
  .m-mbx { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px; border-radius: 14px; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
  .m-mbx:active { background: rgba(15, 23, 42, .05); }
  .m-mbx-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; color: #fff; background: linear-gradient(135deg, #4c5bd4, #7c3aed); box-shadow: 0 6px 16px rgba(76, 91, 212, .35); }
  .m-mbx-ico .nav-ico { color: #fff; } .m-mbx-ico .ico .ic-d { fill: #fff; opacity: .3; }
  .m-mbx .mbx-tile { border-radius: 10px; }
  .m-mbx-t { min-width: 0; display: flex; flex-direction: column; }
  .m-mbx-t b { font-size: 24px; line-height: 1.15; letter-spacing: -.4px; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-mbx-t small { color: var(--muted); font-size: 12.5px; }
  .m-caret { transform: rotate(90deg); color: var(--muted); display: flex; }
  .m-head .icon-btn { width: 38px; height: 38px; border-radius: 12px; }
  .list-head .icon-btn { display: none; }
  .list-head { margin: 0 12px; border-radius: 14px !important; border: 1px solid var(--glass-rim) !important; }
  .list-head input { height: 38px; font-size: 15px; }
  .list-body { margin: 8px 0 0; border-radius: 0 !important; border-left: 0; border-right: 0; }
  .item { grid-template-columns: 44px 1fr auto; gap: 10px; padding: 12px 14px; align-items: center; }
  .who-ava .ava { display: inline-grid; width: 42px; height: 42px; font-size: 15px; }
  .who-ava .mbx-tile { position: absolute; right: -3px; bottom: -3px; box-shadow: 0 0 0 2px var(--panel); border-radius: 5px; }
  .item.unread .who::before { display: none; }
  .item.unread .who-ava::after { content: ''; position: absolute; left: -3px; top: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 2px var(--panel); }
  .item .who { font-size: 15px; } .item .subj { font-size: 14px; } .item .snip { font-size: 13px; }
  .item.active { box-shadow: none; }
  /* reader: back + subject on top, the actions at the bottom (More = an Office-style menu) */
  .reader-head .tools { display: none; }
  .reader-head { padding: 12px 16px; }
  .reader-head h2 { font-size: 20px; letter-spacing: -.3px; }
  .reader > .mobile-bar { position: sticky; top: 0; z-index: 3; }
  .mailmsg { margin: 10px 10px; border-radius: 16px; }
  .mailmsg .mhead { padding: 12px 14px; }
  .mailmsg .mhead .meta[style] { display: none; }
  .m-actions { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 18; height: var(--mnav-h); justify-content: space-around; align-items: flex-start;
    padding: 6px max(6px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--panel) 96%, transparent); -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5); border-top: 1px solid var(--glass-edge, var(--line)); }
  .shell:not([data-pane=reader]) .m-actions { display: none; }
  .m-actions button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 50px; padding: 4px 2px; border: 0; background: none; color: var(--ink); font: 600 10.5px/1.2 var(--font-ui); cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .m-actions button:active { color: var(--indigo); }
  .m-more { height: 20px; display: grid; place-items: center; font-size: 15px; letter-spacing: 1px; }
  /* notes: the editor in place of the list */
  .notes-cols.editing .notes-list { display: none; }
  .notes-cols.editing .note-edit { display: flex; }
  .note-back { display: inline-grid; }
}

/* ═════════ calendar: a month of glass, the day's agenda beside it, and the event window ═════════ */
.cal-head h1 { font-size: 26px; letter-spacing: -.5px; }
.cal-head h1 small { font-size: 18px; color: var(--muted); font-weight: 500; }
.cal-nav button { min-width: 34px; justify-content: center; font-size: 15px; }
.cal-add { background: linear-gradient(135deg, #4c5bd4, #7c3aed) !important; }
.cal-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 14px; padding: 4px 20px 20px; align-items: start; }
.cal .cal-grid { margin: 0; gap: 0; border: 1px solid var(--glass-rim, var(--line)); border-radius: 16px; overflow: hidden; background: var(--glass-strong, var(--panel));
  box-shadow: 0 10px 30px rgba(30, 41, 59, .08); }
.cal .cal-dow { background: transparent; border-bottom: 1px solid var(--glass-edge, var(--line)); padding: 9px 6px; letter-spacing: .04em; }
.cal .cal-day { background: transparent; border-right: 1px solid var(--glass-edge, var(--line)); border-bottom: 1px solid var(--glass-edge, var(--line)); min-height: 104px; padding: 5px 6px; position: relative; transition: background .12s; }
.cal .cal-day:nth-child(7n) { border-right: 0; }
.cal .cal-day.wkend { background: rgba(15, 23, 42, .022); }
[data-theme=dark] .cal .cal-day.wkend { background: rgba(255, 255, 255, .02); }
.cal .cal-day:hover { background: color-mix(in srgb, var(--indigo) 5%, transparent); }
.cal .cal-day.sel { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--indigo) 70%, transparent); background: color-mix(in srgb, var(--indigo) 6%, transparent); }
.cal .cal-day .num { width: 26px; height: 26px; line-height: 26px; border-radius: 50%; font-size: 12.5px; }
.cal .cal-day.today .num { background: linear-gradient(135deg, #4c5bd4, #7c3aed); color: #fff; box-shadow: 0 4px 12px rgba(76, 91, 212, .4); }
.cal-plus { position: absolute; right: 5px; top: 5px; width: 22px; height: 22px; border-radius: 7px; border: 0; background: color-mix(in srgb, var(--indigo) 12%, transparent); color: var(--indigo);
  font-weight: 700; cursor: pointer; opacity: 0; transition: opacity .12s; display: grid; place-items: center; line-height: 1; }
.cal-day:hover .cal-plus { opacity: 1; }
.cal .cal-ev { --ec: #5e5ce6; color: color-mix(in srgb, var(--ec) 78%, #000); background: color-mix(in srgb, var(--ec) 14%, var(--panel)); border-left: 3px solid var(--ec);
  border-radius: 6px; padding: 2px 6px; margin-top: 3px; font-size: 11.5px; cursor: pointer; }
/* an event: its title, and one line of its notes underneath */
.cal .cal-ev .cal-ev-t, .cal .cal-ev .cal-ev-n { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .cal-ev .cal-ev-n { font-size: 10.5px; opacity: .78; font-weight: 400; }
.agenda-note { color: var(--text-2, var(--muted)); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .cal-ev b { font-weight: 700; }
.cal .cal-ev.allday { background: var(--ec); color: #fff; border-left-color: transparent; font-weight: 600; }
[data-theme=dark] .cal .cal-ev { color: color-mix(in srgb, var(--ec) 45%, #fff); background: color-mix(in srgb, var(--ec) 24%, transparent); }
.cal-more { font-size: 11px; color: var(--muted); margin-top: 2px; padding-left: 4px; font-weight: 600; }
.cal-dots { display: none; }
.cal .agenda { margin: 0; border-radius: 16px; padding: 14px; background: var(--glass-strong, var(--panel)); border: 1px solid var(--glass-rim, var(--line)); box-shadow: 0 10px 30px rgba(30, 41, 59, .08); position: sticky; top: 8px; }
.agenda-day { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; margin-bottom: 6px; border-bottom: 1px solid var(--glass-edge, var(--line)); }
.agenda-day > div { flex: 1; display: flex; flex-direction: column; }
.agenda-day b { color: var(--navy); font-size: 15px; text-transform: capitalize; } .agenda-day small { color: var(--muted); font-size: 12px; }
.agenda-num { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 21px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #4c5bd4, #7c3aed); box-shadow: 0 6px 16px rgba(76, 91, 212, .35); }
.cal .agenda-row { --ec: #5e5ce6; display: flex; gap: 10px; align-items: stretch; padding: 6px 0; border: 0; cursor: pointer; }
.agenda-time { width: 46px; flex: none; display: flex; flex-direction: column; font-size: 12.5px; padding-top: 6px; } .agenda-time b { color: var(--navy); } .agenda-time small { color: var(--muted); font-size: 11.5px; }
.agenda-card { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; border-left: 3px solid var(--ec); background: color-mix(in srgb, var(--ec) 10%, var(--panel)); }
.agenda-card b { color: var(--ink); font-size: 13.5px; } .agenda-card small { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.agenda-card small svg { width: 13px; height: 13px; }
.agenda-row:hover .agenda-card { background: color-mix(in srgb, var(--ec) 16%, var(--panel)); }
.agenda-empty { text-align: center; padding: 18px 6px 8px; }
/* the right column: the day's agenda, then the calendars (names and colours) */
.cal-side { display: grid; gap: 14px; position: sticky; top: 8px; align-content: start; }
.cal-side .agenda { position: static; }
.calc { border-radius: 16px; padding: 12px 12px 10px; background: var(--glass-strong, var(--panel)); border: 1px solid var(--glass-rim, var(--line)); box-shadow: 0 10px 30px rgba(30, 41, 59, .08); }
.calc-head { display: flex; flex-direction: column; gap: 2px; padding: 0 4px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--glass-edge, var(--line)); }
.calc-head b { color: var(--navy); font-size: 14px; } .calc-head small { color: var(--muted); font-size: 11.5px; }
.calc-row { display: flex; align-items: center; gap: 9px; padding: 5px 4px; border-radius: 10px; }
.calc-row:hover { background: color-mix(in srgb, var(--indigo) 5%, transparent); }
.calc-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13.5px; color: var(--ink); cursor: text; overflow: hidden; }
.calc-name small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calc-act { width: 24px; height: 24px; flex: none; border: 0; border-radius: 7px; background: none; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .12s; }
.calc-row:hover .calc-act, .calc-act:focus-visible { opacity: 1; } .calc-act:hover { background: rgba(15, 23, 42, .07); color: var(--ink); }
.calc-act-gap { width: 24px; flex: none; }
.calc-input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--ink); font: 13.5px var(--font-ui); padding: 5px 9px; outline: none; }
.calc-input:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px color-mix(in srgb, var(--indigo) 16%, transparent); background: var(--panel); }
.ev-cal-add { border-style: dashed; color: var(--indigo); padding: 0 12px; }
/* a calendar's square: its colour with its emoji */
.cal-sq { --cc: #5e5ce6; --cs: 18px; width: var(--cs); height: var(--cs); flex: none; border-radius: calc(var(--cs) * .3); display: inline-grid; place-items: center;
  background: var(--cc); color: #fff; font-size: calc(var(--cs) * .62); line-height: 1; box-shadow: 0 2px 6px color-mix(in srgb, var(--cc) 40%, transparent), inset 0 1px 0 rgba(255, 255, 255, .3); }
.cal-sq.big { --cs: 40px; border-radius: 12px; }
.ev-cal-wrap { display: inline-flex; align-items: center; gap: 2px; }
.ev-cal-act { height: 28px; padding: 0 10px; border: 0; border-radius: 8px; background: color-mix(in srgb, var(--evc) 13%, transparent); color: color-mix(in srgb, var(--evc) 80%, #000);
  cursor: pointer; font: 600 12.5px var(--font-ui); margin-left: 4px; }
.ev-cal-act.del { background: rgba(229, 72, 106, .1); color: #e5486a; }
.ev-cal-act:hover { filter: brightness(.95); }
.calf { flex-basis: 100%; display: grid; gap: 8px; margin-top: 4px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); }
.calf-top { display: flex; align-items: center; gap: 10px; } .calf-top .ev-input { padding: 8px 10px; }
.calf-lbl { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.calf-row { display: flex; gap: 8px; flex-wrap: wrap; }
.calf-emoji { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.calf-e { width: 32px; height: 32px; border: 1px solid transparent; border-radius: 9px; background: var(--panel); font-size: 17px; cursor: pointer; display: grid; place-items: center; line-height: 1; }
.calf-e:hover { border-color: var(--line); }
.calf-e.on { border-color: var(--indigo); box-shadow: 0 0 0 3px color-mix(in srgb, var(--indigo) 18%, transparent); }
.calf-e.none { color: var(--muted); font-size: 14px; }
.calf-own { width: 72px; height: 32px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); font: 14px var(--font-ui); padding: 0 8px; }
.calf-foot { display: flex; gap: 6px; align-items: center; padding-top: 2px; }
.calc .calf { margin: 4px 0; }
.calc-row { cursor: pointer; }
.calc-add { width: 100%; margin-top: 6px; height: 34px; border: 1px dashed var(--line); border-radius: 10px; background: none; color: var(--indigo); font: 600 13px var(--font-ui); cursor: pointer; }
.calc-add:hover { background: color-mix(in srgb, var(--indigo) 6%, transparent); }
@media (max-width: 1100px) { .cal-wrap { grid-template-columns: 1fr; } .cal .agenda, .cal-side { position: static; } }
@media (max-width: 980px) {
  .cal-head { padding: 10px 14px 6px; } .cal-head h1 { font-size: 22px; } .cal-io { display: none; }
  .cal-wrap { padding: 4px 10px 16px; gap: 10px; }
  .cal .cal-day { min-height: 54px; padding: 4px 2px; text-align: center; }
  .calc-act { opacity: 1; }
  .cal .cal-ev, .cal-more, .cal-plus { display: none; }
  .cal-dots { display: flex; justify-content: center; gap: 3px; margin-top: 3px; } .cal-dots i { width: 6px; height: 6px; border-radius: 50%; }
}

/* the event window: centred, a third of the way down (grid rows 1 : auto : 2) */
.overlay.ev-overlay { display: grid; grid-template-rows: 1fr auto 2fr; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px; z-index: 45; animation: sheet-fade .14s ease-out; }
.ev-win { --evc: #4C5BD4; grid-row: 2; position: relative; width: min(560px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; border-radius: 20px; overflow: visible;
  background: var(--panel); box-shadow: 0 30px 80px rgba(16, 24, 40, .32), 0 0 0 1px rgba(15, 23, 42, .06); animation: ev-in .2s cubic-bezier(.2, .8, .2, 1); }
@keyframes ev-in { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.ev-band { display: flex; align-items: center; gap: 12px; padding: 16px 14px 16px 16px; border-radius: 20px 20px 0 0; color: #fff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--evc) 88%, #fff), var(--evc) 55%, color-mix(in srgb, var(--evc) 75%, #000)); }
.ev-badge { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: rgba(255, 255, 255, .22); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35); }
.ev-badge .ico, .ev-badge svg { color: #fff; }
.ev-title { flex: 1; min-width: 0; border: 0; background: transparent; color: #fff; font: 700 20px var(--font-ui); letter-spacing: -.3px; outline: none; padding: 4px 0; }
.ev-title::placeholder { color: rgba(255, 255, 255, .72); }
.ev-x { width: 32px; height: 32px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .18); color: #fff; cursor: pointer; font-size: 14px; flex: none; }
.ev-x:hover { background: rgba(255, 255, 255, .3); }
.ev-body { padding: 8px 16px 4px; overflow: auto; }
.ev-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--glass-edge, var(--line)); }
.ev-row:last-child { border-bottom: 0; }
.ev-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; color: var(--evc); background: color-mix(in srgb, var(--evc) 12%, var(--panel)); }
.ev-ico .ico .ic-d { fill: var(--evc); }
.ev-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--evc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--evc) 25%, transparent); }
.ev-when { flex: 1; display: grid; gap: 7px; }
.ev-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ev-lbl { width: 58px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ev-chip { height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: 600 14px var(--font-ui); cursor: pointer; text-transform: capitalize; }
.ev-chip:hover { border-color: var(--evc); }
.ev-chip.on { border-color: var(--evc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--evc) 20%, transparent); background: var(--panel); }
.ev-dur { font-size: 12px; color: var(--muted); margin-left: 2px; }
.ev-quick { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ev-allday { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-right: 6px; cursor: pointer; }
.ev-allday .k-switch:checked, .ev-win .k-switch:checked { background: var(--evc); }
.chip.on { background: color-mix(in srgb, var(--evc, var(--indigo)) 14%, var(--panel)); border-color: var(--evc, var(--indigo)); color: color-mix(in srgb, var(--evc, var(--indigo)) 80%, #000); font-weight: 600; }
[data-theme=dark] .chip.on { color: #fff; }
.ev-swatches { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 3px; }
.ev-sw { width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--sw); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); transition: transform .12s; }
.ev-sw.auto { background: conic-gradient(from 0deg, var(--sw) 0 50%, color-mix(in srgb, var(--sw) 45%, #fff) 50% 100%); }
.ev-sw:hover { transform: scale(1.1); }
.ev-sw.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--sw); }
.ev-cals, .ev-chips { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 2px; }
.ev-cal { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px 0 7px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: 500 13px var(--font-ui); cursor: pointer; }
.ev-cal.on { border-color: var(--evc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--evc) 18%, transparent); font-weight: 600; }
.ev-cal-p { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; font-size: 11px; color: #fff; background: linear-gradient(135deg, #f59e0b, #f0703c); }
.ev-input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: 14px var(--font-ui); padding: 7px 10px; outline: none; }
.ev-input:focus { border-color: var(--evc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--evc) 18%, transparent); background: var(--panel); }
.ev-notes { min-height: 64px; resize: vertical; }
.ev-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--glass-edge, var(--line)); }
.ev-save { background: var(--evc) !important; box-shadow: 0 6px 16px color-mix(in srgb, var(--evc) 40%, transparent) !important; min-width: 96px; justify-content: center; }
.ev-del { color: #dc2626 !important; }
.ev-pop { position: absolute; z-index: 5; width: 292px; border-radius: 16px; background: var(--panel); box-shadow: 0 24px 60px rgba(16, 24, 40, .3), 0 0 0 1px rgba(15, 23, 42, .08); animation: kpop .1s ease-out; overflow: hidden; }
/* our date picker */
.dp { --evc: #4C5BD4; padding: 12px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-head b { font-size: 14.5px; color: var(--navy); text-transform: capitalize; }
.dp-nav { width: 30px; height: 30px; border-radius: 9px; border: 0; background: var(--bg); color: var(--ink); font-size: 16px; cursor: pointer; }
.dp-nav:hover { background: color-mix(in srgb, var(--evc) 14%, var(--panel)); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 2px 0 4px; text-transform: uppercase; }
.dp-day { height: 34px; border: 0; border-radius: 10px; background: none; color: var(--ink); font: 500 13.5px var(--font-ui); cursor: pointer; }
.dp-day:hover { background: color-mix(in srgb, var(--evc) 12%, transparent); }
.dp-day.other { color: var(--muted); opacity: .55; }
.dp-day.today { box-shadow: inset 0 0 0 1.5px var(--evc); font-weight: 700; }
.dp-day.on { background: var(--evc); color: #fff; font-weight: 700; box-shadow: 0 4px 12px color-mix(in srgb, var(--evc) 45%, transparent); }
.dp-foot { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--glass-edge, var(--line)); }
/* our time picker */
.tp { display: flex; flex-direction: column; }
.tp-type { margin: 10px 10px 6px; height: 36px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--bg); color: var(--ink); font: 14px var(--font-ui); outline: none; }
.tp-type:focus { border-color: var(--evc, var(--indigo)); }
.tp-list { max-height: 252px; overflow: auto; padding: 4px 6px 8px; position: relative; scroll-behavior: auto; }
.tp-opt { display: flex; width: 100%; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--ink); font: 500 14px var(--font-ui); cursor: pointer; text-align: left; }
.tp-opt small { color: var(--muted); font-size: 12px; }
.tp-opt:hover { background: color-mix(in srgb, var(--evc, var(--indigo)) 10%, transparent); }
.tp-opt.on { background: var(--evc, var(--indigo)); color: #fff; } .tp-opt.on small { color: rgba(255, 255, 255, .8); }
@media (max-width: 600px) {
  .overlay.ev-overlay { padding: 10px; grid-template-rows: 1fr auto 2fr; }
  .ev-win { border-radius: 18px; max-height: calc(100dvh - 20px); }
  .ev-pop { left: 8px !important; right: 8px; width: auto; }
  .ev-lbl { width: 48px; }
}
/* KiQ AI Agent › meeting times */
.agent-meet { display: grid; grid-template-columns: 120px 120px 1fr; gap: 10px; align-items: end; padding: 4px 0 6px; }
.day-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.day-chips .chip { text-transform: capitalize; margin: 0; }
@media (max-width: 600px) { .agent-meet { grid-template-columns: 1fr 1fr; } .agent-meet .field:last-child { grid-column: span 2; } }
.reader-head > div:first-child { flex: 1 1 240px; min-width: 0; }
.reader-acct { flex-wrap: wrap; row-gap: 4px; }
.cal .cal-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal .cal-ev { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-time { width: 64px; white-space: nowrap; }
a.cal-io { text-decoration: none; }

/* the installed app on a phone: the app is fixed to the screen, so the page has nothing to scroll and nothing slides under
   the status bar; the top bar, the drawer and full-screen windows keep clear of it (viewport-fit=cover). No overflow:hidden
   on html/body: on iPhone home-screen apps that shrinks the fixed layout by the status bar's height (bottom bar too high). */
html:has(.frame), html:has(.frame) body { overscroll-behavior: none; }
.frame { position: fixed; inset: 0; height: auto; }
.topbar { height: calc(var(--topbar-h) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top);
  padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
.k-menu.acct-menu { top: calc(54px + env(safe-area-inset-top)); }
@media (max-width: 980px) {
  .side { padding-top: env(safe-area-inset-top); }
  .overlay.ev-overlay { padding-top: max(10px, env(safe-area-inset-top)); }
}
@media (max-width: 600px) { .compose.compose-win { padding-top: env(safe-area-inset-top); } }

/* Add a mailbox: automatic server discovery (AccountForm) */
.autofind { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin: 0 0 14px; border-radius: 12px; background: var(--tint); color: var(--ink); font-size: 14px; }
.autofind-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--indigo); border-right-color: transparent; animation: autofind-spin .8s linear infinite; flex: none; }
@keyframes autofind-spin { to { transform: rotate(360deg); } }
.autofound { padding: 12px 14px; margin: 0 0 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 7%, var(--panel)); }
.autofound-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; color: var(--ok); }
.autofound-head b { color: var(--ink); }
.autofound-head .linkish { margin-left: auto; }
.autofound-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 13px; padding: 3px 0; }
.autofound-row > span:first-child { font-weight: 600; color: var(--muted); }
.autofound-row code { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.autofound-row > span:last-child { color: var(--muted); white-space: nowrap; }
.autofail { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin: 0 0 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 7%, var(--panel)); font-size: 13.5px; color: var(--ink); }
.autofail .ico { flex: none; margin-top: 1px; }
.linkish { background: none; border: 0; padding: 0; color: var(--indigo); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.linkish:hover { text-decoration: underline; }
@media (max-width: 600px) { .autofound-row { grid-template-columns: 44px minmax(0, 1fr); } .autofound-row > span:last-child { grid-column: 2; } }
.row3.row-srv { grid-template-columns: minmax(0, 1fr) 88px 132px; }
@media (max-width: 600px) { .row3.row-srv { grid-template-columns: 88px minmax(0, 1fr); } .row3.row-srv > .field:first-child { grid-column: 1 / -1; } }
/* contact photos instead of initials (Settings › Contact photos) */
.ava.ava-img { object-fit: cover; padding: 0; background: var(--line); box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08); }
/* attachments in Compose */
.catts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 4px; }
.catt { position: relative; display: inline-flex; align-items: center; gap: 6px; max-width: 280px; padding: 6px 6px 6px 10px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg); font-size: 13px; color: var(--ink); }
.catt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.catt-size { color: var(--muted); font-size: 12px; flex: none; }
.catt-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--indigo); transition: width .2s; }
.catt-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 6px; flex: none; font-size: 12px; }
.catt-x:hover { background: rgba(15, 23, 42, .07); color: var(--ink); }
.catt-total { font-size: 12px; color: var(--muted); }
.catt-total.over { color: #dc2626; font-weight: 600; }
.cfoot .cattach { margin-left: auto; }
.ceditor img.cpic { max-width: 100%; height: auto; border-radius: 6px; vertical-align: bottom; }
.ceditor img.cpic.up { opacity: .45; }
.compose-win { position: relative; }
.compose-win.dropping .cbody { opacity: .35; }
.cdrop { position: absolute; inset: 52px 12px 64px; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 8px; pointer-events: none;
  border: 2px dashed var(--indigo); border-radius: 16px; color: var(--indigo); font-weight: 600; background: color-mix(in srgb, var(--indigo) 6%, transparent); }
/* formatted text in Compose: the format bar (Apple Mail-like) and the editor */
.ftools { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 4px; margin: 10px 0 4px; border: 1px solid var(--line); border-radius: 11px;
  background: color-mix(in srgb, var(--bg) 70%, var(--panel)); overflow: visible; }
/* two parts (text menus + colour, then the buttons); each grows so every row is filled edge to edge — when the window is narrow
   the buttons drop to a second full row instead of leaving gaps, and nothing ever scrolls sideways */
.ft-row { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0; }
.ft-row-btns { flex-grow: 1.4; justify-content: space-between; }
.ft-sel { height: 28px; padding: 0 2px 0 6px; border: 0; border-radius: 7px; background-color: rgba(15, 23, 42, .045); color: var(--ink); font-size: 12px;
  cursor: pointer; flex: 1 1 74px; min-width: 60px; max-width: 190px; width: auto; }
[data-theme=dark] .ft-sel { background-color: rgba(255, 255, 255, .06); }
.ft-font { flex: 1.3 1 92px; }
.ft-sel:hover { background-color: rgba(15, 23, 42, .08); }
.ft-size { flex: .8 1 56px; min-width: 52px; }
.ft-group { display: flex; flex: var(--n, 1) 1 auto; padding: 1px; border-radius: 8px; background: rgba(15, 23, 42, .045); }
[data-theme=dark] .ft-group { background: rgba(255, 255, 255, .06); }
.ft-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--ink);
  font: 600 13px/1 Georgia, 'Times New Roman', serif; cursor: pointer; flex: none; }
.ft-group .ft-btn { flex: 1 1 26px; width: auto; min-width: 22px; }
.ft-btn svg { width: 15px; height: 15px; }
.ft-btn:hover { background: rgba(15, 23, 42, .07); }
.ft-btn.on { background: color-mix(in srgb, var(--indigo) 16%, transparent); color: var(--indigo); }
[data-theme=dark] .ft-btn:hover { background: rgba(255, 255, 255, .08); }
.ft-color-wrap { position: relative; flex: none; }
.ft-color span { width: 16px; height: 16px; border-radius: 50%; background: conic-gradient(#f43f5e, #f59e0b, #eab308, #22c55e, #06b6d4, #3b82f6, #8b5cf6, #ec4899, #f43f5e);
  box-shadow: inset 0 0 0 3px var(--panel); border: 1px solid var(--line); }
.ft-palette { position: fixed; z-index: 60; display: grid; grid-template-columns: repeat(6, 24px); gap: 6px; padding: 10px; margin-top: 6px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(15, 23, 42, .18); }
.ft-swatch { width: 24px; height: 24px; border-radius: 50%; border: 1px solid rgba(15, 23, 42, .18); cursor: pointer; padding: 0; }
.ft-swatch:hover { transform: scale(1.12); }
.ft-custom { position: relative; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px dashed var(--muted); color: var(--muted); cursor: pointer; font-weight: 700; }
.ft-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ceditor { min-height: 240px; padding: 12px 2px 46px; outline: none; font: 14px/1.55 Helvetica, Arial, sans-serif; color: var(--ink); overflow-wrap: anywhere; }
.ceditor:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.ceditor h1 { font-size: 24px; margin: .3em 0; } .ceditor h2 { font-size: 19px; margin: .3em 0; } .ceditor h3 { font-size: 16px; margin: .3em 0; }
.ceditor ul, .ceditor ol { padding-left: 26px; margin: .3em 0; }
.ceditor blockquote { margin: 0 0 0 26px; }
.cfwd { white-space: pre-wrap; font-size: 13px; color: var(--muted); border-left: 3px solid var(--line); padding: 4px 0 4px 12px; margin: 4px 0 8px; max-height: 260px; overflow: auto; }
/* replies the KiQ AI Agent prepared but nobody sent yet (Drafts) */
.kai-pending { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px 0 4px; border-radius: 999px; font-size: 11px; font-weight: 700;
  color: #b45309; background: color-mix(in srgb, #f59e0b 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, #f59e0b 40%, transparent); white-space: nowrap; }
.kai-pending img { border-radius: 3px; }
.kai-draft { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 16px 10px; padding: 10px 12px; border-radius: 12px;
  background: color-mix(in srgb, #f59e0b 10%, var(--panel)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #f59e0b 38%, transparent); }
.kai-draft-txt { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
.kai-draft-txt b { color: #92400e; font-size: 13.5px; } .kai-draft-txt small { color: var(--muted); font-size: 12px; }
[data-theme=dark] .kai-draft-txt b { color: #fbbf24; }
.mbody.editable { cursor: text; }
.mbody.editable:hover { outline: 1px dashed color-mix(in srgb, #f59e0b 55%, transparent); outline-offset: -4px; border-radius: 8px; }
