@font-face { font-family: 'Montserrat'; font-weight: 400; font-display: swap; src: url('fonts/montserrat-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-weight: 500; font-display: swap; src: url('fonts/montserrat-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-weight: 600; font-display: swap; src: url('fonts/montserrat-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-weight: 700; font-display: swap; src: url('fonts/montserrat-latin-700-normal.woff2') format('woff2'); }

/* Brand colors: change --brand to the exact PML logo teal */
:root {
  --brand: #0285a3;
  --brand-dark: #016a82;
  --brand-tint: #e4f2f6;
  --ink: #17242a;
  --muted: #5d6d74;
  --line: #dde5e8;
  --bg: #f5f8f9;
  --card: #ffffff;
  --green: #1d7a46;
  --green-tint: #e5f4ea;
  --amber: #9a5b00;
  --amber-tint: #fdf1de;
  --red: #a3292d;
  --red-tint: #fbe9e9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 40, 48, .06), 0 4px 16px rgba(16, 40, 48, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Montserrat', system-ui, -apple-system, Segoe UI, sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--brand); }
.hidden { display: none !important; }

/* buttons and inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; font-size: 14px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: #b9c8cd; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.04); }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .55; cursor: default; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; width: 100%; }
.input:focus, textarea:focus { outline: 2px solid var(--brand-tint); border-color: var(--brand); }
.error { color: var(--red); font-size: 14px; min-height: 20px; }
.ok { color: var(--green); font-size: 14px; }

/* header */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; letter-spacing: .5px; }
.brand-name { font-weight: 700; line-height: 1.1; }
.brand-name small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.topnav { display: flex; align-items: center; gap: 4px; }
.who { color: var(--muted); font-size: 13px; margin-right: 8px; }

/* banners */
.banner { margin: 12px auto 0; max-width: 1100px; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; background: var(--amber-tint); color: var(--amber); }
.banner.info { background: var(--brand-tint); color: var(--brand-dark); }

/* login */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, var(--brand-tint), var(--bg) 60%); }
.login-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 32px 28px; }
.login-card h1 { font-size: 20px; margin: 18px 0 4px; }
.login-card p.sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.login-card .btn.primary { width: 100%; justify-content: center; padding: 11px; }
.login-foot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 18px; }

/* chat layout */
.chat-shell { display: flex; flex-direction: column; height: calc(100% - 57px); }
.thread { flex: 1; overflow-y: auto; padding: 20px 16px 8px; }
.thread-inner { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.msg-user { align-self: flex-end; max-width: 75%; background: var(--brand); color: #fff; padding: 10px 14px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.msg-user .files { margin-top: 6px; font-size: 12.5px; opacity: .9; }
.msg-user.long { max-height: 160px; overflow: hidden; position: relative; }
.msg-user.long::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 40px; background: linear-gradient(transparent, var(--brand)); }
.msg-bot { align-self: stretch; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); }
.msg-bot .note { margin: 0 0 12px; }
.msg-bot.error-msg { border-color: #f0c9ca; background: var(--red-tint); color: var(--red); box-shadow: none; }
.typing { display: inline-flex; gap: 4px; align-items: center; color: var(--muted); font-size: 14px; }
.typing span.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: blink 1.2s infinite; }
.typing span.dot:nth-child(2) { animation-delay: .2s; } .typing span.dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

