/* Countathon Mail - brand: deep navy #072f42 */
:root {
	--navy: #072f42;
	--navy-2: #0d4560;
	--accent: #137ca8;
	--accent-soft: #e5f2f8;
	--bg: #f2f5f7;
	--panel: #ffffff;
	--line: #dde5ea;
	--text: #15262f;
	--muted: #667985;
	--danger: #b42318;
	--ok: #1a7f37;
	--radius: 10px;
	--shadow: 0 1px 2px rgba(7, 47, 66, .08), 0 8px 24px rgba(7, 47, 66, .10);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
	font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--text); background: var(--bg); -webkit-text-size-adjust: 100%;
}
body.modal-open { overflow: hidden; }
#ctn-mail-root { height: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.grow { flex: 1 1 auto; }
.muted { color: var(--muted); margin: 0 0 12px; }
:focus-visible { outline: 3px solid rgba(19, 124, 168, .45); outline-offset: 1px; border-radius: 6px; }

.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ic.mini { width: 14px; height: 14px; color: var(--muted); }
.ic.starred { color: #d99a00; fill: #f5b800; }
.ic.big { width: 46px; height: 46px; color: #b7c6cf; stroke-width: 1.4; }

/* ---- buttons ---- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px;
	border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-weight: 600; font-size: 14px;
	transition: background .12s, border-color .12s, box-shadow .12s; white-space: nowrap;
}
.btn:hover { background: #f5f8fa; border-color: #cbd7de; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: #eef3f6; }
.btn.danger { color: var(--danger); }
.btn.on .ic { color: #d99a00; fill: #f5b800; }
.btn.block { width: 100%; min-height: 46px; font-size: 16px; }
.icon-btn {
	display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 0; border-radius: 8px;
	background: transparent; cursor: pointer; color: inherit; flex: none;
}
.icon-btn:hover { background: rgba(127, 150, 163, .16); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* ---- spinner ---- */
.spinner { width: 20px; height: 20px; border: 3px solid #cfdbe2; border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot { height: 100%; display: grid; place-items: center; }

/* ---- sign in ---- */
.login-wrap {
	min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px 16px;
	background: radial-gradient(1200px 600px at 50% -10%, #1a5f80 0%, var(--navy) 55%, #041f2c 100%);
}
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 30px 28px 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.login-logo { display: block; margin: 0 auto 10px; height: auto; }
.login-card h1 { margin: 0; text-align: center; font-size: 22px; color: var(--navy); }
.login-card .sub { margin: 6px 0 20px; text-align: center; color: var(--muted); }
.login-form label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 13px; color: #324a57; }
.login-form input {
	width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #c6d3db; border-radius: 9px; font-size: 16px; background: #fff;
}
.login-form input:focus { border-color: var(--accent); outline: 3px solid rgba(19, 124, 168, .25); }
.pw { position: relative; }
.pw input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 4px; top: 4px; width: 38px; height: 38px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.pw-toggle.on { color: var(--accent); }
.login-error { margin: 14px 0 0; padding: 10px 12px; background: #fdecea; color: #8a1c12; border-radius: 8px; font-size: 14px; }
.login-form .btn { margin-top: 18px; }
.login-card .fine { margin: 18px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.5; }
.login-card .help { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13.5px; text-align: center; white-space: pre-line; }
.login-foot { color: rgba(255, 255, 255, .6); font-size: 12.5px; }

/* ---- app shell ---- */
.app { height: 100%; height: 100dvh; display: flex; flex-direction: column; position: relative; }
.top {
	display: flex; align-items: center; gap: 10px; background: var(--navy); color: #fff; min-height: 56px;
	padding: env(safe-area-inset-top) 12px 0 10px; flex: none;
}
.top-logo { height: 30px; width: auto; display: block; }
.top-brand { font-weight: 700; letter-spacing: .2px; font-size: 16px; }
.menu-btn { display: none; color: #fff; }
.top .icon-btn { color: #fff; }
.user-chip { display: flex; align-items: center; gap: 8px; border: 0; background: rgba(255, 255, 255, .1); color: #fff; border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; max-width: 46vw; }
.user-chip:hover { background: rgba(255, 255, 255, .18); }
.user-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }

.cols { flex: 1; min-height: 0; display: grid; grid-template-columns: 228px 380px minmax(0, 1fr); }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; overflow-y: auto; }
.compose-btn { width: 100%; margin-bottom: 14px; min-height: 44px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
	display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 0 12px; border: 0; background: transparent;
	border-radius: 8px; cursor: pointer; text-align: left; color: #2b4350;
}
.nav-item:hover { background: #eef3f6; }
.nav-item.on { background: var(--accent-soft); color: var(--navy); font-weight: 700; }
.nav-item .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .cnt { font-size: 12px; font-weight: 700; background: var(--navy); color: #fff; border-radius: 999px; padding: 1px 8px; }

.mid { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.list-head { padding: 12px 14px 8px; border-bottom: 1px solid var(--line); flex: none; }
.lh-row { display: flex; align-items: center; }
.lh-row h2 { margin: 0; font-size: 18px; color: var(--navy); }
.search { position: relative; margin: 8px 0; }
.search .ic { position: absolute; left: 11px; top: 11px; color: var(--muted); }
.search .q { width: 100%; min-height: 40px; padding: 8px 12px 8px 36px; border: 1px solid var(--line); border-radius: 9px; background: #f6f9fb; font-size: 16px; }
.search .q:focus { background: #fff; border-color: var(--accent); outline: 3px solid rgba(19, 124, 168, .2); }
.tabs { display: flex; gap: 6px; }
.tab { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.tab:hover { background: #eef3f6; }
.tab.on { background: var(--navy); color: #fff; }

.list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.row { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid #edf1f4; cursor: pointer; align-items: flex-start; }
.row:hover { background: #f7fafb; }
.row.on { background: var(--accent-soft); }
.rb { min-width: 0; flex: 1; }
.r1, .r2 { display: flex; align-items: center; gap: 6px; }
.who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when { font-size: 12px; color: var(--muted); flex: none; }
.subj { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #44606f; font-size: 14px; }
.row.unread .who, .row.unread .subj { font-weight: 700; color: var(--text); }
.row.unread .when { color: var(--accent); font-weight: 700; }
.row.unread { box-shadow: inset 3px 0 0 var(--accent); }

.avatar { width: 38px; height: 38px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; font-size: 15px; }
.avatar.sm { width: 30px; height: 30px; font-size: 13px; }

.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty .btn { margin-top: 8px; }
.pager { display: flex; align-items: center; padding: 6px 10px 6px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; min-height: 46px; flex: none; }
.pager:empty { display: none; }

.skeleton { padding: 6px 0; }
.sk-row { display: flex; gap: 12px; padding: 14px; align-items: center; }
.sk-av { width: 38px; height: 38px; border-radius: 50%; background: #e7eef2; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sk-lines i { height: 10px; border-radius: 5px; background: #e7eef2; display: block; }
.sk-lines i:last-child { width: 70%; }
.sk-av, .sk-lines i { animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* ---- reader ---- */
.reader { background: var(--panel); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.reader-empty, .reader-loading { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); padding: 24px; text-align: center; }
.rbar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex: none; }
.back-btn { display: none; }
.actions { display: flex; flex: 1; flex-wrap: wrap; gap: 6px; align-items: center; }
.rscroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px 22px 28px; }
.mhead { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.msubj { margin: 0 0 12px; font-size: 21px; line-height: 1.3; color: var(--navy); overflow-wrap: anywhere; }
.mfrom { display: flex; gap: 12px; align-items: flex-start; }
.mmeta { flex: 1; min-width: 0; }
.mname { overflow-wrap: anywhere; }
.addr { color: var(--muted); font-size: 13px; }
.mto { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; margin-top: 2px; }
.mdate { font-size: 12.5px; color: var(--muted); flex: none; text-align: right; max-width: 150px; }
.frame { width: 100%; border: 0; display: block; background: #fff; min-height: 60px; }
.notice { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: #fff7e0; border: 1px solid #f1deaa; color: #6b5200; border-radius: 8px; padding: 9px 12px; font-size: 13.5px; margin-bottom: 12px; }
.notice.soft { background: var(--accent-soft); border-color: #cfe4ee; color: #174a62; }
.atts-wrap { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.atts-title { font-weight: 700; font-size: 13px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .4px; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; }
.att { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; text-decoration: none; color: var(--text); max-width: 100%; background: #f8fafb; }
.att:hover { border-color: var(--accent); background: var(--accent-soft); }
.att .an { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; font-weight: 600; font-size: 14px; }
.att .as { color: var(--muted); font-size: 12.5px; }

/* ---- toasts ---- */
.toasts { position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; transition: opacity .3s, transform .3s; text-align: center; }
.toast.error { background: var(--danger); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---- modals ---- */
.modal-layer { position: fixed; inset: 0; background: rgba(4, 31, 44, .55); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal { background: #fff; border-radius: 14px; box-shadow: var(--shadow); width: 100%; max-width: 740px; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column; overflow: hidden; }
.modal.small { max-width: 480px; }
.modal-head { display: flex; align-items: center; padding: 8px 8px 8px 18px; background: var(--navy); color: #fff; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .icon-btn { color: #fff; }
.modal-body { padding: 8px 18px 4px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.field { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); min-height: 46px; }
.field label { width: 58px; color: var(--muted); font-size: 13.5px; flex: none; }
.field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; min-height: 44px; font-size: 16px; }
.field.col { flex-direction: column; align-items: stretch; border: 0; gap: 6px; margin-bottom: 14px; }
.field.col label { width: auto; font-weight: 600; color: #324a57; }
.field.col input, .modal textarea { border: 1px solid #c6d3db; border-radius: 9px; padding: 10px 12px; }
.modal textarea { width: 100%; border: 0; outline: 0; resize: vertical; min-height: 220px; padding: 14px 0; font-size: 16px; line-height: 1.5; background: transparent; }
.field.col + .field.col textarea, .modal-body .field.col textarea { border: 1px solid #c6d3db; border-radius: 9px; padding: 10px 12px; min-height: 120px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #eef3f6; border-radius: 999px; padding: 4px 4px 4px 10px; font-size: 13px; max-width: 100%; }
.chip .cn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.chip .cs { color: var(--muted); }
.chip-x { border: 0; background: transparent; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.chip-x:hover { background: #dbe5ea; }
.chip-x .ic { width: 14px; height: 14px; }
.c-error { margin: 6px 0 10px; padding: 9px 12px; background: #fdecea; color: #8a1c12; border-radius: 8px; font-size: 14px; }

.scrim { display: none; }

/* ---- tablet and phone ---- */
@media (max-width: 1099px) {
	.cols { grid-template-columns: 300px minmax(0, 1fr); }
	.side { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(290px, 82vw); transform: translateX(-102%); transition: transform .22s ease; padding-top: calc(14px + env(safe-area-inset-top)); box-shadow: var(--shadow); }
	.nav-open .side { transform: none; }
	.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(4, 31, 44, .45); z-index: 30; }
	.menu-btn { display: inline-flex; }
	.cols { grid-template-columns: 340px minmax(0, 1fr); }
}
@media (max-width: 760px) {
	.cols { grid-template-columns: minmax(0, 1fr); }
	.reader { display: none; }
	.reading .reader { display: flex; }
	.reading .mid { display: none; }
	.back-btn { display: inline-flex; }
	.top-brand { display: none; }
	.user-email { display: none; }
	.user-chip { padding: 4px; }
	.actions .btn .lbl { display: none; }
	.actions .btn { padding: 0 11px; min-width: 40px; }
	.actions .grow { display: none; }
	.rscroll { padding: 14px 14px 24px; }
	.msubj { font-size: 19px; }
	.mdate { max-width: 100px; }
	.mfrom { flex-wrap: wrap; }
	.modal-layer { padding: 0; align-items: stretch; }
	.modal { max-width: none; max-height: none; height: 100%; border-radius: 0; }
	.modal.small { height: auto; margin-top: auto; border-radius: 14px 14px 0 0; }
	.modal-layer:has(.modal.small) { align-items: flex-end; }
	.field label { width: 50px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- polish ---- */
.btn.ico { padding: 0; width: 38px; }
.btn.ico .lbl { display: none; }
.fab { display: none; position: fixed; right: 16px; bottom: calc(66px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--navy); color: #fff; box-shadow: 0 6px 18px rgba(7, 47, 66, .4); cursor: pointer; z-index: 20; align-items: center; justify-content: center; }
.fab .ic { width: 24px; height: 24px; }
@media (max-width: 760px) {
	.fab { display: inline-flex; }
	.reading .fab, .nav-open .fab { display: none; }
	.list { padding-bottom: 84px; }
	.actions { gap: 4px; }
	.actions .btn { min-width: 36px; min-height: 36px; padding: 0 8px; }
	.actions .btn.ico { width: 36px; }
	.rbar { padding: 6px 8px; gap: 2px; }
}
