* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, sans-serif; color: #1f2937; background: #f3f4f6; }
a { color: #1d4ed8; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { display: flex; align-items: center; gap: 1rem; background: #1e3a5f; color: #fff; padding: .7rem 1.2rem; }
.topbar .brand { color: #fff; font-weight: 700; font-size: 1.15rem; }
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 1.1rem; }
.topbar nav a { color: #dbeafe; }
.topbar .who { color: #93c5fd; font-size: .9rem; }

main { max-width: 900px; margin: 1.5rem auto; padding: 0 1rem; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; margin-top: 1.6rem; }

.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 1.1rem 1.3rem; margin-bottom: 1rem; }
.flash { background: #fef3c7; border: 1px solid #fcd34d; border-radius: 8px; padding: .6rem .9rem; margin-bottom: 1rem; }

label { display: block; margin: .7rem 0 .2rem; font-weight: 600; font-size: .92rem; }
input[type=text], input[type=password], input[type=file], input[type=date], select, textarea {
  width: 100%; max-width: 420px; padding: .5rem .6rem; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 1rem; }
textarea { font-family: ui-monospace, Consolas, monospace; }
.hint { color: #6b7280; font-size: .85rem; margin: .15rem 0 0; }

button, .btn { display: inline-block; background: #1d4ed8; color: #fff; border: 0; border-radius: 7px;
  padding: .55rem 1.1rem; font-size: 1rem; cursor: pointer; }
button:hover, .btn:hover { background: #1743b3; text-decoration: none; }
.btn.secondary { background: #e5e7eb; color: #1f2937; }
.btn.small { padding: .3rem .7rem; font-size: .85rem; }
.btn.danger { background: #dc2626; }
.btn.danger:hover { background: #b91c1c; }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid #eef2f7; }
th { font-size: .82rem; color: #6b7280; text-transform: uppercase; letter-spacing: .02em; }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge.done { background: #dcfce7; color: #166534; }
.badge.todo { background: #fee2e2; color: #991b1b; }

.step { border: 1px solid #e5e7eb; border-radius: 9px; padding: .9rem 1rem; margin-bottom: .8rem; }
.step h3 { margin: 0 0 .3rem; font-size: 1.02rem; }
pre.output { background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: 8px; overflow-x: auto;
  white-space: pre-wrap; font-size: .9rem; }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .6rem; }

.tabbar { display: flex; gap: .25rem; border-bottom: 2px solid #d7dce3; margin: .4rem 0 1.2rem; }
.tabbar a { padding: .5rem 1rem; border-radius: 9px 9px 0 0; color: #4b5563; font-weight: 600;
  border: 1px solid transparent; border-bottom: 0; }
.tabbar a:hover { background: #e8ecf2; text-decoration: none; }
.tabbar a.active { background: #fff; color: #1d4ed8; border-color: #d7dce3; margin-bottom: -2px;
  padding-bottom: calc(.5rem + 2px); }

.badge.upload { background: #dbeafe; color: #1e40af; }
.badge.review { background: #fef3c7; color: #92400e; }
.badge.internal { background: #f3f4f6; color: #6b7280; }

/* ---- pipeline ---- */
.pgrid input, .pgrid select { border: 1px solid transparent; background: transparent;
  width: auto; max-width: none; padding: .3rem .4rem; font-size: .95rem; }
.pgrid input:hover, .pgrid select:hover, .pgrid input:focus, .pgrid select:focus {
  border-color: #cbd5e1; background: #fff; }
.pgrid input.num { width: 70px; }
.pgrid input[type=date] { width: 150px; }
.pgrid td { white-space: nowrap; }
.cellsave.saving { outline: 2px solid #fcd34d; }
.cellsave.saved { outline: 2px solid #86efac; }
.cellsave.savefail { outline: 2px solid #fca5a5; }
input.overdue { color: #b91c1c; font-weight: 700; }
.title-edit { font-size: 1.3rem; font-weight: 700; border: 1px solid transparent;
  background: transparent; flex: 1; min-width: 200px; }
.title-edit:hover, .title-edit:focus { border-color: #cbd5e1; background: #fff; }
.hdr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .2rem .9rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.contact-row { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem .6rem;
  border-bottom: 1px solid #eef2f7; padding: .6rem 0; }
.contact-row input { max-width: none; }
.tapbar { grid-column: 1 / -1; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.tap-wa { background: #16a34a; }
.tap-wa:hover { background: #15803d; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.chip { background: #eef2f7; color: #1f2937; border: 1px solid #d7dce3; border-radius: 999px;
  padding: .3rem .8rem; font-size: .88rem; cursor: pointer; }
.chip.on { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.act { border-bottom: 1px solid #eef2f7; padding: .45rem 0; }

/* grid collapses to cards on phones */
@media (max-width: 700px) {
  .pgrid thead { display: none; }
  .pgrid tbody tr { display: block; border: 1px solid #e5e7eb; border-radius: 9px;
    margin-bottom: .7rem; padding: .5rem .7rem; }
  .pgrid td { display: flex; justify-content: space-between; align-items: center;
    border: 0; padding: .25rem 0; gap: .6rem; white-space: normal; }
  .pgrid td::before { content: attr(data-l); font-size: .78rem; color: #6b7280;
    text-transform: uppercase; }
  button, .btn { padding: .65rem 1.2rem; }   /* bigger tap targets */
}

.login-wrap { max-width: 360px; margin: 4rem auto; }
.chat { height: 60vh; overflow-y: auto; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 1rem; }
.msg { margin-bottom: .9rem; } .msg .role { font-weight: 700; font-size: .85rem; }
.msg.you .role { color: #1d4ed8; } .msg.bot .role { color: #166534; }
.msg .body { white-space: pre-wrap; }
