/* Nexus — simple, calm interface that works on phone and computer. */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #1d1d1b;
  --muted: #6b6a66;
  --line: #e3e1dc;
  --accent: #b5532a;
  --accent-ink: #ffffff;
  --ok: #2f7a4b;
  --warn: #a2401f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 8px rgba(0, 0, 0, .04);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5; font-size: 16px; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.9rem; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; }

.env-banner { background: #f2c94c; color: #3d2f00; text-align: center; font-weight: 600; padding: .35rem 1rem; font-size: .9rem; }

/* Top bar */
.topbar { background: var(--ink); color: #fff; display: flex; align-items: center; flex-wrap: wrap; padding: 0 1rem; min-height: 56px; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: .55rem; margin-right: 1.5rem; }
.brand-mark { background: var(--accent); width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; font-size: .95rem; }
.nav { display: flex; align-items: center; gap: .25rem; flex: 1; }
.nav a { color: #d8d6d0; text-decoration: none; padding: .45rem .7rem; border-radius: 6px; font-size: .95rem; }
.nav a:hover, .nav a.active { color: #fff; background: rgba(255, 255, 255, .1); }
.nav-spacer { flex: 1; }
.nav-logout { margin: 0; }
.nav-logout button { background: none; border: 1px solid rgba(255, 255, 255, .25); color: #d8d6d0; border-radius: 6px; padding: .4rem .7rem; cursor: pointer; font: inherit; font-size: .9rem; }
.nav-logout button:hover { color: #fff; border-color: #fff; }
.nav-toggle, .nav-burger { display: none; }

.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1rem 4rem; }
.page-head { margin-bottom: 1.75rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--muted); margin: 0 0 .4rem; font-weight: 600; }
.lead { color: var(--muted); font-size: 1.05rem; margin: 0; }
.section-title { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 2rem 0 .8rem; font-weight: 600; }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); position: relative; }
.card p { margin: 0; color: var(--muted); font-size: .93rem; }
.card-muted h3 { color: #4a4945; }
.card-link { text-decoration: none; color: inherit; transition: border-color .15s; }
.card-link:hover { border-color: var(--accent); }
.badge { display: inline-block; margin-bottom: .5rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; background: #efede8; color: var(--muted); padding: .15rem .5rem; border-radius: 99px; font-weight: 600; }
.empty-state { text-align: center; padding: 2.5rem 1.5rem; }
.empty-state p { max-width: 480px; margin: 0 auto; }

.callout { display: flex; gap: 1rem; align-items: center; justify-content: space-between; background: #fff4ec; border: 1px solid #f0cdb5; border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1.5rem; }

/* Buttons and forms (also styles the login pages) */
.btn, button[type=submit], input[type=submit] { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: .65rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover, button[type=submit]:hover { filter: brightness(.94); }
.nav-logout button[type=submit] { font-weight: 400; background: none; color: #d8d6d0; padding: .4rem .7rem; }
.nav-logout button[type=submit]:hover { filter: none; color: #fff; }
label { display: block; font-weight: 600; font-size: .9rem; margin: .9rem 0 .3rem; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input[type=checkbox] { width: auto; margin-right: .4rem; }
.errorlist, .errorlist li { color: var(--warn); list-style: none; padding: 0; margin: .3rem 0; font-size: .9rem; }
.helptext { color: var(--muted); font-size: .85rem; }

/* Login / password pages: centered card */
.entrance main.container { max-width: 440px; margin: 3rem auto; padding: 2rem 1.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.entrance main.container h1 { font-size: 1.5rem; }
.entrance main.container form button[type=submit] { width: 100%; margin-top: 1.2rem; }

.messages { margin-bottom: 1rem; }
.message { background: #eef6f0; border: 1px solid #cbe3d3; color: #1f4d30; padding: .7rem 1rem; border-radius: 8px; margin-bottom: .5rem; }
.message.error { background: #fbeeea; border-color: #f0cfc4; color: var(--warn); }

/* Tables */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: .65rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #faf9f7; }
tr:last-child td { border-bottom: 0; }
.small { font-size: .85rem; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 1.5rem; }
.tag { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 99px; font-weight: 600; vertical-align: middle; }
.tag-login { background: #e3f1e8; color: var(--ok); }
.tag-logout { background: #efede8; color: var(--muted); }
.tag-failed { background: #fbe6df; color: var(--warn); }

/* Company brain */
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; }
.tabs a { text-decoration: none; color: var(--muted); padding: .5rem .8rem; border-bottom: 2px solid transparent; font-weight: 600; font-size: .93rem; }
.tabs a.active, .tabs a:hover { color: var(--ink); border-bottom-color: var(--accent); }
.search-form { margin-bottom: 1.25rem; }
.search-form > input[type=text] { font-size: 1.05rem; padding: .75rem .9rem; }
.search-filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.search-filters select, .search-filters input { flex: 1 1 160px; width: auto; }
.results { display: flex; flex-direction: column; gap: .75rem; }
.result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; box-shadow: var(--shadow); }
.result h3 { margin: .35rem 0 .2rem; font-size: 1.02rem; }
.result h3 a { color: var(--ink); text-decoration: none; }
.result h3 a:hover { color: var(--accent); }
.result-meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.result-path { margin: 0 0 .3rem; word-break: break-all; }
.result-snippet { margin: 0; color: #3c3b38; font-size: .93rem; overflow-wrap: anywhere; }
.tag-project { background: #f6e3d9; color: var(--accent); text-decoration: none; }
.tag-kind-email { background: #e4ecf7; color: #2b4f80; }
.tag-kind-file { background: #efede8; color: #4a4945; }
.tag-kind-transcript { background: #ece4f5; color: #5a3a86; }
.tag-kind-card { background: #e3f1e8; color: var(--ok); }
.pager { display: flex; gap: .5rem; justify-content: space-between; margin-top: 1rem; }
.btn-quiet, button.btn-quiet[type=submit] { background: none; color: var(--accent); border: 1px solid var(--line); font-weight: 600; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0 0 1rem; font-size: .93rem; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.doc-body { border-top: 1px solid var(--line); padding-top: 1rem; font-size: .95rem; overflow-wrap: anywhere; }
.source-message { white-space: normal; margin-top: .4rem !important; overflow-wrap: anywhere; }
pre.key { background: #1d1d1b; color: #fff; padding: .7rem .9rem; border-radius: 8px; overflow-x: auto; user-select: all; margin: .5rem 0; }

/* Phone */
@media (max-width: 720px) {
  h1 { font-size: 1.5rem; }
  .container { padding: 1.25rem 1rem 3rem; }
  .nav-burger { display: flex; flex-direction: column; gap: 4px; margin-left: auto; padding: .6rem; cursor: pointer; }
  .nav-burger span { width: 22px; height: 2px; background: #fff; display: block; }
  .nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding: .5rem 0 1rem; }
  .nav-toggle:checked ~ .nav { display: flex; }
  .nav-spacer { display: none; }
  .nav-logout button { width: 100%; text-align: left; }
  .callout { flex-direction: column; align-items: flex-start; }
  .facts { grid-template-columns: 1fr; }
  .facts dd { margin-bottom: .4rem; }
  .entrance main.container { margin: 1.25rem 1rem; padding: 1.5rem 1.25rem; }
  /* Tables become stacked cards */
  table thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { border-bottom: 1px solid var(--line); padding: .5rem 0; }
  td { border: 0; padding: .25rem .9rem; }
  td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
}
