:root {
  --ink: #1a2332;
  --ink-2: #243044;
  --paper: #f3efe6;
  --card: #fffcf7;
  --line: #e5dccf;
  --forest: #2d6a4f;
  --forest-2: #1b4332;
  --clay: #c4783a;
  --clay-soft: #f3e1cf;
  --text: #1c1917;
  --muted: #6b6258;
  --danger: #b42318;
  --ok: #1b7a4a;
  --warn: #b45309;
  --shadow: 0 10px 30px rgba(26, 35, 50, 0.07);
  --side: 268px;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.app-body {
  font-family: "Manrope", sans-serif;
  background: var(--paper);
  color: var(--text);
  min-height: 100vh;
}
h1, h2, h3, .serif { font-family: "Fraunces", Georgia, serif; font-weight: 560; }
a { color: inherit; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--side);
  background: var(--ink);
  color: #f4f0e8;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  flex-shrink: 0;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 8px 22px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 16px;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(145deg, #c4783a, #2d6a4f);
  display: grid; place-items: center; font-weight: 700; color: #fff;
}
.brand b { display: block; font-size: 17px; letter-spacing: -.02em; }
.brand span { font-size: 11px; color: #b9b1a4; }
.nav { overflow: auto; flex: 1; padding-right: 4px; }
.nav a, .nav button.nav-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; background: none; border: 0;
  color: #d8d0c4; text-decoration: none; padding: 9px 10px;
  border-radius: 10px; font: inherit; cursor: pointer; font-size: 13.5px;
}
.nav a:hover, .nav button.nav-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: #2d6a4f; color: #fff; }
.nav .sub { padding-left: 18px; display: none; }
.nav .group.open .sub { display: block; }
.nav .chev { margin-left: auto; opacity: .5; font-size: 11px; }
.side-foot {
  margin-top: 12px; padding: 12px; border-radius: 12px;
  background: #243044; font-size: 12px; color: #cfc6b8;
}
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px 8px;
}
.topbar h1 { margin: 0; font-size: 28px; }
.top-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.content { padding: 12px 28px 40px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; font-size: 12px;
  background: var(--clay-soft); color: #7a4316;
}
.badge.ok { background: #d8f3dc; color: #1b4332; }
.badge.danger { background: #f8d7da; color: #842029; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.kpi .val { font-family: "Fraunces", serif; font-size: 28px; margin-top: 6px; }
.kpi .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.table-wrap { overflow: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.data th { color: var(--muted); font-weight: 600; font-size: 12px; }
.btn, button.btn, input[type=submit].btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--forest); color: #fff; border-radius: 11px;
  padding: 9px 14px; font: inherit; font-weight: 650; font-size: 13.5px;
}
.btn:hover { background: var(--forest-2); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.clay { background: var(--clay); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.row-actions { display: flex; gap: 6px; }
form.stack, .stack { display: grid; gap: 10px; }
label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 10px; padding: 9px 11px; font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs a, .tabs button {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font: inherit; text-decoration: none;
}
.tabs a.active, .tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.flash {
  margin: 0 28px 12px; padding: 12px 14px; border-radius: 12px;
  background: #fff3cd; border: 1px solid #ffe08a;
}
.flash.ok { background: #d8f3dc; border-color: #95d5b2; }
.flash.err { background: #f8d7da; border-color: #f1aeb5; }
.ai-box { background: linear-gradient(180deg, #fff8ee, #fffcf7); border-color: #ead3b6; }
.muted { color: var(--muted); }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.modal-bg {
  position: fixed; inset: 0; background: rgba(26,35,50,.45);
  display: none; align-items: center; justify-content: center; padding: 20px; z-index: 30;
}
.modal-bg.show { display: flex; }
.modal { background: var(--card); border-radius: 18px; width: min(640px, 100%); padding: 22px; max-height: 90vh; overflow: auto; }
.chat-app {
  height: calc(100dvh - 132px);
  min-height: 360px;
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
}
.chat-head { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #1a2332; color: #f4f0e8; }
.chat-head .muted { color: #b9b1a4; font-size: 12px; }
.chat-ava {
  width: 40px; height: 40px; border-radius: 14px;
  background: linear-gradient(145deg, #c4783a, #2d6a4f);
  display: grid; place-items: center; color: #fff; font-weight: 700; flex-shrink: 0;
}
.chat-ava.sm { width: 32px; height: 32px; border-radius: 10px; font-size: 13px; }
.chat-log { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 92%; }
.msg.user { margin-left: auto; flex-direction: row-reverse; }
.msg-body { padding: 12px 14px; border-radius: 16px; line-height: 1.55; background: #fff; border: 1px solid var(--line); }
.msg.user .msg-body { background: #1a2332; color: #fff; border-color: #1a2332; }
.chat-composer {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: #fffcf7;
}
.chat-composer textarea { min-height: 44px; max-height: 140px; margin: 0; }
.dots { display: flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: #c4783a; display: block; animation: bounce 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 50% { transform: translateY(-4px); opacity: .5; } }
.quote-line { grid-template-columns: 2fr 70px 70px 90px 70px 50px; gap: 8px; margin-bottom: 8px; }
.quote-line textarea { grid-column: 1 / -1; min-height: 48px; }
.side-backdrop { display: none; }
.cal { min-height: 620px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.product-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.product-card img { width: 100%; height: 140px; object-fit: cover; background: #eee7da; }
.product-card .pad { padding: 12px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.auth-body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 10% -10%, #2d6a4f55, transparent),
    radial-gradient(900px 400px at 100% 0%, #c4783a33, transparent),
    var(--paper);
  font-family: "Manrope", sans-serif;
}
.auth-wrap { display: grid; grid-template-columns: 1.1fr .9fr; min-height: 100vh; }
.hero { padding: 64px 72px; }
.hero h1 { font-size: 54px; line-height: 1.05; margin: 12px 0 18px; }
.hero p { font-size: 18px; color: var(--muted); max-width: 540px; }
.hero-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.hero-pills span { background: #fff; border: 1px solid var(--line); padding: 7px 11px; border-radius: 999px; font-size: 13px; }
.auth-card { display: grid; place-items: center; padding: 32px; }
.auth-box { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.mobile-toggle { display: none; }
.phone-field {
  display: flex; align-items: stretch;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff;
}
.phone-field span {
  display: grid; place-items: center;
  padding: 0 12px; background: #1a2332; color: #fff; font-weight: 700; font-size: 14px;
}
.phone-field input { border: 0; border-radius: 0; }
.ms {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}
.ms-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 34px; }
.ms-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #e8f5ee; color: #1b4332; border-radius: 999px;
  padding: 4px 10px; font-size: 12px;
}
.ms-chip button { border: 0; background: none; cursor: pointer; color: inherit; font-size: 14px; padding: 0; }
.ms input[type=search] { border: 0; padding: 8px 4px; outline: none; }
.ms-list { max-height: 180px; overflow: auto; border-top: 1px solid var(--line); margin-top: 6px; }
.ms-item { display: flex; gap: 8px; align-items: center; padding: 8px 6px; cursor: pointer; border-radius: 8px; }
.ms-item:hover { background: #f6f1e8; }
.ms-item.on { background: #e8f5ee; }
.pricing {
  border: 1px solid var(--line); border-radius: 18px; padding: 22px;
  background: linear-gradient(180deg, #fff, #fffcf7); position: relative;
}
.pricing.featured { border-color: #c4783a; box-shadow: 0 12px 30px rgba(196,120,58,.12); }
.pricing .tag { position: absolute; top: 14px; right: 14px; }
.pricing ul { padding-left: 18px; color: var(--muted); }
.pricing .price { font-family: Fraunces, serif; font-size: 36px; margin: 8px 0; }
.dash-notes-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.dash-notes-head a { font-size: 13px; text-decoration: none; }
.notes-row, .notes-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.note-card {
  border-radius: 18px;
  padding: 18px 18px 14px;
  min-height: 140px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(26,35,50,.06);
  position: relative;
  display: flex;
  flex-direction: column;
}
.note-card h3 { font-family: Fraunces, serif; font-size: 18px; margin: 0 0 8px; line-height: 1.25; }
.note-card p { margin: 0; color: #3d3a34; font-size: 14px; line-height: 1.5; flex: 1; white-space: pre-wrap; }
.note-card .note-meta { margin-top: 12px; font-size: 11px; color: #7a7368; }
.note-card .row-actions { margin-top: 10px; }
.note-pin {
  position: absolute; top: 12px; right: 12px;
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: #6b6258;
}
.note-card.sand { background: #f4ead6; }
.note-card.forest { background: #d7eadc; }
.note-card.clay { background: #f5dcc8; }
.note-card.sky { background: #d7e4f2; }
.note-card.lemon { background: #eaf3b4; }
html, body { overflow-x: hidden; }
.is-chat .content { padding-bottom: 8px; }
.is-chat .topbar h1 { font-size: 22px; }
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; transform: translateX(-110%); z-index: 40;
    transition: .2s; width: min(86vw, 300px);
    padding-top: calc(16px + env(safe-area-inset-top));
  }
  .sidebar.open { transform: none; }
  .side-backdrop.show {
    display: block; position: fixed; inset: 0; background: rgba(15,20,28,.5); z-index: 35;
  }
  body.nav-open { overflow: hidden; }
  .mobile-toggle { display: inline-flex; }
  .auth-wrap, .grid-2, .grid-4, .quote-line { grid-template-columns: 1fr; }
  .hero { padding: 36px 22px; }
  .hero h1 { font-size: 36px; }
  .content, .topbar { padding-left: 14px; padding-right: 14px; }
  .topbar { padding-top: calc(12px + env(safe-area-inset-top)); }
  .topbar h1 { font-size: 22px; }
  .who { display: none; }
  .flash { margin-left: 14px; margin-right: 14px; }
  .kpi .val { font-size: 22px; }
  .cal { min-height: 420px; }
  .row-actions { flex-wrap: wrap; }
  .modal { width: 100%; padding: 16px; border-radius: 16px 16px 0 0; }
  .modal-bg { align-items: flex-end; padding: 0; }
  .tabs { overflow: auto; flex-wrap: nowrap; }
  .chat-app { height: calc(100dvh - 118px); border-radius: 14px; }
  table.data { font-size: 13px; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr; }
  .btn { min-height: 42px; }
}
