/* Labob M&E — Purple Tulip Development brand */
@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;1,500&family=Jost:wght@400;500;600&family=Noto+Sans+Lao:wght@400;500;600&family=Noto+Serif+Lao:wght@600&display=swap");
:root {
  --plum: #301934; --gold: #E6C068; --gold-antique: #C6A85B; --gold-deep: #7A5A12; --gold-pale: #ECE2A5;
  --tulip: #5E1952; --orchid: #A9488A; --leaf: #4F9049; --ivory: #FBF7EE; --ivory-tint: #F4EDDA;
  --ink: #301934; --muted: #6B5670; --line: #E7DCC8; --white: #FFFFFF;
  --bad: #A8322A; --bad-soft: #F8E3E0; --warn: #8A5A00; --warn-soft: #F9EED4; --ok: #2F6B2B; --ok-soft: #E4F0E2;
  --f-head: "Cormorant Garamond", "Noto Serif Lao", Georgia, serif;
  --f-body: "Jost", "Noto Sans Lao", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --r: 6px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--f-body); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--ivory); -webkit-font-smoothing: antialiased; }
body.lo { font-size: 16px; }
h1, h2, h3 { font-family: var(--f-head); font-weight: 600; margin: 0 0 .4em; line-height: 1.2; color: var(--plum); }
h1 { font-size: 2rem; } h2 { font-size: 1.45rem; } h3 { font-size: 1.15rem; }
a { color: var(--tulip); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mono { font-family: ui-monospace, Menlo, monospace; font-size: .85em; }
.eyebrow { font-weight: 500; text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; color: var(--gold-deep); }

/* buttons and inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 500 .9rem var(--f-body); padding: 8px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--white); color: var(--plum); cursor: pointer; text-decoration: none; min-height: 38px; }
.btn:hover { border-color: var(--gold-antique); }
.btn.primary { background: var(--plum); color: var(--gold); border-color: var(--plum); }
.btn.primary:hover { background: var(--tulip); }
.btn.gold { background: var(--gold); color: var(--plum); border-color: var(--gold); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--bad); border-color: #E8C4BF; }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: .82rem; }
.btn:disabled { opacity: .55; cursor: default; }
label.field { display: grid; gap: 4px; font-size: .85rem; font-weight: 500; }
label.field > span.hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
input, select, textarea { font: 400 .95rem var(--f-body); color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 9px 11px; width: 100%; min-height: 40px; }
textarea { min-height: 86px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-antique); outline-offset: 1px; border-color: var(--gold-antique); }
input.err, select.err, textarea.err { border-color: var(--bad); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.check input { width: auto; min-height: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; } .g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } .g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } @media (max-width: 560px) { .two { grid-template-columns: 1fr; } }
.form { display: grid; gap: 12px; }

/* shell */
.top { background: var(--plum); color: var(--ivory); border-bottom: 2px solid var(--gold); position: sticky; top: 0; z-index: 20; }
.top-in { display: flex; align-items: center; gap: 14px; padding: 10px 18px; max-width: 1360px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand .mark { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--gold); display: grid; place-items: center; font-family: var(--f-head); color: var(--gold); font-size: 1.2rem; font-weight: 600; }
.brand b { font-family: var(--f-head); font-size: 1.35rem; color: var(--gold); font-weight: 600; letter-spacing: .01em; }
.brand small { display: block; font-size: .7rem; color: var(--gold-antique); letter-spacing: .06em; }
.top .sp { flex: 1; }
.top select { background: var(--tulip); color: var(--ivory); border-color: var(--gold-antique); min-height: 34px; padding: 4px 10px; width: auto; max-width: 240px; }
.top .btn { background: transparent; color: var(--ivory); border-color: rgba(230,192,104,.45); min-height: 34px; }
.top .btn.active, .top .btn:hover { border-color: var(--gold); color: var(--gold); }
.bell { position: relative; }
.bell .dot { position: absolute; top: -6px; right: -6px; background: var(--gold); color: var(--plum); font-size: .68rem; font-weight: 600; border-radius: 999px; padding: 1px 6px; }
.shell { display: grid; grid-template-columns: 220px 1fr; max-width: 1360px; margin: 0 auto; min-height: calc(100vh - 60px); }
nav.side { border-right: 1px solid var(--line); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 60px; align-self: start; max-height: calc(100vh - 60px); overflow: auto; }
nav.side .grp { margin: 14px 8px 4px; }
nav.side a { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: var(--r); text-decoration: none; color: var(--plum); font-weight: 500; font-size: .92rem; }
nav.side a:hover { background: var(--ivory-tint); }
nav.side a.on { background: var(--plum); color: var(--gold); }
nav.side a .n { margin-left: auto; background: var(--gold); color: var(--plum); font-size: .7rem; border-radius: 999px; padding: 0 7px; }
main { padding: 24px 28px 60px; min-width: 0; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  nav.side { position: sticky; top: 56px; z-index: 10; flex-direction: row; overflow-x: auto; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); background: var(--ivory); padding: 6px; }
  nav.side .grp { display: none; } nav.side a { flex: none; padding: 6px 10px; }
  main { padding: 16px 14px 80px; }
  .top-in { padding: 8px 12px; gap: 8px; } .brand small { display: none; } .hide-sm { display: none !important; }
}
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--gold-antique); padding-bottom: 10px; }
.pagehead p { margin: 0; color: var(--muted); }

