/* ChallanFlow – Genesis Laundries */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: #f3f1ec; font-family: Poppins, system-ui, sans-serif; color: #232323; font-size: 14px; }
input, select, textarea, button { font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid #301157; outline-offset: -1px; }
a { color: #301157; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: #5b5468; }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: #232323; font-weight: 600; }
.grow { flex: 1 1 240px; min-width: 0; }
.upper { text-transform: uppercase; }
.accent { color: #301157 !important; }

.wrap { max-width: 1760px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }

/* top bar */
.topbar { background: #fff; border-bottom: 1px solid #e6e1d8; }
.topbar-inner { padding-top: 8px; padding-bottom: 8px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; }
.dots { display: grid; grid-template-columns: repeat(2, 10px); gap: 4px; }
.dots span { width: 10px; height: 10px; border-radius: 50%; }
.brand-name { font-weight: 700; font-size: 17px; color: #301157; line-height: 1.2; }
.brand-sub { font-size: 12px; color: #6b6478; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; background: #f3f1ec; padding: 4px; border-radius: 12px; }
.tabs a { text-decoration: none; padding: 9px 18px; border-radius: 9px; color: #4a4257; font-weight: 500; font-size: 13px; }
.tabs a.active { background: #301157; color: #fff; font-weight: 600; }
.api-status { font-size: 12px; color: #6b6478; }
.api-status.ok { color: #1f6b3a; }
.api-status.bad { color: #8a2b2b; }

/* page */
.screen { padding-top: 12px; padding-bottom: 20px; }
.titlerow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
h1 { margin: 0; font-size: 20px; font-weight: 600; color: #1d0a36; }
h2 { margin: 0; font-size: 16px; font-weight: 600; color: #1d0a36; }
.dcno { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #e6e1d8; border-radius: 10px; padding: 6px 14px; }
.dcno strong { font-size: 16px; color: #301157; letter-spacing: .02em; }
.chip { font-size: 11px; color: #5b5468; background: #f3f1ec; border-radius: 6px; padding: 3px 8px; }
.badge { background: #ece6f6; color: #301157; border-radius: 6px; padding: 4px 10px; font-size: 12px; font-weight: 600; }

.split { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.split-main { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.card { background: #fff; border: 1px solid #e6e1d8; border-radius: 14px; padding: 16px 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 500; color: #4a4257; }
label input, label textarea, label select { border: 1px solid #ddd6ca; border-radius: 10px; padding: 8px 12px; font-size: 14px; color: #232323; background: #fdfcfa; }
textarea { resize: vertical; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 input, .grid2 input { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.mt { margin-top: 14px; }

.vendor-field { position: relative; }
.suggest { position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; background: #fff; border: 1px solid #ddd6ca; border-radius: 10px; box-shadow: 0 8px 24px rgba(29,10,54,.12); z-index: 20; max-height: 260px; overflow-y: auto; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: 8px 12px; font-size: 13px; cursor: pointer; color: #232323; }
.suggest button:hover, .suggest button.hl { background: #f3eefa; }
.suggest .sub { display: block; font-size: 11px; color: #5b5468; }
.suggest .none { padding: 8px 12px; font-size: 12px; color: #5b5468; }

.party-line { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: baseline; background: #f8f6f1; border: 1px dashed #d9d1c3; border-radius: 10px; padding: 8px 14px; font-size: 13px; }

/* tables */
.table-box { overflow-x: auto; border: 1px solid #ece7de; border-radius: 10px; }
.card.flush .table-box { border: 0; border-radius: 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: #f8f6f1; color: #4a4257; text-align: left; font-weight: 600; }
th.r, td.r { text-align: right; }
th.c, td.c { text-align: center; }
table.items { min-width: 900px; table-layout: fixed; }
table.items th { padding: 10px 15px; }
table.items th:first-child { padding: 10px 8px; }
table.items th:nth-child(6) { padding: 10px 6px; }
table.items th:last-child { padding: 0; }
table.items td { padding: 4px 6px; vertical-align: middle; border-top: 1px solid #ece7de; }
table.items td.num, table.items td.unit { padding: 4px 8px; color: #6b6478; }
table.items td.val { padding: 4px 15px; font-weight: 600; text-align: right; }
table.items input { width: 100%; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; font-size: 13px; background: #fdfcfa; }
table.items input:hover { border-color: #e6e1d8; }
table.items input.r { text-align: right; }
.btn-del { border: 0; background: transparent; color: #8a2b2b; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.btn-del:hover { background: #fbeeee; }

table.list { min-width: 820px; }
table.list th { padding: 9px 12px; }
table.list td { padding: 7px 12px; border-top: 1px solid #ece7de; vertical-align: middle; }
table.list td.actions { padding: 4px 12px; text-align: right; white-space: nowrap; }
table.list tr.cancelled td { color: #8a8494; }
table.list tr.cancelled td.dc { text-decoration: line-through; }
td.dc { font-weight: 600; color: #301157; }
td.empty { text-align: center; color: #5b5468; padding: 28px; }
.st-pending { color: #8a5a00; font-weight: 500; }
.st-completed { color: #1f6b3a; font-weight: 500; }
.st-cancelled { color: #8a2b2b; font-weight: 500; }

/* buttons */
button { cursor: pointer; }
.btn-primary { border: 0; background: #301157; color: #fff; border-radius: 12px; padding: 12px; font-size: 14px; font-weight: 600; }
.btn-primary:hover { background: #24093f; }
.btn-outline { border: 1px solid #301157; background: #fff; color: #301157; border-radius: 12px; padding: 10px; font-size: 14px; font-weight: 600; display: inline-flex; gap: 8px; align-items: center; justify-content: center; }
.btn-primary.sm, .btn-outline.sm { border-radius: 8px; padding: 7px 16px; font-size: 13px; }
.btn-primary:disabled, .btn-outline:disabled { opacity: .55; cursor: wait; }
.block { width: 100%; margin-top: 10px; }
.summary .btn-primary.block { margin-top: 16px; }
.btn-dashed { margin-top: 10px; border: 1px dashed #b9aed0; background: #faf8fd; color: #301157; border-radius: 10px; padding: 8px 16px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.btn-small { display: inline-block; text-decoration: none; border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 600; border: 1px solid #ddd6ca; background: #fff; color: #301157; margin-left: 6px; }
.btn-small.fill { background: #301157; border-color: #301157; color: #fff; }
.btn-small.warn { color: #8a2b2b; }
.btn-link { border: 0; background: none; color: #5b5468; font-size: 13px; text-decoration: underline; }

/* summary */
.summary { flex: 1 1 300px; min-width: 280px; max-width: 100%; }
.summary h2 { margin-bottom: 12px; }
.stat { background: #f8f6f1; border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.big { font-size: 22px; font-weight: 700; color: #1d0a36; }
.rows { display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.rows > div { display: flex; justify-content: space-between; }
.rows hr { border: 0; height: 1px; background: #ece7de; margin: 4px 0; width: 100%; }
.rows .total { align-items: baseline; font-weight: 600; }
.rows .total span:last-child { font-weight: 700; font-size: 20px; color: #301157; }
.hint { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid #ece7de; font-size: 12px; color: #5b5468; line-height: 1.6; }

/* reports */
.filters { display: grid; grid-template-columns: minmax(240px, 3fr) repeat(2, minmax(140px, 1fr)) auto; gap: 10px; align-items: end; padding: 10px 14px; margin-bottom: 10px; border-radius: 12px; }
.filters label { gap: 3px; font-size: 11px; }
.filters input { border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.strip { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; padding: 8px 16px; margin-bottom: 10px; font-size: 13px; border-radius: 12px; }
.strip strong { font-size: 15px; color: #1d0a36; margin-left: 4px; }
@media (max-width: 720px) { .filters { grid-template-columns: 1fr 1fr; } }

/* masters */
.seg { display: inline-flex; gap: 4px; background: #fff; border: 1px solid #e6e1d8; padding: 4px; border-radius: 10px; }
.seg button { border: 0; padding: 8px 18px; border-radius: 8px; background: transparent; color: #4a4257; font-weight: 500; font-size: 13px; }
.seg button[aria-pressed="true"] { background: #301157; color: #fff; font-weight: 600; }
.list-head { padding: 12px 16px; border-bottom: 1px solid #ece7de; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.list-head input { flex: 1; border: 1px solid #ddd6ca; border-radius: 10px; padding: 8px 12px; font-size: 14px; background: #fdfcfa; }
table.list tr.editing td { background: #faf8fd; }

/* toast */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1d0a36; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 50; max-width: 90vw; }
.toast.err { background: #8a2b2b; }

/* login & users */
.userbox { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #4a4257; }
.btn-ghost { border: 1px solid #e6e1d8; background: #fff; color: #301157; border-radius: 10px; padding: 7px 14px; font-size: 13px; font-weight: 500; }
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid #e6e1d8; border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { margin-top: 8px; }
.login-err { color: #8a2b2b; font-size: 13px; margin: 0; min-height: 18px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; }
.role-admin { background: #ece6f6; color: #301157; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.role-staff { background: #f3f1ec; color: #4a4257; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
