*{box-sizing:border-box}
body{margin:0;background:#f1f4fa;color:#192239;font-family:Arial,sans-serif;line-height:1.6;font-size:16px}
main{max-width:1260px;margin:auto;padding:36px}
header{padding:32px 36px;border-radius:24px;background:linear-gradient(120deg,#143886,#3848aa);color:white}
h1{font-size:34px;margin:10px 0}h2{font-size:22px}h3{font-size:19px;line-height:1.35}
.eyebrow{font-size:14px;opacity:.85}header p{margin:0}
.panel,article{border:1px solid #dce3ef;border-radius:18px;background:white;padding:24px}
.panel{margin:24px 0}
.toolbar,nav,.controls{display:flex;gap:12px;align-items:end;flex-wrap:wrap;margin:24px 0}
.toolbar{align-items:center}
button,select,input{font:inherit;border:1px solid #ccd7eb;border-radius:10px;padding:10px 16px;min-height:44px}
button{background:#244dbe;color:white;border-color:#244dbe;cursor:pointer}button:hover{background:#193a95}
.secondary,nav button{background:white;color:#244086}.secondary:hover{background:#eef2fb}
nav button[aria-pressed=true]{background:#244dbe;color:white}
label{display:grid;gap:5px}input{min-width:230px;background:white}select{background:white}
.muted,small{color:#647089}.small{font-size:13px}
.note,footer{color:#647089;font-size:14px}footer{padding:32px 0}
#refresh-status{margin-bottom:16px;padding:14px;border-radius:10px;background:#e4ecff}
#detail{scroll-margin-top:20px;border-color:#657bdd}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible{outline:3px solid #f1b73d;outline-offset:3px}
[hidden]{display:none!important}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* sample banner – preview only */
.sample-banner{background:#fff0d3;color:#775000;border-bottom:1px solid #f0d49a;padding:10px 16px;font-weight:bold;text-align:center}
.sample-tag{display:inline-block;font-size:11px;font-weight:bold;color:#775000;background:#fff0d3;border-radius:5px;padding:0 5px;margin-inline-start:6px;vertical-align:middle;line-height:1.6}

/* freshness chips */
.fresh-row{display:flex;flex-wrap:wrap;gap:8px}
.fresh-chip{display:inline-flex;align-items:center;gap:6px;background:white;border:1px solid #dce3ef;border-radius:999px;padding:5px 12px;font-size:14px}
.fresh-chip.stale,.fresh-chip.error{background:#fff0d3;border-color:#f0d49a;color:#775000}
.fresh-chip.not_connected,.fresh-chip.pending{color:#647089}
.dot{width:9px;height:9px;border-radius:50%;display:inline-block;background:#9aa4b8}
.fresh-chip.fresh .dot.meta{background:#1877f2}.fresh-chip.fresh .dot.google{background:#e37400}.fresh-chip.fresh .dot.tiktok{background:#111}

/* stats */
.stats,.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}
.stats{grid-template-columns:repeat(4,minmax(0,1fr));margin-bottom:8px}
.stats article{border-top:4px solid #6f65ce;padding:18px 20px}
.stats small{display:block}.stats strong{display:block;font-size:26px;line-height:1.3;margin:4px 0 2px}
.stats .muted{display:block}
.badge{display:inline-block;padding:3px 12px;border-radius:20px;background:#eeedff;color:#5746a8;font-size:13px}

/* values */
.amount{font-variant-numeric:tabular-nums;white-space:nowrap}
.warn{color:#9a5b00;font-weight:bold}.over{color:#b42318;font-weight:bold}
.period{white-space:nowrap}
.tag{display:inline-block;font-size:12px;padding:1px 8px;border-radius:6px;background:#eef1f6;color:#647089}
.chips{display:inline-flex;flex-wrap:wrap;gap:4px}
.chip{font-size:12px;padding:1px 8px;border-radius:6px;color:white;background:#647089}
.chip.meta{background:#1877f2}.chip.google{background:#c25e00}.chip.tiktok{background:#111}
meter{display:block;width:100%;max-width:120px;height:8px;margin-top:4px}

/* shows table (desktop) */
.table-panel{padding:0;overflow:hidden}.table-panel h2{margin:0;padding:16px 20px;border-bottom:1px solid #dce3ef}
.table-wrap{overflow-x:auto}
table{width:100%;border-collapse:collapse}
th,td{padding:11px 12px;text-align:right;border-bottom:1px solid #e8edf5;vertical-align:middle}
th{font-size:13px;color:#647089;font-weight:600;background:#f8faff;white-space:nowrap}
tbody tr:hover{background:#f7f9ff}
.small-btn{min-height:36px;padding:6px 12px}
.show-cards{display:none}
.wide{width:100%;margin-top:10px}
.asset-link{display:inline-block;margin:12px 0;color:#244dbe;font-weight:bold;text-underline-offset:4px}

/* show cards (phone) */
.show-card{border:none;border-bottom:1px solid #e8edf5;border-radius:0;padding:18px 16px}
.show-card h3{margin:0;font-size:20px}.show-card>p{margin:2px 0 12px;font-size:15px}
.card-main{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.card-main small{display:block;font-size:14px}
.card-main .amount{display:block;font-size:20px;font-weight:bold;white-space:normal}
.card-main .sample-tag{display:block;width:fit-content;margin:3px 0 0}
.show-card meter{max-width:none;height:10px;margin-top:12px}
.show-card details{margin-top:10px}
.show-card summary{cursor:pointer;color:#244dbe;font-weight:bold;padding:6px 0;min-height:44px;display:flex;align-items:center}
.card-more{display:grid;grid-template-columns:auto 1fr;gap:6px 14px;margin:6px 0 0;font-size:15px}
.card-more dt{color:#647089}.card-more dd{margin:0}

@media(max-width:850px){main{padding:20px}.grid{grid-template-columns:repeat(2,minmax(0,1fr))}.stats{grid-template-columns:repeat(2,minmax(0,1fr))}h1{font-size:29px}}
@media(max-width:700px){
 .table-panel .table-wrap{display:none}.table-panel .table-wrap.always,#detail .table-wrap{display:block}
 .show-cards{display:block}
}
@media(max-width:560px){
 main{padding:14px}header{padding:22px}h1{font-size:26px}
 .grid{grid-template-columns:1fr}.stats{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
 .stats article{padding:14px}.stats strong{font-size:21px}
 nav{gap:8px}nav button{font-size:14px;padding:10px}article{padding:18px}
 .controls{display:grid;grid-template-columns:1fr 1fr}.controls label:last-child{grid-column:1/-1}
 .controls input{min-width:0;width:100%}
 .toolbar span{width:100%;overflow-wrap:anywhere}
}

/* systems shell */
.crumbs{display:block;margin:0 0 8px;font-size:15px;color:#647089}
.crumbs a{color:#244dbe;font-weight:bold;text-decoration:none}.crumbs a:hover{text-decoration:underline}
.systems{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;margin:8px 0 24px}
.system-card{display:block;border:1px solid #dce3ef;border-radius:18px;background:white;padding:24px;color:inherit;text-decoration:none;border-top:5px solid #244dbe;min-height:170px}
a.system-card:hover{box-shadow:0 6px 20px rgba(36,77,190,.12);border-color:#9fb1e6}
.system-card h2{margin:0 0 6px;font-size:21px}
.system-card .go{display:inline-block;margin-top:10px;color:#244dbe;font-weight:bold}
.system-card.soon{border-top-color:#c9d1e0;background:#f8f9fc}
.system-card.soon h2{color:#647089}
@media(max-width:850px){.systems{grid-template-columns:1fr}.system-card{min-height:0}}

/* budget entry */
.budget-form{margin:18px 0;padding:18px;border:1px dashed #9fb1e6;border-radius:14px;background:#f8faff}
.budget-form h3{margin-top:0}
.budget-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.budget-row{border:1px solid #dce3ef;border-radius:12px;background:white;padding:12px 14px;display:grid;gap:8px;margin:0}
.budget-row legend{font-weight:bold;padding:0 6px}
.budget-row input{min-width:0;width:100%}
@media(max-width:850px){.budget-grid{grid-template-columns:1fr}}

/* workflow screens */
nav .count:not(:empty){display:inline-block;min-width:20px;padding:0 6px;margin-inline-start:6px;border-radius:10px;background:#d92d20;color:white;font-size:12px;line-height:20px}
.form-panel h3{margin-top:0}
.form-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px 16px;margin:10px 0 14px}
.form-grid label{font-size:14px;color:#3b4660}
.form-grid input,.form-grid select,.form-grid textarea{min-width:0;width:100%;font:inherit;border:1px solid #ccd7eb;border-radius:10px;padding:9px 12px;background:white}
.form-grid [hidden]{display:none!important}
.item-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-bottom:20px}
.item-card{padding:16px 18px;border-inline-start:5px solid #c9d1e0}
.item-card.status-submitted{border-inline-start-color:#f1b73d}.item-card.status-approved{border-inline-start-color:#1a7f4b}.item-card.status-rejected{border-inline-start-color:#b42318}.item-card.status-returned{border-inline-start-color:#7a5af8}
.item-card.late{border-inline-start-color:#b42318}
.item-card p{margin:6px 0}
.item-head{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.item-head strong{font-size:17px}
.change{font-weight:bold;font-variant-numeric:tabular-nums}
.note-box{background:#f4f6fb;border-radius:8px;padding:8px 10px}
.actions{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0}
.danger{color:#b42318!important;border-color:#f0b4ae!important}
.tag.st-submitted{background:#fff0d3;color:#775000}.tag.st-approved,.tag.st-verified{background:#e3f6ea;color:#1a7f4b}.tag.st-rejected,.tag.st-failed{background:#fde8e6;color:#b42318}.tag.st-returned{background:#efeafe;color:#5b3fd1}.tag.st-done{background:#e4ecff;color:#244086}
.item-card details,.show-file details{margin:10px 0}
.item-card summary,.show-file summary{cursor:pointer;color:#244dbe;font-weight:bold;min-height:40px;display:flex;align-items:center}
.show-file{margin:20px 0;padding-top:6px;border-top:1px solid #e8edf5}
.facts{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;margin-bottom:12px}
.facts div{background:#f4f6fb;border-radius:12px;padding:10px 12px}.facts small{display:block}.facts strong{font-size:20px}
.thread{display:grid;gap:8px;margin:8px 0 12px;max-height:340px;overflow:auto;padding:4px}
.msg{background:#f4f6fb;border-radius:12px;padding:8px 12px;max-width:85%}.msg.mine{background:#e4ecff;margin-inline-start:auto}
.msg p{margin:2px 0 0}
@media(max-width:850px){.form-grid,.item-grid{grid-template-columns:1fr}.facts{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:560px){nav#tabs{overflow-x:auto;flex-wrap:nowrap}nav#tabs button{white-space:nowrap}.facts{grid-template-columns:repeat(2,minmax(0,1fr))}}
.item-card textarea,.show-file textarea,.item-card input[type=text],.item-card input[type=number],.item-card details input{display:block;width:100%;min-width:0;font:inherit;border:1px solid #ccd7eb;border-radius:10px;padding:9px 12px;background:white}
.item-card label,.show-file label{display:block;margin:8px 0;font-size:14px;color:#3b4660}
