/* Procura — brand tokens from mahathiinfra.com. --brand is decorative; --brand-text/-btn are darker so white text passes contrast. */
:root {
  --brand: #fd5d14; --brand-2: #ef8a2f; --brand-text: #c2410a; --brand-btn: #d04408; --brand-soft: #fff1e8;
  --danger: #c03b40; --ok: #1f7a4d; --warn: #9a6700; --info: #2b6cb0;
  --ink: #32373c; --text: #23282c; --muted: #5f6870; --bg: #f4f5f6; --card: #fff; --line: #e2e5e8; --field: #fff; --hover: #f0f2f3;
  --nav: #2a2e32; --nav-text: #d5d9dc; --radius: 12px; --shadow: 0 1px 2px rgba(20, 24, 28, .06), 0 4px 14px rgba(20, 24, 28, .05);
  --head: 'Exo 2', system-ui, sans-serif; --body: 'Roboto', system-ui, sans-serif; --nav-w: 232px; --tab-h: 62px;
}
:root[data-theme='dark'] {
  --brand-text: #ff9a63; --brand-soft: #3a2a20; --danger: #ff7b80; --ok: #56c98d; --warn: #e3b341; --info: #7db4f0;
  --text: #e8eaec; --muted: #9aa3ab; --bg: #141618; --card: #1e2124; --line: #2f3439; --field: #171a1c; --hover: #262a2e; --nav: #101214;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --brand-text: #ff9a63; --brand-soft: #3a2a20; --danger: #ff7b80; --ok: #56c98d; --warn: #e3b341; --info: #7db4f0;
    --text: #e8eaec; --muted: #9aa3ab; --bg: #141618; --card: #1e2124; --line: #2f3439; --field: #171a1c; --hover: #262a2e; --nav: #101214;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--body); }
h1, h2, h3 { font-family: var(--head); margin: 0; letter-spacing: .1px; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
a { color: var(--brand-text); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- buttons, fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); cursor: pointer; font-weight: 500; text-decoration: none; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--brand-btn); border-color: var(--brand-btn); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); } .btn.small { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; } .btn[disabled] { opacity: .55; cursor: default; }
.field { display: grid; gap: 4px; margin-bottom: 14px; }
.field label { font-weight: 500; font-size: 13px; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); min-height: 40px; }
.field textarea { min-height: 96px; resize: vertical; }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field input[readonly] { background: var(--hover); color: var(--muted); }
.row { display: grid; gap: 14px; } @media (min-width: 640px) { .row.two { grid-template-columns: 1fr 1fr; } }
.error { color: var(--danger); font-size: 13.5px; min-height: 20px; }

/* ---- cards, pills */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card > h2 { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grid { display: grid; gap: 16px; } .grid.kpi { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .grid.kpi { grid-template-columns: repeat(4, 1fr); } .grid.two { grid-template-columns: 3fr 2fr; } }
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 500; border: 1px solid var(--line); background: var(--hover); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: currentColor; background: transparent; } .pill.warn { color: var(--warn); border-color: currentColor; background: transparent; }
.pill.info { color: var(--info); border-color: currentColor; background: transparent; } .pill.brand { color: var(--brand-text); background: var(--brand-soft); border-color: transparent; }
.pill.off { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; } .chip { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--hover); border: 1px solid var(--line); }
.chip b { font-weight: 500; color: var(--muted); margin-right: 3px; }

