/* LetsVisit brand board: deep teal, lime sun, warm white.
   Lime is a fill only — never a word or a line on the light ground. */
:root {
  --teal-900: #073F43;
  --teal-800: #205256;
  --teal-700: #396569;
  --lime-500: #CCEF68;
  --lime-600: #91ba5d;
  --lime-50: #f3f8df;
  --apno-50: #FAF9F4;
  --apno-100: #eef0eb;
  --apno-200: #dde3df;
  --kamen-600: #507778;
  --red-600: #a8361f;
  --ochre-50: #fbf2e4;
  --ochre-600: #9e5e1a;

  --surface: var(--apno-50);
  --raised: #ffffff;
  --sunken: var(--apno-100);
  --ink: var(--teal-900);
  --muted: var(--kamen-600);
  --line: var(--apno-200);
  --accent: var(--teal-700);

  --font-display: 'Bricolage Grotesque', 'Trebuchet MS', 'Segoe UI', sans-serif;
  --font-sans: 'Instrument Sans', 'Segoe UI', system-ui, sans-serif;
  --radius-card: 1rem;
  --radius-field: 0.625rem;
  --elev-card: 0 1px 2px rgb(6 21 15 / 0.04), 0 6px 16px -8px rgb(6 21 15 / 0.14);
  --elev-float: 0 2px 4px rgb(6 21 15 / 0.05), 0 12px 32px -8px rgb(6 21 15 / 0.22);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 15px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; margin: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--red-600); margin: 0; font-size: 14px; }

/* --- buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 999px; padding: 10px 18px;
  font: 600 15px var(--font-sans); color: var(--ink); background: transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-cta { background: var(--lime-500); color: var(--teal-900); }
.btn-cta:hover { background: #c1e65a; }
.btn-cta:active { background: var(--lime-600); }
.btn-cta:disabled { opacity: 0.6; cursor: progress; }
.btn-ghost { background: var(--raised); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ghost:hover { background: var(--sunken); }
.btn-danger { background: var(--raised); color: var(--red-600); box-shadow: inset 0 0 0 1px var(--line); }
.btn-danger:hover { background: #fbecea; }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--sunken); }
:focus-visible { outline: 2px solid var(--teal-700); outline-offset: 2px; }

/* --- sign in ---------------------------------------------------------- */
.login {
  min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(1200px 500px at 50% -10%, var(--lime-50), transparent 70%),
    var(--surface);
}
.login-card {
  width: min(400px, 100%); background: var(--raised); border-radius: 1.25rem;
  padding: 32px 28px; box-shadow: var(--elev-float); display: grid; gap: 14px;
}
.login-logo { height: 40px; width: auto; margin-bottom: 8px; }
.login-card h1 { font-size: 28px; }
.login-card p { margin: 0; }
.field { display: grid; gap: 6px; font-weight: 500; font-size: 14px; }
.field input {
  font: 16px var(--font-sans); color: var(--ink); padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-field); background: var(--raised);
}
.field input:focus { border-color: var(--teal-700); outline: none; box-shadow: 0 0 0 3px rgb(57 101 105 / 0.15); }

/* --- shell ------------------------------------------------------------ */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 20px 10px;
  background: var(--raised); box-shadow: 0 1px 0 var(--line);
  position: relative; z-index: 2;
}
.topbar-logo { height: 30px; width: auto; }
.topbar-tag {
  font: 600 12px var(--font-sans); text-transform: uppercase; letter-spacing: 0.08em;
  background: var(--teal-900); color: #fff; padding: 3px 9px; border-radius: 999px;
}
.search {
  flex: 1; max-width: 560px; margin-left: 24px; display: flex; align-items: center; gap: 8px;
  background: var(--sunken); border-radius: 999px; padding: 0 16px; color: var(--muted);
}
.search input { flex: 1; border: 0; background: transparent; font: 15px var(--font-sans); color: var(--ink); padding: 10px 0; min-width: 0; }
.search input:focus { outline: none; }
.search:focus-within { background: var(--raised); box-shadow: 0 0 0 2px var(--teal-700); }
.account { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.account-name { font-size: 14px; color: var(--muted); }

.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 240px minmax(320px, 420px) 1fr; }

