@charset "UTF-8";

:root {
  --canvas: #f3f3f0;
  --surface: #fff;
  --surface-muted: #f7f7f5;
  --ink: #181816;
  --muted: #74746d;
  --line: #e5e5df;
  --accent: #e8ff57;
  --danger: #a74747;
  --radius: 14px;
  --font: Inter, "SF Pro Text", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
.hidden { display: none !important; }

button:focus-visible, input:focus-visible, .message-item:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.wordmark {
  color: var(--ink);
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -.06em;
  text-decoration: none;
}
.wordmark span { color: #9cab22; }

.button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 650;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.button:active { transform: translateY(1px); }
.button-dark { color: #fff; background: var(--ink); }
.button-dark:hover { background: #343430; }
.button-quiet { border-color: var(--line); background: transparent; }
.button-quiet:hover, .button-outline:hover { background: var(--surface-muted); }
.button-outline { width: 100%; border-color: var(--line); background: var(--surface); }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(390px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 18px 60px rgba(25, 25, 20, .07);
}
.login-wordmark { display: inline-block; margin-bottom: 64px; }
.login-copy { margin-bottom: 28px; }
.login-copy h1 { margin: 5px 0 8px; font-size: 30px; letter-spacing: -.04em; }
.login-copy p:last-child { margin: 0; color: var(--muted); line-height: 1.5; }
.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.login-input, .custom-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface);
}
.login-input:focus, .custom-input:focus { border-color: #aaa; outline: none; }
.login-btn { width: 100%; margin-top: 12px; }

.page-shell {
  min-height: 100vh;
  padding: 14px;
}
.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
}
.top-actions { display: flex; align-items: center; gap: 20px; }
.connection-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-right: 6px;
  color: var(--muted);
  font-size: 12px;
}
.connection-status i { width: 7px; height: 7px; border-radius: 50%; background: #9c9c95; }
.connection-status[data-mode="online"] i { background: #5a9e63; }
.connection-status[data-mode="loading"] i { background: #c29c34; }
.connection-status[data-mode="offline"] { color: var(--danger); }
.connection-status[data-mode="offline"] i { background: var(--danger); }
.top-link {
  min-height: 32px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}
.top-link:hover { border-bottom-color: currentColor; color: var(--ink); }
#refreshBtn.is-loading { opacity: .45; pointer-events: none; }

.workspace-grid {
  height: calc(100vh - 86px);
  min-height: 580px;
  display: grid;
  grid-template-columns: 235px minmax(320px, 390px) minmax(440px, 1fr);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.sidebar, .mail-panel { border-right: 1px solid var(--line); }
.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: 18px 12px;
  background: var(--surface-muted);
}
.new-address {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--ink);
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 650;
}
.new-address:hover { color: #fff; background: var(--ink); }
.folder-list { display: grid; gap: 3px; margin-top: 22px; }
.folder-item {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}
.folder-item:hover { background: #ecece8; }
.folder-item.active { background: var(--surface); box-shadow: 0 1px 2px rgba(20,20,15,.05); font-weight: 650; }
.folder-item b::after { content: attr(data-count); font-size: 11px; font-weight: 500; color: var(--muted); }

.address-section { padding: 14px 10px 4px; border-top: 1px solid var(--line); }
.section-label, .eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.address-line { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.address-email { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; font-size: 12px; white-space: nowrap; }
.copy-button, .text-button {
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
}
.copy-button:hover, .text-button:hover { color: var(--ink); text-decoration: underline; }
.text-button { margin-top: 12px; }
.alias-form { display: none; margin-top: 14px; }
.alias-form.open { display: block; }
.alias-form .button { margin-top: 8px; }

.mail-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  background: var(--surface);
}
.panel-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 23px 20px 17px;
}
.panel-header h1 { margin: 5px 0 0; font-size: 25px; letter-spacing: -.04em; }
.panel-meta { display: flex; gap: 8px; color: var(--muted); font-size: 11px; }
.panel-meta span + span::before { content: "·"; margin-right: 8px; }
.search-box {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 14px 12px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-muted);
  color: var(--muted);
}
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box button { padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.message-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  border-top: 1px solid var(--line);
}
.message-item {
  min-height: 112px;
  padding: 17px 19px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  transition: background 120ms ease;
}
.message-item:hover { background: #fafaf8; }
.message-item.active { background: #f0f0eb; box-shadow: inset 3px 0 var(--ink); }
.message-item.empty { display: grid; place-content: center; height: 100%; border: 0; color: var(--muted); line-height: 1.6; text-align: center; cursor: default; }
.message-header { display: flex; justify-content: space-between; gap: 10px; }
.message-header strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 13px; white-space: nowrap; }
.message-time { flex: none; color: var(--muted); font-size: 10px; }
.message-from, .message-preview { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-from { margin-top: 7px; color: #54544f; font-size: 12px; }
.message-preview { margin-top: 8px; color: var(--muted); font-size: 12px; }
.mobile-otp, .mobile-detail-link { display: none; }

.detail-panel { min-width: 0; overflow: hidden; background: var(--surface); }
.detail-header {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
}
.detail-header button {
  display: none;
  padding: 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}
.detail-header p { margin: 0; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.message-detail { height: calc(100% - 56px); overflow-y: auto; }
.detail-empty { display: grid; place-items: center; }
.empty-reader-card { width: min(340px, 80%); text-align: center; }
.empty-reader-mark {
  width: 42px; height: 42px; display: grid; place-items: center; margin: 0 auto 20px;
  border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-weight: 750;
}
.empty-reader-card h2 { margin: 0 0 9px; font-size: 18px; letter-spacing: -.025em; }
.empty-reader-card p { margin: 0; color: var(--muted); line-height: 1.6; }
.message-sender-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
}
.sender-avatar {
  width: 36px; height: 36px; display: grid; place-items: center; flex: none;
  border-radius: 50%; background: var(--accent); font-size: 12px; font-weight: 800;
}
.sender-info { min-width: 0; display: grid; gap: 3px; }
.sender-info strong { overflow: hidden; text-overflow: ellipsis; font-size: 12px; white-space: nowrap; }
.sender-info span { color: var(--muted); font-size: 11px; }
.email-content-card { max-width: 760px; padding: 34px 42px 64px; }
.email-content-card h3 { margin: 0; font-size: clamp(22px, 2.3vw, 34px); letter-spacing: -.045em; line-height: 1.15; }
.email-date { margin: 10px 0 30px; color: var(--muted); font-size: 11px; }
.detail-body { color: #3e3e39; font-size: 14px; line-height: 1.75; }
.otp-card {
  margin: 0 0 30px;
  padding: 20px;
  border: 1px solid #d8df91;
  border-radius: 11px;
  background: #f9fcdc;
}
.otp-label { margin: 0 0 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.otp-code { margin: 0 0 16px; font: 700 30px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.otp-copy { min-height: 34px; padding: 0 12px; border: 1px solid #ccd477; border-radius: 7px; background: transparent; font-weight: 650; }

@media (max-width: 980px) {
  .workspace-grid { grid-template-columns: 205px minmax(300px, 1fr); }
  .detail-panel { display: none; }
  .detail-panel.has-message {
    position: fixed; inset: 14px; z-index: 10; display: block;
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 20px 70px rgba(20,20,15,.18);
  }
  .detail-panel.has-message .detail-header { gap: 14px; }
  .detail-panel.has-message .detail-header button { display: block; }
}

@media (max-width: 640px) {
  .page-shell { padding: 0; }
  .topbar { height: 56px; border-width: 0 0 1px; border-radius: 0; }
  .connection-status, #logoutBtn { display: none; }
  .workspace-grid {
    height: calc(100vh - 56px); min-height: 0; display: block;
    border: 0; border-radius: 0; overflow-y: auto;
  }
  .sidebar { display: block; padding: 12px; border: 0; }
  .sidebar-main { display: none; }
  .address-section { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
  .mail-panel { height: calc(100vh - 148px); border: 0; }
  .panel-header { padding: 18px 16px 14px; }
  .panel-header h1 { font-size: 23px; }
  .search-box { margin-inline: 12px; }
  .detail-panel.has-message { inset: 0; border: 0; border-radius: 0; }
  .email-content-card { padding: 26px 22px 50px; }
  .message-sender-bar { padding: 18px 22px; }
  .login-card { padding: 28px 24px; }
}
