/* Skylight Mail. Modelled on a 2007-era desktop mail client: an Aero glass frame around a plain
   white client area with a command bar, folder pane, sortable message list, reading pane and
   status bar. System fonts only, so the page makes no third-party requests. */

:root {
  --sky-top: #1a6fb8;
  --sky-mid: #5aaee3;
  --sky-low: #c9e8f8;
  --hill-light: #8ccf45;
  --hill-dark: #3f8c1c;

  --frame: rgba(154, 196, 226, .62);
  --frame-edge: rgba(30, 50, 70, .55);
  --frame-shine: rgba(255, 255, 255, .55);

  --client: #ffffff;
  --panel: #f4f8fc;
  --bar-top: #fdfeff;
  --bar-bottom: #dfe9f5;
  --rule: #c5d2df;
  --rule-soft: #e3e9ef;

  --text: #1e1e1e;
  --text-soft: #5b6670;
  --link: #0a64c2;
  --unread: #00319c;

  --hover-top: #f5fbfe;
  --hover-bottom: #e1f2fc;
  --hover-edge: #b8d6fb;
  --select-top: #e3f2fd;
  --select-bottom: #c3e3fb;
  --select-edge: #84acdd;

  --button-edge: #707070;
  --focus: #3d7bad;
  --warn-bg: #fff8d7;
  --warn-edge: #e7cf72;
  --bad: #b3261e;
  --good: #2f7d18;

  --ui-font: "Segoe UI", Tahoma, "Lucida Grande", "Helvetica Neue", Arial, sans-serif;
  --read-font: Calibri, Candara, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: Consolas, "Lucida Console", Menlo, monospace;

  color-scheme: light;
}

