/* EzMail: Projectopia World's Frutiger Aero look — sky, glass, gloss. */
:root {
  --sky-top: #bfe9ff;
  --sky-bottom: #eaf8ff;
  --grass: #7ccf4a;
  --ink: #0f2b46;
  --muted: #557089;
  --accent: #1e8fd6;
  --accent-dark: #0b5fa8;
  --accent-light: #7fd8ff;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(255, 255, 255, 0.95);
  --line: rgba(15, 43, 70, 0.12);
  --row-hover: rgba(30, 143, 214, 0.08);
  --row-active: rgba(30, 143, 214, 0.16);
  --unread: #0b5fa8;
  --danger: #c62f3b;
  --shadow: 0 8px 28px rgba(11, 95, 168, 0.18);
  --radius: 16px;
  --glow: rgba(255, 255, 255, .7);
  --font: "Segoe UI", "Frutiger", "Myriad Pro", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --sky-top: #06233d;
    --sky-bottom: #0d3b5e;
    --ink: #e4f4ff;
    --muted: #93b4cc;
    --glass: rgba(10, 40, 66, 0.72);
    --glass-strong: rgba(12, 46, 76, 0.92);
    --glass-border: rgba(127, 216, 255, 0.25);
    --line: rgba(228, 244, 255, 0.12);
    --row-hover: rgba(127, 216, 255, 0.08);
    --row-active: rgba(127, 216, 255, 0.16);
    --unread: #7fd8ff;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
    --glow: rgba(127, 216, 255, .12);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 40% at 50% 115%, var(--grass), transparent 70%),
    radial-gradient(circle at 15% 10%, var(--glow), transparent 30%),
    linear-gradient(var(--sky-top), var(--sky-bottom));
  background-attachment: fixed;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2 { margin: 0; font-weight: 600; }
h2 { font-size: 1.15rem; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.error { color: var(--danger); margin: 0; }
.spacer { flex: 1; }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.6);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
}

/* Buttons: glossy capsules */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35em;
  padding: .45em 1em;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: linear-gradient(rgba(255,255,255,.85), rgba(255,255,255,.45));
  cursor: pointer;
  white-space: nowrap;
  transition: transform .08s, box-shadow .15s;
}
@media (prefers-color-scheme: dark) { .btn { background: linear-gradient(rgba(127,216,255,.18), rgba(127,216,255,.06)); } }
.btn:hover { box-shadow: 0 2px 10px rgba(30,143,214,.25); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary {
  color: #fff;
  border-color: var(--accent-dark);
  background: linear-gradient(var(--accent-light), var(--accent) 50%, var(--accent-dark));
  text-shadow: 0 1px 1px rgba(0,0,0,.25);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 3px 10px rgba(11,95,168,.35);
}
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--row-hover); box-shadow: none; }
.btn.small { padding: .3em .75em; font-size: .9em; }
.btn.big { padding: .7em 1.4em; font-size: 1.02em; }
.icon-btn { border: 0; background: transparent; font-size: 1.3rem; cursor: pointer; padding: .2em .45em; border-radius: 10px; }
.icon-btn:hover { background: var(--row-hover); }
.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; }

input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .55em .7em;
  background: var(--glass-strong);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(30,143,214,.2); }

/* Sign in */
.screen { height: 100%; }
#login { display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); padding: 32px 28px; display: grid; gap: 14px; text-align: center; }
.login-card label { display: grid; gap: 6px; text-align: left; font-size: .9em; color: var(--muted); }
.login-card input { color: var(--ink); }
.login-logo { margin: 0 auto; filter: drop-shadow(0 6px 12px rgba(11,95,168,.35)); }
.login-card h1 { font-size: 1.8rem; }