/* cards and lists */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.kpi { display: grid; gap: 4px; } .kpi .v { font-family: var(--f-head); font-size: 2.1rem; font-weight: 600; line-height: 1; color: var(--plum); }
.kpi .v small { font-family: var(--f-body); font-size: .85rem; color: var(--muted); font-weight: 400; margin-left: 4px; }
.list { display: grid; } .list .it { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list .it:last-child { border-bottom: 0; }
.list .it.new { background: linear-gradient(90deg, rgba(236,226,165,.55), transparent 70%); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ivory-tint); color: var(--tulip); display: grid; place-items: center; font-weight: 600; font-size: .8rem; border: 1px solid var(--line); flex: none; }
.chip { display: inline-block; font-size: .74rem; padding: 2px 9px; border-radius: 999px; background: var(--ivory-tint); color: var(--plum); font-weight: 500; white-space: nowrap; }
.chip.gold { background: var(--gold-pale); color: var(--gold-deep); } .chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.warn { background: var(--warn-soft); color: var(--warn); } .chip.bad { background: var(--bad-soft); color: var(--bad); } .chip.plum { background: var(--plum); color: var(--gold); }
.bar { height: 8px; background: var(--ivory-tint); border-radius: 99px; overflow: hidden; } .bar i { display: block; height: 100%; background: var(--tulip); border-radius: 99px; } .bar.ok i { background: var(--leaf); }
.banner { border: 1px solid var(--gold-antique); background: var(--gold-pale); color: var(--plum); border-radius: var(--r); padding: 10px 14px; margin-bottom: 16px; display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.banner.bad { background: var(--bad-soft); border-color: #E8C4BF; }
.empty { text-align: center; padding: 34px 12px; color: var(--muted); }

/* tables */
.tablewrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--white); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th { background: var(--plum); color: var(--gold); text-align: left; font-weight: 500; padding: 9px 10px; white-space: nowrap; position: sticky; top: 0; }
td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
tr:nth-child(even) td { background: #FDFBF5; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--ivory-tint); }

/* change history */
.diff { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 4px 12px; font-size: .85rem; margin-top: 6px; }
.diff .k { color: var(--muted); }
.diff del { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; padding: 0 4px; border-radius: 3px; }
.diff ins { background: var(--ok-soft); color: var(--ok); text-decoration: none; padding: 0 4px; border-radius: 3px; }
.timeline { border-left: 2px solid var(--gold-antique); margin-left: 8px; padding-left: 16px; display: grid; gap: 14px; }
.timeline .ev { position: relative; } .timeline .ev::before { content: ""; position: absolute; left: -23px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--ivory); border: 2px solid var(--tulip); }

/* form builder and collection */
.qcard { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; background: var(--white); display: grid; gap: 10px; }
.qcard.sel { border-color: var(--gold-antique); box-shadow: 0 0 0 2px var(--gold-pale); }
.qtype { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gold-deep); font-weight: 500; }
.collect { max-width: 640px; margin: 0 auto; }
.collect .q { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 8px; }
.collect .q .lbl { font-weight: 500; } .collect .q .req { color: var(--bad); }
.opts { display: grid; gap: 6px; } .opts label { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; font-weight: 400; }
.opts input { width: auto; min-height: 0; } .opts label:has(input:checked) { border-color: var(--tulip); background: #F7EEF4; }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth .side { background: var(--plum); color: var(--ivory); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth .side h1 { color: var(--gold); font-size: 2.6rem; } .auth .side p { color: var(--ivory); max-width: 420px; }
.auth .side .ring { width: 120px; height: 120px; border: 1.5px solid var(--gold); border-radius: 50%; display: grid; place-items: center; font-family: var(--f-head); font-size: 3rem; color: var(--gold); }
.auth .pane { display: grid; place-items: center; padding: 32px 18px; }
.auth .box { width: min(420px, 100%); display: grid; gap: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); } .tabs button { border: 0; background: none; padding: 8px 12px; font: 500 .92rem var(--f-body); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--plum); border-bottom-color: var(--gold-antique); }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth .side { padding: 28px; } .auth .side .ring { display: none; } }

/* modal and toast */
.scrim { position: fixed; inset: 0; background: rgba(48,25,52,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--white); border-radius: var(--r); width: min(560px, 100%); max-height: 92vh; display: flex; flex-direction: column; }
.modal.wide { width: min(920px, 100%); }
.modal header, .modal footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal footer { border-top: 1px solid var(--line); border-bottom: 0; justify-content: flex-end; }
.modal header h2 { margin: 0; } .mbody { padding: 16px 18px; overflow: auto; display: grid; gap: 12px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--plum); color: var(--gold); padding: 10px 18px; border-radius: var(--r); z-index: 60; max-width: 90vw; }
.toast.bad { background: var(--bad); color: #fff; }
.demo { background: var(--gold); color: var(--plum); text-align: center; font-size: .8rem; padding: 4px 8px; font-weight: 500; }
