:root { --orange:#E2531D; --orange-d:#C2410C; --orange-l:#FDEEE7; --ink:#1E1E20; --ink-2:#2A2A2E; --line:#E7E5E2; --bg:#F4F3F1; --muted:#74747B; --head:'Montserrat',system-ui,sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 'Inter', system-ui, sans-serif; color: #33333A; background: var(--bg); }
a { color: inherit; text-decoration: none; }
h1,h2,h3 { font-family: var(--head); color: var(--ink); margin: 0 0 .8rem; }
h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: .04em; border-left: 3px solid var(--orange); padding-left: .6rem; }
code { background: #F1EFEC; padding: 1px 5px; border-radius: 3px; font-size: .85em; }
.muted { color: var(--muted); }
.layout { display: flex; min-height: 100vh; }
.side { width: 250px; background: var(--ink); color: #BDBDC4; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 20; transition: .25s; }
.side-brand { display: flex; align-items: center; gap: .7rem; padding: 1.3rem 1.3rem 1.2rem; border-bottom: 1px solid #333; }
.side-brand img { height: 32px; }
.side-brand .wordmark { height: 15px; display: block; margin-bottom: .35rem; }
.side-brand strong { display: block; font: 800 1.1rem/1 var(--head); color: #fff; letter-spacing: .14em; text-transform: uppercase; }
.side-brand small { display: block; white-space: nowrap; font-size: .68rem; color: var(--orange); text-transform: uppercase; letter-spacing: .12em; }
.side nav { padding: 1rem .7rem; flex: 1; }
.side nav a { display: flex; align-items: center; gap: .75rem; padding: .7rem .8rem; border-radius: 5px; margin-bottom: 2px; font-weight: 500; }
.side nav a:hover { background: #2B2B30; color: #fff; }
.side nav a.on { background: var(--orange); color: #fff; }
.side nav em { margin-left: auto; font-style: normal; background: #fff; color: var(--orange); font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 10px; }
.side-foot { padding: 1rem .7rem; border-top: 1px solid #333; }
.side-foot a, .side-foot button { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .6rem .8rem; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; border-radius: 5px; }
.side-foot a:hover, .side-foot button:hover { background: #2B2B30; color: #fff; }
.main { flex: 1; margin-left: 250px; min-width: 0; }
.bar { display: flex; align-items: center; gap: 1rem; background: #fff; border-bottom: 1px solid var(--line); padding: 1rem 2rem; position: sticky; top: 0; z-index: 10; }
.bar h1 { font-size: 1.3rem; margin: 0; flex: 1; }
.who { font-size: .85rem; color: var(--muted); }
.side-toggle { display: none; background: none; border: 0; cursor: pointer; }
.content { padding: 2rem; max-width: 1300px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 1.5rem; margin-bottom: 1.5rem; }
.card.flush { padding: 0; overflow: auto; }
.card.narrow { max-width: 760px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.card-head h2 { font-size: 1.05rem; }
.card-head a { color: var(--orange); font-weight: 600; font-size: .88rem; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 1.3rem; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 1rem; align-items: center; transition: .2s; }
.stat:hover { border-color: var(--orange); }
.stat .ico { grid-row: span 2; color: var(--orange); background: var(--orange-l); padding: 10px; width: 48px; height: 48px; border-radius: 8px; }
.stat strong { font: 800 1.7rem/1 var(--head); color: var(--ink); }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.hot .ico { background: var(--orange); color: #fff; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem; }
.grid-main { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1.5rem; align-items: start; }
.quick { display: grid; gap: .6rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; background: var(--orange); color: #fff; border: 1px solid var(--orange); padding: .7rem 1.2rem; border-radius: 6px; font: 700 .82rem var(--head); text-transform: uppercase; letter-spacing: .04em; cursor: pointer; }
.btn:hover { background: var(--orange-d); }
.btn-light { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-light:hover { background: #F6F5F3; }
.btn-danger { background: #fff; color: #B91C1C; border-color: #F3C4C4; }
.btn-danger:hover { background: #FDECEC; }
.btn.full { width: 100%; padding: .9rem; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.inline { display: inline; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font: 700 .72rem var(--head); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .9rem 1rem; border-bottom: 1px solid var(--line); background: #FAFAF9; }
.table td { padding: .8rem 1rem; border-bottom: 1px solid #F0EEEB; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.unread td:first-child { box-shadow: inset 3px 0 var(--orange); }
.table tr.unread strong { color: var(--orange-d); }
.table tr.editing td { background: var(--orange-l); }
.card:not(.flush) .table td { padding: .7rem 0; }
.table .thumb { width: 64px; }
.table .thumb img { width: 52px; height: 52px; object-fit: cover; border-radius: 5px; background: #eee; }
.table .thumb .ico { color: var(--orange); }
.right { text-align: right; } .nowrap { white-space: nowrap; } .pad { padding: 2rem !important; text-align: center; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: #55555C; cursor: pointer; vertical-align: middle; }
.icon-btn:hover { border-color: var(--orange); color: var(--orange); }
.icon-btn.danger:hover { border-color: #DC2626; color: #DC2626; }
.pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 9px; border-radius: 20px; background: #EEE; color: #666; }
.pill.ok { background: #E3F5E8; color: #166534; }
.pill.star { background: var(--orange-l); color: var(--orange-d); }
.form label { display: block; font: 600 .82rem var(--head); color: var(--ink); margin-bottom: 1rem; }
.form label small { font: 400 .78rem 'Inter'; color: var(--muted); }
.lbl { display: block; font: 600 .82rem var(--head); color: var(--ink); margin-bottom: .4rem; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea, select { display: block; width: 100%; margin-top: .35rem; padding: .65rem .8rem; border: 1px solid #D8D6D2; border-radius: 6px; font: 400 .92rem 'Inter'; background: #FDFDFC; }
.toolbar select { width: auto; margin: 0; }
.form textarea { resize: vertical; line-height: 1.5; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(226,83,29,.14); }
.form label.check, label.check { display: flex; align-items: center; gap: .5rem; font: 500 .88rem 'Inter'; margin-bottom: .6rem; cursor: pointer; }
label.check.danger { color: #B91C1C; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
.actions.sticky { position: sticky; bottom: 0; background: var(--bg); padding: 1rem 0; border-top: 1px solid var(--line); }
.img-manage { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.img-item { border: 1px solid var(--line); border-radius: 6px; padding: .5rem; }
.img-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; margin-bottom: .4rem; background: #eee; }
.img-item label.check { font-size: .8rem; margin: .2rem 0; }
.preview { display: flex; gap: .5rem; flex-wrap: wrap; }
.preview img { width: 80px; height: 80px; object-fit: cover; border-radius: 5px; border: 2px solid var(--orange); }
.cur-img { max-width: 140px; border-radius: 6px; margin-bottom: .8rem; border: 1px solid var(--line); }
.cur-img.wide { max-width: 100%; max-height: 160px; object-fit: cover; }
.logo-box { background: #F6F5F3; border: 1px dashed #CCC; border-radius: 6px; padding: 1rem; display: inline-block; }
.logo-box img { height: 60px; }
.kv { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.kv th { text-align: left; width: 140px; padding: .55rem 0; color: var(--muted); font-weight: 500; }
.kv td { padding: .55rem 0; border-bottom: 1px solid #F0EEEB; }
.message { white-space: pre-wrap; background: #FAF9F7; border-left: 3px solid var(--orange); padding: 1rem 1.2rem; border-radius: 4px; margin-bottom: 1.2rem; }
.alert { padding: .9rem 1.1rem; border-radius: 6px; margin-bottom: 1.3rem; font-weight: 500; }
.alert.success { background: #E5F6EA; color: #166534; }
.alert.error { background: #FDECEC; color: #991B1B; }
.alert.warn { background: #FFF4E0; color: #8A4B00; }
.alert.warn a { text-decoration: underline; font-weight: 700; }
/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(120deg, var(--ink) 55%, var(--orange) 55.2%); padding: 1rem; }
.login-card { background: #fff; width: 100%; max-width: 400px; padding: 2.5rem 2.2rem; border-radius: 10px; box-shadow: 0 30px 60px rgba(0,0,0,.3); }
.login-logo { height: 110px; margin: 0 auto 1rem; display: block; }
.login-card h1 { font-size: 1.5rem; text-transform: uppercase; letter-spacing: .12em; margin-bottom: .3rem; }
.login-card h1 span { color: var(--orange); }
.login-card p { color: var(--muted); margin: 0 0 1.5rem; }
.login-card label { display: block; font: 600 .82rem var(--head); margin-bottom: 1rem; }
.login-card input { display: block; width: 100%; margin-top: .35rem; padding: .8rem; border: 1px solid #D8D6D2; border-radius: 6px; font: inherit; }
.login-card input:focus { outline: none; border-color: var(--orange); }
.back { display: block; text-align: center; margin-top: 1.2rem; color: var(--muted); font-size: .88rem; }
@media (max-width: 1000px) { .grid-2, .grid-main { grid-template-columns: 1fr; } .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) {
  .side { transform: translateX(-100%); } body.side-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .main { margin-left: 0; } .side-toggle { display: block; } .who { display: none; }
  .content { padding: 1rem; } .bar { padding: .8rem 1rem; } .grid2 { grid-template-columns: 1fr; }
}
.lab-type-row { display: flex; align-items: center; gap: 1rem; padding: .7rem; border: 1px solid var(--line); border-radius: 6px; margin-bottom: .7rem; }
.lab-type-row img, .lab-type-row .noimg { width: 90px; height: 60px; object-fit: cover; border-radius: 4px; background: #eee; flex-shrink: 0; display: grid; place-items: center; font-size: .75rem; color: var(--muted); }
.lab-type-row label { flex: 1; margin: 0 !important; }
/* phone: lists become stacked cards, nothing hidden off-screen */
.btn { white-space: nowrap; }
@media (max-width: 760px) {
  .toolbar { flex-wrap: wrap; }
  .toolbar form, .toolbar select { flex: 1; min-width: 0; }
  .card.flush .table thead { display: none; }
  .card.flush .table, .card.flush .table tbody { display: block; }
  .card.flush .table tr { display: grid; grid-template-columns: 56px 1fr; gap: .35rem .9rem; padding: 1rem; border-bottom: 1px solid #F0EEEB; }
  .card.flush .table tr:not(:has(.thumb)) { grid-template-columns: 1fr; }
  .card.flush .table td { display: block; padding: 0 !important; border: 0; }
  .card.flush .table td.thumb { grid-row: span 5; width: auto; }
  .card.flush .table td.right { text-align: left; margin-top: .3rem; }
  .card.flush .table td.pad { grid-column: 1 / -1; }
  .card.flush .table tr.unread { box-shadow: inset 3px 0 var(--orange); }
  .card.flush .table tr.unread td:first-child { box-shadow: none; }
  .card.flush .table td[data-label] { font-size: .85rem; }
  .card.flush .table td[data-label]::before { content: attr(data-label) ': '; color: var(--muted); }
  .icon-btn { width: 40px; height: 40px; }
  .stat { padding: 1rem; }
  .stat strong { font-size: 1.4rem; }
  .actions .btn { flex: 1; }
  .bar h1 { font-size: 1.1rem; }
}
/* company profile editor */
.img-slot { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.img-slot img, .img-slot .noimg { width: 120px; height: 80px; object-fit: cover; border-radius: 5px; background: #eee; border: 1px solid var(--line); flex-shrink: 0; display: grid; place-items: center; font-size: .75rem; color: var(--muted); }
.img-slot label { flex: 1; margin: 0 !important; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .4rem 1.2rem; }
.img-slot.small img, .img-slot.small .noimg { width: 80px; height: 60px; }
.img-slot.small label { font-size: .78rem; }
@media (max-width: 760px) { .slot-grid { grid-template-columns: 1fr; } .img-slot img { width: 90px; height: 64px; } }
