body.app { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
.app main { flex: 1; padding: 34px 0 60px; }
.auth-card { max-width: 440px; margin: 30px auto; }
.tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 22px; }
.tabs button { flex: 1; border: 0; background: none; padding: 10px; border-radius: 8px; font: 600 14px var(--font); color: var(--muted); cursor: pointer; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.linkbtn { background: none; border: 0; color: var(--em); font: 600 14px var(--font); cursor: pointer; padding: 0; }
.muted { color: var(--muted); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 30px; margin: 0; letter-spacing: -.6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #eef0f2; color: var(--ch-3); white-space: nowrap; }
.pill.s-new { background: #e0f2fe; color: #075985; }
.pill.s-ats_checked, .pill.s-quoted { background: #ede9fe; color: #5b21b6; }
.pill.s-in_progress { background: var(--warn-bg); color: #92400e; }
.pill.s-review { background: #fce7f3; color: #9d174d; }
.pill.s-assigned { background: #e0e7ff; color: #3730a3; }
.pill.s-revision { background: #ffedd5; color: #9a3412; }
.pill.s-delivered { background: var(--mint-2); color: var(--em-dark); }
.pill.s-closed { background: #eef0f2; color: #6b7280; }

.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 4px 0 24px; }
.step { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; color: var(--muted); position: relative; }
.step b { display: block; color: var(--ink); font-size: 14px; }
.step.done { border-color: var(--mint-2); background: var(--mint); } .step.done b { color: var(--em-dark); }
.step.now { border-color: var(--em); box-shadow: 0 0 0 3px rgba(5,150,105,.12); }
@media (max-width: 640px) { .steps { grid-template-columns: 1fr 1fr; } }

.cols { display: grid; grid-template-columns: 1fr 1.25fr; gap: 22px; align-items: start; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }
.card h3 { display: flex; justify-content: space-between; align-items: center; }
.files { list-style: none; padding: 0; margin: 12px 0 0; }
.files li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.files li:first-child { border-top: 0; }
.files .fi { width: 34px; height: 34px; border-radius: 8px; background: var(--bg); display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--ch-3); }
.files .fi.adm { background: var(--mint-2); color: var(--em-dark); }
.files small { display: block; color: var(--muted); font-size: 12.5px; }
.files .name { word-break: break-all; font-weight: 600; }
.upl { border: 2px dashed #c3ccd5; border-radius: 12px; padding: 18px; text-align: center; cursor: pointer; font-size: 14px; color: var(--muted); transition: .15s; }
.upl:hover, .upl.over { border-color: var(--em); background: var(--mint); color: var(--em-dark); }
.upl b { color: var(--ink); }
.prog { height: 6px; background: #eef0f2; border-radius: 9px; overflow: hidden; margin-top: 10px; }
.prog i { display: block; height: 100%; width: 40%; background: var(--em); animation: slide 1s ease-in-out infinite alternate; }
@keyframes slide { from { margin-left: 0 } to { margin-left: 60% } }

.thread { height: 420px; overflow-y: auto; padding: 6px 2px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; padding: 10px 13px; border-radius: 14px; font-size: 14.5px; white-space: pre-wrap; word-wrap: break-word; }
.msg small { display: block; font-size: 11.5px; margin-top: 4px; opacity: .7; }
.msg.me { align-self: flex-end; background: var(--em); color: #fff; border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: #f1f3f5; color: var(--ink); border-bottom-left-radius: 4px; }
.msg .who { font-size: 12px; font-weight: 700; margin-bottom: 2px; opacity: .8; }
.empty { color: var(--muted); font-size: 14px; text-align: center; margin: auto; padding: 30px 10px; }
.composer { display: flex; gap: 10px; margin-top: 12px; align-items: flex-end; }
.composer textarea { min-height: 52px; height: 52px; max-height: 160px; }

/* admin */
.admin-grid { display: grid; grid-template-columns: 340px 1fr; gap: 22px; align-items: start; }
@media (max-width: 960px) { .admin-grid { grid-template-columns: 1fr; } }
.clist { list-style: none; margin: 0; padding: 0; max-height: 70vh; overflow-y: auto; }
.clist li { padding: 12px 12px; border-radius: 10px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; border: 1px solid transparent; }
.clist li:hover { background: var(--bg); }
.clist li.on { background: var(--mint); border-color: var(--mint-2); }
.clist .nm { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clist .em { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clist .tm { font-size: 12px; color: var(--muted); text-align: right; }
.badge { background: var(--bad); color: #fff; font-size: 11.5px; font-weight: 800; min-width: 20px; height: 20px; border-radius: 99px; display: inline-grid; place-items: center; padding: 0 6px; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; }
.filters input { flex: 1; } .filters select { width: 140px; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; font-size: 14px; margin: 0 0 16px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-all; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat b { font-size: 26px; display: block; letter-spacing: -.5px; } .stat span { font-size: 13px; color: var(--muted); }
@media (max-width: 640px) { .stats { grid-template-columns: 1fr 1fr; } }
.setup { max-width: 640px; margin: 40px auto; }
.setup code { background: var(--bg); padding: 2px 6px; border-radius: 5px; font-size: 13px; }
@media (max-width: 640px) {
  .app .nav-links a { font-size: 13.5px; padding: 6px 8px; white-space: nowrap; }
  .app .logo { font-size: 17px; }
  .card h3 { flex-wrap: wrap; gap: 4px; }
  .card h3 .muted { width: 100%; }
  .thread { height: 360px; }
  .page-head h1 { font-size: 26px; }
  .filters { flex-direction: column; } .filters select { width: 100%; }
}
.biz td, .biz th { padding: 8px 10px; border-top: 1px solid var(--line); }
/* wide admin */
.admin-wide .wrap { max-width: 1680px; }
.admin-wide .admin-grid { grid-template-columns: 300px 1fr; }
.toppanels { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; align-items: start; }
.dgrid { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(480px, 1.3fr); gap: 22px; align-items: start; }
.dright .cols { grid-template-columns: 1fr; }
.dright .cols > .card:last-child { order: -1; }
.dright .thread { max-height: 560px; }
@media (max-width: 1300px) { .dgrid { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .toppanels { grid-template-columns: 1fr; } }
