/* Cxnverge dashboard theme: flat corporate light theme. Soft grey canvas,
   white surfaces, charcoal actions. Colour is reserved for semantic
   status (ok/warn pills) and third-party marks (the Google logo). */
:root {
  --bg: #f2f3f5;
  --card: #ffffff;
  --ink: #1d222a;
  --muted: #6a7482;
  --faint: #9aa3af;
  --line: #e4e7eb;
  --line-strong: #d6dbe1;
  --hover: #f5f6f8;
  --head: #f8f9fa;
  --brand: #2c333d;
  --brand-ink: #ffffff;
  --danger: #b23c3c;
  --ok: #22754c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
a { color: #3d4653; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 2px; }
a:hover { color: var(--ink); text-decoration-color: var(--faint); }
h1, h2, h3, h4 { letter-spacing: -0.01em; }

.nav {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.8rem;
  padding: 0.7rem 1.2rem; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 700; font-size: 1.12rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
/* Product mark: the Cx^n logo painted through a CSS mask so one SVG
   renders in any foreground colour. */
.brand-mark {
  width: 34px; height: 24px; flex: 0 0 auto; background-color: var(--ink);
  -webkit-mask: url('/static/img/cxn-logo.svg') no-repeat center / contain;
          mask: url('/static/img/cxn-logo.svg') no-repeat center / contain;
}
.brand-mark--foot { width: 28px; height: 20px; background-color: var(--muted); }
/* Consciousnx company mark used in attribution lines. */
.cinf-mark {
  display: inline-block; width: 30px; height: 17px; vertical-align: -3px;
  margin-right: 0.15rem; background-color: var(--muted);
  -webkit-mask: url('/static/img/consciousnx-logo.svg') no-repeat center / contain;
          mask: url('/static/img/consciousnx-logo.svg') no-repeat center / contain;
}
.nav nav { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.nav .tabs { margin-left: 0.8rem; margin-right: auto; display: flex; gap: 0.1rem; flex-wrap: wrap; flex: 1; min-width: 0; }
.tabs a {
  color: var(--muted); padding: 0.35rem 0.55rem; border-radius: 6px;
  cursor: pointer; font-size: 0.88rem; white-space: nowrap; text-decoration: none;
}
.tabs a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.tabs a.active { background: #e9ebee; color: var(--ink); font-weight: 600; }

/* Hamburger toggle: hidden on desktop, shown on small screens where the
   tab list collapses into a full-width column under the header. */
.nav-toggle {
  display: none; border: 1px solid var(--line); background: var(--card);
  border-radius: 8px; width: 38px; height: 38px; align-items: center;
  justify-content: center; color: var(--ink); cursor: pointer; margin-left: auto;
}
.nav-toggle:hover { background: var(--hover); }

@media (max-width: 920px) {
  .nav .tabs { display: none; }
  .nav > #signout { display: none; }
  .nav-toggle { display: inline-flex; }
  /* Opened menu: a full-width column of stretch-aligned rows. The desktop
     `.nav nav` rule sets align-items:center, gap and flex:1, which would
     otherwise center-shrink each link; override all of them here. */
  .nav.open .tabs {
    display: flex; flex-direction: column; align-items: stretch;
    order: 3; flex: none; width: 100%;
    margin: 0.15rem 0 0; padding-top: 0.5rem;
    border-top: 1px solid var(--line); gap: 2px;
  }
  .nav.open .tabs a {
    display: block; width: 100%; font-size: 0.95rem;
    padding: 0.6rem 0.65rem; border-radius: 8px; text-align: left;
  }
  .nav.open > #signout {
    display: block; order: 4; width: 100%; text-align: left;
    margin: 0.15rem 0 0; padding: 0.6rem 0.65rem; font-size: 0.95rem;
    border-top: 1px solid var(--line); border-radius: 0;
  }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  background: var(--brand); color: var(--brand-ink);
  padding: 0.5rem 0.9rem; border-radius: 8px; border: 0; cursor: pointer;
  font-size: 0.92rem; font-weight: 500; text-decoration: none;
}
.btn:hover { background: #3a424d; text-decoration: none; color: var(--brand-ink); }
.btn-lg { padding: 0.7rem 1.3rem; font-size: 1.02rem; }
.btn-link {
  background: none; border: 0; color: #4a5362; cursor: pointer;
  padding: 0.4rem; font-size: 0.9rem; text-decoration: none;
}
.btn-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.btn-danger { background: var(--danger); }

.hero { max-width: 760px; margin: 4.5rem auto; padding: 0 1.5rem; text-align: center; }
.hero h1 { font-size: 2.3rem; margin-bottom: 0.6rem; letter-spacing: -0.02em; }
.hero .lead { font-size: 1.12rem; color: var(--muted); }
.hero .cta { margin: 1.8rem 0; }
.features { list-style: none; padding: 0; margin: 2rem auto; max-width: 460px; text-align: left; }
.features li { padding: 0.5rem 0 0.5rem 1.6rem; position: relative; color: #3d4653; }
.features li::before { content: "\2713"; color: var(--muted); position: absolute; left: 0; font-weight: 700; }

.foot { text-align: center; color: var(--faint); padding: 2rem; font-size: 0.9rem; }
.foot-brand { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; color: var(--muted); margin-right: 0.9rem; }
.foot-by { color: var(--faint); }
.foot-by sup { font-size: 0.7em; }

.auth { max-width: 420px; margin: 3rem auto; padding: 0 1.2rem; }
.auth h1 { text-align: center; font-size: 1.5rem; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 1.2rem 1.3rem; display: flex; flex-direction: column; gap: 0.8rem;
  box-shadow: 0 1px 2px rgba(20, 26, 34, 0.04);
}
.grid2, .card.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.grid2 button[type="submit"], .card.grid2 button { grid-column: 1 / -1; }
.grid2 > h3, .grid2 > p, .card.grid2 > h3 { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; font-size: 0.82rem; color: var(--muted); gap: 0.3rem; font-weight: 500; }
input, select, textarea {
  padding: 0.55rem 0.65rem; border: 1px solid var(--line-strong); border-radius: 8px;
  font-size: 0.93rem; font-family: inherit; color: var(--ink); background: #fff;
  font-weight: 400;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--faint);
  box-shadow: 0 0 0 3px rgba(29, 34, 42, 0.07);
}
textarea { min-height: 120px; resize: vertical; }
.msg { color: var(--danger); min-height: 1.2em; margin: 0; }
.alt { color: var(--muted); font-size: 0.9rem; text-align: center; }
.muted { color: var(--muted); font-size: 0.9rem; }

.dash { max-width: 1000px; margin: 1.5rem auto; padding: 0 1.5rem; }
.dash h2 { margin-top: 0; }

/* Consistent page header: title, muted subtitle, bottom rule. */
.page-head { margin: 0 0 1.2rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--line); }
.page-head h2 { margin: 0; font-size: 1.32rem; }
.page-sub { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.9rem; max-width: 70ch; }

/* Pages are stacks of titled cards; give direct children rhythm. */
.dash > .card, .dash > form.card { margin: 0 0 1.1rem; }
#list-detail .card { margin: 0 0 1.1rem; }
#new-key .card { margin: 1.1rem 0 0; }
.card > h3 {
  margin: 0; padding-bottom: 0.7rem; border-bottom: 1px solid var(--line);
  font-size: 0.92rem; font-weight: 600; color: var(--ink);
}
.empty { color: var(--faint); font-size: 0.92rem; margin: 0; padding: 0.4rem 0; }

/* Card header row: title left, action controls right. */
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  flex-wrap: wrap; padding-bottom: 0.7rem; border-bottom: 1px solid var(--line);
}
.card-head h3 { margin: 0; padding: 0; border: 0; font-size: 0.92rem; font-weight: 600; }
.card-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* Two-panel layouts: .split is an even pair, .split-side is a narrow
   master list next to a wide detail/editor panel. */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; align-items: start; margin: 0 0 1.1rem; }
.split-side { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 1.1rem; align-items: start; margin: 0 0 1.1rem; }
.split-side.wide-side { grid-template-columns: 440px minmax(0, 1fr); }
@media (max-width: 950px) {
  .split, .split-side, .split-side.wide-side { grid-template-columns: 1fr; }
}

/* Master list rows (templates, links): clickable with inline actions. */
.list-rows { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 6px;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--hover); }
.list-row.sel { background: #e9edf3; }
.lr-main { flex: 1; min-width: 0; }
.lr-title { font-weight: 600; font-size: 0.9rem; }
.lr-sub { color: var(--muted); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Category headings inside the template-presets modal. */
.preset-cat {
  margin: 1.1rem 0 0.3rem; font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint);
}
.preset-cat:first-of-type { margin-top: 0.4rem; }

/* border-collapse: separate (not collapse) so the rounded corners work
   with overflow left visible; visible overflow keeps action-button
   tooltips from being clipped at the table edges. */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; margin: 1rem 0; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.tbl thead th:first-child { border-top-left-radius: 7px; }
.tbl thead th:last-child { border-top-right-radius: 7px; }
.tbl tr:last-child td:first-child { border-bottom-left-radius: 7px; }
.tbl tr:last-child td:last-child { border-bottom-right-radius: 7px; }
.col-actions { text-align: right; white-space: nowrap; width: 1%; }
.col-actions .icon-btn { margin-left: 0.25rem; }
.tbl th, .tbl td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.tbl th {
  background: var(--head); color: var(--muted); font-weight: 600;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.tbl tbody tr:hover td { background: var(--hover); }
.tbl tr:last-child td { border-bottom: 0; }

.stats { display: flex; gap: 1rem; flex-wrap: wrap; margin: 0 0 1.1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem 1.3rem; min-width: 150px; box-shadow: 0 1px 2px rgba(20, 26, 34, 0.04); }
.stat .num { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; }
.stat .lbl { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; }

/* Inbox: two-pane mailbox. The left panel lists messages with a pager,
   the right panel reads the selection and hosts the reply composer.
   Both panes scroll internally so the frame itself never scrolls. */
.dash-wide { max-width: 1500px; }
.mailbox {
  display: flex; height: calc(100vh - 140px); min-height: 480px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; box-shadow: 0 1px 2px rgba(20, 26, 34, 0.04);
}
.mail-list {
  width: 340px; min-width: 280px; flex: none; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: #fbfcfd;
}
.mail-tools {
  display: flex; gap: 0.5rem; padding: 0.7rem;
  border-bottom: 1px solid var(--line); background: var(--card);
}
.mail-tools select { flex: 1; min-width: 0; }
.icon-btn {
  flex: none; width: 37px; height: 37px; display: inline-flex; align-items: center;
  justify-content: center; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 7px; }
.icon-btn.danger:hover { color: var(--danger); border-color: #e0c9c9; background: #faf4f4; }
a.icon-btn { text-decoration: none; }

/* Flat CSS tooltips driven by data-tip; used on icon-only controls. */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%); background: #1d222a; color: #fff;
  padding: 0.22rem 0.5rem; border-radius: 6px; font-size: 0.72rem;
  font-weight: 400; white-space: nowrap; z-index: 60; pointer-events: none;
}
.modal-head [data-tip]:hover::after { bottom: auto; top: calc(100% + 6px); }
.mail-quota {
  padding: 0.35rem 0.85rem; border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 0.78rem; background: var(--card);
}
.mail-items { flex: 1; overflow-y: auto; }
.mail-note { padding: 1rem; color: var(--muted); margin: 0; }
.mail-note.err { color: var(--danger); }
.mail-row { padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.mail-row:hover { background: var(--hover); }
.mail-row.sel { background: #e9edf3; box-shadow: inset 3px 0 0 #5b6676; }
.mr-top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.mr-from {
  font-weight: 600; font-size: 0.88rem; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mr-date { flex: none; color: var(--muted); font-size: 0.75rem; }
.mr-subj { font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mr-snip { color: var(--muted); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-pager {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.45rem 0.6rem; border-top: 1px solid var(--line);
  background: var(--card); font-size: 0.85rem;
}
.mail-pager .btn-link { color: #5b6676; }
.mail-pager .btn-link[disabled] { color: #c3cad4; cursor: default; }

.mail-read { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-y: auto; }
.read-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 0.7rem; color: #c3cad4; font-size: 0.95rem;
}
.read-head { padding: 1.1rem 1.4rem 0.9rem; border-bottom: 1px solid var(--line); }
.read-subj { margin: 0 0 0.9rem; font-size: 1.15rem; font-weight: 600; overflow-wrap: anywhere; }
.read-meta { display: flex; gap: 0.8rem; align-items: flex-start; }
.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #e5e9ef; color: #5b6676; font-weight: 600;
}
.read-who { flex: 1; min-width: 0; }
.read-name { font-weight: 600; }
.read-addr { color: var(--muted); font-size: 0.85rem; }
.read-to { color: var(--muted); font-size: 0.8rem; overflow-wrap: anywhere; }
.read-date { flex: none; color: var(--muted); font-size: 0.8rem; }
.read-actions { display: flex; gap: 0.5rem; margin-top: 0.9rem; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 8px;
  color: var(--ink); padding: 0.45rem 0.85rem; font-size: 0.9rem; cursor: pointer;
}
.btn-ghost:hover { background: var(--hover); }
.read-body {
  padding: 1.1rem 1.4rem; white-space: pre-wrap; overflow-wrap: anywhere;
  color: #2a3140; font-size: 0.92rem;
}
.read-compose { padding: 0 1.4rem 1.4rem; }
.cp-attach-row { align-items: baseline; }
.cp-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.cp-chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 0.45rem;
  background: #eef1f5; border: 1px solid var(--line); border-radius: 999px;
  padding: 0.2rem 0.35rem 0.2rem 0.7rem; font-size: 0.8rem;
}
.chip .chip-size { color: var(--muted); }
.chip button {
  width: 18px; height: 18px; border: 0; border-radius: 50%; padding: 0;
  background: #dde2e9; color: #5b6676; line-height: 1; font-size: 0.8rem; cursor: pointer;
}
.chip button:hover { background: #cdd4dd; }

.keybox { background: #1d222a; color: #d6dbe1; padding: 0.8rem; border-radius: 8px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85rem; word-break: break-all; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 0.6rem 0; }
.pill {
  display: inline-block; padding: 0.12rem 0.55rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 500; background: #eceef1; color: #4a5362;
  border: 1px solid var(--line);
}
.pill.ok { background: #eef4f0; color: var(--ok); border-color: #d8e5dd; }
.pill.warn { background: #f8efef; color: var(--danger); border-color: #ecd9d9; }
.loading, .err { color: var(--muted); padding: 1rem 0; }
.err { color: var(--danger); }
.cp-status { margin-top: 0.6rem; font-size: 0.9rem; color: var(--muted); }
.cp-status.err { color: var(--danger); padding: 0; }

code { background: #eceef1; border-radius: 4px; padding: 0.05rem 0.3rem; font-size: 0.85em; }
.keybox code, code .keybox { background: transparent; padding: 0; }

/* Public link page (Linktree-style) and the dashboard links editor. */
.link-list { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 1.5rem; }
.link-item {
  display: block; text-align: center; background: var(--card);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 0.85rem 1rem;
  color: var(--ink); font-weight: 600; text-decoration: none;
}
.link-item:hover { background: var(--hover); text-decoration: none; }
.link-row { display: flex; gap: 0.5rem; align-items: center; }
.link-row input { flex: 1; min-width: 0; }

/* Campaign progress bar (flat grey). */
.progress { height: 8px; border-radius: 999px; background: #e5e9ef; overflow: hidden; }
.progress-fill { height: 100%; background: #5b6676; border-radius: 999px; transition: width .3s; }

/* Leads: clickable rows and the lead-detail modal. */
.lead-row { cursor: pointer; }
.modal-overlay {
  position: fixed; inset: 0; z-index: 50; padding: 1rem;
  background: rgba(20, 26, 34, 0.45);
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--card); border-radius: 10px; padding: 1.2rem 1.4rem;
  width: 100%; max-width: 640px; max-height: 85vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.8rem;
}
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h3, .modal h4 { margin: 0; }
.modal form { display: flex; flex-direction: column; gap: 0.8rem; }
.modal form.grid2 { display: grid; }
.modal p { margin: 0; }
.modal .tbl { margin: 0; }
.modal pre.keybox { margin: 0.5rem 0 0; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.modal details summary { cursor: pointer; color: #4a5362; font-size: 0.95rem; }
.tbl.kv td:first-child { color: var(--muted); width: 34%; }

.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: #1d222a; color: #fff; padding: 0.7rem 1.1rem; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.show { opacity: 1; }
.toast.err { background: var(--danger); }

/* Shared body editor: source pane left, sandboxed live preview right. */
.editor-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; align-items: stretch; }
.editor-split label { min-height: 100%; }
.body-input {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.85rem;
  min-height: 240px; flex: 1; tab-size: 2;
}
.preview-pane { display: flex; flex-direction: column; gap: 0.25rem; }
.preview-title { font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.preview-frame {
  flex: 1; width: 100%; min-height: 240px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff;
}

.pager { display: flex; align-items: center; gap: 0.8rem; margin: 0.6rem 0; }
.pager button[disabled] { color: var(--faint); cursor: default; text-decoration: none; }

.check { flex-direction: row; align-items: center; gap: 0.5rem; font-size: 0.95rem; color: var(--ink); }
.check input { width: auto; }

/* Card polish: consistent internal rhythm (settings, list detail, etc.). */
.card p { margin: 0; }
.card .tbl { margin: 0; }
.card .row { margin: 0; }
.card details summary { cursor: pointer; color: #4a5362; font-size: 0.95rem; }
.card details[open] summary { margin-bottom: 0.5rem; }
.card pre.keybox { margin: 0.5rem 0 0; overflow-x: auto; white-space: pre; }

/* Settings tab: masonry-style card columns. CSS multi-columns pack cards
   top-down so a short card does not reserve the full height of its row;
   the 300px column width collapses to a single column on narrow phones. */
.cards {
  columns: 300px; column-gap: 1rem; margin: 1rem 0;
}
.cards > .card {
  break-inside: avoid; display: inline-block; width: 100%;
  margin: 0 0 1rem; vertical-align: top;
}
.num-cell { font-weight: 700; text-align: right; }

@media (max-width: 800px) {
  .editor-split { grid-template-columns: 1fr; }
  .preview-frame { min-height: 180px; }
  .mailbox { flex-direction: column; height: auto; min-height: 0; }
  .mail-list { width: auto; min-width: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .mail-items { max-height: 45vh; }
  .mail-read { overflow: visible; }
}

/* Phone layout: tighter page padding, horizontally scrollable tables
   (the page itself never scrolls sideways), stacked form grids. */
@media (max-width: 700px) {
  .dash { margin: 1rem auto; padding: 0 0.8rem; }
  .tbl { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl th, .tbl td { white-space: nowrap; }
  .stats { gap: 0.6rem; }
  .stat { flex: 1 1 40%; min-width: 0; padding: 0.8rem 1rem; }
  .card { padding: 1rem; }
  .modal { padding: 1rem; max-height: 90vh; }
  .modal-overlay { padding: 0.6rem; }
  .read-head { padding: 0.9rem 1rem 0.8rem; }
  .read-body { padding: 0.9rem 1rem; }
  .read-compose { padding: 0 1rem 1rem; }
  .read-meta { flex-wrap: wrap; }
  .hero { margin: 2.5rem auto; }
  .hero h1 { font-size: 1.8rem; }
}

@media (max-width: 640px) {
  .grid2, .card.grid2, .modal form.grid2 { grid-template-columns: 1fr; }
}