/* App frame */
#app { display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; color: var(--accent-dark); }
@media (prefers-color-scheme: dark) { .brand { color: var(--accent-light); } }
.search { flex: 1; max-width: 560px; }
.search input { width: 100%; border-radius: 999px; padding-left: 1.1em; }
.me { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.layout {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(280px, 380px) 1fr;
  gap: 12px;
  padding: 0 16px 16px;
}
.sidebar, .list-pane, .read-pane { min-height: 0; overflow: auto; }
.sidebar { padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.compose-btn { width: 100%; }
.mailbox-pick { display: grid; gap: 4px; font-size: .8em; color: var(--muted); }
.mailbox-pick select { font-size: 1.05em; color: var(--ink); }
.folders { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.folders button {
  width: 100%; display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; padding: .55em .8em; border-radius: 10px; cursor: pointer; text-align: left;
}
.folders button:hover { background: var(--row-hover); }
.folders button[aria-current="true"] { background: var(--row-active); font-weight: 600; }
.folders .count { margin-left: auto; font-size: .8em; font-weight: 700; color: var(--unread); }

.demo-banner {
  margin: 0 16px 12px; padding: .6em 1em; border-radius: 12px; font-size: .9em;
  color: #5a3d00; background: linear-gradient(#fff6d6, #ffe9a8); border: 1px solid #f1c75b;
}
.demo-banner code { font-size: .95em; }
@media (max-width: 860px) { .demo-banner { margin: 0 8px 8px; } }

/* Message list */
.list-pane { display: flex; flex-direction: column; }
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; position: sticky; top: 0; background: inherit; }
.list-tools { display: flex; gap: 4px; }
.message-list { list-style: none; margin: 0; padding: 0 6px 6px; }
.message-list li { border-bottom: 1px solid var(--line); }
.message-list li:last-child { border-bottom: 0; }
.msg-row {
  width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px;
  border: 0; background: transparent; padding: 10px 10px; border-radius: 10px; cursor: pointer; text-align: left;
}
.msg-row:hover { background: var(--row-hover); }
.msg-row[aria-current="true"] { background: var(--row-active); }
.msg-row .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-row .when { font-size: .8em; color: var(--muted); }
.msg-row .subj, .msg-row .snip { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-row .snip { font-size: .87em; color: var(--muted); }
.msg-row.unread .who, .msg-row.unread .subj { font-weight: 700; color: var(--unread); }
.msg-row .flags { font-size: .85em; }
.star { border: 0; background: none; cursor: pointer; font-size: 1.05em; color: #f1b300; padding: 0 2px; }
.empty { padding: 32px 16px; text-align: center; }
#more-btn { margin: 8px auto 12px; }

/* Reading */
.read-pane { padding: 16px 20px; }
.read-pane > .empty { height: 100%; display: grid; place-items: center; }
.reader-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; position: sticky; top: -16px; padding: 8px 0; background: var(--glass-strong); border-radius: 12px; z-index: 1; }
#reader-subject { font-size: 1.35rem; margin-bottom: 10px; overflow-wrap: anywhere; }
.mail { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; background: var(--glass-strong); }
.mail-head { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 700; background: linear-gradient(var(--accent-light), var(--accent-dark));
}
.mail-meta { flex: 1 1 180px; min-width: 0; font-size: .9em; }
.mail-meta .addr, .mail-meta .rcpt { font-size: .92em; }
.mail-meta .from { font-weight: 600; font-size: 1.05em; }
.mail-meta .addr, .mail-meta .rcpt { color: var(--muted); overflow-wrap: anywhere; }
.mail-date { color: var(--muted); font-size: .85em; white-space: nowrap; }
.mail-body { margin-top: 12px; }
.mail-body iframe { width: 100%; border: 0; min-height: 60px; background: #fff; border-radius: 8px; display: block; }
.images-note { margin-top: 10px; font-size: .88em; display: flex; gap: 8px; align-items: center; }
.att-list { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.att-list li button, .att-chip {
  display: inline-flex; gap: 6px; align-items: center; padding: .35em .8em; border-radius: 999px;
  border: 1px solid var(--line); background: var(--glass); cursor: pointer; font-size: .88em;
}
.mail.collapsed .mail-body, .mail.collapsed .att-list, .mail.collapsed .images-note { display: none; }
.mail.collapsed { cursor: pointer; }
.mail .snip { color: var(--muted); font-size: .9em; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Composer + settings */
dialog.composer { width: min(720px, calc(100vw - 32px)); padding: 0; color: var(--ink); background: var(--glass-strong); }
dialog::backdrop { background: rgba(6, 35, 61, .35); backdrop-filter: blur(2px); }
.composer form { padding: 18px 20px; display: grid; gap: 10px; }
.composer-head { display: flex; align-items: center; gap: 10px; }
.composer-head h2 { flex: 1; }
.composer .row { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; color: var(--muted); font-size: .9em; }
.composer .row input, .composer .row select { color: var(--ink); font-size: 1.05em; min-width: 0; width: 100%; }
.composer form > * { min-width: 0; }
.composer .stack { display: grid; gap: 6px; color: var(--muted); font-size: .9em; }
.composer textarea { width: 100%; resize: vertical; min-height: 180px; color: var(--ink); line-height: 1.45; }
.row-toggle { text-align: right; font-size: .85em; }
.composer-foot { display: flex; gap: 8px; align-items: center; }
.file-btn { cursor: pointer; }
.att-list .remove { border: 0; background: none; cursor: pointer; color: var(--danger); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  padding: .7em 1.2em; border-radius: 999px; color: #fff; z-index: 10;
  background: linear-gradient(var(--accent), var(--accent-dark)); box-shadow: var(--shadow);
  display: flex; gap: 12px; align-items: center;
}
.toast button { color: #fff; border: 0; background: rgba(255,255,255,.2); border-radius: 999px; padding: .2em .8em; cursor: pointer; }

/* Narrow screens: one pane at a time */
.only-narrow { display: none; }
@media (max-width: 860px) {
  .only-narrow { display: inline-block; }
  .topbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .me #me-name { display: none; }
  .layout { grid-template-columns: 1fr; padding: 0 8px 8px; gap: 8px; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 85vw); z-index: 5; border-radius: 0 var(--radius) var(--radius) 0; transform: translateX(-105%); transition: transform .2s; background: var(--glass-strong); }
  body.menu-open .sidebar { transform: none; }
  body.reading .list-pane { display: none; }
  body:not(.reading) .read-pane { display: none; }
  .read-pane { padding: 12px; }
  .composer .row { grid-template-columns: 56px 1fr; }
}