/* ---- login */
.center { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--bg), var(--brand-soft)); }
.auth-card { width: min(420px, 100%); }
.auth-card .logo { display: block; width: 170px; margin: 0 auto 6px; background: #fff; border-radius: 10px; padding: 8px 12px; }
.auth-card h1 { text-align: center; margin: 10px 0 2px; font-size: 26px; } .auth-card .sub { text-align: center; color: var(--muted); margin-bottom: 20px; }
.auth-card .foot { text-align: center; margin-top: 16px; font-size: 12.5px; color: var(--muted); }

/* ---- shell */
#app { min-height: 100vh; }
.nav { display: none; }
.main { min-width: 0; padding-bottom: calc(var(--tab-h) + 16px); }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 58px; padding: 0 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.top::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.top .logo-sm { height: 30px; background: #fff; border-radius: 6px; padding: 2px 6px; }
.top h1 { font-size: 19px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.welcome { display: none; font-size: 14px; color: var(--muted); } .welcome b { color: var(--text); font-weight: 500; }
.live { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); } .live.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.iconbtn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; border: 1px solid transparent; background: transparent; cursor: pointer; }
.iconbtn:hover { background: var(--hover); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-btn); color: #fff; font: 600 13px var(--head); border: 0; cursor: pointer; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; cursor: default; }
.menu { position: absolute; right: 12px; top: 54px; width: 250px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0, 0, 0, .18); padding: 8px; z-index: 30; }
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; } .menu .who b { display: block; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; border: 0; background: none; cursor: pointer; text-decoration: none; color: var(--text); }
.menu a:hover, .menu button:hover { background: var(--hover); }
.page { padding: 16px; max-width: 1180px; margin: 0 auto; display: grid; gap: 16px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; height: var(--tab-h); z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a, .tabbar button { display: grid; place-content: center; justify-items: center; gap: 2px; font-size: 11.5px; color: var(--muted); text-decoration: none; border: 0; background: none; cursor: pointer; padding: 4px 0; }
.tabbar svg, .nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar .on { color: var(--brand-text); font-weight: 500; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 40; }
.sheet { position: fixed; z-index: 41; background: var(--card); box-shadow: 0 -8px 30px rgba(0, 0, 0, .25); left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet h2 { margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }
.sheet .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }
.morelist a, .morelist button { display: flex; gap: 12px; align-items: center; padding: 12px 6px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; text-decoration: none; color: var(--text); font-size: 16px; cursor: pointer; text-align: left; }

@media (min-width: 900px) {
  #app { display: grid; grid-template-columns: var(--nav-w) 1fr; }
  .nav { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; background: var(--nav); color: var(--nav-text); padding: 14px 12px; }
  .nav .brandtile { background: #fff; border-radius: 10px; padding: 8px 10px; margin-bottom: 18px; } .nav .brandtile img { display: block; width: 100%; }
  .nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--nav-text); text-decoration: none; margin-bottom: 2px; }
  .nav a:hover { background: rgba(255, 255, 255, .08); } .nav a.on { background: rgba(253, 93, 20, .18); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
  .nav .sec { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .6; padding: 14px 12px 6px; }
  .nav .spacer { flex: 1; } .nav .ver { font-size: 12px; opacity: .55; padding: 0 12px; }
  .tabbar, .top .logo-sm { display: none; } .main { padding-bottom: 24px; } .welcome { display: block; }
  .sheet { left: auto; top: 0; right: 0; bottom: 0; width: 460px; max-height: none; border-radius: 0; box-shadow: -8px 0 30px rgba(0, 0, 0, .25); padding: 22px; }
  .sheet.modal { top: 50%; left: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); width: min(460px, 92vw); border-radius: 16px; max-height: 88vh; }
}
@media (min-width: 600px) { .top .welcome { display: block; } }

