:root {
  --paper: #f5f0e8;
  --paper-2: #efe8dd;
  --card: #fffdf9;
  --ink: #221c18;
  --ink-2: #4a413a;
  --muted: #857a70;
  --faint: #b3a89d;
  --line: #e6ddd1;
  --line-2: #efe8de;
  --terra: #c0533a;
  --terra-d: #a2432d;
  --terra-l: #f7e6df;
  --sage: #5b7a60;
  --sage-l: #e5eee5;
  --gold: #c08f35;
  --gutter: clamp(14px, 2.4vw, 40px);
  --strip: 60px;
}
* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; }
body { font-family: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", sans-serif; color: var(--ink); background: var(--paper); font-size: 16px; line-height: 1.75; letter-spacing: .02em; -webkit-font-smoothing: antialiased; touch-action: manipulation; }
h1, h2, h3, h4 { margin: 0; line-height: 1.5; letter-spacing: .04em; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
input, select, textarea { font-size: 16px; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.t { font-feature-settings: "tnum" 1; }

/* ============ 上の帯 ============ */
.strip { position: sticky; top: 0; z-index: 40; height: var(--strip); display: flex; align-items: center; gap: 18px; padding: 0 var(--gutter); background: rgba(255, 253, 249, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark { width: 36px; height: 36px; border-radius: 10px; background: var(--terra); color: #fff; display: grid; place-items: center; font-family: "Shippori Mincho", serif; font-weight: 700; font-size: 20px; }
.brand b { display: block; font-size: 16px; line-height: 1.2; letter-spacing: .08em; }
.brand small { font-size: 12.5px; color: var(--muted); }
.mode { display: flex; gap: 4px; margin-left: clamp(8px, 2vw, 32px); background: var(--paper-2); padding: 4px; border-radius: 12px; }
.mode button { border: none; background: none; padding: 6px 16px; border-radius: 9px; font-weight: 700; font-size: 14.5px; color: var(--muted); white-space: nowrap; }
.mode button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(60, 40, 20, .12); }
.strip-note { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ============ チャット（3列） ============ */
.chat-page { display: grid; grid-template-columns: clamp(280px, 22vw, 360px) minmax(0, 1fr) clamp(300px, 24vw, 400px); height: calc(100vh - var(--strip)); height: calc(100svh - var(--strip)); }
.prof { border-right: 1px solid var(--line); padding: clamp(14px, 1.4vw, 22px); overflow-y: auto; display: flex; flex-direction: column; gap: 18px; background: var(--paper); }
.prof-photo { position: relative; margin: 0; border-radius: 20px; overflow: hidden; aspect-ratio: 4 / 4.3; flex: none; box-shadow: 0 18px 40px rgba(80, 50, 20, .15); }
.prof-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; display: block; }
.prof-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(30, 18, 10, .72), rgba(30, 18, 10, 0) 45%); }
.prof-photo figcaption { position: absolute; left: 18px; bottom: 14px; z-index: 2; color: #fff; }
.prof-photo figcaption small { display: block; font-size: 13px; opacity: .9; }
.prof-photo figcaption b { font-family: "Shippori Mincho", serif; font-size: clamp(24px, 1.7vw, 30px); letter-spacing: .12em; line-height: 1.3; }
.quote { margin: 0; font-family: "Shippori Mincho", serif; font-weight: 600; font-size: clamp(16px, 1.05vw, 18px); line-height: 1.9; color: var(--ink-2); padding-left: 16px; border-left: 3px solid var(--terra); }
.prof-sec h3 { font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 7px; margin-bottom: 10px; }
.prof-sec h3 svg { color: var(--terra); }
.memo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.memo div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.memo b { display: block; font-size: 24px; line-height: 1.3; font-feature-settings: "tnum" 1; }
.memo b small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.memo span { font-size: 13px; color: var(--muted); }
.memo-add { margin-top: 8px; font-size: 13.5px; color: var(--sage); display: flex; align-items: center; gap: 6px; font-weight: 700; }
.ng-mini { margin: 0 0 8px; padding: 0; list-style: none; display: grid; gap: 6px; }
.ng-mini li { font-size: 14px; color: var(--ink-2); padding-left: 18px; position: relative; line-height: 1.6; }
.ng-mini li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 8px; height: 2px; background: var(--terra); border-radius: 2px; }
.link { border: none; background: none; padding: 0; color: var(--terra-d); font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 5px; }
.link svg { width: 15px; height: 15px; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--card); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px clamp(16px, 2vw, 28px); border-bottom: 1px solid var(--line-2); }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.who b { display: block; font-size: 17px; line-height: 1.35; }
.who b span { font-size: 12px; background: var(--terra); color: #fff; padding: 1px 7px; border-radius: 6px; vertical-align: 2px; margin-left: 2px; letter-spacing: .08em; }
.who small { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #4caf72; box-shadow: 0 0 0 3px rgba(76, 175, 114, .2); display: inline-block; }
.ghost { margin-left: auto; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 6px 12px; font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.ghost:hover { background: var(--paper); }
.msgs { flex: 1; overflow-y: auto; padding: clamp(18px, 2vw, 30px) clamp(16px, 3vw, 56px) 30px; display: flex; flex-direction: column; gap: 22px; scroll-behavior: smooth; }
.msg { display: flex; gap: 12px; max-width: min(760px, 100%); }
.msg .av { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; margin-top: 2px; }
.msg.ai .bubble { background: var(--paper); border: 1px solid var(--line-2); border-radius: 4px 20px 20px 20px; padding: 14px 18px; }
.msg.user { margin-left: auto; }
.msg.user .bubble { background: var(--ink); color: #fff; border-radius: 20px 4px 20px 20px; padding: 11px 18px; }
.msg.sys { margin: 0 auto; }
.msg.sys .bubble { background: var(--terra-l); color: var(--terra-d); border-radius: 12px; padding: 8px 14px; font-size: 14.5px; }
.bubble p + p { margin-top: 8px; }
.bubble ul { margin: 8px 0; padding-left: 1.3em; }
.bubble li + li { margin-top: 4px; }
.bubble b { color: var(--ink); background: linear-gradient(transparent 62%, rgba(192, 143, 53, .28) 62%); }
.cite { border: none; background: var(--terra); color: #fff; font-size: 11px; font-weight: 700; width: 18px; height: 18px; border-radius: 6px; display: inline-grid; place-items: center; vertical-align: 2px; margin: 0 1px; padding: 0; line-height: 1; }
.cite:hover { background: var(--terra-d); }
.m-hero { display: none; position: relative; border-radius: 20px; overflow: hidden; height: clamp(200px, 30vw, 280px); flex: none; box-shadow: 0 14px 30px rgba(80, 50, 20, .14); }
.m-hero img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 14%; display: block; }
.m-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(30, 18, 10, .78), rgba(30, 18, 10, 0) 60%); }
.m-hero div { position: absolute; left: 18px; right: 18px; bottom: 14px; z-index: 2; color: #fff; }
.m-hero small { display: block; font-size: 13px; opacity: .9; }
.m-hero b { font-family: "Shippori Mincho", serif; font-size: 26px; letter-spacing: .12em; line-height: 1.3; }
.m-hero p { font-family: "Shippori Mincho", serif; font-size: 14.5px; line-height: 1.7; margin-top: 4px; opacity: .95; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 7px 14px; font-size: 14.5px; color: var(--ink-2); text-align: left; line-height: 1.5; transition: border-color .15s, background .15s; }
.chip:hover { border-color: var(--terra); background: #fff; color: var(--ink); }
.chip em { white-space: nowrap; font-style: normal; font-size: 12px; color: var(--terra-d); background: var(--terra-l); padding: 0 7px; border-radius: 99px; margin-left: 8px; }
.typing { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--terra); opacity: .4; animation: bl 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.typing span { margin-left: 6px; }
@keyframes bl { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
.mfoot { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); }
.srcbtn { border: none; background: none; padding: 0; color: var(--terra-d); font-weight: 700; font-size: 13px; display: inline-flex; gap: 5px; align-items: center; }
.srcbtn svg { width: 15px; height: 15px; }
.msrc { display: none; margin-top: 8px; gap: 6px; }
.msg.show-src .msrc { display: grid; }
.msrc-item { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.msrc-item > b { width: 18px; height: 18px; border-radius: 6px; background: var(--terra); color: #fff; font-size: 11px; display: grid; place-items: center; flex: none; }
.composer { margin: 0 clamp(16px, 3vw, 56px); display: flex; align-items: flex-end; gap: 10px; background: var(--card); border: 1.5px solid var(--line); border-radius: 18px; padding: 8px 8px 8px 18px; box-shadow: 0 10px 30px rgba(80, 50, 20, .08); transition: border-color .15s; }
.composer:focus-within { border-color: var(--terra); }
.composer textarea { flex: 1; border: none; outline: none; resize: none; background: none; padding: 8px 0; line-height: 1.6; max-height: 160px; }
.send { width: 46px; height: 46px; border: none; border-radius: 14px; background: var(--terra); color: #fff; display: grid; place-items: center; flex: none; transition: background .15s; }
.send:hover { background: var(--terra-d); }
.send:disabled { background: var(--faint); cursor: wait; }
.send svg { width: 20px; height: 20px; stroke-width: 2.2; }
.composer-note { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); padding: 8px clamp(18px, 3vw, 60px) 14px; }

.src { border-left: 1px solid var(--line); padding: clamp(16px, 1.6vw, 24px); overflow-y: auto; background: var(--paper); display: flex; flex-direction: column; gap: 12px; }
.src h3 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.src h3 span { font-size: 13px; background: var(--terra); color: #fff; padding: 0 9px; border-radius: 99px; }
.src-sub { font-size: 14px; color: var(--muted); margin-top: -6px; }
.how { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 10px; }
.how li { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.how li > b { width: 28px; height: 28px; border-radius: 9px; background: var(--terra-l); color: var(--terra-d); display: grid; place-items: center; flex: none; font-size: 14px; }
.how strong { display: block; font-size: 15px; line-height: 1.5; }
.how span { font-size: 13.5px; color: var(--muted); line-height: 1.6; display: block; }
.src-photo { width: 100%; border-radius: 16px; aspect-ratio: 16 / 10; object-fit: cover; margin-top: 4px; }
.scard { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; transition: border-color .2s, box-shadow .2s; }
.scard.on { border-color: var(--terra); box-shadow: 0 0 0 3px var(--terra-l); }
.scard header { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.scard .num { width: 22px; height: 22px; border-radius: 7px; background: var(--terra); color: #fff; font-size: 12.5px; display: grid; place-items: center; }
.scard .date { margin-left: auto; font-size: 12.5px; color: var(--faint); font-feature-settings: "tnum" 1; }
.scard h4 { font-size: 15px; line-height: 1.5; }
.scard p { font-size: 14px; color: var(--ink-2); line-height: 1.7; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.scard.on p { -webkit-line-clamp: unset; }
.near { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.near i { flex: 1; height: 6px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.near em { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--terra)); border-radius: 6px; }
.near b { font-feature-settings: "tnum" 1; color: var(--ink-2); }
.nosrc { display: flex; gap: 10px; background: var(--card); border: 1px dashed var(--line); border-radius: 14px; padding: 14px; font-size: 14px; color: var(--ink-2); }
.nosrc svg { color: var(--sage); width: 22px; height: 22px; }
.nosrc b { display: block; }
.tb { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 6px; white-space: nowrap; background: var(--paper-2); color: var(--ink-2); }
.t-rinen { background: #f3e7d3; color: #8a5a14; }
.t-blog { background: var(--terra-l); color: var(--terra-d); }
.t-mail { background: #f6e3e9; color: #9b3a5a; }
.t-mtg { background: #e3ebf3; color: #35587a; }
.t-faq { background: var(--sage-l); color: #3f5e45; }
.t-ng { background: #ece6f2; color: #5b4777; }
.t-chat { background: #e8f0ef; color: #2f6763; }
.t-add { background: #fff1c9; color: #7a5a00; }

@media (max-width: 1180px) {
  .chat-page { grid-template-columns: minmax(0, 1fr) clamp(300px, 34vw, 380px); }
  .prof { display: none; }
  .m-hero { display: block; }
}
@media (max-width: 820px) {
  :root { --strip: 108px; }
  .strip { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; gap: 8px 12px; }
  .strip-note { margin-left: auto; font-size: 12px; }
  .mode { order: 3; width: 100%; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .mode button { flex: 1; padding: 6px 10px; font-size: 13.5px; }
  .chat-page { grid-template-columns: 1fr; }
  .src { display: none; }
  .msgs { padding: 16px 14px 24px; }
  .composer { margin: 0 12px; }
  .composer-note { padding: 6px 16px 10px; }
  .composer-note span:first-child { display: none; }
  .msg { max-width: 100%; }
  .msg .av { width: 32px; height: 32px; }
  .msg.ai .bubble { padding: 12px 14px; }
  .who small { display: none; }
  .ghost span { display: none; }
  .ghost { padding: 8px; }
  .chat-head { padding: 10px 14px; }
}

/* ============ LINE・Chatwork ============ */
.line-page { position: relative; min-height: calc(100vh - var(--strip)); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: clamp(24px, 4vw, 80px); padding: clamp(28px, 4vw, 64px) clamp(20px, 6vw, 120px); overflow: hidden; color: #fff; isolation: isolate; }
.line-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.line-page::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(28, 18, 12, .88) 0%, rgba(28, 18, 12, .72) 45%, rgba(28, 18, 12, .35) 100%); }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: #f3c9b9; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); padding: 3px 12px; border-radius: 99px; }
.line-copy h2 { font-size: clamp(30px, 2.6vw + 8px, 56px); line-height: 1.4; margin: 16px 0 14px; letter-spacing: .05em; }
.lead { font-size: clamp(16px, .3vw + 13px, 19px); color: #eadfd6; max-width: 34em; line-height: 1.9; }
.flow { display: flex; align-items: center; gap: 10px; margin: 28px 0 22px; flex-wrap: wrap; }
.flow > div { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); border-radius: 16px; padding: 12px 16px; display: flex; align-items: center; gap: 10px; backdrop-filter: blur(6px); }
.flow > div b { width: 40px; height: 40px; border-radius: 12px; background: var(--terra); display: grid; place-items: center; }
.flow > div span { font-size: 14.5px; line-height: 1.5; font-weight: 700; }
.flow > i { color: #f3c9b9; display: grid; }
.line-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.line-points li { display: flex; gap: 8px; align-items: flex-start; font-size: 15.5px; color: #f1e8e0; }
.line-points svg { color: #8fd19e; margin-top: 4px; stroke-width: 2.4; }
.line-note { margin-top: 18px; font-size: 13.5px; color: #cdbfb4; }
.phone { width: clamp(300px, 24vw, 370px); aspect-ratio: 9 / 18.5; max-height: calc(100vh - var(--strip) - 60px); border-radius: 46px; background: #121212; padding: 12px; box-shadow: 0 40px 90px rgba(0, 0, 0, .5), inset 0 0 0 2px #2c2c2c; }
.ph-in { width: 100%; height: 100%; border-radius: 36px; overflow: hidden; background: #8fb1cf; display: flex; flex-direction: column; color: var(--ink); }
.ph-head { display: flex; align-items: center; gap: 10px; padding: 34px 14px 10px; background: #f7f7f7; border-bottom: 1px solid #e3e3e3; }
.ph-back { font-size: 28px; line-height: 1; color: #333; }
.ph-head img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.ph-head b { display: block; font-size: 15px; line-height: 1.3; }
.ph-head small { font-size: 12px; color: #777; }
.ph-msgs { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.pm { display: flex; gap: 8px; align-items: flex-start; }
.pm img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; }
.pb { background: #fff; border-radius: 4px 16px 16px 16px; padding: 8px 12px; font-size: 14px; line-height: 1.65; max-width: 82%; }
.pb p + p { margin-top: 6px; }
.pb ul { margin: 4px 0; padding-left: 1.2em; }
.pm.user { justify-content: flex-end; }
.pm.user .pb { background: #9ee08a; border-radius: 16px 4px 16px 16px; }
.pm.sys { justify-content: center; font-size: 12.5px; background: rgba(0, 0, 0, .25); color: #fff; padding: 4px 12px; border-radius: 99px; align-self: center; }
.pref { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px solid #eee; font-size: 12px; color: #8a8a8a; }
.pchips { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 38px; }
.pchips button { border: none; background: rgba(255, 255, 255, .85); border-radius: 99px; padding: 4px 12px; font-size: 13px; color: #1f6b3a; font-weight: 700; }
.ptyping { display: inline-flex; gap: 4px; padding: 4px 0; }
.ptyping i { width: 6px; height: 6px; border-radius: 50%; background: #999; animation: bl 1.2s infinite; }
.ptyping i:nth-child(2) { animation-delay: .15s; } .ptyping i:nth-child(3) { animation-delay: .3s; }
.ph-form { display: flex; gap: 8px; padding: 10px 12px 22px; background: #f7f7f7; border-top: 1px solid #e3e3e3; }
.ph-form input { flex: 1; border: none; border-radius: 99px; padding: 8px 14px; background: #fff; outline: none; }
.ph-form button { border: none; background: none; color: #1f6b3a; display: grid; place-items: center; }
@media (max-width: 980px) {
  .line-page { grid-template-columns: 1fr; justify-items: center; }
  .line-page::before { background: rgba(28, 18, 12, .82); }
  .phone { width: min(360px, 100%); max-height: none; aspect-ratio: 9 / 17; }
}

/* ============ 管理画面 ============ */
.admin { display: grid; grid-template-columns: clamp(220px, 16vw, 260px) minmax(0, 1fr); min-height: calc(100vh - var(--strip)); }
.a-side { background: #2a211c; color: #e9dfd5; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: var(--strip); height: calc(100vh - var(--strip)); }
.a-side button { border: none; background: none; color: #cdbfb3; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; font-weight: 700; font-size: 15px; text-align: left; }
.a-side button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.a-side button.on { background: var(--terra); color: #fff; }
.a-side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border-top: 1px solid rgba(255, 255, 255, .1); }
.a-side-foot .av-init { width: 34px; height: 34px; border-radius: 50%; background: #4a3b32; color: #f3d9cc; display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; }
.a-side-foot b { display: block; font-size: 14px; line-height: 1.4; }
.a-side-foot small { font-size: 12.5px; color: #a8998c; }
.a-main { padding: clamp(18px, 2.4vw, 40px) clamp(18px, 3vw, 56px) 60px; min-width: 0; }
.a-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.a-head h2 { font-size: clamp(22px, 1.4vw + 4px, 28px); }
.a-head p { color: var(--muted); font-size: 15px; margin-top: 4px; max-width: 46em; }
.a-head > .btn, .a-head-acts { margin-left: auto; }
.a-head-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.btn { display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 14.5px; color: var(--ink-2); white-space: nowrap; }
.btn:hover { background: #fff; border-color: #d9cdbf; }
.btn.primary { background: var(--terra); border-color: var(--terra); color: #fff; }
.btn.primary:hover { background: var(--terra-d); }
.btn.primary:disabled { opacity: .7; cursor: wait; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn.danger { color: #b3261e; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; color: var(--muted); flex: none; }
.kb-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.kb-stats div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.kb-stats b { display: block; font-size: 26px; line-height: 1.3; font-feature-settings: "tnum" 1; }
.kb-stats span { font-size: 13.5px; color: var(--muted); }
.kb-wrap { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
.kb-wrap.has-open { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.kb-list { padding: 6px; }
.kb-row { width: 100%; border: none; background: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 11px 12px; border-radius: 10px; text-align: left; }
.kb-row + .kb-row { border-top: 1px solid var(--line-2); }
.kb-row:hover { background: var(--paper); }
.kb-row.on { background: var(--terra-l); }
.kt { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd, .kn { font-size: 13px; color: var(--muted); white-space: nowrap; font-feature-settings: "tnum" 1; }
.kb-has-open .kn { display: none; }
.kb-detail { padding: 18px; position: sticky; top: calc(var(--strip) + 16px); max-height: calc(100vh - var(--strip) - 32px); overflow-y: auto; }
.kb-detail header { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.kb-detail h3 { font-size: 18px; margin-top: 6px; }
.kb-detail header small { font-size: 13px; color: var(--muted); }
.kb-acts { margin-left: auto; display: flex; gap: 8px; }
.chunks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.chunks li { background: var(--paper); border-radius: 12px; padding: 10px 14px; border-left: 3px solid var(--gold); }
.chunks span { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.chunks p { font-size: 14.5px; line-height: 1.8; white-space: pre-line; margin-top: 2px; }
.hint { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--muted); margin-top: 14px; line-height: 1.7; }
.hint svg { color: var(--gold); margin-top: 3px; }
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(34, 24, 18, .45); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(640px, 100%); max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: 20px; padding: 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, .25); }
.modal.wide { width: min(820px, 100%); }
.modal h3 { font-size: 20px; }
.modal .sub { color: var(--muted); font-size: 14.5px; margin: 4px 0 16px; }
.form { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; margin-bottom: 10px; }
.form label { display: grid; gap: 4px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.form label.full { grid-column: 1 / -1; }
.form input, .form select, .form textarea, .pf input, .pf textarea, .sform input { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; font-weight: 400; outline: none; width: 100%; line-height: 1.7; }
.form input:focus, .form select:focus, .form textarea:focus, .pf input:focus, .pf textarea:focus { border-color: var(--terra); box-shadow: 0 0 0 3px var(--terra-l); }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.err { color: #b3261e; font-size: 14px; min-height: 1.4em; margin-top: 6px; }
.prompt { background: #2a211c; color: #f1e7dc; border-radius: 14px; padding: 16px 18px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13.5px; line-height: 1.75; white-space: pre-wrap; max-height: 60vh; overflow: auto; margin: 0; }

.persona { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; align-items: start; }
.pcard { padding: 18px; }
.pcard:first-child { grid-row: span 2; }
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pf { display: grid; gap: 6px; }
.pf.full { grid-column: 1 / -1; }
.pf label { font-size: 14px; font-weight: 700; color: var(--ink-2); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pf label small { font-weight: 400; color: var(--muted); font-size: 13px; }
.plist { display: grid; gap: 8px; }
.pitem { display: flex; gap: 8px; align-items: center; }
.ngcard { border-color: #e8d3cb; }
.seg { display: flex; background: var(--paper); border-radius: 10px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { flex: 1; border: none; background: none; padding: 7px 10px; border-radius: 8px; font-size: 14px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }

.stest { padding: 16px 18px; margin-bottom: 14px; }
.sform { display: flex; gap: 10px; align-items: center; }
.sform > span { color: var(--muted); display: grid; }
.sform input { flex: 1; }
.sopts { display: flex; gap: 14px 28px; flex-wrap: wrap; align-items: flex-end; margin-top: 14px; }
.sopts label { display: grid; gap: 2px; font-size: 13.5px; color: var(--muted); font-weight: 700; min-width: 200px; }
.sopts label b { color: var(--ink); font-size: 15px; font-feature-settings: "tnum" 1; }
.sopts input[type=range] { accent-color: var(--terra); width: 100%; }
.sres { overflow-x: auto; }
.sres table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 860px; }
.sres th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sres td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.sres tr.used td { background: #fffaf3; }
.sres .rk { font-weight: 700; color: var(--muted); font-feature-settings: "tnum" 1; }
.sres .rd { min-width: 220px; }
.sres .rd b { display: block; margin-top: 4px; font-size: 14px; line-height: 1.5; }
.sres .rt { color: var(--ink-2); font-size: 13.5px; line-height: 1.6; min-width: 240px; }
.bar { width: 90px; height: 6px; border-radius: 6px; background: var(--line-2); overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--terra)); }
.bar.kw i { background: var(--sage); }
.sres .sc { font-weight: 700; }
.use { display: inline-flex; align-items: center; gap: 4px; color: var(--terra-d); font-weight: 700; font-size: 13px; white-space: nowrap; }
.use svg { width: 15px; height: 15px; stroke-width: 2.4; }
.nouse { color: var(--faint); font-size: 13px; white-space: nowrap; }
.sempty { padding: 40px; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 8px; }
.sempty svg { width: 30px; height: 30px; color: var(--faint); }

.usage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ucard { padding: 18px 20px; }
.ucard.wide { grid-column: 1 / -1; }
.ucard h3 { font-size: 16px; margin-bottom: 10px; }
.unum b { font-size: 40px; line-height: 1.2; font-feature-settings: "tnum" 1; }
.unum span { color: var(--muted); margin-left: 6px; }
.ubar { height: 10px; border-radius: 10px; background: var(--line-2); overflow: hidden; margin: 10px 0; }
.ubar i { display: block; height: 100%; background: var(--terra); }
.muted { color: var(--muted); font-size: 14px; }
.ulist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ulist li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line-2); padding-bottom: 8px; font-size: 14.5px; }
.ulist span { color: var(--muted); }
.cost { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.cost th { text-align: left; font-size: 13px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.cost td { padding: 10px; border-bottom: 1px solid var(--line-2); }
.cost td:last-child { white-space: nowrap; }
@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .a-side { position: sticky; top: var(--strip); z-index: 5; height: auto; flex-direction: row; overflow-x: auto; padding: 8px 10px; gap: 4px; scrollbar-width: none; }
  .a-side button { flex: none; padding: 8px 12px; font-size: 14px; }
  .a-side-foot { display: none; }
  .kb-stats { grid-template-columns: repeat(2, 1fr); }
  .kb-wrap.has-open { grid-template-columns: 1fr; }
  .kb-row { grid-template-columns: auto minmax(0, 1fr); }
  .kd, .kn { display: none; }
  .kb-detail { position: static; max-height: none; }
  .pgrid { grid-template-columns: 1fr; }
  .usage-grid { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
}
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 99; background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14.5px; font-weight: 700; display: flex; gap: 8px; align-items: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.toast svg { color: #9fd9a9; }
