/* 브랜드 블루 머리 + 흰 카드 + 메뉴별 색 아이콘. 이모지 대신 선 아이콘을 쓴다. */
:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --ink: #171a21;
  --ink-2: #505866;
  --ink-3: #939aa7;
  --line: #e8ebf0;
  --brand: #1f5fd6;
  --brand-deep: #17479f;
  --brand-soft: #eaf1fe;
  --danger: #dc3b43;
  --ok: #16804f;
  --bar-h: 56px;
  --nav-h: 60px;
  --shadow: 0 1px 2px rgba(23, 32, 61, .05), 0 6px 18px rgba(23, 32, 61, .06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Noto Sans KR", "Segoe UI", "Malgun Gothic", sans-serif;
  background: #e9ecf2; color: var(--ink);
  font-size: 15px; line-height: 1.45; letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; letter-spacing: inherit; color: inherit; }
button { cursor: pointer; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; display: block; }
#app { position: relative; max-width: 480px; margin: 0 auto; min-height: 100%; background: var(--bg); }
.view { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.view.with-nav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
.hidden { display: none !important; }

/* 로그인 */
#view-login { background: var(--surface); }
.login-hero {
  padding: 84px 28px 56px; color: #fff;
  background: linear-gradient(155deg, #2b6ff0 0%, var(--brand) 45%, var(--brand-deep) 100%);
  border-radius: 0 0 28px 28px;
}
.brand { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; }
.brand-sub { opacity: .8; margin-top: 4px; font-size: 14px; }
.login-wrap { padding: 28px 24px 40px; }
#login-form { display: flex; flex-direction: column; gap: 10px; }
#login-form input {
  padding: 15px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 16px; background: var(--bg); outline: 0;
}
#login-form input:focus { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-soft); }
#login-form button {
  margin-top: 8px; padding: 15px; border: 0; border-radius: 12px;
  background: var(--brand); color: #fff; font-size: 16px; font-weight: 600;
}
#login-form button:active { background: var(--brand-deep); }
#login-form button:disabled { opacity: .55; }
.msg { margin-top: 14px; min-height: 20px; font-size: 14px; color: var(--danger); white-space: pre-wrap; }
.note { margin-top: 24px; color: var(--ink-3); font-size: 12.5px; }

/* 상단바 (목록·상세) */
.bar {
  display: flex; align-items: center; gap: 4px; height: var(--bar-h); padding: 0 6px;
  background: var(--surface); position: sticky; top: 0; z-index: 3; border-bottom: 1px solid var(--line);
}
.bar .title { flex: 1; font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 2px; }
.ghost {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 12px; color: var(--ink); flex-shrink: 0;
}
.ghost:active { background: var(--bg); }
.ghost.on-dark { color: #fff; }
.ghost.on-dark:active { background: rgba(255,255,255,.16); }
.spacer { width: 44px; flex-shrink: 0; }

/* 홈 머리 */
.hero {
  padding: 22px 12px 64px 22px; color: #fff;
  background: linear-gradient(155deg, #2b6ff0 0%, var(--brand) 45%, var(--brand-deep) 100%);
  border-radius: 0 0 26px 26px;
}
.hero-top { display: flex; align-items: flex-start; gap: 8px; }
.hero .who { flex: 1; min-width: 0; padding-top: 4px; }
.hello { font-size: 23px; font-weight: 700; letter-spacing: -0.03em; }
.where { margin-top: 3px; font-size: 13.5px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-row { margin: 14px 10px 0 0; }
.company-row select {
  width: 100%; padding: 10px 36px 10px 13px; border: 1px solid rgba(255,255,255,.28); border-radius: 12px;
  background-color: rgba(255,255,255,.14); color: #fff; font-size: 14px; appearance: none; -webkit-appearance: none; outline: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.company-row select option { color: var(--ink); background: #fff; }

/* 홈 요약 숫자 */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); margin: -44px 16px 0; position: relative;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 6px 4px;
}
.stat { background: none; border: 0; padding: 12px 4px; border-radius: 14px; text-align: center; position: relative; }
.stat + .stat::before { content: ""; position: absolute; left: 0; top: 22%; height: 56%; width: 1px; background: var(--line); }
.stat:active { background: var(--bg); }
.stat .s-num { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink-3); }
.stat.has .s-num { color: var(--brand); }
.stat .s-name { margin-top: 1px; font-size: 12.5px; color: var(--ink-2); }

.sec-title { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 10px; font-size: 15px; font-weight: 700; }
.sec-title button { background: none; border: 0; font-size: 13px; font-weight: 500; color: var(--brand); padding: 4px 0; }

/* 홈 메뉴 */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 0 16px; padding: 14px 6px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 2px; background: none; border: 0; border-radius: 14px; }
.tile:active { background: var(--bg); }
.tile .t-icon { width: 48px; height: 48px; border-radius: 16px; display: flex; align-items: center; justify-content: center; }
.tile .t-icon svg { width: 24px; height: 24px; }
.tile .t-name { font-size: 12.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.tile .t-badge {
  position: absolute; top: 2px; left: calc(50% + 10px); min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface); box-sizing: content-box;
}
.tile.off { opacity: .45; cursor: default; }

