/* Sign-in + inbox pages. Layout follows internetch_frontend (login card, two-pane inbox);
   --accent is set per domain by app.js. */
:root {
  --accent: #2f6fed;
  --ink: #2e3033;
  --ink-soft: #5c6470;
  --ink-faint: #939aa3;
  --line: #e1e3e5;
  --page: #f0f4f9;
  --panel: #f5f7fa;
  --card: #ffffff;
  --accent-wash: color-mix(in srgb, var(--accent) 7%, #ffffff);
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  height: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

h1,
h2,
p {
  margin: 0;
}

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

.boot {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--ink-faint);
}

/* ── brand ── */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
}

.mark {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  overflow: hidden;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.mark img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.button {
  flex: none;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.button:disabled {
  opacity: 0.6;
  cursor: default;
}

.button.icon {
  width: 38px;
  padding: 8px 0;
  font-size: 16px;
  line-height: 1.2;
}

.button.icon.is-busy span {
  display: inline-block;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── sign-in ── */
.login {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 32px;
  border-radius: var(--radius);
  background: var(--card);
}

.login-body {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  margin-top: 32px;
}

.login-intro {
  flex: 1;
  min-width: 0;
}

.login-intro h1 {
  font-size: 40px;
  font-weight: 400;
  line-height: 1.2;
}

.login-intro p {
  max-width: 34ch;
  margin-top: 16px;
  color: var(--ink-soft);
}

.login-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 460px;
  max-width: 100%;
}

.notice {
  padding: 12px 16px;
  border-radius: 12px;
  background: #fff4e5;
  color: #7a4a00;
  font-size: 14px;
}

.notice.banner {
  flex: none;
  margin: 0 24px 16px;
}

.provider {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 24px;
  border-radius: 12px;
}

.provider:hover {
  background: var(--accent-wash);
}

.provider-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

.provider-icon img {
  width: 32px;
  height: 32px;
}

.provider-text {
  display: flex;
  flex-direction: column;
}

.provider-text b {
  font-size: 16px;
}

.provider-text small {
  color: var(--ink-faint);
  font-size: 13px;
}

.login-footer {
  display: flex;
  gap: 24px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 32px;
  color: var(--ink-soft);
  font-size: 14px;
}

.login-footer a:hover,
.side-footer a:hover {
  color: var(--accent);
}

/* ── inbox shell ── */
.shell {
  display: flex;
  height: 100%;
  background: var(--card);
}

.side {
  display: flex;
  flex-direction: column;
  flex: none;
  width: 220px;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
}

.side nav {
  flex: 1;
  margin-top: 28px;
}

.nav-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 600;
}

.nav-item.is-active {
  background: var(--accent-wash);
  color: var(--accent);
}

.side-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink-faint);
  font-size: 13px;
}

.main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: none;
  height: 64px;
  padding: 0 24px;
}

.top h1 {
  font-size: 20px;
}

.account {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.account-email {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panes {
  display: flex;
  flex: 1;
  gap: 24px;
  min-height: 0;
  margin: 0 24px 24px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--panel);
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-radius: 8px;
  background: var(--card);
  overflow: hidden;
}

.list-pane {
  flex: 1 1 280px;
  min-width: 240px;
}

.detail-pane {
  flex: 2 1 320px;
}

.pane-tools {
  display: flex;
  gap: 12px;
  flex: none;
  padding: 20px;
}

.pane-tools input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  color: var(--ink);
}

.rows {
  flex: 1;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 16px 20px;
  border: 0;
  border-left: 4px solid transparent;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.row:hover,
.row.is-active {
  background: var(--accent-wash);
}

.row.is-active {
  border-left-color: var(--accent);
}

.row-subject {
  overflow: hidden;
  font-size: 16px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-from {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-date,
.detail-info time,
.detail-from small {
  color: var(--ink-faint);
  font-size: 13px;
}

.skeleton {
  height: 80px;
  margin: 0 20px 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, #eef1f5 25%, #f7f9fb 50%, #eef1f5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton,
  .button.icon.is-busy span {
    animation: none;
  }
}

.empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px;
  color: var(--ink-faint);
  text-align: center;
}

.back {
  display: none;
  align-self: flex-start;
  margin: 16px 0 0 16px;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: none;
  padding: 24px 24px 0;
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--accent);
  font-weight: 700;
}

.detail-from {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.detail-from b,
.detail-from small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-info {
  flex: none;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}

.detail-info h2 {
  margin-bottom: 8px;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.mail-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 0 20px;
  border: 0;
  background: var(--card);
}

/* ── narrow screens: one pane at a time, no sidebar ── */
@media (max-width: 900px) {
  body {
    background: var(--card);
  }

  .login {
    justify-content: space-between;
    padding: 0;
  }

  .login-card {
    padding: 20px;
    border-radius: 0;
  }

  .login-body {
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
  }

  .login-intro h1 {
    font-size: 28px;
  }

  .login-options {
    width: 100%;
  }

  .provider {
    gap: 16px;
    padding: 12px;
  }

  .provider-icon {
    width: 48px;
    height: 48px;
  }

  .login-footer {
    justify-content: flex-end;
    padding: 20px;
  }

  .side {
    display: none;
  }

  .top {
    padding: 0 16px;
  }

  .panes {
    margin: 0;
    padding: 0;
    border-radius: 0;
    background: var(--card);
  }

  .panes.show-list .detail-pane,
  .panes.show-detail .list-pane {
    display: none;
  }

  .back {
    display: block;
  }
}
