@import url('https://fonts.googleapis.com/css2?family=Anuphan:wght@500;600;700&family=IBM+Plex+Sans+Thai:wght@400;500;600&display=swap');
/* Light only, by design (SornSa dashboards stay light on every device). */
:root {
  color-scheme: light;
  --navy: #1C2E45; --navy-2: #3A4C63; --coral: #F04B2C; --coral-soft: #FDE7E1; --sand: #DDDACC; --paper: #F6F4EE; --stone: #ADA69F;
  --white: #FFFFFF; --ink-muted: #5E6672; --line: #E4E1D6; --ok: #2F7A4F; --ok-soft: #E3F1E8; --warn: #9A6400; --warn-soft: #FBF0D9; --info-soft: #E6ECF4;
  --radius: 12px; --shadow: 0 1px 2px rgba(28,46,69,.06), 0 4px 14px rgba(28,46,69,.05);
  --head: 'Anuphan', 'IBM Plex Sans Thai', system-ui, sans-serif; --body: 'IBM Plex Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--navy); font: 16px/1.6 var(--body); }
a { color: var(--navy); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--head); line-height: 1.3; margin: 0 0 .5em; letter-spacing: -.005em; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* top bar */
.top { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top .row1 { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.brand { font-family: var(--head); font-weight: 700; font-size: 1.08rem; text-decoration: none; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--coral); }
.top .spacer { flex: 1; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; margin-top: -2px; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; padding: 7px 12px; border-radius: 999px; font-size: .94rem; white-space: nowrap; color: var(--navy-2); }
.nav a.on { background: var(--navy); color: var(--white); }
.nav .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--coral); color: #fff; font-size: .75rem; text-align: center; }
.small-btn { border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 4px 10px; font-size: .85rem; cursor: pointer; }

main { padding: 20px 0 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.muted { color: var(--ink-muted); }
.tiny { font-size: .82rem; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.panel > h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.empty { color: var(--ink-muted); font-size: .94rem; padding: 6px 0; }

/* cards */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.card:hover { border-color: var(--stone); }
.card .t { font-family: var(--head); font-weight: 600; font-size: 1.02rem; line-height: 1.35; }
.card .code { font-size: .78rem; color: var(--ink-muted); font-weight: 600; letter-spacing: .02em; }
.card .p { font-size: .92rem; color: var(--navy-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .82rem; }
.list-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.list-row:first-of-type { border-top: 0; }
.list-row .grow { flex: 1; min-width: 0; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 500; background: var(--paper); border: 1px solid var(--line); white-space: nowrap; }
.chip.status { background: var(--info-soft); border-color: transparent; }
.chip.st-accepted, .chip.st-planned, .chip.st-in_development, .chip.st-released { background: var(--ok-soft); color: var(--ok); }
.chip.st-declined { background: #EEE; color: #555; }
.chip.st-later { background: var(--warn-soft); color: var(--warn); }
.chip.st-needs_clarification { background: var(--coral-soft); color: #A2321D; }
.chip.sugg { background: transparent; border: 1px dashed var(--stone); color: var(--navy-2); }
.chip.conf { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.demo { background: #FFF3C4; color: #6B5200; border-color: #E9D27A; font-weight: 600; }
.chip.ai { background: transparent; border: 1px dashed var(--stone); color: var(--ink-muted); font-size: .72rem; padding: 0 7px; }
.chip.human { background: var(--ok-soft); color: var(--ok); border-color: transparent; font-size: .72rem; padding: 0 7px; }

/* forms */
.btn { border: 1px solid var(--navy); background: var(--navy); color: #fff; border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 500; min-height: 42px; }
.btn.ghost { background: var(--white); color: var(--navy); border-color: var(--line); }
.btn.coral { background: var(--coral); border-color: var(--coral); }
.btn.sm { padding: 5px 10px; min-height: 34px; font-size: .88rem; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
input[type=text], input[type=search], input[type=password], input[type=url], input[type=number], select, textarea { width: 100%; border: 1px solid var(--sand); border-radius: 10px; padding: 9px 11px; background: var(--white); min-height: 42px; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--coral); outline-offset: 1px; }
label { display: block; font-size: .88rem; font-weight: 500; margin: 10px 0 4px; }
.filters { display: grid; gap: 8px; grid-template-columns: 2fr repeat(5, 1fr); margin-bottom: 12px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--white); }
.seg button { border: 0; background: transparent; padding: 7px 12px; cursor: pointer; font-size: .88rem; }
.seg button.on { background: var(--navy); color: #fff; }

/* table */
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; background: var(--paper); white-space: nowrap; }

/* detail */
.detail-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.detail-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
.field { padding: 10px 0; border-top: 1px solid var(--line); }
.field:first-of-type { border-top: 0; }
.field .k { display: flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--ink-muted); text-transform: none; }
.field .v { white-space: pre-wrap; overflow-wrap: anywhere; }
.field .v.unknown { color: var(--stone); font-style: italic; }
.field .edit-link { margin-left: auto; font-size: .8rem; background: none; border: 0; color: var(--navy-2); text-decoration: underline; cursor: pointer; padding: 2px 4px; }
.msg { border-left: 3px solid var(--sand); padding: 8px 10px; margin: 8px 0; background: var(--paper); border-radius: 0 8px 8px 0; }
.msg.review { border-left-color: var(--coral); background: var(--coral-soft); }
.msg .who { font-size: .82rem; color: var(--ink-muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.msg .txt { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.quote { font-size: .85rem; border-left: 2px solid var(--stone); padding-left: 8px; color: var(--ink-muted); margin: 4px 0; }
.shot { max-width: 100%; max-height: 260px; border-radius: 8px; border: 1px solid var(--line); display: block; margin: 6px 0; }
.ocr { font-size: .86rem; background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; margin-top: 4px; white-space: pre-wrap; }
.ref { padding: 10px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.ref:first-of-type { border-top: 0; }
.banner { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: .92rem; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner.info { background: var(--info-soft); color: var(--navy); }
.note-ai { font-size: .8rem; color: var(--ink-muted); }
.hist { font-size: .86rem; padding: 6px 0; border-top: 1px dashed var(--line); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: .92rem; }
.kv dt { color: var(--ink-muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.toast.err { background: #A2321D; }
dialog { border: 0; border-radius: 14px; padding: 18px; max-width: min(560px, calc(100% - 32px)); width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(28,46,69,.35); }
footer { color: var(--ink-muted); font-size: .8rem; padding: 20px 0 30px; text-align: center; }

/* sign-in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth .panel { width: 100%; max-width: 400px; }

@media (max-width: 860px) {
  .detail-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .q { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  h1 { font-size: 1.3rem; }
  .cards { grid-template-columns: 1fr; }
  .panel { padding: 14px; }
  .hide-sm { display: none; }
  .top .row1 { gap: 6px; }
  .brand { font-size: .98rem; }
  .seg button { padding: 5px 8px; font-size: .8rem; white-space: nowrap; }
  .small-btn { padding: 3px 8px; font-size: .8rem; }
  #me { max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