.welcome { text-align: center; padding: 30px 10px 10px; }
.welcome h2 { margin: 0 0 6px; font-size: 22px; }
.welcome p { color: var(--muted); margin: 0 auto 18px; max-width: 560px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { border: 1px solid var(--line); background: var(--card); padding: 7px 12px; border-radius: 999px; cursor: pointer; font-size: 13.5px; }
.chip:hover { border-color: var(--brand); color: var(--brand); }

/* summary pills */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.pill { padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.pill.in { background: var(--green-tint); color: var(--green); }
.pill.out { background: var(--amber-tint); color: var(--amber); }
.pill.nf { background: var(--red-tint); color: var(--red); }
.pills .spacer { flex: 1; }

/* results table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table.results { border-collapse: collapse; width: 100%; font-size: 13.5px; min-width: 760px; }
table.results th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; padding: 9px 10px; background: #fafcfc; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.results td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.results tr:last-child td { border-bottom: 0; }
table.results td.num, table.results th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.results tr.group td { background: #fafcfc; font-weight: 700; font-size: 13px; padding-top: 10px; }
table.results tr.group.in td { color: var(--green); }
table.results tr.group.out td { color: var(--amber); }
table.results tr.group.nf td { color: var(--red); }
table.results tr.total td { font-weight: 700; background: #fafcfc; }
.sub { color: var(--muted); font-size: 12px; }
.req { color: var(--muted); }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--brand-tint); color: var(--brand-dark); margin-left: 4px; }

/* composer */
.composer { border-top: 1px solid var(--line); background: var(--card); padding: 12px 16px 14px; }
.composer-inner { max-width: 1100px; margin: 0 auto; }
.compose-box { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; }
.compose-box:focus-within { border-color: var(--brand); }
.compose-box textarea { flex: 1; border: 0; resize: none; outline: none; min-height: 24px; max-height: 220px; padding: 6px 4px; font-size: 15px; }
.file-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-tint); color: var(--brand-dark); border-radius: 8px; padding: 4px 8px; font-size: 13px; }
.file-chip button { border: 0; background: none; cursor: pointer; color: inherit; font-size: 15px; line-height: 1; padding: 0 2px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.drop-overlay { position: fixed; inset: 0; background: rgba(2, 133, 163, .12); border: 3px dashed var(--brand); display: grid; place-items: center; font-size: 20px; font-weight: 700; color: var(--brand-dark); z-index: 20; pointer-events: none; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 30, 36, .4); display: grid; place-items: center; z-index: 30; padding: 16px; }
.modal { background: var(--card); border-radius: 14px; padding: 24px; width: 100%; max-width: 400px; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 14px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* admin */
.page { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card h3 { margin: 0 0 12px; font-size: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row .field { flex: 1; min-width: 160px; margin-bottom: 0; }
table.list { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.list th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.stat { background: var(--bg); border-radius: 10px; padding: 10px 14px; min-width: 120px; }
.stat b { display: block; font-size: 20px; }
.stat span { color: var(--muted); font-size: 12.5px; }
.temp-pw { font-family: ui-monospace, Menlo, monospace; background: var(--brand-tint); padding: 2px 6px; border-radius: 6px; }
.warn-list { max-height: 180px; overflow: auto; font-size: 13px; color: var(--amber); background: var(--amber-tint); border-radius: 8px; padding: 8px 12px; margin: 10px 0; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--green); }
.status-dot.off { background: #b8c2c6; }

@media (max-width: 640px) {
  .who { display: none; }
  .brand-name { display: none; }
  .topnav .btn.small { padding: 5px 7px; font-size: 12.5px; }
  .msg-user { max-width: 90%; }
  .msg-bot { padding: 12px; }
  .topbar { padding: 8px 12px; }
}
.modal .row { margin-bottom: 14px; }
.input:disabled { background: var(--bg); color: var(--muted); }

/* PML logo */
.brand-logo { height: 40px; width: auto; display: block; }
.login-logo { display: block; height: 120px; width: auto; margin: 0 auto 6px; }
.login-card h1, .login-card p.sub { text-align: center; }
.login-tagline { text-align: center; color: var(--brand-dark); font-weight: 600; font-size: 13px; margin: 0 0 18px; }
@media (max-width: 640px) { .brand-logo { height: 34px; } }
.login-card h1 { font-size: 19px; line-height: 1.3; }

/* Phones: results become stacked cards so prices are visible without sideways scrolling */
@media (max-width: 640px) {
  table.results { min-width: 0; }
  table.results thead { display: none; }
  table.results tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.results tr:last-child { border-bottom: 0; }
  table.results td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 3px 12px; text-align: right; }
  table.results td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; text-align: left; flex: none; padding-top: 2px; }
  table.results td.c-req, table.results td.c-test { display: block; text-align: left; }
  table.results td.c-req::before, table.results td.c-test::before { display: block; }
  table.results td.c-wide { display: block; text-align: left; }
  table.results td.c-wide::before, table.results td.c-empty { display: none; }
  table.results td:empty:not(.c-wide) { display: none; }
  table.results tr.group { padding: 0; }
  table.results tr.group td { display: block; text-align: left; padding: 8px 12px; }
  .hint span:first-child { display: none; }
  .pills .btn.small { padding: 4px 9px; }
}

/* In house vs send out badge on every row */
.badge { display: inline-block; font-weight: 700; font-size: 12.5px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge.in { background: var(--green-tint); color: var(--green); }
.badge.out { background: var(--amber-tint); color: var(--amber); }
.badge.nf { background: var(--red-tint); color: var(--red); }
table.results td.c-status { width: 1%; }
.pill { font-size: 14px; padding: 5px 12px; }

@media (max-width: 640px) {
  table.results tr:not(.group):not(.total) { padding: 12px 0 10px; }
  table.results td.c-status { display: block; width: auto; padding: 0 12px 6px; }
  table.results td.c-status .badge { font-size: 14px; padding: 5px 14px; }
  table.results td.c-cpt { display: none; }
  /* three prices side by side */
  table.results td.num { display: inline-flex; flex-direction: column; width: 33%; text-align: left; gap: 0; padding-top: 6px; }
  table.results td.num::before { font-size: 11px; }
  table.results tr.total td.num { padding-top: 2px; }
}

/* Phone card order: status, then the PML test, then what was asked, then prices */
@media (max-width: 640px) {
  table.results tr:not(.group) { display: flex; flex-wrap: wrap; align-items: baseline; }
  table.results tr:not(.group) td { width: 100%; }
  table.results td.c-status { order: 1; width: auto !important; text-align: left; padding: 0 0 6px 12px; }
  table.results td.c-test { order: 2; padding-top: 2px; }
  table.results td.c-test::before { display: none; }
  table.results td.c-test > div:first-child { font-weight: 700; font-size: 15.5px; }
  table.results td.c-req { order: 3; display: flex; justify-content: flex-start; gap: 6px; padding-top: 2px; font-size: 13px; }
  table.results td.c-req::before { content: 'Asked as'; display: inline; font-size: 11px; padding-top: 3px; }
  table.results td.c-wide { order: 4; }
  table.results td.num { order: 5; width: 33.33% !important; }
  table.results td[data-label="Turnaround"] { order: 6; }
  table.results tr.total td.c-wide { order: 1; }
}
@media (max-width: 640px) { table.results td.c-panel { order: 5; } }