[hidden] { display: none !important; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
html { height: 100%; box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }

body {
  height: 100%;
  margin: 0;
  padding: 18px max(16px, env(safe-area-inset-right, 0px)) 18px max(16px, env(safe-area-inset-left, 0px));
  overflow: hidden;
  font: 13px/1.4 var(--ui-font);
  color: var(--text);
  background-color: var(--sky-mid);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='a' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23a9e05e'/%3E%3Cstop offset='1' stop-color='%235aa52a'/%3E%3C/linearGradient%3E%3ClinearGradient id='b' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%238ccf45'/%3E%3Cstop offset='1' stop-color='%233f8c1c'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 130C260 60 520 90 760 125S1200 80 1440 115V320H0Z' fill='url(%23a)'/%3E%3Cpath d='M0 215C320 120 640 140 900 200S1280 175 1440 190V320H0Z' fill='url(%23b)'/%3E%3C/svg%3E"),
    radial-gradient(70% 55% at 78% 8%, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 45%, var(--sky-low) 80%);
  background-repeat: no-repeat;
  background-size: 100% 34vh, auto, auto;
  background-position: bottom, 0 0, 0 0;
}

button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--link); }
:focus-visible { outline: 1px dotted #000; outline-offset: 1px; }

/* ---------- glass frame ---------- */
.window {
  display: flex;
  flex-direction: column;
  padding: 0 7px 7px;
  border: 1px solid var(--frame-edge);
  border-radius: 7px 7px 4px 4px;
  background:
    linear-gradient(180deg, var(--frame-shine) 0, rgba(255, 255, 255, .12) 28px, rgba(255, 255, 255, 0) 29px),
    var(--frame);
  -webkit-backdrop-filter: blur(14px) saturate(1.6);
  backdrop-filter: blur(14px) saturate(1.6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45), 0 10px 32px rgba(0, 25, 50, .45);
}
.caption {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 4px;
  color: #000;
  text-shadow: 0 0 9px #fff, 0 0 4px #fff;
  white-space: nowrap;
  overflow: hidden;
}
.caption img { width: 16px; height: 16px; flex: none; }
.caption h1 { margin: 0; font-size: 13px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.client {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #6d8297;
  background: var(--client);
}

/* ---------- buttons and fields ---------- */
.button {
  min-width: 75px;
  min-height: 23px;
  padding: 1px 12px;
  border: 1px solid var(--button-edge);
  border-radius: 3px;
  background: linear-gradient(180deg, #f2f2f2 0%, #ebebeb 49%, #dddddd 50%, #cfcfcf 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .75);
  cursor: default;
}
.button:hover { border-color: #3c7fb1; background: linear-gradient(180deg, #eaf6fd 0%, #d9f0fc 49%, #bee6fd 50%, #a7d9f5 100%); }
.button:active { border-color: #2c628b; background: linear-gradient(180deg, #e5f4fc 0%, #c4e5f6 49%, #98d1ef 50%, #68b3db 100%); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25); }
.button:disabled { color: #838383; border-color: #adb2b5; background: #f4f4f4; box-shadow: none; }
.button.default { border-color: #3399ff; box-shadow: inset 0 0 0 1px #99ccff; }
.button.danger { color: var(--bad); }

.field {
  width: 100%;
  min-height: 23px;
  padding: 2px 5px;
  border: 1px solid #abadb3;
  border-top-color: #8e8f8f;
  border-radius: 2px;
  background: #fff;
}
.field:hover { border-color: #5794bf; border-top-color: #3d7bad; }
.field:focus { outline: none; border-color: var(--focus); border-top-color: #2c628b; }

/* ---------- command bar ---------- */
.commands {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 34px;
  padding: 3px 6px;
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, var(--bar-top) 0%, #eef3fa 50%, var(--bar-bottom) 100%);
}
.cmd {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: none;
  white-space: nowrap;
  cursor: default;
}
.cmd svg { width: 16px; height: 16px; flex: none; }
.cmd:hover:not(:disabled) { border-color: var(--hover-edge); background: linear-gradient(180deg, var(--hover-top), var(--hover-bottom)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8); }
.cmd:active:not(:disabled) { border-color: var(--select-edge); background: linear-gradient(180deg, var(--select-bottom), var(--select-top)); }
.cmd:disabled { color: #9aa3ab; }
.cmd:disabled svg { filter: grayscale(1); opacity: .5; }
.sep { width: 1px; height: 20px; margin: 0 4px; background: var(--rule); box-shadow: 1px 0 0 #fff; }
.search {
  display: flex;
  align-items: center;
  margin-left: auto;
  width: 230px;
  height: 23px;
  border: 1px solid #abadb3;
  border-top-color: #8e8f8f;
  border-radius: 2px;
  background: #fff;
}
.search:focus-within { border-color: var(--focus); }
.search input { flex: 1; min-width: 0; height: 100%; padding: 0 5px; border: 0; background: none; }
.search input:focus { outline: none; }
.search svg { width: 14px; height: 14px; margin: 0 6px 0 2px; flex: none; color: #5a6f82; }
.folder-select { display: none; }

/* ---------- panes ---------- */
.main { flex: 1; min-height: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr); }

.folders {
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--rule);
  background: var(--panel);
}
.folders h2 {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 7px 8px 4px;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folders h2 svg { width: 14px; height: 14px; flex: none; }
.folders ul { margin: 0; padding: 0 4px 8px 12px; list-style: none; }
.folder {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: none;
  text-align: left;
  white-space: nowrap;
  cursor: default;
}
.folder svg { width: 16px; height: 16px; flex: none; }
.folder:hover { border-color: var(--hover-edge); background: linear-gradient(180deg, var(--hover-top), var(--hover-bottom)); }
.folder[aria-current="true"] { border-color: var(--select-edge); background: linear-gradient(180deg, var(--select-top), var(--select-bottom)); }
.folder .n { color: var(--unread); font-weight: 600; }
.folder.has-unread .name { font-weight: 600; }

.mail { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(120px, 42%) minmax(0, 1fr); }

/* message list */
.list { min-height: 0; display: flex; flex-direction: column; border-bottom: 1px solid #a0afc3; }
.cols, .row { display: grid; grid-template-columns: 22px 18px minmax(120px, 28%) minmax(0, 1fr) 132px; align-items: center; }
.cols {
  height: 23px;
  border-bottom: 1px solid #d5d5d5;
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 40%, #f1f2f4 41%, #eaecef 100%);
}
.cols > * {
  height: 100%;
  padding: 0 6px;
  border: 0;
  border-right: 1px solid #e3e5e8;
  background: none;
  color: #4c607a;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}
.cols > button:hover { background: linear-gradient(180deg, #f3f9fd, #d8ecf9); }
.cols .icon-col { display: grid; place-items: center; padding: 0; }
.cols .icon-col svg { width: 12px; height: 12px; }
.cols [aria-sort="ascending"]::after { content: " \25B4"; }
.cols [aria-sort="descending"]::after { content: " \25BE"; }

.rows { flex: 1; min-height: 0; margin: 0; padding: 0; list-style: none; overflow: auto; }
.rows:empty { display: none; }
.row {
  width: 100%;
  height: 22px;
  border: 1px solid transparent;
  background: none;
  text-align: left;
  cursor: default;
}
.row > span { padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .glyph { display: grid; place-items: center; padding: 0; }
.row svg { width: 14px; height: 14px; }
.row .star svg { width: 12px; height: 12px; }
.row:hover { border-color: var(--hover-edge); background: linear-gradient(180deg, var(--hover-top), var(--hover-bottom)); }
.row[aria-current="true"] { border-color: var(--select-edge); background: linear-gradient(180deg, var(--select-top), var(--select-bottom)); }
.row.unread { font-weight: 600; color: var(--unread); }
.row .date { font-variant-numeric: tabular-nums; }
.row.undecryptable { color: var(--bad); font-style: italic; }
.row-two { display: none; }

.empty { margin: 18px 0; color: var(--text-soft); text-align: center; }

/* reading pane */
.reader { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.reader-empty { margin: auto; color: var(--text-soft); }
.reader-head {
  padding: 8px 12px 7px;
  border-bottom: 1px solid #cbd8e6;
  background: linear-gradient(180deg, #f5f9fd, #e3edf7);
}
.reader-head h2 { margin: 0 0 3px; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.reader-head dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 8px; margin: 0; font-size: 12px; }
.reader-head dt { color: var(--text-soft); }
.reader-head dd { margin: 0; overflow-wrap: anywhere; }
.back { display: none; }
.verify { display: flex; align-items: center; gap: 5px; }
.verify svg { width: 14px; height: 14px; flex: none; }
.verify.good { color: var(--good); }
.verify.bad { color: var(--bad); font-weight: 600; }
.verify .fp { font-family: var(--mono); font-size: 11px; color: var(--text-soft); }
.infobar { padding: 4px 12px; font-size: 12px; border-bottom: 1px solid var(--warn-edge); background: var(--warn-bg); }
.reader-body { flex: 1; min-height: 0; overflow: auto; margin: 0; padding: 12px 14px 20px; font: 15px/1.5 var(--read-font); white-space: pre-wrap; overflow-wrap: anywhere; }

/* status bar */
.statusbar {
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 23px;
  border-top: 1px solid var(--rule);
  background: linear-gradient(180deg, #f3f6fa, #e2e9f1);
  font-size: 12px;
  color: #33404c;
}
.statusbar > span { padding: 0 8px; border-right: 1px solid #c9d3dd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.statusbar .grow { flex: 1; min-width: 0; }
.statusbar .lock { display: inline-flex; align-items: center; gap: 4px; }
.statusbar svg { width: 12px; height: 12px; }
.statusbar > span:last-child { border-right: 0; }

/* ---------- dialogs ---------- */
dialog {
  padding: 0 7px 7px;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  border: 1px solid var(--frame-edge);
  border-radius: 7px 7px 4px 4px;
  color: var(--text);
  background:
    linear-gradient(180deg, var(--frame-shine) 0, rgba(255, 255, 255, .12) 28px, rgba(255, 255, 255, 0) 29px),
    rgba(154, 196, 226, .9);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45), 0 12px 40px rgba(0, 25, 50, .5);
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(0, 0, 0, .12); }
.compose { width: 680px; height: min(560px, calc(100dvh - 24px)); }
.compose .client { min-height: 0; }
.compose-fields { display: grid; grid-template-columns: 62px minmax(0, 1fr); align-items: center; gap: 5px 6px; padding: 8px 10px; border-bottom: 1px solid var(--rule-soft); background: var(--panel); }
.compose-fields label { text-align: right; color: var(--text-soft); }
.compose-fields .from { padding: 0 6px; overflow-wrap: anywhere; }
.compose textarea { flex: 1; min-height: 160px; padding: 8px 10px; border: 0; resize: none; font: 15px/1.5 var(--read-font); }
.compose textarea:focus { outline: none; }
.compose-note { display: flex; align-items: center; gap: 5px; padding: 0 10px; min-height: 23px; border-top: 1px solid var(--rule-soft); background: var(--panel); font-size: 12px; color: var(--text-soft); }
.compose-note svg { width: 12px; height: 12px; flex: none; }
.error { color: var(--bad); }

.prefs { width: 460px; }
.prefs .client { overflow: auto; padding: 12px; gap: 12px; }
fieldset { margin: 0; padding: 6px 10px 10px; border: 1px solid #d5dfe5; border-radius: 3px; }
legend { padding: 0 3px; color: #1d5b9c; }
fieldset p { margin: 2px 0 8px; }
.form-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 8px; }
.form-grid label { white-space: nowrap; }
.actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 8px; }
.actions .error { margin-right: auto; font-size: 12px; }
.fingerprint { font-family: var(--mono); font-size: 13px; letter-spacing: .02em; word-spacing: .3em; }
.dialog-buttons { display: flex; justify-content: flex-end; padding: 8px 0 0; }

/* ---------- sign in / create account ---------- */
.auth-body { display: grid; place-items: center; overflow: auto; }
.auth { width: min(430px, 100%); }
.auth .client { padding: 16px 18px 14px; }
.auth h2 { margin: 0 0 10px; font-size: 15px; font-weight: 400; color: #1d5b9c; }
.auth .form-grid { grid-template-columns: 116px minmax(0, 1fr); }
.auth .form-grid label { text-align: right; }
.auth .check { grid-column: 2; display: flex; align-items: center; gap: 6px; }
.auth .bot-check { grid-column: 1 / -1; min-height: 65px; margin-top: 4px; }
.auth .hint { grid-column: 2; margin-top: -3px; font-size: 11px; color: var(--text-soft); }
.auth .error { min-height: 18px; margin: 8px 0 0; }
.auth .actions { margin-top: 4px; }
.auth .actions a { margin-right: auto; }
.auth .note { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--rule-soft); font-size: 12px; color: var(--text-soft); }
.warnbox { display: flex; gap: 8px; margin: 0 0 12px; padding: 7px 9px; border: 1px solid var(--warn-edge); background: var(--warn-bg); font-size: 12px; }
.warnbox svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }

.app { height: 100%; max-width: 1360px; margin: 0 auto; }

/* ---------- narrow screens ---------- */
@media (max-width: 760px) {
  body { padding: 8px; font-size: 14px; }
  .window { padding: 0 4px 4px; }
  .cmd .label { display: none; }
  .cmd { padding: 0 7px; }
  .commands { flex-wrap: wrap; row-gap: 4px; justify-content: space-between; }
  .commands .sep { display: none; }
  .search { order: 1; flex: 1 0 100%; width: auto; height: 28px; margin: 0; }
  .folder-select { display: block; width: auto; max-width: 42%; height: 26px; margin: 4px 6px; }
  .main { grid-template-columns: minmax(0, 1fr); }
  .folders { display: none; }
  .mail { grid-template-rows: minmax(0, 1fr); }
  .app[data-view="list"] .reader { display: none; }
  .app[data-view="reader"] .list { display: none; }
  .list { border-bottom: 0; }
  .cols { display: none; }
  .row { display: block; height: auto; padding: 6px 8px; border-width: 0 0 1px; border-bottom-color: var(--rule-soft); }
  .row > span:not(.row-two) { display: none; }
  .row > .row-two { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 8px; padding: 0; }
  .row-two span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .row-two .subject { grid-column: 1 / -1; }
  .row-two .date { color: var(--text-soft); font-weight: 400; }
  .back { display: inline-flex; }
  .statusbar .who { display: none; }
  .compose, .prefs { width: 100%; }
  .auth .form-grid { grid-template-columns: minmax(0, 1fr); }
  .auth .form-grid label { text-align: left; }
  .auth .check, .auth .hint { grid-column: 1; }
}
