:root {
  --blue: #139dde; --blue-ink: #0b6fa0; --blue-soft: #e5f4fc;
  --green: #68c333; --green-ink: #3f7d1c; --green-soft: #ecf7e4;
  --pink: #ec028c; --pink-ink: #a8025f; --pink-soft: #fde6f3;
  --amber-ink: #8a5a00; --amber-soft: #fff3d6;
  --red-ink: #b42318; --red-soft: #fdecea;
  --ink: #353030; --ink-2: #6b6565; --ink-3: #9a9494;
  --line: #ebe8e8; --line-2: #dcd8d8;
  --bg: #f7f6f6; --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(53,48,48,.05), 0 4px 16px rgba(53,48,48,.06);
  --head: "Baloo 2", system-ui, sans-serif;
  --body: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--blue-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--head); font-weight: 600; margin: 0; line-height: 1.2; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; transform: scale(.94); } }

/* buttons + fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: #faf9f9; border-color: #cfcaca; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: #108ac4; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #f0eeee; }
.btn.danger { color: var(--red-ink); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 12px; color: var(--ink-2); font-weight: 500; }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=url], input[type=date], input[type=search], input[type=number], select, textarea {
  height: 38px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(19,157,222,.15); }
.err { color: var(--red-ink); font-size: 13px; min-height: 18px; }

/* shell */
.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1180px; margin: 0 auto; height: 60px; padding: 0 20px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-family: var(--head); font-size: 19px; font-weight: 600; text-decoration: none !important; }
.brand img { width: 34px; height: 34px; }
.brand small { display: block; font: 500 11px/1 var(--body); color: var(--ink-3); letter-spacing: .02em; margin-top: -2px; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { padding: 7px 12px; border-radius: 9px; color: var(--ink-2); font-weight: 500; text-decoration: none; }
.nav a:hover { background: #f3f1f1; color: var(--ink); }
.nav a.on { background: var(--blue-soft); color: var(--blue-ink); }
.spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 12px; background: var(--pink-soft); color: var(--pink-ink); flex: none; }
.main { max-width: 1180px; margin: 0 auto; padding: 22px 20px 100px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; color: var(--ink-2); }
.tabbar { display: none; }

/* chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; cursor: pointer; font-weight: 500; font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.chip b { font-weight: 600; color: var(--ink-3); }
.chip.on { background: var(--blue-soft); border-color: #b7e0f5; color: var(--blue-ink); }
.chip.on b { color: var(--blue-ink); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; line-height: 18px; }
.k-new { background: var(--green-soft); color: var(--green-ink); }
.k-new_company { background: var(--amber-soft); color: var(--amber-ink); }
.k-check { background: var(--blue-soft); color: var(--blue-ink); }
.k-existing { background: #f1efef; color: var(--ink-2); }
.k-closing, .k-irrelevant { background: var(--red-soft); color: var(--red-ink); }
.k-tender_open { background: var(--green-soft); color: var(--green-ink); }
.k-tender_closed, .k-tender { background: #f1efef; color: var(--ink-2); }
.sec-sen { background: #efe9ff; color: #5b3fb3; }
.sec-leisure { background: #e3f6f3; color: #0f6e60; }
.sec-public { background: #eef0f3; color: #44505e; }
.k-op { background: #fff0d9; color: #8a4b00; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 0 12px; height: 36px; cursor: pointer; font-weight: 500; color: var(--ink-2); }
.seg button.on { background: var(--blue-soft); color: var(--blue-ink); }
#map { position: relative; overflow: hidden; z-index: 0; }
.map-note { position: absolute; left: 10px; bottom: 10px; z-index: 500; background: rgba(255,255,255,.95); padding: 5px 10px; border-radius: 8px; font-size: 12px; color: var(--ink-2); }
.k-social { background: var(--pink-soft); color: var(--pink-ink); }
.k-manual { background: #f1efef; color: var(--ink-2); }
.s-new { background: var(--blue-soft); color: var(--blue-ink); }
.s-researching { background: #eef0ff; color: #3b45a8; }
.s-contacted { background: var(--pink-soft); color: var(--pink-ink); }
.s-in_talks, .s-quoted { background: var(--amber-soft); color: var(--amber-ink); }
.s-won { background: var(--green-soft); color: var(--green-ink); }
.s-lost, .s-not_relevant { background: #f1efef; color: var(--ink-3); }

/* toolbar + list */
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1 1 240px; }
.toolbar select { width: auto; flex: 0 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.list { overflow: hidden; }
.row { display: grid; grid-template-columns: minmax(0,1fr) auto 150px; gap: 14px; align-items: center; padding: 13px 16px; border-top: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.row:first-child { border-top: 0; }
.row:hover { background: #fbfafa; }
.row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { color: var(--ink-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .who { font-size: 12.5px; color: var(--ink-2); display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.due { color: var(--pink-ink); font-weight: 600; }
.empty { padding: 48px 20px; text-align: center; color: var(--ink-2); }
.empty h3 { color: var(--ink); margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* slide-over */
.scrim { position: fixed; inset: 0; background: rgba(30,26,26,.28); z-index: 40; animation: fade .18s; }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--bg); z-index: 41; overflow-y: auto; box-shadow: -10px 0 40px rgba(0,0,0,.12); animation: slide .22s cubic-bezier(.2,.8,.2,1); }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.panel-head { position: sticky; top: 0; z-index: 2; background: rgba(247,246,246,.95); backdrop-filter: blur(8px); padding: 14px 18px 12px; border-bottom: 1px solid var(--line); }
.panel-head .bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.panel-body { padding: 16px 18px 40px; display: flex; flex-direction: column; gap: 14px; }
.sec { padding: 14px 16px; }
.sec h3 { margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.sec h3 .spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kv { display: grid; grid-template-columns: 110px minmax(0,1fr); gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.desc { font-size: 13.5px; color: var(--ink); background: #faf9f9; border-radius: 10px; padding: 10px 12px; margin: 0 0 10px; }
.contact-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.contact-btns .btn.on { background: var(--blue-soft); border-color: #b7e0f5; color: var(--blue-ink); }
.timeline { display: flex; flex-direction: column; }
.tl { display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.tl:first-child { border-top: 0; }
.tl .ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; background: #f1efef; }
.tl.call .ic { background: var(--green-soft); } .tl.email .ic { background: var(--blue-soft); } .tl.visit .ic { background: var(--amber-soft); } .tl.message .ic { background: var(--pink-soft); }
.tl .meta { font-size: 12px; color: var(--ink-3); }
.tl .txt { white-space: pre-wrap; overflow-wrap: anywhere; }
.tl.hist { padding: 6px 0; } .tl.hist .ic { background: transparent; color: var(--ink-3); } .tl.hist .txt { color: var(--ink-2); font-size: 12.5px; }
.co { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.co + .co { margin-top: 6px; }
.co .nm { font-weight: 600; }
.co .small { font-size: 12.5px; color: var(--ink-2); }
.officers { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; }
.officers li { padding: 3px 0; }

/* search page */
.src-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.src-tabs .chip { height: 38px; padding: 0 16px; font-size: 14px; }
.runbox { padding: 16px; margin-bottom: 14px; }
.runbox .terms { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.runbox .terms label { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 13px; cursor: pointer; background: #fff; }
.runbox .terms label:has(input:checked) { background: var(--blue-soft); border-color: #b7e0f5; color: var(--blue-ink); }
.runbox .terms input { accent-color: var(--blue); margin: 0; }
.runrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.progress { height: 4px; background: #eee; border-radius: 4px; overflow: hidden; flex: 1 1 160px; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--green)); transition: width .3s; }
.res { padding: 14px 16px; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; }
.res:first-child { border-top: 0; }
.res .t { font-weight: 600; }
.res .sub { font-size: 12.5px; color: var(--ink-2); }
.res .d { font-size: 13px; margin-top: 4px; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.res .d.open { -webkit-line-clamp: unset; }
.res .acts { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.res.done { opacity: .55; }
.note-line { font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: min(400px, 100%); padding: 28px 26px; }
.auth .logo { display: block; width: 190px; margin: 0 auto 6px; }
.auth h1 { text-align: center; font-size: 22px; margin-bottom: 4px; }
.auth p.lede { text-align: center; color: var(--ink-2); margin: 0 0 18px; }
.auth form { display: flex; flex-direction: column; gap: 12px; }
.auth .btn { height: 42px; }

/* team */
.team-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.team-row:first-child { border-top: 0; }
.team-row .nm { font-weight: 600; } .team-row .small { font-size: 12.5px; color: var(--ink-2); }
.cols { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.form { display: flex; flex-direction: column; gap: 10px; padding: 16px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 500; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* phone */
@media (max-width: 760px) {
  .top-in { height: 54px; padding: 0 14px; }
  .nav { display: none; }
  .brand { font-size: 17px; } .brand img { width: 30px; height: 30px; }
  .main { padding: 16px 14px 96px; }
  h1 { font-size: 22px; }
  .row { grid-template-columns: minmax(0,1fr) auto; padding: 12px 14px; }
  .row .who { display: none; }
  .row .t { white-space: normal; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--ink-3); padding: 4px 0; text-decoration: none; }
  .tabbar a .i { font-size: 19px; line-height: 1; }
  .tabbar a.on { color: var(--blue); }
  .panel { width: 100%; }
  .grid2, .cols { grid-template-columns: 1fr; }
  .res { grid-template-columns: 1fr; }
  .res .acts { flex-direction: row; }
  .res .acts .btn { flex: 1; }
  .kv { grid-template-columns: 96px minmax(0,1fr); }
}
