/* ==========================================================
   every corporate ever - link inbox
   Aesthetic: convincing corporate banality, executed precisely.
   ========================================================== */

:root {
  --font-ui: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --bg: #f3f2f1;
  --pane: #ffffff;
  --rail: #faf9f8;
  --line: #e3e1df;
  --line-soft: #eeecea;

  --ink: #1b1a19;
  --ink-2: #4a4846;
  --ink-3: #7a7876;

  --brand: #17457a;
  --brand-2: #2f6fb0;
  --brand-ink: #ffffff;
  --accent-soft: #eaf1f8;

  --urgent: #b4243a;
  --ok: #1d7a4c;

  --row-h: 76px;
  --radius: 3px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.07), 0 4px 14px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
  --bg: #141312;
  --pane: #1f1e1d;
  --rail: #1a1918;
  --line: #34322f;
  --line-soft: #2a2826;

  --ink: #f2f0ee;
  --ink-2: #b8b4b0;
  --ink-3: #86827e;

  --brand: #0f2f55;
  --brand-2: #6aa6e0;
  --accent-soft: #1c2a3a;

  --urgent: #e2657a;
  --ok: #4bbd85;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 4px 14px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: -2px;
}

/* ---------- top bar ---------- */

.topbar {
  background: var(--brand);
  color: var(--brand-ink);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  height: 48px;
  flex: none;
}

.topbar__grid {
  width: 18px;
  height: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  opacity: 0.85;
  flex: none;
}
.topbar__grid i {
  background: currentColor;
  border-radius: 1px;
  aspect-ratio: 1;
}

.topbar__title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.search {
  flex: 1;
  min-width: 0;
  max-width: 520px;
  height: 30px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  cursor: not-allowed;
  transition: background 0.15s ease;
}
.search:hover { background: rgba(255, 255, 255, 0.22); }
.search svg { flex: none; opacity: 0.8; }
.search span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  margin-left: auto;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: var(--brand-2);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.themebtn {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.8;
}
.themebtn:hover { background: rgba(255, 255, 255, 0.16); opacity: 1; }

/* ---------- shell ---------- */

.shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
}

/* ---------- folder rail ---------- */

.rail {
  display: none;
  background: var(--rail);
  border-right: 1px solid var(--line);
  padding: 14px 8px;
  overflow-y: auto;
}

.rail__head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 10px 8px;
}

.folder {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 13px;
  cursor: default;
}
.folder[data-active] {
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 600;
}
.folder__count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.folder svg { flex: none; opacity: 0.75; }

/* ---------- list column ---------- */

.list {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--pane);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.list__head {
  flex: none;
  padding: 14px 16px 0;
  border-bottom: 1px solid var(--line);
}

.list__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.list__sub {
  margin: 2px 0 12px;
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}

.tabs {
  display: flex;
  gap: 20px;
}

.tab {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--ink-3);
  padding: 0 0 9px;
  cursor: pointer;
  position: relative;
  transition: color 0.15s ease;
}
.tab:hover { color: var(--ink-2); }
.tab[aria-selected="true"] {
  color: var(--ink);
  font-weight: 600;
}
.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--brand-2);
}

.rows {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ---------- a message row ---------- */

.row {
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px 16px 12px 8px;
  border-bottom: 1px solid var(--line-soft);
  border-left: 3px solid transparent;
  cursor: pointer;
  position: relative;
  animation: rowIn 0.42s cubic-bezier(0.2, 0.7, 0.3, 1) backwards;
}

@keyframes rowIn {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

.row:hover,
.row:focus-visible {
  background: var(--accent-soft);
  border-left-color: var(--brand-2);
}

.row__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  background: var(--brand-2);
}
.row[data-unread="false"] .row__dot { background: transparent; }

.row__body { min-width: 0; }

.row__top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.row__sender {
  font-size: 13px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row[data-unread="true"] .row__sender {
  color: var(--ink);
  font-weight: 600;
}

.row__time {
  margin-left: auto;
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}

.row__subject {
  margin: 1px 0 2px;
  font-size: 13.5px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}
.row[data-unread="true"] .row__subject { font-weight: 600; }
.row__subject span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row__preview {
  font-size: 12.5px;
  color: var(--ink-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
}

.chip {
  flex: none;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  padding: 1.5px 5px;
  border-radius: 2px;
  background: var(--accent-soft);
  color: var(--brand-2);
  border: 1px solid color-mix(in srgb, var(--brand-2) 30%, transparent);
}

.bang { color: var(--urgent); font-weight: 700; flex: none; }
.clip { color: var(--ink-3); flex: none; display: inline-flex; }

/* ---------- reading pane ---------- */

.reader {
  display: none;
  background: var(--pane);
  padding: 30px 34px;
  overflow-y: auto;
}

.reader__subject {
  margin: 0 0 14px;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.015em;
}

.reader__from {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.reader__av {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: var(--brand-2);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
}

.reader__name { font-weight: 600; font-size: 13.5px; }
.reader__addr { font-size: 12px; color: var(--ink-3); font-family: var(--font-mono); }
.reader__time { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-family: var(--font-mono); }

.reader__body {
  padding: 20px 0 26px;
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--ink-2);
  max-width: 58ch;
}

.reader__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-2);
  color: #fff;
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 18px;
  border-radius: var(--radius);
  transition: transform 0.12s ease, filter 0.15s ease;
}
.reader__cta:hover { filter: brightness(1.08); transform: translateY(-1px); }
.reader__cta:active { transform: none; }

.reader__sig {
  margin-top: 34px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  line-height: 1.75;
}

.reader--empty {
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--ink-3);
  gap: 6px;
}
.reader--empty strong { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.reader--empty p { margin: 0; font-size: 12.5px; max-width: 34ch; }

/* ---------- status bar ---------- */

.statusbar {
  flex: none;
  height: 26px;
  background: var(--rail);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.statusbar b { font-weight: 500; color: var(--ok); }
.statusbar .spacer { margin-left: auto; }
.statusbar .hide-sm { display: none; }

/* ---------- desktop ---------- */

@media (min-width: 900px) {
  .shell { grid-template-columns: 218px minmax(320px, 400px) 1fr; }
  .rail { display: block; }
  .reader { display: block; }
  .statusbar .hide-sm { display: inline; }
}

@media (min-width: 1400px) {
  .shell { grid-template-columns: 240px 430px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
