:root {
  --ink: #12201d;
  --muted: #64726e;
  --paper: #f6f7f3;
  --white: #fff;
  --line: #dfe5df;
  --green: #1c6b54;
  --green-dark: #13523f;
  --green-pale: #e9f2ed;
  --accent: #d8ff79;
  --danger: #a43d35;
  --shadow: 0 24px 60px rgba(18,32,29,.12);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 800; letter-spacing: .04em; }
.brand b { font-weight: 500; color: var(--muted); letter-spacing: 0; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; background: var(--ink); color: var(--accent); font-family: Georgia, serif; font-size: 22px; font-style: italic; }
.eyebrow { margin: 0 0 9px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .17em; }
.button { border: 1px solid transparent; border-radius: 10px; padding: 12px 17px; cursor: pointer; font-weight: 750; transition: .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button.primary { background: var(--green); color: white; box-shadow: 0 8px 18px rgba(28,107,84,.2); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { background: white; color: var(--ink); border-color: var(--line); }
.button.small { padding: 9px 12px; font-size: 13px; }
.button.wide { width: 100%; padding: 14px 18px; }
.text-button { border: 0; background: none; color: var(--green); cursor: pointer; font-weight: 750; padding: 7px; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); cursor: pointer; font-size: 20px; line-height: 1; }
.icon-button:disabled { opacity: .35; cursor: not-allowed; }
.notice { position: fixed; z-index: 20; left: 50%; top: 18px; transform: translateX(-50%); width: min(640px, calc(100% - 32px)); padding: 13px 16px; border-radius: 10px; background: var(--ink); color: white; box-shadow: var(--shadow); text-align: center; }
.notice.error { background: var(--danger); }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr); }
.auth-intro { position: relative; overflow: hidden; padding: clamp(38px, 6vw, 90px); color: white; background: #153f34; display: flex; flex-direction: column; justify-content: center; }
.auth-intro::before { content: ""; position: absolute; width: 560px; height: 560px; border: 1px solid rgba(216,255,121,.17); border-radius: 50%; right: -210px; top: -170px; box-shadow: 0 0 0 75px rgba(216,255,121,.035), 0 0 0 150px rgba(216,255,121,.025); }
.auth-intro .brand { position: absolute; top: 42px; left: clamp(38px, 6vw, 90px); }
.auth-intro .brand-mark { background: var(--accent); color: var(--ink); }
.auth-intro .eyebrow { color: var(--accent); }
.auth-intro h1 { position: relative; max-width: 710px; margin: 0; font-family: Georgia, serif; font-size: clamp(48px, 6.2vw, 84px); font-weight: 400; line-height: .98; letter-spacing: -.045em; }
.auth-intro h1 em { color: var(--accent); font-weight: 400; }
.lead { position: relative; max-width: 590px; margin: 30px 0 42px; color: #d6e1dc; font-size: 18px; line-height: 1.65; }
.trust-list { position: relative; display: grid; gap: 12px; list-style: none; padding: 0; margin: 0; color: #d6e1dc; font-size: 14px; }
.trust-list li { display: flex; align-items: center; gap: 12px; }
.trust-list span { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .15em; }
.auth-card { padding: clamp(35px, 6vw, 90px); display: flex; flex-direction: column; justify-content: center; background: white; }
.auth-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin-bottom: 34px; }
.tab { position: relative; border: 0; background: none; padding: 12px 0 15px; color: var(--muted); font-weight: 750; cursor: pointer; }
.tab.active { color: var(--ink); }
.tab.active::after { content: ""; position: absolute; height: 3px; left: 0; right: 0; bottom: -1px; background: var(--green); border-radius: 3px 3px 0 0; }
.auth-form { width: min(100%, 480px); display: grid; gap: 20px; }
.auth-form h2, dialog h2 { margin: 0 0 7px; font-family: Georgia, serif; font-size: 34px; font-weight: 500; letter-spacing: -.02em; }
.auth-form p { margin: 0; color: var(--muted); }
label { display: grid; gap: 7px; color: var(--ink); font-size: 13px; font-weight: 720; }
label small { color: var(--muted); font-weight: 500; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 12px 13px; color: var(--ink); background: white; outline: none; }
input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(28,107,84,.12); }
textarea { resize: vertical; line-height: 1.55; }
.form-message { min-height: 20px; margin: 0; color: var(--green); font-size: 13px; }
.form-message.error { color: var(--danger); }

.app-shell { height: calc(100dvh - var(--ilygo-uat-banner-h, 0px)); min-height: 0; display: grid; grid-template-rows: 64px minmax(0, 1fr); overflow: hidden; }
.app-header { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); background: white; }
.user-menu { display: flex; align-items: center; gap: 15px; color: var(--muted); font-size: 13px; }
.mail-layout { min-height: 0; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.sidebar { min-height: 0; display: flex; flex-direction: column; padding: 24px 18px 16px; border-right: 1px solid var(--line); background: #eff2ed; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 12px; }
.sidebar-head .eyebrow { margin: 0; }
.account-list { display: grid; gap: 5px; max-height: 30%; overflow-y: auto; }
.account-item { width: 100%; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 10px; border: 0; border-radius: 10px; padding: 10px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.account-item:hover, .account-item.active { background: white; box-shadow: 0 4px 14px rgba(18,32,29,.06); }
.account-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: #e3edf7; color: #24558f; font-weight: 800; }
.account-copy { min-width: 0; }
.account-copy strong, .account-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: 13px; }
.account-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.account-menu { color: var(--muted); }
.empty-side { padding: 10px 6px 20px; color: var(--muted); font-size: 13px; }
.compose-button { width: 100%; margin-top: 22px; background: var(--accent); color: var(--ink); box-shadow: 0 8px 18px rgba(18,32,29,.08); }
.compose-button span { margin-right: 5px; font-size: 18px; }
.folder-section { min-height: 0; flex: 1; display: flex; flex-direction: column; margin-top: 24px; }
.folder-section .eyebrow { margin: 0 6px 10px; }
.folder-list { min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 2px; }
.folder-item { width: 100%; display: grid; grid-template-columns: 18px minmax(0,1fr) auto; align-items: center; gap: 7px; border: 0; border-radius: 8px; padding: 8px 8px 8px calc(8px + var(--folder-depth, 0) * 14px); background: transparent; color: inherit; text-align: left; cursor: pointer; }
.folder-item:hover, .folder-item.active { background: white; }
.folder-item.active { color: var(--green-dark); font-weight: 750; box-shadow: 0 3px 10px rgba(18,32,29,.05); }
.folder-icon { color: var(--muted); font-size: 12px; }
.folder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.folder-count { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.sidebar-foot { margin-top: auto; padding: 18px 6px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 7px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #46a27a; box-shadow: 0 0 0 3px rgba(70,162,122,.13); }
.mail-content { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); background: white; }
.content-head { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 28px; border-bottom: 1px solid var(--line); }
.content-head h1 { margin: 0; font-family: Georgia, serif; font-size: 27px; font-weight: 500; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.welcome-state, .message-placeholder { display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); }
.welcome-state { padding: 50px 20px; }
.welcome-state h2 { margin: 14px 0 5px; color: var(--ink); font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.welcome-state p { margin: 0 0 22px; }
.welcome-icon { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 18px; background: var(--green-pale); color: var(--green); font-size: 28px; }
.mail-columns { min-height: 0; display: grid; grid-template-columns: minmax(330px, 38%) minmax(0, 1fr); }
.message-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; border-right: 1px solid var(--line); }
.message-card { display: grid; gap: 7px; width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 17px 20px; background: white; color: inherit; text-align: left; cursor: pointer; }
.message-card:hover, .message-card.active { background: #f6f9f6; }
.message-card.unread { box-shadow: inset 3px 0 var(--green); }
.message-top { display: flex; justify-content: space-between; gap: 12px; }
.message-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.message-top time { flex: none; color: var(--muted); font-size: 10px; }
.message-card h3 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.message-card p { margin: 0; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.message-view { min-width: 0; overflow-y: auto; padding: 30px clamp(24px, 4vw, 52px); }
.message-placeholder { height: 100%; }
.message-placeholder span { font-size: 34px; color: #aebbb5; }
.message-head { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.message-head h2 { margin: 6px 0 18px; font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.sender { display: flex; align-items: center; gap: 12px; }
.sender-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--green); color: white; font-weight: 800; }
.sender small { display: block; color: var(--muted); margin-top: 3px; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; padding: 28px 0; color: #26332f; line-height: 1.7; }
.loading, .empty-list { padding: 30px 20px; color: var(--muted); text-align: center; }

dialog { width: min(600px, calc(100% - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 16px; background: white; color: var(--ink); box-shadow: var(--shadow); white-space: normal; text-align: start; margin: auto; }
dialog::backdrop { background: rgba(10,22,18,.48); backdrop-filter: blur(3px); }
.dialog-body { display: grid; grid-template-columns: minmax(0,1fr); gap: 18px; padding: 26px; overflow-y: auto; }
.dialog-body.compact { max-width: 480px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; padding-top: 4px; }
.dialog-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.provider-card { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; align-items: center; gap: 14px; width: 100%; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: white; color: inherit; text-align: left; cursor: pointer; }
.provider-card:hover { border-color: var(--green); background: #f8fbf8; }
.provider-card.disabled { opacity: .48; cursor: default; }
.provider-card strong, .provider-card small { display: block; }
.provider-card small { margin-top: 4px; color: var(--muted); }
.provider-card b { color: var(--green); font-size: 12px; }
.microsoft-mark { width: 30px; height: 30px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.microsoft-mark i:nth-child(1) { background: #f35325; }.microsoft-mark i:nth-child(2) { background: #81bc06; }.microsoft-mark i:nth-child(3) { background: #05a6f0; }.microsoft-mark i:nth-child(4) { background: #ffba08; }
.provider-letter { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: #f0f2f1; font-weight: 850; }
.from-line { margin: -6px 0 2px; color: var(--muted); font-size: 13px; }
.contacts-list { display: grid; gap: 6px; max-height: 420px; overflow-y: auto; }
.contact { display: flex; justify-content: space-between; gap: 15px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.contact small { color: var(--muted); }
#ilygo-uat-banner { position: sticky; top: 0; z-index: 2147483000; box-sizing: border-box; min-height: 40px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: center; padding: 6px 14px; background: #B45309; border-bottom: 3px solid #F59E0B; color: #fff; font: 500 13px/1.35 system-ui, sans-serif; text-align: center; }
#ilygo-uat-banner b { font-weight: 700; }
#ilygo-uat-banner a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.uat-chip { background: #7C2D12; border-radius: 4px; padding: 2px 7px; font-size: 11px; font-weight: 700; letter-spacing: .06em; white-space: nowrap; }
.uat-more, .uat-toggle { appearance: none; background: none; color: #fff; cursor: pointer; font: inherit; border: 1px solid rgba(255,255,255,.55); border-radius: 6px; padding: 3px 10px; }
.uat-toggle { border-color: transparent; text-decoration: underline; padding: 3px 4px; }
.uat-short { display: none; }
#ilygo-uat-banner[data-collapsed] { min-height: 28px; padding: 2px 14px; }
#ilygo-uat-banner[data-collapsed] .uat-txt, #ilygo-uat-banner[data-collapsed] .uat-mail-lead, #ilygo-uat-banner[data-collapsed] .uat-more { display: none; }
#ilygo-uat-banner[data-collapsed] .uat-short { display: inline; }
.uat-dialog-body b { font-weight: 750; }
.uat-dialog-body p { margin: 0; line-height: 1.55; }
.uat-dialog-body a { color: var(--green); }
.uat-foot { border-top: 1px solid var(--line); padding-top: 12px; color: var(--muted); font-size: 12px; }
@media (max-width: 640px) {
  #ilygo-uat-banner .uat-txt, #ilygo-uat-banner .uat-mail-lead { display: none; }
  #ilygo-uat-banner .uat-short { display: inline; }
  #ilygo-uat-banner[data-collapsed] { flex-wrap: nowrap; gap: 10px; white-space: nowrap; }
  #ilygo-uat-banner[data-collapsed] .uat-short { display: none; }
}
@media print {
  #ilygo-uat-banner { position: static; }
  #ilygo-uat-banner .uat-txt, #ilygo-uat-banner[data-collapsed] .uat-txt { display: inline; }
  #ilygo-uat-banner .uat-short, #ilygo-uat-banner .uat-more, #ilygo-uat-banner .uat-toggle { display: none; }
}

@media (max-width: 850px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-intro { min-height: 420px; padding: 90px 30px 45px; }
  .auth-intro .brand { top: 28px; left: 30px; }
  .auth-intro h1 { font-size: 50px; }
  .auth-card { padding: 42px 30px; }
  .mail-layout { grid-template-columns: 210px minmax(0,1fr); }
  .sidebar { padding: 18px 12px; }
  .account-menu, .sidebar-foot { display: none; }
  .compose-button { padding: 11px; }
  .account-item { padding: 8px; }
  .mail-columns { grid-template-columns: 1fr; }
  .message-view { display: none; }
}
@media (max-width: 560px) {
  .app-header { padding: 0 14px; }
  .brand b, #user-name { display: none; }
  .mail-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0,1fr); }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  .sidebar-head { padding-bottom: 6px; }
  .sidebar-head .eyebrow { font-size: 10px; }
  .account-list { display: flex; max-height: none; overflow-x: auto; }
  .account-item { min-width: 180px; }
  .compose-button, .sidebar-foot, .empty-side { display: none; }
  .folder-section { flex: none; margin-top: 10px; }
  .folder-section .eyebrow { display: none; }
  .folder-list { display: flex; overflow-x: auto; }
  .folder-item { min-width: max-content; padding: 8px 10px; }
  .folder-count { display: none; }
  .content-head { padding: 16px; }
  .content-head h1 { font-size: 21px; }
  #copy-link { display: none; }
}
