/* Mail Station: a Gmail-style window onto Hostinger mailboxes, branded for The Serviss Station.
   Themes: <html data-theme="dark|light|system">. Dark is the default; "system" follows the device. All colours are tokens. */

:root {
  --pink: #ff2d8e; --pink-ink: #c8166c; --purple: #a44bff; --cyan: #35dcf5; --yellow: #ffd23f;
  --bg: #f6f8fc; --panel: #ffffff; --ink: #1f1f1f; --ink-2: #444746; --ink-3: #5f6368; --line: #e3e6ea;
  --row-read: #f2f6fc; --row-hover-shadow: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  --hover: rgba(68,71,70,.08); --active: #fde0ee; --active-ink: #8a0f4a; --selected-row: #fbe3ef;
  --compose: #ffe1ef; --compose-ink: #6b0b3a; --chip: #eef0f3; --danger: #c5221f; --focus: #a44bff;
  --toast: #303030; --toast-ink: #f2f2f2; --shadow: 0 4px 8px 3px rgba(60,64,67,.15), 0 1px 3px rgba(60,64,67,.3);
  --search-bg: #e9eef6; --compose-head: #f2f6fc; --link: #c8166c; --btn-ink: #c8166c; --btn-on-ink: #ffffff; --toast-btn: #ff9ccb;
  --brand-glow: drop-shadow(0 4px 10px rgba(164,75,255,.25)); --box: #3c4043;
  --radius: 16px;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111015; --panel: #1c1b22; --ink: #ecebf2; --ink-2: #cfcdd8; --ink-3: #a19fae; --line: #2f2d38;
  --row-read: #17161c; --row-hover-shadow: 0 1px 3px rgba(0,0,0,.6); --hover: rgba(255,255,255,.07);
  --active: #4a1631; --active-ink: #ffc2df; --selected-row: #3a1427; --compose: #4a1631; --compose-ink: #ffd6e9;
  --chip: #2c2a35; --danger: #ff8a80; --toast: #e8e6ee; --toast-ink: #1c1b22; --shadow: 0 6px 24px rgba(0,0,0,.6);
  --search-bg: #26242e; --compose-head: #26242e; --link: #ff8cc4; --btn-ink: #ff8cc4; --btn-on-ink: #1c1b22; --toast-btn: #c8166c;
  --brand-glow: drop-shadow(0 6px 18px rgba(255,45,142,.35)); --box: #a19fae;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #111015; --panel: #1c1b22; --ink: #ecebf2; --ink-2: #cfcdd8; --ink-3: #a19fae; --line: #2f2d38;
    --row-read: #17161c; --row-hover-shadow: 0 1px 3px rgba(0,0,0,.6); --hover: rgba(255,255,255,.07);
    --active: #4a1631; --active-ink: #ffc2df; --selected-row: #3a1427; --compose: #4a1631; --compose-ink: #ffd6e9;
    --chip: #2c2a35; --danger: #ff8a80; --toast: #e8e6ee; --toast-ink: #1c1b22; --shadow: 0 6px 24px rgba(0,0,0,.6);
    --search-bg: #26242e; --compose-head: #26242e; --link: #ff8cc4; --btn-ink: #ff8cc4; --btn-on-ink: #1c1b22; --toast-btn: #c8166c;
    --brand-glow: drop-shadow(0 6px 18px rgba(255,45,142,.35)); --box: #a19fae;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--link); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg.i { width: 20px; height: 20px; fill: currentColor; flex: none; display: block; }

/* ------------------------------------------------------------------ sign in */

.login-page {
  min-height: 100%; color: #edf4ff; font-family: Inter, sans-serif;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(164,75,255,.35), transparent 60%),
    radial-gradient(800px 500px at 110% 110%, rgba(255,45,142,.28), transparent 60%),
    repeating-linear-gradient(0deg, rgba(53,220,245,.05) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(53,220,245,.05) 0 1px, transparent 1px 44px),
    #05040a;
}
:root[data-theme="light"] .login-page { color: #1f1430; background:
    radial-gradient(900px 500px at 15% -10%, rgba(164,75,255,.18), transparent 60%),
    radial-gradient(800px 500px at 110% 110%, rgba(255,45,142,.14), transparent 60%),
    repeating-linear-gradient(0deg, rgba(164,75,255,.05) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(164,75,255,.05) 0 1px, transparent 1px 44px), #f7f4fb; }
:root[data-theme="light"] .login-card { background: rgba(255,255,255,.92); border-color: rgba(164,75,255,.25); box-shadow: 0 10px 40px -18px rgba(164,75,255,.45); }
:root[data-theme="light"] .login-sub, :root[data-theme="light"] .field > span:first-child, :root[data-theme="light"] .login-security { color: #5b5470; }
:root[data-theme="light"] .field input { background: #fff; color: #1f1430; border-color: #d9d2e6; }
:root[data-theme="light"] .field input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(164,75,255,.18); }
:root[data-theme="light"] .pw-toggle, :root[data-theme="light"] .login-help a { color: #7a2bd6; }
:root[data-theme="light"] .login-help { color: #6d6782; }
:root[data-theme="light"] .login-notice { background: rgba(164,75,255,.08); border-color: rgba(164,75,255,.35); color: #3d2a66; }
:root[data-theme="light"] .login-error { color: #8a0f4a; background: rgba(255,45,142,.08); }
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; gap: 18px; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.login-app { font-family: "Saira Condensed", sans-serif; font-weight: 800; font-size: 26px; letter-spacing: .2em; text-transform: uppercase; color: #edf4ff; text-shadow: 0 0 22px rgba(53,220,245,.45); }
:root[data-theme="light"] .login-app { color: #3d2a66; text-shadow: none; }
.login-logo { width: min(340px, 82vw); height: auto; filter: drop-shadow(0 10px 30px rgba(255,45,142,.35)); }
.login-card {
  width: min(420px, 100%); background: rgba(14,9,36,.82); border: 1px solid rgba(53,220,245,.28); border-radius: 18px;
  padding: 30px 28px 26px; box-shadow: 0 0 60px -20px rgba(255,45,142,.7), inset 0 1px 0 rgba(255,255,255,.06); backdrop-filter: blur(6px);
}
.login-card h1 { font-family: "Saira Condensed", sans-serif; font-weight: 800; font-size: 30px; letter-spacing: .02em; margin: 0; text-transform: uppercase; }
.login-sub { margin: 4px 0 22px; color: #c3cbda; }
.field { display: block; margin-bottom: 16px; }
.field > span:first-child { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #c3cbda; }
.field input {
  width: 100%; padding: 13px 14px; border-radius: 10px; border: 1px solid rgba(195,203,218,.28); background: rgba(5,4,10,.6); color: #fff; font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(53,220,245,.22); }
.pw { position: relative; display: block; }
.pw input { padding-right: 70px; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); padding: 6px 10px; border-radius: 8px; color: var(--cyan); font-weight: 600; font-size: 13px; }
.pw-toggle:hover { background: rgba(53,220,245,.12); }
.check { display: flex; align-items: center; gap: 10px; color: #c3cbda; margin: 4px 0 18px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--pink); }
.login-notice { background: rgba(53,220,245,.1); border: 1px solid rgba(53,220,245,.45); color: #d8f7fd; padding: 10px 12px; border-radius: 10px; margin: -8px 0 18px; line-height: 1.45; }
.login-security { color: #98a2b6; font-size: 12.5px; line-height: 1.45; margin: 0 0 16px; }
.login-error { background: rgba(255,45,142,.14); border: 1px solid rgba(255,45,142,.5); color: #ffd1e6; padding: 10px 12px; border-radius: 10px; margin: 0 0 14px; }
.login-btn {
  width: 100%; padding: 14px; border-radius: 10px; color: #05040a; font-family: "Saira Condensed", sans-serif; font-weight: 800; font-size: 19px; letter-spacing: .08em; text-transform: uppercase;
  background: linear-gradient(180deg, #ff7ab8, #ff2d8e); border: 1px solid #ffb1d5; box-shadow: 0 0 28px -6px rgba(255,45,142,.9); transition: transform .1s, filter .15s;
}
.login-btn:hover { filter: brightness(1.07); }
.login-btn:active { transform: translateY(1px); }
.login-btn[disabled] { opacity: .7; cursor: progress; }
.login-help { max-width: 420px; text-align: center; color: #98a2b6; font-size: 13px; line-height: 1.5; margin: 0; }
.login-help a { color: var(--cyan); }

/* ------------------------------------------------------------------ app frame */

.app { height: 100vh; height: 100dvh; overflow: hidden; }
/* sidebar (logo, Compose, folders) runs full height on the left; the top bar and mail sit to its right */
.shell { display: flex; height: 100%; position: relative; }
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 4px; height: 64px; flex: none; }
.mobile-brand { display: none; }
.mobile-brand img { width: 36px; height: 36px; border-radius: 8px; display: block; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); flex: none; position: relative; }
.icon-btn:hover { background: var(--hover); }
.icon-btn.small { width: 32px; height: 32px; }
.icon-btn.small svg.i { width: 18px; height: 18px; }
.icon-btn[disabled] { opacity: .38; cursor: default; background: none; }
.search { flex: 1; min-width: 0; max-width: 720px; display: flex; align-items: center; background: var(--search-bg); border-radius: 28px; height: 48px; padding: 0 4px; transition: background .15s, box-shadow .15s; }
.search:focus-within { background: var(--panel); box-shadow: var(--shadow); }
.search input { flex: 1; border: 0; background: none; height: 100%; font-size: 16px; outline: none; min-width: 0; }
.search input::-webkit-search-cancel-button { display: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.avatar-btn { width: 40px; height: 40px; border-radius: 50%; padding: 4px; }
.avatar-btn:hover { background: var(--hover); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 15px; flex: none; user-select: none; }
.avatar.big { width: 72px; height: 72px; font-size: 32px; }
.account { position: relative; }
.popover { position: absolute; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); z-index: 50; }
.account-menu { right: 0; top: 48px; width: 320px; padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.account-name { font-size: 18px; font-weight: 600; margin-top: 8px; }
.account-email { color: var(--ink-3); margin-bottom: 14px; word-break: break-all; }
.account-help { font-size: 12px; color: var(--ink-3); margin: 14px 0 0; }
.pill-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); padding: 9px 18px; border-radius: 20px; font-weight: 500; }
.pill-btn:hover { background: var(--hover); }
.pill-btn svg.i { width: 18px; height: 18px; }

.sidebar { width: 256px; flex: none; overflow-y: auto; padding: 0 12px 16px 0; display: flex; flex-direction: column; }
.sidebar > ul { flex: none; }
.side-brand { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 4px 10px 16px; text-decoration: none; color: var(--ink-2); }
.side-logo { width: 200px; height: auto; filter: var(--brand-glow); }
.side-icon { display: none; width: 40px; height: 40px; border-radius: 10px; }
.side-name { font-family: "Saira Condensed", sans-serif; font-size: 22px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.compose-btn {
  display: inline-flex; align-items: center; gap: 12px; margin: 4px 0 14px 8px; height: 56px; padding: 0 22px 0 18px; border-radius: 16px;
  background: var(--compose); color: var(--compose-ink); font-weight: 600; font-size: 15px; transition: box-shadow .15s;
}
.compose-btn:hover { box-shadow: var(--row-hover-shadow); }
.compose-btn.fab { display: none; }
.folder-list { list-style: none; margin: 0; padding: 0; }
.folder {
  display: flex; align-items: center; gap: 14px; height: 32px; padding: 0 8px 0 24px; border-radius: 0 16px 16px 0; color: var(--ink); cursor: pointer;
  text-decoration: none; user-select: none; position: relative;
}
.folder:hover { background: var(--hover); }
.folder.active { background: var(--active); color: var(--active-ink); font-weight: 700; }
.folder.drop { background: var(--active); outline: 2px dashed var(--pink); outline-offset: -2px; }
.folder .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder .count { font-size: 12px; font-weight: 700; }
.folder.has-unread .label { font-weight: 700; }
.folder svg.i { width: 20px; height: 20px; }
.folder .more { visibility: hidden; margin-right: -4px; }
.folder:hover .more, .folder .more[aria-expanded="true"] { visibility: visible; }
.folder:hover .count:has(+ .more) { display: none; }
.folders-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 4px 4px 24px; font-size: 15px; font-weight: 500; color: var(--ink-2); }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }

.main { flex: 1; min-width: 0; min-height: 0; background: var(--panel); border-radius: var(--radius); margin: 0 16px 16px 0; display: flex; flex-direction: column; overflow: hidden; }
.list-view, .message-view { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.toolbar { display: flex; align-items: center; gap: 2px; min-height: 48px; padding: 4px 8px 4px 12px; border-bottom: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar .range { color: var(--ink-3); font-size: 12px; padding: 0 8px; white-space: nowrap; }
.toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.toolbar .view-title { font-weight: 600; padding: 0 8px; }
.cb { width: 18px; height: 18px; cursor: pointer; margin: 11px; flex: none; }
/* Checkboxes and radio buttons are drawn here (not the browser's faint default) so they stand out in both themes */
.cb, .check-row input[type=checkbox], .choice input[type=radio] {
  appearance: none; -webkit-appearance: none; width: 18px; height: 18px; flex: none; display: inline-grid; place-content: center;
  border: 2px solid var(--box); border-radius: 3px; background: var(--panel); cursor: pointer; transition: border-color .1s, background .1s;
}
.choice input[type=radio] { border-radius: 50%; }
.cb:hover, .check-row input[type=checkbox]:hover, .choice input[type=radio]:hover { border-color: var(--pink); box-shadow: 0 0 0 4px var(--hover); }
.cb:checked, .check-row input[type=checkbox]:checked { background: var(--pink); border-color: var(--pink); }
.cb:checked::after, .check-row input[type=checkbox]:checked::after { content: ""; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.cb:indeterminate { background: var(--pink); border-color: var(--pink); }
.cb:indeterminate::after { content: ""; width: 9px; height: 2px; background: #fff; }
.choice input[type=radio]:checked { border-color: var(--pink); }
.choice input[type=radio]:checked::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--pink); }
.banner { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 16px; background: var(--row-read); color: var(--ink-2); font-size: 13px; border-bottom: 1px solid var(--line); flex-wrap: wrap; text-align: center; }
.link-btn { color: var(--link); font-weight: 600; padding: 4px 6px; border-radius: 6px; }
.link-btn:hover { background: var(--hover); }

/* ------------------------------------------------------------------ message list */

.list { overflow-y: auto; flex: 1; }
.row {
  display: grid; grid-template-columns: auto auto minmax(120px, 200px) 1fr auto; align-items: center; height: 40px; padding-right: 16px;
  border-bottom: 1px solid var(--line); background: var(--row-read); cursor: pointer; position: relative;
}
.row.unread { background: var(--panel); }
.row.unread .who, .row.unread .subject, .row.unread .date { font-weight: 700; color: var(--ink); }
.row:hover { box-shadow: var(--row-hover-shadow); z-index: 1; }
.row.selected { background: var(--selected-row); }
.row .star { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--ink-3); margin-left: -6px; }
.row .star:hover { background: var(--hover); }
.row .star.on, .msg-star.on { color: #f4b400; }
.row .who { padding: 0 12px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.row .who .draft-tag, .draft-tag { color: var(--danger); }
.row .text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-3); min-width: 0; display: flex; align-items: center; gap: 6px; }
.row .subject { color: var(--ink-2); }
.row .snippet { overflow: hidden; text-overflow: ellipsis; }
.row .date { font-size: 12px; color: var(--ink-3); padding-left: 12px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.row .date svg.i { width: 16px; height: 16px; }
.chip { display: inline-block; background: var(--chip); color: var(--ink-2); border-radius: 4px; padding: 0 6px; font-size: 12px; line-height: 20px; white-space: nowrap; font-weight: 500; }
.row .hover-actions { display: none; position: absolute; right: 8px; top: 0; bottom: 0; align-items: center; background: inherit; padding-left: 8px; }
.row:hover .hover-actions { display: flex; }
.row:hover .date { visibility: hidden; }
.empty { text-align: center; padding: 64px 24px; color: var(--ink-3); }
.empty strong { display: block; font-size: 18px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.loading-bar { height: 3px; background: linear-gradient(90deg, var(--pink), var(--purple), var(--cyan)); background-size: 200% 100%; animation: slide 1s linear infinite; }
@keyframes slide { from { background-position: 200% 0; } to { background-position: 0 0; } }
.spin svg.i { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* compact list spacing (setting) */
.compact .row { height: 32px; }
.compact .row .star { width: 28px; height: 28px; }
.compact .cb { margin: 7px 11px; }
.compact .folder { height: 28px; }

/* ------------------------------------------------------------------ reading */

.message-view .scroll { overflow-y: auto; flex: 1; padding: 8px 24px 32px 72px; }
.msg-subject { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 22px; font-weight: 400; margin: 16px 0 18px -16px; line-height: 1.3; word-break: break-word; }
.msg-head { display: grid; grid-template-columns: 40px 1fr auto; gap: 0 14px; margin-left: -56px; align-items: start; }
.msg-head .avatar { width: 40px; height: 40px; font-size: 18px; }
.msg-from { font-weight: 700; word-break: break-word; }
.msg-from .addr { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.msg-to { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.msg-to button { color: var(--ink-3); font-size: 12px; vertical-align: middle; border-radius: 4px; }
.msg-to button:hover { background: var(--hover); }
.msg-details { margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 12px; color: var(--ink-2); display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; word-break: break-word; }
.msg-details dt { color: var(--ink-3); text-align: right; }
.msg-details dd { margin: 0; }
.msg-meta { display: flex; align-items: center; gap: 2px; color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.msg-meta .when { margin-right: 6px; }
.msg-body { margin-top: 22px; }
.img-banner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); background: var(--row-read); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }
.msg-body iframe { width: 100%; border: 0; display: block; min-height: 60px; background: #fff; border-radius: 4px; }
.msg-text { white-space: pre-wrap; word-break: break-word; line-height: 1.5; font-size: 14px; }
.msg-text .quote { color: var(--ink-3); }
.atts { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 14px; }
.atts h3 { font-size: 14px; font-weight: 500; margin: 0 0 12px; }
.att-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.att { display: flex; align-items: center; gap: 10px; width: 220px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); }
.att:hover { background: var(--hover); }
.att .meta { min-width: 0; flex: 1; }
.att .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; font-size: 13px; }
.att .size { font-size: 12px; color: var(--ink-3); }
.att .ext { width: 36px; height: 36px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 10px; font-weight: 700; background: var(--purple); flex: none; text-transform: uppercase; }
.reply-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.reply-bar .pill-btn { padding: 9px 22px 9px 16px; color: var(--ink-2); }

/* ------------------------------------------------------------------ compose */

.compose {
  position: fixed; right: 24px; bottom: 0; width: 560px; max-width: calc(100vw - 32px); height: min(620px, calc(100vh - 80px)); z-index: 40;
  background: var(--panel); border-radius: 12px 12px 0 0; box-shadow: 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12), 0 5px 5px -3px rgba(0,0,0,.2);
  display: flex; flex-direction: column; overflow: hidden;
}
.compose.min { height: 44px; width: 300px; }
.compose.max { right: 50%; bottom: 50%; transform: translate(50%, 50%); width: min(1000px, calc(100vw - 64px)); height: calc(100vh - 96px); border-radius: 12px; }
.compose-head { display: flex; align-items: center; gap: 2px; background: var(--compose-head); padding: 0 6px 0 16px; height: 44px; flex: none; cursor: pointer; font-weight: 500; }
.compose-head .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-head .icon-btn { width: 30px; height: 30px; }
.compose-head svg.i { width: 18px; height: 18px; }
.compose-fields { padding: 0 16px; flex: none; }
.cf { display: flex; align-items: center; border-bottom: 1px solid var(--line); min-height: 40px; gap: 8px; }
.cf label { color: var(--ink-3); min-width: 30px; }
.cf input { flex: 1; border: 0; outline: none; background: none; padding: 8px 0; min-width: 0; font-size: 14px; }
.cf .cc-toggle { color: var(--ink-3); font-size: 13px; padding: 4px 6px; border-radius: 4px; }
.cf .cc-toggle:hover { background: var(--hover); color: var(--ink); }
.compose textarea { flex: 1; border: 0; outline: none; resize: none; padding: 12px 16px; font: 14px/1.5 Inter, Arial, sans-serif; background: none; min-height: 80px; }
.compose-atts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px; flex: none; max-height: 110px; overflow-y: auto; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--chip); border-radius: 16px; padding: 4px 4px 4px 12px; font-size: 13px; max-width: 100%; }
.att-chip .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; font-weight: 500; }
.att-chip .s { color: var(--ink-3); }
.att-chip button { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.att-chip button:hover { background: var(--hover); }
.att-chip svg.i { width: 16px; height: 16px; }
.compose-foot { display: flex; align-items: center; gap: 4px; padding: 10px 12px 12px 16px; flex: none; }
.send-btn { background: linear-gradient(180deg, #ff4fa0, var(--pink)); color: #fff; font-weight: 600; padding: 0 22px; height: 40px; border-radius: 20px; display: inline-flex; align-items: center; gap: 8px; margin-right: 8px; }
.send-btn:hover { box-shadow: 0 1px 3px rgba(255,45,142,.5); filter: brightness(1.05); }
.send-btn[disabled] { opacity: .6; }
.send-btn svg.i { width: 18px; height: 18px; }
.compose-foot .spacer { flex: 1; }
.compose.drag::after { content: "Drop files to attach"; position: absolute; inset: 44px 0 0; background: rgba(255,225,239,.92); color: var(--compose-ink); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; border: 2px dashed var(--pink); }

/* ------------------------------------------------------------------ menus, dialogs, toasts */

.menu { position: fixed; background: var(--panel); border-radius: 8px; box-shadow: var(--shadow); padding: 6px 0; z-index: 60; min-width: 200px; max-height: 60vh; overflow-y: auto; }
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 18px; text-align: left; white-space: nowrap; }
.menu button:hover, .menu button:focus-visible { background: var(--hover); outline: none; }
.menu button.danger { color: var(--danger); }
.menu .menu-label { font-size: 12px; color: var(--ink-3); padding: 6px 18px; }
.menu svg.i { width: 18px; height: 18px; color: var(--ink-3); }
.dialog { border: 0; border-radius: 24px; padding: 24px; width: min(420px, calc(100vw - 32px)); background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(0,0,0,.4); }
.dialog h2 { margin: 0 0 12px; font-size: 22px; font-weight: 400; }
.dialog p { color: var(--ink-2); line-height: 1.5; margin: 0 0 16px; }
.dialog input[type=text], .dialog select { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: none; font-size: 15px; margin-bottom: 12px; }
.dialog input[type=text]:focus, .dialog select:focus { outline: 2px solid var(--focus); border-color: transparent; }
.dialog select option { background: var(--panel); }
.dialog .dlg-label { display: block; font-size: 13px; color: var(--ink-3); margin: 4px 0 6px; }
.dialog .dlg-error { color: var(--danger); font-size: 13px; margin: -4px 0 12px; }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.btn { padding: 10px 20px; border-radius: 20px; font-weight: 600; color: var(--btn-ink); }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--pink); color: var(--btn-on-ink); }
.btn.primary:hover { filter: brightness(1.06); background: var(--pink); }
.btn.danger { background: var(--danger); color: var(--btn-on-ink); }
.toasts { position: fixed; left: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 70; pointer-events: none; }
.toast { background: var(--toast); color: var(--toast-ink); border-radius: 6px; padding: 12px 16px; min-width: 280px; max-width: min(560px, calc(100vw - 48px)); display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow); pointer-events: auto; animation: rise .18s ease-out; }
.toast.error { background: #b3261e; color: #fff; }
.toast .msg { flex: 1; line-height: 1.4; }
.toast button { color: var(--toast-btn); font-weight: 700; padding: 4px 8px; border-radius: 4px; text-transform: none; }
.toast.error button { color: #fff; text-decoration: underline; }
.toast button:hover { background: rgba(255,255,255,.1); }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

/* settings */
.dialog.wide { width: min(680px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow-y: auto; }
.settings h2 { margin-bottom: 4px; }
.settings section { border-top: 1px solid var(--line); padding: 14px 0 6px; }
.settings section:first-of-type { border-top: 0; }
.settings h3 { margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.set-row { display: grid; grid-template-columns: 170px 1fr; gap: 6px 16px; align-items: start; margin-bottom: 14px; }
.set-label { font-weight: 600; padding-top: 9px; }
.set-label small, .choice small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; margin-top: 3px; line-height: 1.4; }
.set-control select, .set-control input[type=text], .set-control textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 14px; }
.set-control textarea { resize: vertical; min-height: 80px; font-family: inherit; line-height: 1.45; }
.set-control select:focus, .set-control input:focus, .set-control textarea:focus { outline: 2px solid var(--focus); border-color: transparent; }
.choices { display: flex; gap: 8px; flex-wrap: wrap; }
.choice { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; cursor: pointer; flex: 1 1 140px; }
.choice:has(input:checked) { border-color: var(--pink); background: var(--active); color: var(--active-ink); }
.choice input, .check-row input { margin-top: 2px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding-top: 8px; cursor: pointer; line-height: 1.4; }
@media (max-width: 600px) { .set-row { grid-template-columns: 1fr; } .set-label { padding-top: 0; } }

/* first sign-in: welcome + quick setup */
.onboard-overlay { position: fixed; inset: 0; z-index: 95; background: rgba(5,4,10,.62); display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(3px); }
.onboard { background: var(--panel); color: var(--ink); border-radius: 24px; padding: 28px; width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; box-shadow: 0 20px 60px -20px rgba(255,45,142,.55), var(--shadow); animation: rise .2s ease-out; }
.onboard h2 { margin: 0 0 10px; font-size: 24px; font-weight: 600; }
.onboard p { color: var(--ink-2); line-height: 1.55; margin: 0 0 12px; }
.onboard .actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.onboard .actions .spacer { flex: 1; }
.ob-brand { display: flex; flex-direction: column; align-items: center; margin: -6px 0 14px; }
.ob-brand img { width: min(260px, 70%); height: auto; filter: var(--brand-glow); }
.ob-app { font-family: "Saira Condensed", sans-serif; font-weight: 800; font-size: 22px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); }
.ob-field { display: block; margin: 14px 0 6px; }
.ob-field small { display: block; color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.onboard input[type=text], .onboard textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font: inherit; font-size: 15px; }
.onboard textarea { resize: vertical; line-height: 1.45; }
.onboard input:focus, .onboard textarea:focus { outline: 2px solid var(--focus); border-color: transparent; }
.ob-note { font-size: 13.5px; background: var(--row-read); border-radius: 10px; padding: 10px 12px; }
.ob-dots { display: flex; justify-content: center; gap: 6px; margin-top: 18px; }
.ob-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.ob-dots span.on { background: var(--pink); width: 22px; border-radius: 4px; }

/* guided tour */
.tour-layer { position: fixed; inset: 0; z-index: 100; }
.tour-layer.no-hole { background: rgba(5,4,10,.62); }
.tour-hole { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(5,4,10,.62), 0 0 0 3px var(--pink); pointer-events: none; transition: all .2s ease; }
.tour-card { position: fixed; background: var(--panel); color: var(--ink); border-radius: 16px; padding: 16px 18px 12px; box-shadow: var(--shadow); }
.tour-card h3 { margin: 2px 0 6px; font-size: 17px; }
.tour-card p { margin: 0; color: var(--ink-2); line-height: 1.5; font-size: 14px; }
.tour-card .actions { display: flex; align-items: center; gap: 4px; margin-top: 12px; }
.tour-card .actions .spacer { flex: 1; }
.tour-card .btn { padding: 8px 14px; }
.tour-step { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--link); }
.pill-btn.subtle { border-color: transparent; color: var(--ink-2); }

/* add to home screen / bookmarks */
.add-invite { width: min(420px, 100%); background: rgba(53,220,245,.08); border: 1px solid rgba(53,220,245,.45); border-radius: 18px; padding: 18px 20px; text-align: center; }
.add-invite h2 { margin: 0 0 6px; font-family: "Saira Condensed", sans-serif; font-size: 22px; letter-spacing: .04em; text-transform: uppercase; }
.add-invite p { margin: 0 0 14px; color: #c3cbda; line-height: 1.5; }
.add-btn { background: linear-gradient(180deg, #7ff0ff, #35dcf5); border-color: #b9f6ff; box-shadow: 0 0 24px -8px rgba(53,220,245,.9); font-size: 17px; }
.add-link { color: var(--cyan); font-weight: 600; font-size: 13.5px; padding: 6px 10px; border-radius: 8px; text-decoration: underline; text-underline-offset: 3px; }
.add-link:hover { background: rgba(53,220,245,.1); }
:root[data-theme="light"] .add-invite { background: rgba(164,75,255,.06); border-color: rgba(164,75,255,.35); }
:root[data-theme="light"] .add-invite p { color: #5b5470; }
:root[data-theme="light"] .add-link { color: #7a2bd6; }
.ob-wide { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; margin: 4px 0 14px; font-size: 15px; }
.ob-wide svg.i { width: 18px; height: 18px; }
.add-steps { margin: 0 0 4px; padding-left: 22px; color: var(--ink-2); line-height: 1.55; }
.add-steps li { margin-bottom: 8px; padding-left: 4px; }
div.add-steps { padding-left: 0; }
.add-help { z-index: 150; }

/* signing out */
.leaving-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(5,4,10,.55); display: flex; align-items: center; justify-content: center; animation: rise .12s ease-out; }
.leaving-box { display: flex; align-items: center; gap: 12px; background: var(--panel); color: var(--ink); padding: 16px 22px; border-radius: 14px; box-shadow: var(--shadow); font-weight: 600; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--pink); animation: spin .7s linear infinite; }

/* inactivity warning */
.idle-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.idle-box { background: var(--panel); color: var(--ink); border-radius: 24px; padding: 24px; width: min(420px, 100%); box-shadow: var(--shadow); }
.idle-box h2 { margin: 0 0 10px; font-size: 22px; font-weight: 500; }
.idle-box p { margin: 0 0 18px; color: var(--ink-2); line-height: 1.5; }
.idle-box strong { color: var(--pink-ink); font-variant-numeric: tabular-nums; }
.idle-box .actions { display: flex; justify-content: flex-end; gap: 8px; }

/* collapsed sidebar (menu button on wide screens) */
@media (min-width: 901px) {
  .rail .sidebar { width: 76px; padding-right: 8px; }
  .rail .folder { padding-left: 26px !important; border-radius: 16px; margin-left: 8px; }
  .rail .folder .label, .rail .folder .count, .rail .folder .more, .rail .folders-head span, .rail .compose-btn span:last-child { display: none; }
  .rail .folders-head { padding-left: 18px; }
  .rail .compose-btn { padding: 0 16px; }
  .rail .side-logo, .rail .side-name { display: none; }
  .rail .side-icon { display: block; }
  .rail .side-brand { padding: 12px 0 10px 18px; align-items: flex-start; }
}

/* ------------------------------------------------------------------ small screens */

@media (max-width: 900px) {
  .mobile-brand { display: block; }
  .topbar { padding-left: 4px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 35; background: var(--bg); padding-top: 12px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); width: 280px; }
  .sidebar.open { transform: none; }
  .main { margin: 0; border-radius: 16px 16px 0 0; }
  .compose-btn.fab { display: inline-flex; position: fixed; right: 16px; bottom: 16px; z-index: 30; box-shadow: var(--shadow); margin: 0; }
  .compose-btn.fab.hide { display: none; }
  .row { grid-template-columns: auto auto 1fr auto; grid-template-rows: auto auto; height: auto; padding: 8px 12px 8px 0; row-gap: 2px; }
  .row .who { grid-column: 3; grid-row: 1; padding-left: 4px; }
  .row .date { grid-column: 4; grid-row: 1; }
  .row .text { grid-column: 3 / 5; grid-row: 2; padding-left: 4px; white-space: normal; display: block; }
  .row .text .subject { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .row .text .sep-dash { display: none; }
  .row .text .snippet { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .row .cb, .row .star { grid-row: 1 / 3; }
  .row:hover .hover-actions { display: none; }
  .row:hover .date { visibility: visible; }
  .message-view .scroll { padding: 8px 16px 32px; }
  .msg-subject { margin-left: 0; font-size: 20px; }
  .msg-head { margin-left: 0; grid-template-columns: 40px 1fr; }
  .msg-meta { grid-column: 2; margin-top: 4px; }
}
@media (max-width: 600px) {
  .topbar { padding: 8px; gap: 4px; height: 60px; }
  .mobile-brand img { width: 32px; height: 32px; }
  .search input { font-size: 15px; }
  .search .icon-btn { width: 34px; }
  .search { height: 44px; }
  #refresh-top { display: none; }
  .toolbar .hide-sm { display: none; }
  .compose, .compose.max { inset: 0; width: 100%; max-width: none; height: 100%; border-radius: 0; transform: none; }
  .compose.min { inset: auto 0 0 auto; width: 240px; height: 44px; border-radius: 12px 0 0 0; }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .toast { min-width: 0; }
  .att { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