/* ---- dashboard */
.hero { display: flex; gap: 16px; align-items: center; background: linear-gradient(120deg, var(--ink), #444b52); color: #fff; border: 0; }
.hero h1 { font-size: 24px; } .hero .muted { color: #c7cdd2; } .hero .avatar { background: var(--brand); }
.kpi .card { padding: 14px 16px; } .kpi .n { font: 700 26px var(--head); line-height: 1.1; } .kpi .l { color: var(--muted); font-size: 13px; }
.stack { display: flex; height: 16px; border-radius: 99px; overflow: hidden; background: var(--hover); margin: 6px 0 14px; }
.stack i { display: block; height: 100%; } .c-confirmed { background: var(--ok); } .c-auto { background: #4aa3df; } .c-review { background: var(--brand); } .c-unmatched { background: #9aa3ab; }
.legend { display: grid; gap: 6px; } .legend div { display: flex; align-items: center; gap: 8px; font-size: 14px; } .legend .sw { width: 12px; height: 12px; border-radius: 3px; } .legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.list { display: grid; } .list > * { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); } .list > *:last-child { border: 0; }
.list .cnt { margin-left: auto; font-weight: 500; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 34px 12px; color: var(--muted); } .empty .big { font-size: 40px; }
.banner { padding: 8px 12px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-text); font-size: 13.5px; }

/* ---- preview screens */
.searchbar { display: flex; gap: 8px; } .searchbar input { flex: 1; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); min-height: 46px; font-size: 16px; }
.tabs { display: inline-flex; background: var(--hover); border-radius: 10px; padding: 3px; } .tabs button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; cursor: pointer; }
.tabs .on { background: var(--card); box-shadow: var(--shadow); font-weight: 500; }
.result { display: grid; gap: 6px; padding: 14px 2px; border-bottom: 1px solid var(--line); } .result:last-child { border: 0; }
.result .t { font-weight: 500; } .result .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.code { font: 500 13px ui-monospace, Consolas, monospace; background: var(--hover); padding: 1px 6px; border-radius: 5px; }
.split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); } .split > *, .page > * { min-width: 0; }
@media (min-width: 900px) { .split { grid-template-columns: 340px minmax(0, 1fr); align-items: start; } }
.qitem .t, .result .t, .cand .t { overflow-wrap: anywhere; }
.tabs { max-width: 100%; overflow-x: auto; } .tabs button { white-space: nowrap; }
.searchbar select { min-width: 0; max-width: 42%; padding: 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); min-height: 46px; }
.qitem { padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; background: var(--card); }
.qitem.on { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 25%, transparent); }
.cand { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; display: grid; gap: 8px; }
.cand.best { border-color: var(--ok); }
.score { font: 700 15px var(--head); } .fit { font-size: 13px; color: var(--muted); } .fit b { color: var(--ok); font-weight: 500; } .fit i { color: var(--warn); font-style: normal; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- tables (users): a real table from 700px, cards below */
table { width: 100%; border-collapse: collapse; } th { text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 11px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; } tr:last-child td { border: 0; }
.ucards { display: grid; gap: 10px; } .ucard { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 6px; }
.utable { display: none; } @media (min-width: 760px) { .utable { display: table; } .ucards { display: none; } }
.acts { display: flex; gap: 6px; flex-wrap: wrap; }
.temp { font: 600 18px ui-monospace, Consolas, monospace; padding: 12px; border: 2px dashed var(--brand); border-radius: 10px; text-align: center; letter-spacing: .5px; user-select: all; word-break: break-all; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + 14px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); max-width: 92vw; }
.toast.bad { background: var(--danger); } @media (min-width: 900px) { .toast { bottom: 24px; } }
.skeleton { background: linear-gradient(90deg, var(--hover) 25%, var(--line) 37%, var(--hover) 63%); background-size: 400% 100%; animation: sk 1.3s infinite; border-radius: 8px; min-height: 18px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.btn.block { width: 100%; } .hero-skel { height: 96px; border-radius: var(--radius); } .kpi-skel { height: 76px; border-radius: var(--radius); }

/* icons: every inline svg is a stroked outline icon */
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.empty .big svg { width: 44px; height: 44px; }
.grid.two { align-items: start; }
h3 { margin: 8px 0 12px; }

/* procurement home */
.hero .grow, .po .grow { flex: 1; min-width: 0; } .hero-actions { margin-top: 12px; }
.btn.hero-btn { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .35); color: #fff; } .btn.hero-btn:hover { background: rgba(255, 255, 255, .2); }
.kpi-link { display: block; text-decoration: none; color: inherit; } .kpi-link:hover { border-color: var(--brand); }
.card > h2 a.small { font: 500 13px var(--body); }
.po { display: flex; align-items: center; gap: 12px; } .po .right { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.po .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 599px) { .hero .avatar.lg { display: none; } .hero-actions .btn { flex: 1 1 100%; } }
a.plain { text-decoration: none; color: inherit; } a.plain:hover { background: var(--hover); }
.searchbar input.qty { max-width: 80px; flex: 0 0 auto; } .searchbar input.unit { max-width: 90px; flex: 0 0 auto; }
textarea.tall { min-height: 260px; }
.result[role=button] { cursor: pointer; } .result[role=button]:hover { background: var(--hover); }
label.btn input[type=file] { display: none; }
