:root {
  --ink: #0B0B0F;
  --ink2: #1D1D22;
  --paper: #FFFFFF;
  --surface: #F5F5F7;
  --line: #E5E5EA;
  --muted: #6E6E73;
  --accent: #1A5CFF;
  --accent-hover: #0F4AE0;
  --green: #1DB954;
  --red: #FF3B30;
  --yellow: #FF9F0A;
  --radius: 18px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-head: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2 { font-family: var(--font-head); margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 30px; line-height: 1.1; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
p { margin: 0; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 20px; padding-bottom: calc(48px + env(safe-area-inset-bottom)); }

.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.top-in { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand img { display: block; width: auto; }
.brand span { padding-top: 2px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); }
.brand.big { display: flex; justify-content: center; margin-bottom: 24px; }
.who { display: flex; align-items: center; gap: 14px; }
.who form { margin: 0; }
.who-name { font-size: 14px; color: var(--muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkbtn { font: inherit; font-size: 14px; font-weight: 600; color: var(--accent); background: none; border: 0; padding: 8px 0; cursor: pointer; }
.linkbtn:hover { color: var(--accent-hover); }

.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.sub i { font-style: normal; }
.sub i::before { content: "\00b7"; margin: 0 8px; }

.card { background: var(--paper); border-radius: var(--radius); border: 1px solid var(--line); }
.pad { padding: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 18px;
  font: inherit; font-size: 15px; font-weight: 600;
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 12px;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.block { width: 100%; }
.btn.off { color: var(--muted); opacity: 0.5; cursor: default; }
.btn.off:hover { background: var(--paper); }

input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 14px; min-height: 46px;
}
textarea { resize: vertical; line-height: 1.45; }
select {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236E6E73' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 38px;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, .tab:focus-visible, .call:focus-visible, .row:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.search { display: flex; gap: 8px; margin-bottom: 14px; }
.search input { flex: 1; min-width: 0; }

.tabs {
  display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 16px; padding: 2px 16px 4px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 19px;
  background: var(--paper); border: 1px solid var(--line);
  font-size: 14px; font-weight: 600; color: var(--ink2);
}
.tab b { font-weight: 600; font-size: 12px; color: var(--muted); }
.tab:hover { background: #fff; border-color: #D2D2D7; }
.tab.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.tab.on b { color: rgba(255, 255, 255, 0.7); }

.list { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.list li + li { border-top: 1px solid var(--line); }
.row { display: flex; gap: 14px; padding: 16px; align-items: flex-start; }
.row:hover { background: #FAFAFC; }
.avatar {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); color: var(--ink2);
  font-family: var(--font-head); font-weight: 700; font-size: 17px;
}
.row-main { flex: 1; min-width: 0; display: block; }
.row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.name { font-weight: 650; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.biz { display: block; margin-top: 2px; color: var(--ink2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { display: flex; flex-wrap: wrap; gap: 0 14px; margin-top: 4px; color: var(--muted); font-size: 13px; }
.meta span { white-space: nowrap; }
.nb { white-space: nowrap; }

.pill {
  display: inline-block; flex: none; vertical-align: middle;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 650; line-height: 1.5; white-space: nowrap;
  background: var(--surface); color: var(--ink2);
}
.pill.big { font-size: 14px; padding: 5px 14px; margin-top: 4px; }
.s-new { background: #E8EFFF; color: var(--accent); }
.s-contacted { background: #ECECF0; color: var(--ink2); }
.s-no_answer { background: #FFF1DB; color: #9A5B00; }
.s-consulted { background: var(--ink); color: #fff; }
.s-proposal { background: var(--paper); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.s-won { background: #DDF6E6; color: #0C7A35; }
.s-lost { background: #FFE5E3; color: #C4231A; }

.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.pager .sub { margin: 0; }

.empty { text-align: center; padding: 64px 16px; }
.empty h1, .empty h2 { margin-bottom: 8px; }
.empty p { color: var(--muted); margin-bottom: 20px; }

.back { display: inline-block; margin-bottom: 12px; color: var(--accent); font-weight: 600; font-size: 15px; padding: 4px 0; }

.call {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 16px; margin-bottom: 16px;
  background: var(--accent); color: #fff; border-radius: var(--radius);
}
.call:hover { background: var(--accent-hover); }
.call-label { font-size: 13px; font-weight: 600; opacity: 0.85; }
.call-num { font-family: var(--font-head); font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }

.detail { display: grid; gap: 16px; grid-template-areas: "info" "manage" "note" "timeline"; }
.area-info { grid-area: info; }
.area-manage { grid-area: manage; }
.area-note { grid-area: note; }
.area-timeline { grid-area: timeline; }

.facts { margin: 0; }
.facts dt { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 14px; }
.facts dt:first-child { margin-top: 0; }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.facts .pre { white-space: pre-wrap; }
.facts .small { font-size: 13px; color: var(--muted); }
.tech { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.tech summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); }
.tech .facts { margin-top: 12px; }

.stack { margin: 0 0 16px; }
.stack:last-child { margin-bottom: 0; }
.stack .btn.primary { margin-top: 10px; }
.ctl { display: flex; gap: 8px; }
.ctl select { flex: 1; min-width: 0; }
.js .ctl .btn { display: none; }

.tz { margin-left: 10px; font-family: var(--font); font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.ev { position: relative; padding: 0 0 18px 22px; }
.ev::before { content: ""; position: absolute; left: 3px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.ev::after { content: ""; position: absolute; left: 7px; top: 20px; bottom: -2px; width: 1px; background: var(--line); }
.ev:last-child { padding-bottom: 0; }
.ev:last-child::after { display: none; }
.ev-head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.when { color: var(--muted); font-size: 13px; white-space: nowrap; }
.ev-body { margin-top: 4px; font-size: 15px; color: var(--ink2); }
.ev-note { margin-top: 6px; padding: 10px 14px; background: var(--surface); border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.arrow { color: var(--muted); margin: 0 4px; }

.login { max-width: 400px; margin: 0 auto; padding-top: 12vh; }
.login-card { padding: 28px 24px; }
.login-card h1 { font-size: 26px; margin-bottom: 18px; }
.login-card label { margin-top: 14px; }
.login-card .btn { margin-top: 22px; }
.alert { padding: 10px 14px; margin-bottom: 4px; background: #FFE5E3; color: #C4231A; border-radius: 12px; font-size: 14px; font-weight: 500; }

@media (min-width: 900px) {
  main.wrap { padding-top: 32px; }
  h1 { font-size: 36px; }
  .row { padding: 18px 22px; }
  .tabs { margin: 0 0 16px; padding: 2px 0 4px; flex-wrap: wrap; overflow: visible; }
  .detail {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    grid-template-areas: "info manage" "info note" "timeline timeline";
    align-items: start;
  }
  .call { flex-direction: row; justify-content: space-between; padding: 18px 24px; }
}

@media (max-width: 380px) {
  .who-name { display: none; }
  .call-num { font-size: 23px; }
}