/* 홈 카드 */
.card { margin: 0 16px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.card .row:last-child { border-bottom: 0; }
.foot-note { padding: 20px 20px 24px; text-align: center; color: var(--ink-3); font-size: 12px; }

/* 목록 상단: 검색 + 칩 */
.sub-bar { position: sticky; top: var(--bar-h); z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); }
.search { display: flex; align-items: center; gap: 8px; margin: 10px 14px 0; padding: 0 12px; height: 42px; background: var(--bg); border-radius: 12px; color: var(--ink-3); }
.search svg { width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: 0; font-size: 15px; color: var(--ink); }
.search input::placeholder { color: var(--ink-3); }
.chips { display: flex; gap: 6px; padding: 10px 14px; overflow-x: auto; scrollbar-width: none; align-items: center; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: 0 0 auto; padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 13.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.chips button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.chips button.toggle.on { background: var(--brand-soft); border-color: #bcd2fb; color: var(--brand); }
.chips .sep { flex: 0 0 1px; height: 18px; background: var(--line); margin: 0 2px; }
.chips .t-cnt { margin-left: 5px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.chips button.on .t-cnt { color: #fff; opacity: .85; }
.chips .t-label { flex: 1; text-align: center; font-weight: 700; font-size: 15px; }

/* 목록 행 */
.list { flex: 1; background: var(--surface); }
.row {
  display: flex; gap: 12px; width: 100%; padding: 14px 16px; background: none; border: 0;
  border-bottom: 1px solid var(--line); text-align: left;
}
button.row:active { background: var(--bg); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; margin-top: 1px;
}
.avatar.sq { border-radius: 13px; }
.avatar.sq svg { width: 20px; height: 20px; }
.r-main { flex: 1; min-width: 0; }
.r-top { display: flex; align-items: baseline; gap: 8px; }
.r-from { flex: 1; min-width: 0; font-size: 15px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-time { flex-shrink: 0; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.r-subj { margin-top: 2px; font-size: 14.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-sub { margin-top: 2px; font-size: 13.5px; color: var(--ink-3); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-all; }
.r-marks { display: inline-flex; gap: 4px; vertical-align: -3px; margin-right: 4px; color: var(--ink-3); }
.r-marks svg { width: 15px; height: 15px; }
.r-marks .star { color: #e8a400; fill: #e8a400; }
.row.unseen .r-from, .row.unseen .r-subj { font-weight: 700; }
.row.unseen .r-time { color: var(--brand); font-weight: 600; }
.row.unseen .r-from::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin-right: 7px; vertical-align: 2px; }
.row:not(.unseen).dim .r-from, .row:not(.unseen).dim .r-subj { color: var(--ink-2); }
.row.wrap .r-subj { white-space: normal; }
.row.wrap .r-sub { -webkit-line-clamp: 3; word-break: break-word; }
.badge { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--bg); color: var(--ink-2); margin-right: 6px; font-weight: 600; vertical-align: 1px; }
.badge.ing { background: #fdebec; color: var(--danger); }
.badge.done { background: #e4f4eb; color: var(--ok); }
.badge.blue { background: var(--brand-soft); color: var(--brand); }
.day-head { padding: 10px 16px 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--bg); border-bottom: 1px solid var(--line); }
.empty { padding: 72px 24px; text-align: center; color: var(--ink-3); white-space: pre-wrap; font-size: 14.5px; }
.empty.small { padding: 28px 16px; font-size: 13.5px; }
.more { padding: 16px; text-align: center; }
.more button { padding: 10px 22px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; color: var(--ink-2); font-size: 14px; font-weight: 500; }

/* 상세 */
.detail { flex: 1; background: var(--surface); }
.d-head { padding: 20px 18px 16px; }
.d-head h2 { font-size: 20px; line-height: 1.35; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 16px; word-break: break-word; }
.sender { display: flex; gap: 12px; align-items: center; }
.sender .s-main { flex: 1; min-width: 0; }
.sender .s-name { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sender .s-addr { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sender .s-time { font-size: 12.5px; color: var(--ink-3); flex-shrink: 0; align-self: flex-start; margin-top: 2px; font-variant-numeric: tabular-nums; }
.rcpt { margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.rcpt summary { list-style: none; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-3); }
.rcpt summary::-webkit-details-marker { display: none; }
.rcpt[open] summary { display: none; }
.rcpt .r-line { margin-top: 6px; word-break: break-word; }
.rcpt .r-line b { display: inline-block; min-width: 52px; font-weight: 500; color: var(--ink-3); }
.props { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin-top: 16px; padding: 12px 14px; background: var(--bg); border-radius: 12px; font-size: 13.5px; }
.props dt { color: var(--ink-3); }
.props dd { margin: 0; word-break: break-word; }
.files { display: flex; flex-direction: column; gap: 8px; padding: 0 18px 16px; }
.file {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  font-size: 13.5px; color: var(--ink); text-decoration: none; background: var(--surface);
}
.file:active { background: var(--bg); }
.file .f-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.file .f-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .f-size { color: var(--ink-3); font-size: 12.5px; flex-shrink: 0; }
.file svg { width: 18px; height: 18px; color: var(--ink-3); }
.d-body { border-top: 1px solid var(--line); }
.d-body iframe { display: block; width: 100%; height: 60vh; border: 0; background: #fff; }

/* 하단 탭 */
.nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 5;
  display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.nav button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: none; border: 0; font-size: 11px; font-weight: 500; color: var(--ink-3); }
.nav button.on { color: var(--brand); font-weight: 700; }
.nav button svg { width: 23px; height: 23px; }
.nav .n-dot { position: absolute; top: 9px; left: calc(50% + 7px); width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid #fff; box-sizing: content-box; }

/* 스피너 */
.spinner { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.35); z-index: 10; }
.dot { width: 28px; height: 28px; border: 2.5px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 메일 화면: 핵심 메일함 줄 + 더보기 패널 ─────────────── */
.sub-bar:not(:has(> :not(.hidden))) { display: none; }
.sub-bar.mail { position: static; background: var(--bg); }
.mbar { display: grid; grid-template-columns: repeat(5, 1fr); padding: 14px 6px 11px; background: var(--surface); border-bottom: 1px solid var(--line); }
.mbar button { border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 7px; font: inherit; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.mbar .m-ic { position: relative; width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--c, var(--ink-3)); transition: border-color .15s, background .15s; }
.mbar .m-ic svg { width: 22px; height: 22px; }
.mbar button.on { color: var(--brand); font-weight: 700; }
.mbar button.on .m-ic { border: 2px solid var(--brand); background: var(--brand-soft); color: var(--brand); }
.mbar .m-bd { position: absolute; top: -6px; right: -8px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; font-style: normal; box-shadow: 0 0 0 2px var(--surface); }
.mact { display: flex; border-bottom: 1px solid var(--line); }
.mact button { flex: 1; height: 44px; border: 0; background: none; font: inherit; font-size: 14px; color: var(--ink-2); }
.mact button.on { color: var(--brand); font-weight: 700; }
.sub-bar.mail .search { margin: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }

.mbox { display: flex; align-items: center; gap: 14px; width: 100%; height: 54px; padding: 0 18px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 16px; color: var(--ink); text-align: left; }
.mbox svg { width: 22px; height: 22px; flex: none; color: var(--brand); }
.mbox .b-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbox .b-cnt { color: var(--ink-3); font-size: 14.5px; font-variant-numeric: tabular-nums; }
.mbox .b-cnt.has { color: var(--brand); font-weight: 700; }
.mbox.on .b-name { color: var(--brand); font-weight: 700; }
.mbox:active, .mrow:active { background: var(--bg); }

.mrow { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); padding: 13px 16px 14px; font: inherit; color: var(--ink); }
.m-top { display: flex; align-items: center; gap: 9px; }
.m-env { flex: none; display: grid; color: var(--ink-3); }
.m-env svg { width: 19px; height: 19px; }
.mrow.unseen .m-env { color: var(--brand); }
.mrow.unseen .m-env svg { fill: var(--brand); }
.mrow.unseen .m-env svg path { stroke: #fff; }
.m-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15.5px; }
.m-from small { margin-left: 6px; font-size: 12.5px; font-weight: 400; color: var(--ink-3); }
.m-time { flex: none; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.m-subj { margin-top: 6px; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-subj svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; color: var(--ink-3); }
.m-subj svg.star { color: #e8a317; fill: #e8a317; }
.m-prev { margin-top: 4px; font-size: 13px; line-height: 1.45; color: var(--ink-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mrow.unseen .m-from, .mrow.unseen .m-subj { font-weight: 700; }
.mrow.unseen .m-time { color: var(--brand); font-weight: 600; }
.mrow:not(.unseen) .m-from, .mrow:not(.unseen) .m-subj { color: var(--ink-2); }
.card .mrow:last-child { border-bottom: 0; }

/* ── 홈 머리: 낮고 단정하게 ─────────────────────────────── */
.hero { padding: 14px 10px 46px 20px; border-radius: 0 0 20px 20px; background: linear-gradient(160deg, #2a6be8 0%, var(--brand) 60%, #1b55c4 100%); }
.hero-top { align-items: center; }
.hero .who { padding-top: 0; }
.hello { font-size: 20px; }
.where { margin-top: 2px; font-size: 13px; }
/* 겸직 선택 상자가 같은 내용을 보여 주므로 소속 줄은 숨긴다 */
.hero:has(.company-row:not(.hidden)) .where { display: none; }
.company-row { margin: 8px 10px 0 0; }
.company-row select { padding: 7px 32px 7px 12px; border-radius: 10px; font-size: 13.5px; border-color: rgba(255,255,255,.22); background-color: rgba(255,255,255,.12); background-position: right 10px center; }
.stats { margin-top: -32px; border-radius: 16px; padding: 4px; }
.stat { padding: 10px 4px; }
.stat .s-num { font-size: 20px; }


/* ── 홈: 남색 바탕 + 모자이크 타일 ───────────────────────── */
#view-home { background: #0a3a72; min-height: 100vh; color: #fff; }
.h-top { padding: 26px 18px 16px; }
.h-logo { display: inline-block; margin-left: 34px; padding: 1px 12px 2px; border: 1.5px solid rgba(255,255,255,.9); border-radius: 50%; font-size: 13px; font-weight: 800; font-style: italic; letter-spacing: .06em; color: #fff; }
.h-logo img { display: block; height: 22px; }
.h-logo:has(img) { border: 0; padding: 0; border-radius: 0; }
.h-row { display: flex; align-items: center; gap: 6px; margin-top: 14px; }
.h-who { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; font-size: 18px; color: #dbe8fb; }
.h-who > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-chev { flex: none; display: grid; }
.h-chev svg { width: 20px; height: 20px; }
.h-who select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; }
.h-btn { position: relative; flex: none; width: 42px; height: 42px; border: 0; background: none; color: #dbe8fb; display: grid; place-items: center; border-radius: 50%; }
.h-btn:active { background: rgba(255,255,255,.12); }
.h-btn svg { width: 25px; height: 25px; stroke-width: 1.5; }
.h-n { position: absolute; top: 3px; right: 2px; width: 17px; height: 17px; border-radius: 50%; background: #f0356b; color: #fff; font-size: 10.5px; font-weight: 700; font-style: normal; line-height: 17px; text-align: center; }

.mosaic { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 10px; overflow: hidden; }
.mz { position: relative; aspect-ratio: 1 / 1; border: 0; padding: 0; color: #fff; font: inherit; overflow: hidden; display: grid; place-items: center; background: var(--g); }
.mz.tall { grid-row: span 2; aspect-ratio: 1 / 2; }
.mz.wide { grid-column: span 2; aspect-ratio: 2 / 1; }
/* 유리 건물에 비친 하늘 같은 사선 빛 */
.mz::before { content: ""; position: absolute; inset: 0; background:
  linear-gradient(118deg, transparent 0 46%, rgba(255,255,255,.10) 46% 47%, transparent 47% 62%, rgba(255,255,255,.07) 62% 63%, transparent 63%),
  radial-gradient(120% 90% at 85% 0%, rgba(255,255,255,.22), transparent 55%),
  linear-gradient(200deg, rgba(255,255,255,.06), rgba(0,20,60,.18)); pointer-events: none; }
.mz:active::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.14); }
.mz > svg { position: relative; width: 38%; max-width: 62px; height: auto; aspect-ratio: 1; stroke-width: 1.1; margin-bottom: 18%; }
.mz.tall > svg { width: 44%; margin-bottom: 0; align-self: start; margin-top: 42%; }
.mz.wide > svg { width: 19%; margin-bottom: 9%; }
.mz-foot { position: absolute; left: 12px; right: 12px; bottom: 9px; display: flex; align-items: baseline; justify-content: space-between; }
.mz-name { font-size: 15.5px; letter-spacing: -0.01em; }
.mz-cnt { font-size: 21px; font-weight: 300; font-variant-numeric: tabular-nums; }
.mz-mail { --g: linear-gradient(165deg, #2f6bd0 0%, #2456b4 45%, #1c4a9e 100%); }
.mz-approval { --g: linear-gradient(125deg, #2f86de 0%, #4aa6ee 55%, #7cc6f8 100%); }
.mz-alert { --g: linear-gradient(160deg, #3fa7f2 0%, #2f95ea 100%); }
.mz-approvalMailWait { --g: linear-gradient(150deg, #2a76cc 0%, #1e5fb2 100%); }
.mz-board { --g: linear-gradient(160deg, #2e92ea 0%, #237cd8 100%); }
.mz-calendar { --g: linear-gradient(150deg, #1f5aa8 0%, #2a6fc0 100%); }
.mz-talk { --g: linear-gradient(150deg, #22c3d6 0%, #1fb2cf 100%); }
.mz.off > svg, .mz.off .mz-name { opacity: .5; }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); padding: 22px 10px 8px; }
.quick button { border: 0; background: none; padding: 6px 0; display: flex; flex-direction: column; align-items: center; gap: 8px; font: inherit; font-size: 13.5px; color: #8fc2f5; }
.quick svg { width: 34px; height: 34px; stroke-width: 1.2; }
.quick button.off { opacity: .45; }
.quick button:active { opacity: .7; }

#view-home .sec-title { color: #dbe8fb; padding-top: 18px; }
#view-home .sec-title button { color: #8fc2f5; }
#view-home .card { color: var(--ink); }
#view-home .foot-note { color: rgba(219,232,251,.55); }
/* 로그인 화면도 홈과 같은 남색 계열로 */
.login-hero { background: linear-gradient(160deg, #1c4a9e 0%, #0a3a72 100%); }
#login-btn { background: #1c4a9e; }


/* ── 로그인: 아이디 저장 / 자동로그인 ───────────────────── */
.login-opts { display: flex; gap: 22px; margin-top: 16px; }
.login-opts label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.login-opts input { width: 19px; height: 19px; margin: 0; accent-color: #1c4a9e; }
.note { margin-top: 18px; }

/* ── 메일쓰기 버튼(+) ───────────────────────────────────── */
.fab { position: fixed; right: max(18px, calc(50% - 240px + 18px)); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px); z-index: 4;
  width: 58px; height: 58px; border-radius: 50%; border: 0; background: #1677e0; color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(22,119,224,.4); }
.fab svg { width: 30px; height: 30px; stroke-width: 2; }
.fab:active { transform: scale(.95); }

/* ── 메일 상세 ──────────────────────────────────────────── */
.detail .mbar { background: var(--bg); }
.detail .mbar .m-ic { color: var(--ink-2); }
.detail .mbar button { color: var(--ink-2); }
.detail .mbar button:active .m-ic { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.md-from, .md-line { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 15px; color: var(--ink); text-align: left; }
.md-lb { flex: none; width: 62px; color: var(--ink-3); }
.md-v { flex: 1; min-width: 0; word-break: break-word; }
.md-from .md-v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-from svg { flex: none; width: 20px; height: 20px; color: var(--ink-3); transition: transform .15s; }
.md-from.open svg { transform: rotate(180deg); }
.md-from.open .md-v { white-space: normal; }
.md-line { background: var(--bg); font-size: 14px; padding-top: 11px; padding-bottom: 11px; }
.md-subj { padding: 16px 16px 14px; border-bottom: 1px solid var(--line); }
.md-subj h2 { margin: 0; font-size: 18px; line-height: 1.4; font-weight: 700; letter-spacing: -0.02em; word-break: break-word; }
.md-date { margin-top: 4px; font-size: 13.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.md-head + .files { padding-top: 14px; }

/* ── 선택 창 / 알림 띠 ──────────────────────────────────── */
.sheet-ov { position: fixed; inset: 0; z-index: 20; background: rgba(10,20,40,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; max-height: 76vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); animation: sheet-up .18s ease-out; }
@keyframes sheet-up { from { transform: translateY(30px); opacity: .6; } }
.sh-title { padding: 16px 20px 10px; font-size: 14px; font-weight: 700; color: var(--ink-3); }
.sh-list { overflow-y: auto; }
.sh-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 52px; padding: 8px 20px; border: 0; background: none; font: inherit; font-size: 16px; color: var(--ink); text-align: left; }
.sh-item svg { width: 22px; height: 22px; flex: none; color: var(--brand); }
.sh-item span { flex: 1; }
.sh-item small { color: var(--ink-3); font-size: 12px; }
.sh-item.danger, .sh-item.danger svg { color: var(--danger); }
.sh-item:active { background: var(--bg); }
.sh-cancel { margin: 8px 16px 14px; height: 48px; border: 0; border-radius: 12px; background: var(--bg); font: inherit; font-size: 15px; font-weight: 600; color: var(--ink-2); }
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 30px); transform: translate(-50%, 12px); z-index: 30; max-width: min(88vw, 420px); padding: 11px 18px; border-radius: 12px; background: rgba(20,26,38,.92); color: #fff; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── 메일쓰기 ───────────────────────────────────────────── */
#view-compose { background: var(--surface); }
.cbar { background: #1677e0; color: #fff; border-bottom: 0; }
.cbar .title { text-align: center; color: #fff; padding: 0; }
.c-side { flex: none; min-width: 64px; height: 100%; padding: 0 16px; border: 0; background: none; color: #fff; font: inherit; font-size: 16.5px; font-weight: 600; }
.c-side:disabled { opacity: .5; }
.c-row { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.c-row label { flex: none; width: 82px; font-size: 15px; color: var(--ink-3); }
.c-row input, .c-val { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 15.5px; color: var(--ink); padding: 14px 0; }
.c-row input::placeholder, .c-hint { color: #b4bac6; }
.c-val { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0; }
.c-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 4px 5px 10px; border-radius: 8px; background: var(--bg); font-size: 13.5px; }
.c-file > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-file svg { width: 15px; height: 15px; flex: none; color: var(--ink-3); }
.c-file button { border: 0; background: none; padding: 3px; display: grid; }
.c-optrow { align-items: flex-start; }
.c-optrow label { padding-top: 16px; }
.c-opts { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; padding: 11px 0; }
.c-opts button { height: 32px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: inherit; font-size: 13.5px; color: var(--ink-2); }
.c-opts button.on { border-color: #1677e0; background: #e8f2fd; color: #1264c0; font-weight: 600; }
.c-opts button.off { opacity: .45; }
.c-sug { border-bottom: 1px solid var(--line); background: var(--bg); max-height: 240px; overflow-y: auto; }
.c-sug button { display: flex; flex-direction: column; gap: 1px; width: 100%; padding: 9px 16px 9px 108px; border: 0; background: none; font: inherit; text-align: left; }
.c-sug b { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.c-sug span { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-sug button:active { background: var(--brand-soft); }
#c-body { display: block; width: 100%; min-height: 220px; padding: 16px; border: 0; outline: 0; resize: none; font: inherit; font-size: 15.5px; line-height: 1.6; color: var(--ink); field-sizing: content; }
#c-body::placeholder { color: #b4bac6; }
#c-quote:not(:empty) { border-top: 1px dashed var(--line); }

/* ── 확인 창 ────────────────────────────────────────────── */
.sheet-ov.center { align-items: center; padding: 24px; }
.dlg { width: 100%; max-width: 320px; background: var(--surface); border-radius: 16px; overflow: hidden; box-shadow: 0 12px 40px rgba(10,20,40,.3); animation: sheet-up .15s ease-out; }
.dlg-msg { padding: 24px 22px 20px; font-size: 15.5px; line-height: 1.5; color: var(--ink); text-align: center; white-space: pre-line; }
.dlg-btns { display: flex; border-top: 1px solid var(--line); }
.dlg-btns button { flex: 1; height: 50px; border: 0; background: none; font: inherit; font-size: 15.5px; color: var(--ink-2); }
.dlg-btns button + button { border-left: 1px solid var(--line); }
.dlg-ok { color: var(--brand) !important; font-weight: 700 !important; }
.dlg-ok.danger { color: var(--danger) !important; }
.dlg-btns button:active { background: var(--bg); }

/* ── 로그인: 파란 머리 없이 단순하게 ────────────────────── */
.login-hero { padding: 64px 26px 6px; background: none; border-radius: 0; color: var(--ink); }
.brand { font-size: 24px; color: #0a3a72; }
.brand-sub { margin-top: 2px; font-size: 13.5px; opacity: 1; color: var(--ink-3); }
.login-wrap { padding: 22px 24px 40px; }
.msg { margin-top: 10px; min-height: 0; }
.msg:empty { display: none; }
.login-opts { margin-top: 14px; }
.note { margin-top: 14px; }
/* 메일 목록: 둘째 줄이 없어진 만큼 검색 칸 여백을 줄인다 */
.sub-bar.mail .search { margin: 8px 12px; height: 38px; }


/* ══ 색상 모드 ═════════════════════════════════════════════
   기본 / 눈편한(sepia) / 다크. 색은 모두 변수로 받아 테마별로 값만 바꾼다. */
:root {
  --page: #e9ecf2; --paper: #fff; --nav-bg: rgba(255,255,255,.96); --ph: #b4bac6;
  --home-bg: #0a3a72; --home-ink: #dbe8fb; --home-sub: #8fc2f5;
  --accent: #1677e0; --accent-soft: #e8f2fd; --accent-ink: #1264c0; --login-brand: #0a3a72;
}
body { background: var(--page); }
#view-home { background: var(--home-bg); color: var(--home-ink); }
.h-who, .h-btn { color: var(--home-ink); }
.h-logo { color: var(--home-ink); border-color: currentColor; }
.quick button { color: var(--home-sub); }
#view-home .foot-note { color: var(--home-sub); opacity: .7; }
.fab, .cbar { background: var(--accent); }
.c-opts button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.c-row input::placeholder, .c-hint, #c-body::placeholder { color: var(--ph); }
.d-body iframe { background: var(--paper); }
.nav { background: var(--nav-bg); }
.nav .n-dot { border-color: var(--surface); }
.brand { color: var(--login-brand); }
#login-btn { background: var(--login-brand); }
.login-opts input { accent-color: var(--login-brand); }
.spinner { background: color-mix(in srgb, var(--surface) 35%, transparent); }
.h-theme { flex: none; height: 32px; padding: 0 26px 0 11px; border: 1px solid color-mix(in srgb, var(--home-ink) 35%, transparent); border-radius: 9px;
  background-color: color-mix(in srgb, var(--home-ink) 8%, transparent); color: var(--home-ink); font-size: 13px; outline: 0; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-size: 5px 5px, 5px 5px; background-position: right 13px center, right 8px center; background-repeat: no-repeat; }
.h-theme option { color: #171a21; background: #fff; }

/* 눈편한: 따뜻한 종이색 바탕 + 테라코타 강조 */
:root[data-theme="sepia"] {
  --bg: #f1ede4; --surface: #faf7f1; --ink: #2b2622; --ink-2: #5e564c; --ink-3: #978d80; --line: #e4dccf;
  --brand: #b8552e; --brand-deep: #964322; --brand-soft: #f6e6dc; --danger: #c8432f; --ok: #5d7a3a;
  --shadow: 0 1px 2px rgba(60,40,20,.05), 0 6px 18px rgba(60,40,20,.06);
  --page: #e6e0d4; --paper: #fdfbf6; --nav-bg: rgba(250,247,241,.96); --ph: #b9b0a3;
  --home-bg: #f1ede4; --home-ink: #3a332c; --home-sub: #8a6a55;
  --accent: #b8552e; --accent-soft: #f6e6dc; --accent-ink: #964322; --login-brand: #b8552e;
}
[data-theme="sepia"] .mz-mail { --g: linear-gradient(165deg, #c96a41 0%, #b5532d 55%, #a44a27 100%); }
[data-theme="sepia"] .mz-approval { --g: linear-gradient(125deg, #d58a61 0%, #dfa07a 60%, #e9b896 100%); }
[data-theme="sepia"] .mz-alert { --g: linear-gradient(160deg, #cf7c50 0%, #c26d43 100%); }
[data-theme="sepia"] .mz-approvalMailWait { --g: linear-gradient(150deg, #a65a3c 0%, #8f4a30 100%); }
[data-theme="sepia"] .mz-board { --g: linear-gradient(160deg, #c79b6d 0%, #b78858 100%); }
[data-theme="sepia"] .mz-calendar { --g: linear-gradient(150deg, #8c705a 0%, #7a5f4b 100%); }
[data-theme="sepia"] .mz-talk { --g: linear-gradient(150deg, #a9a184 0%, #989073 100%); }
[data-theme="sepia"] .fab { box-shadow: 0 6px 16px rgba(184,85,46,.35); }
[data-theme="sepia"] .badge.ing { background: #f7e1da; }
[data-theme="sepia"] .badge.done { background: #e8eedb; }
[data-theme="sepia"] .chips button.toggle.on { border-color: #e6c3ad; }

/* 다크 */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1319; --surface: #181d26; --ink: #e7eaf0; --ink-2: #b4bbc8; --ink-3: #7c8595; --line: #29303c;
  --brand: #6aa5ff; --brand-deep: #4a8bef; --brand-soft: #1b2b47; --danger: #ff6b72; --ok: #4cc38a;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.35);
  --page: #07090d; --paper: #fff; --nav-bg: rgba(24,29,38,.96); --ph: #5d6675;
  --home-bg: #0b0f16; --home-ink: #d5deec; --home-sub: #7fa8d8;
  --accent: #2f6fd0; --accent-soft: #1b2b47; --accent-ink: #8fbcff; --login-brand: #2f6fd0;
}
[data-theme="dark"] .mz-mail { --g: linear-gradient(165deg, #24509c 0%, #1b4186 50%, #173872 100%); }
[data-theme="dark"] .mz-approval { --g: linear-gradient(125deg, #21578f 0%, #2a6da9 60%, #3a86c2 100%); }
[data-theme="dark"] .mz-alert { --g: linear-gradient(160deg, #2a79ba 0%, #2068a8 100%); }
[data-theme="dark"] .mz-approvalMailWait { --g: linear-gradient(150deg, #1e5593 0%, #17457c 100%); }
[data-theme="dark"] .mz-board { --g: linear-gradient(160deg, #2269ac 0%, #1b5894 100%); }
[data-theme="dark"] .mz-calendar { --g: linear-gradient(150deg, #183f77 0%, #1f518f 100%); }
[data-theme="dark"] .mz-talk { --g: linear-gradient(150deg, #1a8b99 0%, #177a8c 100%); }
[data-theme="dark"] .mz::before { opacity: .55; }
[data-theme="dark"] .brand { color: var(--ink); }
[data-theme="dark"] .badge.ing { background: #3a1d20; }
[data-theme="dark"] .badge.done { background: #173326; }
[data-theme="dark"] .chips button.toggle.on { border-color: #2c4675; }
[data-theme="dark"] .avatar { filter: brightness(.82) saturate(.9); }
[data-theme="dark"] .mrow.unseen .m-env svg path { stroke: var(--surface); }
[data-theme="dark"] .fab { box-shadow: 0 6px 16px rgba(0,0,0,.5); }
[data-theme="dark"] #toast { background: rgba(231,234,240,.94); color: #14171d; }

/* 다크 홈: 파란 타일 대신 어두운 판 + 색 아이콘 */
[data-theme="dark"] .mosaic { gap: 6px; overflow: visible; }
[data-theme="dark"] .mz { background: #171c26; border: 1px solid #252c39; border-radius: 14px; color: #dfe4ee; }
[data-theme="dark"] .mz::before { opacity: 1; background: radial-gradient(120% 90% at 85% 0%, color-mix(in srgb, var(--k) 16%, transparent), transparent 60%); }
[data-theme="dark"] .mz:active::after { background: rgba(255,255,255,.06); border-radius: 14px; }
[data-theme="dark"] .mz > svg { color: var(--k); stroke-width: 1.3; }
[data-theme="dark"] .mz-cnt { color: var(--k); font-weight: 500; }
[data-theme="dark"] .mz-name { color: #c3cad7; }
[data-theme="dark"] .mz-mail { --k: #6aa5ff; }
[data-theme="dark"] .mz-approval { --k: #a78bfa; }
[data-theme="dark"] .mz-alert { --k: #f5b454; }
[data-theme="dark"] .mz-approvalMailWait { --k: #4cc38a; }
[data-theme="dark"] .mz-board { --k: #4fc3d9; }
[data-theme="dark"] .mz-calendar { --k: #ff8a8f; }
[data-theme="dark"] .mz-talk { --k: #8a93a3; }
[data-theme="dark"] .quick button { color: #9aa4b5; }
[data-theme="dark"] .quick button:not(.off) svg { color: #6aa5ff; }
