@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,650&family=Inter:wght@400;500;600&display=swap');

:root {
  --ink: #1b2230;
  --ink-2: #485263;
  --ink-3: #7a8494;
  --paper: #faf8f4;
  --card: #ffffff;
  --line: #e7e2d9;
  --accent: #c8553d;
  --accent-ink: #ffffff;
  --accent-soft: #f6e5df;
  --good: #2f7d5b;
  --good-soft: #e3f1ea;
  --warn-soft: #fbf1dc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27, 34, 48, .06), 0 8px 24px rgba(27, 34, 48, .06);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.55 var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 650; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.hidden { display: none !important; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 560px; }

/* Buttons and forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font: 600 .95rem var(--sans); padding: .75em 1.3em; border-radius: 999px;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  cursor: pointer; text-decoration: none; transition: transform .08s, background .15s;
}
.btn:hover { background: rgba(27, 34, 48, .05); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(.95); }
.btn.small { padding: .45em .9em; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.link { border: 0; padding: .3em .2em; color: var(--ink-2); font-weight: 500; }

input[type=email], input[type=text], select, textarea {
  font: inherit; color: inherit; width: 100%;
  padding: .75em .9em; border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ink-2); }
label { display: block; font-weight: 600; font-size: .9rem; margin: 0 0 .35em; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.notice { padding: 12px 16px; border-radius: 10px; background: var(--warn-soft); margin: 0 0 16px; }
.notice.good { background: var(--good-soft); }
.notice.error { background: var(--accent-soft); }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; padding: .25em .6em; border-radius: 999px; background: #eee9df; color: var(--ink-2); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

/* Top bar and menu */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(250, 248, 244, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.brand { font-family: var(--serif); font-weight: 650; font-size: 1.15rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand span { font-family: var(--sans); font-weight: 500; font-size: .85rem; color: var(--ink-3); margin-left: .4em; }
.menu-btn { width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; display: grid; place-content: center; gap: 5px; border-radius: 10px; }
.menu-btn:hover { background: rgba(27, 34, 48, .06); }
.menu-btn span { display: block; width: 22px; height: 2px; background: var(--ink); border-radius: 2px; }
.scrim { position: fixed; inset: 0; background: rgba(27, 34, 48, .35); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(340px, 88vw); background: var(--card);
  transform: translateX(100%); transition: transform .22s ease; z-index: 40; display: flex; flex-direction: column;
  box-shadow: -8px 0 32px rgba(27, 34, 48, .15);
}
body.menu-open .scrim { opacity: 1; pointer-events: auto; }
body.menu-open .drawer { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer nav { overflow-y: auto; padding: 10px 10px 20px; flex: 1; }
.drawer .group { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 16px 12px 6px; }
.drawer a, .drawer .soon, .drawer button.navlink {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%;
  padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font: 500 .95rem var(--sans);
  background: none; border: 0; text-align: left; cursor: pointer;
}
.drawer a:hover, .drawer button.navlink:hover { background: var(--paper); }
.drawer a.active { background: var(--accent-soft); color: var(--accent); }
.drawer .soon { color: var(--ink-3); cursor: default; }
.drawer .who { padding: 14px 18px; border-top: 1px solid var(--line); font-size: .85rem; color: var(--ink-3); overflow-wrap: anywhere; }

/* Landing */
.hero { padding: 72px 0 48px; }
.hero p.lede { font-size: 1.2rem; color: var(--ink-2); max-width: 640px; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 14px; }
section { padding: 40px 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.tool-card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s; }
a.tool-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(27, 34, 48, .06), 0 14px 32px rgba(27, 34, 48, .1); }
.tool-card h3 { margin: 0; }
.tool-card p { margin: 0; color: var(--ink-2); font-size: .95rem; flex: 1; }
.tool-card.soon { opacity: .7; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.footer { padding: 40px 0 60px; color: var(--ink-3); font-size: .9rem; border-top: 1px solid var(--line); margin-top: 30px; }

/* App pages */
.page { padding: 36px 0 60px; }
.streak { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 26px; }
.dots { display: flex; gap: 6px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: #eee9df; display: block; }
.dots i.on { background: var(--good); }
.celebrate { background: var(--good-soft); border: 1px solid #bfe0cf; border-radius: var(--radius); padding: 16px 20px; margin: 0 0 18px; }
.celebrate strong { font-family: var(--serif); font-size: 1.15rem; display: block; margin-bottom: 2px; }

/* Tool / chat */
.tool-page { display: flex; flex-direction: column; min-height: calc(100vh - 64px); }
.tool-head { padding: 24px 0 8px; }
.tool-head p { color: var(--ink-2); max-width: 720px; }
.thread { flex: 1; padding: 8px 0 24px; display: flex; flex-direction: column; gap: 16px; }
.msg { max-width: 760px; }
.msg.user { align-self: flex-end; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.assistant { align-self: flex-start; width: 100%; }
.msg.assistant .body { overflow-wrap: anywhere; }
.msg.assistant .body > *:last-child { margin-bottom: 0; }
.msg .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; padding: .3em .7em; border-radius: 999px; background: rgba(255, 255, 255, .15); }
.composer .chip { background: #eee9df; color: var(--ink); }
.chip button { border: 0; background: none; cursor: pointer; font-size: 1rem; line-height: 1; color: inherit; padding: 0; }
.doc { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin: 12px 0; box-shadow: var(--shadow); }
.doc-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fcfbf8; border-radius: var(--radius) var(--radius) 0 0; position: sticky; top: 64px; z-index: 5; }
.doc-bar strong { font-family: var(--serif); }
.doc-body { padding: 22px 26px; max-height: 70vh; overflow: auto; }
.doc-body h1 { font-size: 1.7rem; }
.doc-body h2 { font-size: 1.3rem; margin-top: 1.2em; }
.doc-body h3 { font-size: 1.05rem; margin-top: 1em; }
.typing { color: var(--ink-3); font-style: italic; }
.typing::after { content: ''; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
.composer-wrap { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--paper) 22%); padding: 18px 0 18px; }
.composer { background: #fff; border: 1.5px solid var(--line); border-radius: 18px; padding: 10px; box-shadow: var(--shadow); }
.composer textarea { border: 0; resize: none; min-height: 52px; max-height: 240px; padding: 8px 10px; }
.composer .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.composer .chips { padding: 0 6px 6px; display: flex; flex-wrap: wrap; gap: 6px; }

/* Admin */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 18px 0 20px; overflow-x: auto; }
.tabs button { border: 0; background: none; font: 600 .95rem var(--sans); color: var(--ink-3); padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-color: var(--accent); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.kpi b { display: block; font-family: var(--serif); font-size: 1.9rem; line-height: 1.1; }
.kpi span { color: var(--ink-3); font-size: .85rem; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; background: #fcfbf8; }
tr:last-child td { border-bottom: 0; }
.add-form { display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 10px; align-items: end; margin-bottom: 16px; }

@media (max-width: 720px) {
  .split { grid-template-columns: 1fr; }
  .hero { padding: 44px 0 24px; }
  .add-form { grid-template-columns: 1fr; }
  .doc-body { padding: 18px 16px; }
  .brand span { display: none; }
}
