/* Genetidoc GD Grade Bot. Same look as GC Notes / Contact Sorter (Genetidoc brand palette). */
:root {
  --blue: #3E3E7E; --blue-d: #2e2e63; --blue-l: #eceefc; --blue-m: #c9cdf6; --accent: #5E6CE6;
  --pink: #E84E85; --pink-l: #fdeaf1; --cream: #FFF3E8; --mist: #F7F9FC;
  --ink: #232a3d; --ink-2: #35405B; --ink-3: #7b8794; --line: #e3e8ee; --bg: #f5f7fb; --card: #fff;
  --green: #1b8a5a; --green-l: #e5f5ed; --red: #c62828; --red-l: #fdecec; --amber: #9a5b00; --amber-l: #fff4e0;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
h2 { font-size: 15px; margin: 0; color: var(--blue); }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; padding: 7px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { background: #f0f2f8; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-d); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: #4b58d0; }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #eef1f7; }
.btn.sm { padding: 4px 9px; font-size: 13px; }
.btn.icon { padding: 4px 8px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid #d3d9e4; border-radius: 8px; padding: 8px 10px; background: #fff; outline: none; }
textarea.input { resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--blue-l); }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-weight: 500; margin-bottom: 4px; font-size: 13px; color: var(--ink-2); }
.check { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; cursor: pointer; }
.check input { margin-top: 3px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, var(--blue-l) 0%, var(--cream) 100%); }
.login-card { width: 380px; background: #fff; border-radius: 14px; padding: 32px; box-shadow: 0 10px 40px rgba(62,62,126,.14); }
.login-card img { height: 46px; }
.error { color: var(--red); font-size: 13px; min-height: 18px; margin: 6px 0; }

/* top bar */
.topbar { height: 58px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 6px; padding: 0 18px; position: sticky; top: 0; z-index: 20; }
.topbar .logo { height: 30px; margin-right: 10px; }
.topbar .spacer { flex: 1; }
.nav a { padding: 7px 11px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: #f0f2f8; }
.nav a.active { background: var(--blue-l); color: var(--blue); }
.page { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }
.page h1 { font-size: 22px; margin: 0; color: var(--blue); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.empty { text-align: center; padding: 50px 20px; color: var(--ink-3); background: #fff; border: 1px dashed #cfd6e3; border-radius: 12px; margin-top: 14px; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; background: #eef1f6; color: var(--ink-2); white-space: nowrap; }
.pill.blue { background: var(--blue-l); color: var(--blue); }
.pill.green { background: var(--green-l); color: var(--green); }
.pill.amber { background: var(--amber-l); color: var(--amber); }
.pill.pink { background: var(--pink-l); color: #b8285c; }
.pill.red { background: var(--red-l); color: var(--red); }

/* tables */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid #eef1f4; vertical-align: middle; }
th { background: #f9fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tbody.click tr { cursor: pointer; }
tbody.click tr:hover { background: #f7f8ff; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(20,22,45,.45); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: 540px; max-width: 100%; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal.wide { width: 860px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 16px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; z-index: 2; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; align-items: center; position: sticky; bottom: 0; background: #fff; }
.drop { border: 2px dashed #c4cbe6; border-radius: 12px; padding: 26px; text-align: center; cursor: pointer; background: #fafbff; }
.drop.over { border-color: var(--accent); background: var(--blue-l); }
.drop img { max-width: 100%; max-height: 220px; border-radius: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.langs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 10px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 8px; z-index: 200; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 90vw; }
.toast.err { background: var(--red); }

.spinner { width: 18px; height: 18px; border: 2px solid var(--blue-m); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint { background: var(--amber-l); color: #6b4300; border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hint.block { display: block; background: var(--blue-l); color: var(--ink-2); }
.brand-name { color: var(--blue); margin-right: 14px; font-size: 15px; white-space: nowrap; }
tr.off td { opacity: .5; }

/* segmented buttons */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 7px 14px; cursor: pointer; font-weight: 500; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--blue); color: #fff; }
.seg.st { display: flex; } .seg.st button { flex: 1; padding: 7px 6px; }

/* data tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs a { padding: 9px 12px; text-decoration: none; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--blue); border-bottom-color: var(--blue); }
.tabs a:hover { color: var(--blue); }

/* enquiry chat */
.chat-layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.chat-card { padding: 0; display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 520px; }
.chat { flex: 1; overflow-y: auto; padding: 16px; background: #eef1f6; border-radius: var(--radius) var(--radius) 0 0;
  display: flex; flex-direction: column; gap: 10px; }
.composer { padding: 12px; border-top: 1px solid var(--line); background: #fff; border-radius: 0 0 var(--radius) var(--radius); }
.bubble { max-width: 82%; padding: 10px 12px; border-radius: 12px; box-shadow: var(--shadow); line-height: 1.5; word-wrap: break-word; }
.bubble.cust { background: #fff; align-self: flex-start; border-top-left-radius: 4px; }
.bubble.bot { background: #e3f6e9; align-self: flex-end; border-top-right-radius: 4px; min-width: 300px; }
.bubble.bot.blocked { background: var(--red-l); }
.bubble.typing { background: #fff; color: var(--ink-3); display: flex; gap: 8px; align-items: center; min-width: 0; }
.bubble .who { font-size: 11.5px; color: var(--ink-3); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bubble .text { font-size: 14px; }
.bactions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.warn { background: var(--amber-l); color: #6b4300; border-radius: 8px; padding: 6px 10px; margin-top: 8px; font-size: 12.5px; }
.warn.red { background: var(--red-l); color: var(--red); }
.bubble .warn:first-of-type { margin-top: 2px; margin-bottom: 8px; }
.note { margin-top: 6px; color: var(--accent); }
.sm-input { width: auto; display: inline-block; padding: 3px 6px; margin-left: 6px; font-size: 12.5px; }

/* prices grid */
table.prices input.price { width: 110px; padding: 5px 8px; text-align: right; }
table.prices input.price.saved { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-l); }

/* uploads */
.note-card .note-body { white-space: pre-wrap; font-size: 13px; max-height: 220px; overflow: auto; background: var(--mist); border-radius: 8px; padding: 10px; border: 1px solid var(--line); }
.note-card.pending { border-left: 4px solid #f0b44c; }
.note-card.approved { border-left: 4px solid var(--green); }
.check-item { padding: 10px 0; border-bottom: 1px solid #eef1f4; }
.check-item:last-child { border-bottom: 0; }

/* reports */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 14px 0; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.kpi .v { font-size: 22px; font-weight: 700; color: var(--blue); }
.kpi .l { font-size: 12px; color: var(--ink-3); }

/* tablet */
@media (max-width: 1100px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-card { height: 70vh; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .nav a { padding: 7px 7px; }
  .brand-name { display: none; }
  .bubble { max-width: 94%; }
}