.sidebar { padding: 18px 14px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.folders { display: grid; gap: 2px; }
.folder {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 999px;
  color: var(--ink); text-decoration: none; font-weight: 500; cursor: pointer; border: 0; background: none;
  font: 500 15px var(--font-sans); text-align: left; width: 100%;
}
.folder:hover { background: var(--sunken); }
.folder[aria-current="true"] { background: var(--teal-900); color: #fff; }
.folder .count { margin-left: auto; font-size: 13px; font-weight: 600; }
.folder[aria-current="true"] .count { color: var(--lime-500); }

.list-pane {
  background: var(--raised); border-radius: var(--radius-card) var(--radius-card) 0 0;
  margin-top: 14px; box-shadow: var(--elev-card); display: flex; flex-direction: column; min-height: 0;
}
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px 20px; }
.list-head h2 { font-size: 22px; }
.messages { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; flex: 1; }
.msg {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 12px 12px 12px 14px;
  border-radius: 0.75rem; cursor: pointer; position: relative;
}
.msg + .msg { margin-top: 2px; }
.msg:hover { background: var(--surface); }
.msg[aria-selected="true"] { background: var(--sunken); }
.msg .who { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg .when { font-size: 13px; color: var(--muted); white-space: nowrap; }
.msg .subj { grid-column: 1 / -1; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.unread .who, .msg.unread .subj { font-weight: 700; color: var(--ink); }
.msg.unread::before {
  content: ''; position: absolute; left: 4px; top: 50%; width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%; background: var(--teal-700);
}
.msg .tags { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: middle; }
.msg .tags svg { width: 14px; height: 14px; color: var(--muted); }
.list-empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--line); }

.read-pane { min-width: 0; min-height: 0; overflow-y: auto; padding: 14px 20px 0; }
.empty { height: 100%; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; }
.empty-mark { width: 72px; opacity: 0.25; }
.reader {
  background: var(--raised); border-radius: var(--radius-card) var(--radius-card) 0 0;
  box-shadow: var(--elev-card); padding: 16px 28px 28px; min-height: 100%;
  display: flex; flex-direction: column;
}
.reader-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.spacer { flex: 1; }
.r-subject { font-size: 26px; line-height: 1.2; margin: 20px 0 16px; overflow-wrap: anywhere; }
.r-meta { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.r-people { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--teal-900); color: var(--lime-500); font: 700 17px var(--font-display);
}
.notice {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between;
  background: var(--ochre-50); color: var(--ochre-600); border-radius: var(--radius-field);
  padding: 10px 14px; font-size: 14px; margin-bottom: 14px;
}
.attachments { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.attachments:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: var(--radius-field);
  background: var(--sunken); color: var(--ink); text-decoration: none; font-size: 14px; max-width: 100%;
}
.chip:hover { background: var(--apno-200); }
.chip .size { color: var(--muted); font-size: 12px; }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 0 0 4px; font-size: 16px; line-height: 1; }
.r-body { width: 100%; border: 0; flex: 1; min-height: 240px; background: #fff; }

/* --- composer --------------------------------------------------------- */
.composer {
  width: min(680px, calc(100% - 32px)); max-height: calc(100% - 48px); padding: 0; border: 0;
  border-radius: 1.25rem; box-shadow: var(--elev-float); color: var(--ink); background: var(--raised);
}
.composer::backdrop { background: rgb(4 35 37 / 0.35); }
.composer form { display: flex; flex-direction: column; }
.composer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 22px; }
.composer-head h2 { font-size: 20px; }
.row { display: flex; align-items: center; gap: 10px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.row span { width: 64px; color: var(--muted); font-size: 14px; }
.row input { flex: 1; min-width: 0; border: 0; padding: 11px 0; font: 15px var(--font-sans); color: var(--ink); background: transparent; }
.row input:focus { outline: none; }
.row:focus-within { border-bottom-color: var(--teal-700); }
.compose-body {
  min-height: 280px; border: 0; resize: vertical; padding: 16px 22px; font: 15px/1.6 var(--font-sans); color: var(--ink);
}
.compose-body:focus { outline: none; }
.composer .attachments { padding: 0 22px; }
.composer .error { padding: 0 22px 8px; }
.composer-foot { display: flex; gap: 10px; padding: 12px 22px 18px; border-top: 1px solid var(--line); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--teal-900); color: #fff; padding: 10px 18px; border-radius: 999px; box-shadow: var(--elev-float);
  font-weight: 500; z-index: 50; max-width: calc(100% - 32px);
}

.only-narrow { display: none !important; }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; justify-items: start; overflow-wrap: anywhere; }

/* --- narrower screens ------------------------------------------------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 210px minmax(280px, 360px) 1fr; }
  .account-name { display: none; }
}

@media (max-width: 820px) {
  .only-narrow { display: inline-grid !important; }
  .sidebar-foot.only-narrow { display: grid !important; }
  .account { display: none; }
  .topbar { padding-inline: 10px 14px; gap: 8px; }
  .topbar-logo { height: 24px; }
  .topbar-tag { display: none; }
  .search { margin-left: 4px; }
  .layout { display: block; position: relative; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(280px, 85vw); background: var(--raised); z-index: 10;
    box-shadow: var(--elev-float); transform: translateX(-105%); transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    padding-top: calc(18px + env(safe-area-inset-top, 0px));
  }
  .app.menu-open .sidebar { transform: none; }
  .app.menu-open::after { content: ''; position: fixed; inset: 0; background: rgb(4 35 37 / 0.3); z-index: 9; }
  .list-pane { margin: 0; border-radius: 0; height: 100%; box-shadow: none; }
  .read-pane { position: absolute; inset: 0; padding: 0; background: var(--surface); }
  .app:not(.reading) .read-pane { display: none; }
  .app.reading .list-pane { display: none; }
  .reader { border-radius: 0; box-shadow: none; padding: 10px 16px 24px; }
  .r-subject { font-size: 22px; }
  .composer { width: 100%; max-width: 100%; max-height: 100%; height: 100%; border-radius: 0; margin: 0; }
  .composer form { height: 100%; }
  .compose-body { flex: 1; }
}
