/* Samrat Buildcon sales prototype. Colours and fonts from samratbuildcon.com (samrat-tech/brand/README.md). */
@font-face { font-family: "Cal Sans"; src: url("/assets/CalSans-latin.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Golos Text"; src: url("/assets/GolosText-latin.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }

:root {
  color-scheme: light;
  --gold: #CAA05C; --gold-hover: #D8B373; --gold-text: #8A6A33; --gold-soft: #F5EDDF;
  --ink: #1C1C1D; --text: #59585D; --muted: #8C8C92;
  --field: #F6F6F6; --border: #E3E3E8; --white: #FFFFFF; --ground: #FAFAF8;
  --good: #2F7D55; --good-soft: #E1F0E7;
  --warn: #A8681A; --warn-soft: #FBEBD3;
  --bad: #B23A34; --bad-soft: #F7E0DE;
  --hold: #46608C; --hold-soft: #E3E9F3;
  --grey: #C9C9CF;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--white); color: var(--text);
  font: 400 15px/1.5 "Golos Text", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: "Cal Sans", "Golos Text", sans-serif; font-weight: 400; color: var(--ink); margin: 0; line-height: 1.2; }
button { font: inherit; }
.link { background: none; border: 0; padding: 0; color: var(--gold-text); cursor: pointer; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.link:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- Splash: holds 1.1 s, fades 0.4 s ---------- */
.splash {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 32px 16px;
  background: var(--white);
  animation: splash-out .4s ease 1.1s forwards;
}
.splash img { display: block; width: min(420px, 100%); height: auto; }
@keyframes splash-out { to { opacity: 0; visibility: hidden; } }
.no-splash .splash { display: none; }
@media (prefers-reduced-motion: reduce) { .splash { animation-duration: .01s; animation-delay: .8s; } }

/* ---------- Sign in ---------- */
.signin { display: grid; grid-template-columns: 1.15fr 1fr; min-height: 100vh; min-height: 100dvh; }
.signed-in .signin { display: none; }
.photo { position: relative; margin: 0; background: var(--ink); overflow: hidden; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 40% center; }
.photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(28,28,29,.75), rgba(28,28,29,0) 45%); }
.photo figcaption { position: absolute; left: 40px; bottom: 36px; z-index: 1; color: #E4E7D1; font-size: 14px; letter-spacing: .06em; }
.photo figcaption b { display: block; font: 400 26px/1.2 "Cal Sans", "Golos Text", sans-serif; letter-spacing: 0; color: var(--white); margin-bottom: 4px; }
.panel { display: grid; place-items: center; padding: 48px 24px; }
.box { width: 100%; max-width: 360px; }
.box .logo { display: block; width: 168px; height: auto; margin: 0 auto 36px; }
.box h1 { font-size: 30px; margin: 0 0 24px; text-align: center; }
label { display: block; font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.field { margin-bottom: 20px; }
.phone { display: flex; height: 50px; background: var(--field); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; transition: border-color .15s, box-shadow .15s, background .15s; }
.phone span { display: grid; place-items: center; padding: 0 12px 0 14px; color: var(--ink); font-weight: 500; border-right: 1px solid var(--border); }
.phone input { flex: 1; min-width: 0; border: 0; background: none; padding: 0 14px; font: inherit; font-size: 17px; letter-spacing: .04em; color: var(--ink); }
.phone input:focus { outline: none; }
.phone:focus-within { border-color: var(--gold); background: var(--white); box-shadow: 0 0 0 3px rgba(202,160,92,.25); }
.sent { text-align: center; margin: -12px 0 20px; font-size: 14px; }
.sent b { color: var(--ink); font-weight: 500; }
.otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 20px; }
.otp input {
  width: 100%; height: 54px; text-align: center; font: 500 22px "Golos Text", sans-serif; color: var(--ink);
  background: var(--field); border: 1px solid var(--border); border-radius: 6px;
}
.otp input:focus { outline: none; border-color: var(--gold); background: var(--white); box-shadow: 0 0 0 3px rgba(202,160,92,.25); }
.btn-gold {
  width: 100%; height: 50px; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--gold); color: var(--ink);
  font: 500 14px "Golos Text", sans-serif; letter-spacing: .08em; text-transform: uppercase;
  transition: background .15s;
}
.btn-gold:hover { background: var(--gold-hover); }
.btn-gold:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.msg { min-height: 22px; margin: 12px 0 0; font-size: 14px; color: var(--bad); text-align: center; }
.resend { text-align: center; font-size: 14px; margin: 4px 0 0; color: var(--muted); }
.proto { margin-top: 28px; padding: 10px 12px; font-size: 13px; color: var(--gold-text); background: var(--gold-soft); border-radius: 6px; text-align: center; }

/* ---------- App shell ---------- */
.app { display: none; min-height: 100vh; background: var(--ground); }
.signed-in .app { display: block; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  padding: 10px 28px; background: var(--white); border-bottom: 1px solid var(--border);
}
.top-logo { width: 92px; height: auto; display: block; }
.tabs { display: flex; gap: 4px; }
.tabs button, .bottom-tabs button {
  border: 0; background: none; cursor: pointer; color: var(--text);
  padding: 8px 14px; border-radius: 6px; font-size: 15px;
}
.tabs button:hover { background: var(--field); color: var(--ink); }
.tabs button.on { background: var(--gold-soft); color: var(--ink); font-weight: 500; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.top-right select {
  height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--white);
  font: inherit; font-size: 14px; color: var(--ink);
}
.me { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-text);
  font-size: 12px; font-weight: 600;
}
.me-text { display: flex; flex-direction: column; line-height: 1.2; font-size: 12px; color: var(--muted); }
.me-text b { font-size: 13px; color: var(--ink); font-weight: 500; }
.signout { border: 1px solid var(--border); background: var(--white); border-radius: 6px; padding: 6px 12px; cursor: pointer; font-size: 13px; color: var(--text); }
.signout:hover { border-color: var(--gold); color: var(--ink); }
.sample { background: var(--gold-soft); color: var(--gold-text); font-size: 13px; text-align: center; padding: 6px 16px; }
.bottom-tabs { display: none; }

.view { display: none; max-width: 1240px; margin: 0 auto; padding: 24px 28px 56px; }
.view.on { display: block; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head h2 { font-size: 28px; }
.date { color: var(--muted); font-size: 14px; }

.card { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card h3 { font-size: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.hint { font-size: 13px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > .card { margin-bottom: 16px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.kpi .label { font-size: 13px; color: var(--muted); }
.kpi .value { font: 400 34px/1.1 "Cal Sans", "Golos Text", sans-serif; color: var(--ink); margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.kpi .note { font-size: 13px; color: var(--text); }
.kpi .note.bad { color: var(--bad); }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.list li:first-child { border-top: 0; padding-top: 0; }
.list .who { flex: 1; min-width: 0; cursor: pointer; }
.list .who b { display: block; color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .who span { font-size: 13px; color: var(--muted); }
.list .when { font-size: 13px; text-align: right; white-space: nowrap; }
.list .when.bad { color: var(--bad); font-weight: 500; }
.acts { display: flex; gap: 6px; }
.act {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--white);
  display: grid; place-items: center; cursor: pointer; color: var(--ink);
}
.act:hover { border-color: var(--gold); background: var(--gold-soft); }
.act svg { width: 16px; height: 16px; }
.day { min-width: 46px; text-align: center; border-radius: 8px; background: var(--field); padding: 4px 0; line-height: 1.15; }
.day b { display: block; font: 400 18px "Cal Sans", sans-serif; color: var(--ink); }
.day span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* Bars: single series, gold, value labels in text ink */
.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: 150px 1fr 40px; align-items: center; gap: 12px; font-size: 14px; }
.bar .name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .track { height: 12px; position: relative; }
.bar .fill { height: 100%; background: var(--gold); border-radius: 0 4px 4px 0; min-width: 2px; transition: width .3s ease; }
.bar .num { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 500; }
.bar:hover .fill { background: var(--gold-text); }

/* Inventory stacked bar */
.stack { display: flex; height: 28px; gap: 2px; border-radius: 6px; overflow: hidden; }
.stack div { height: 100%; }
.stack-legend, .legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 12px; font-size: 14px; }
.stack-legend span, .legend span { display: inline-flex; align-items: center; gap: 8px; }
.stack-legend i, .legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.stack-legend b, .legend b { color: var(--ink); font-weight: 500; }
.legend { margin: 0 0 16px; }

/* Tables */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 0 12px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .bad { color: var(--bad); font-weight: 500; }
.leads th { padding-top: 14px; }
.leads th:first-child, .leads td:first-child { padding-left: 20px; }
.leads tbody tr { cursor: pointer; }
.leads tbody tr:hover { background: var(--ground); }
.leads td b { color: var(--ink); font-weight: 500; }
.leads td small { display: block; color: var(--muted); font-size: 12px; }
.empty { text-align: center; padding: 28px; color: var(--muted); margin: 0; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill.s-New { background: var(--hold-soft); color: var(--hold); }
.pill.s-Contacted { background: var(--field); color: var(--ink); border: 1px solid var(--border); }
.pill.s-Visit { background: var(--warn-soft); color: var(--warn); }
.pill.s-Visited { background: var(--gold-soft); color: var(--gold-text); }
.pill.s-Negotiation { background: #EDE3F3; color: #6B4A86; }
.pill.s-Booked { background: var(--good-soft); color: var(--good); }
.pill.s-Lost { background: var(--bad-soft); color: var(--bad); }

#lead-search {
  height: 40px; width: min(320px, 100%); padding: 0 12px; border: 1px solid var(--border); border-radius: 6px;
  font: inherit; font-size: 14px; background: var(--white);
}
#lead-search:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(202,160,92,.25); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chips button {
  border: 1px solid var(--border); background: var(--white); border-radius: 99px; padding: 5px 12px;
  font-size: 13px; color: var(--text); cursor: pointer;
}
.chips button span { color: var(--muted); margin-left: 4px; }
.chips button.on { background: var(--ink); border-color: var(--ink); color: var(--white); }
.chips button.on span { color: var(--grey); }

/* Inventory grid */
.grid-inv { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; }
.unit {
  height: 48px; border-radius: 6px; border: 2px solid transparent; cursor: pointer;
  display: grid; place-items: center; font: 500 14px "Golos Text", sans-serif;
  transition: transform .08s;
}
.unit:hover { transform: translateY(-2px); }
.unit.sel { border-color: var(--ink); box-shadow: 0 0 0 2px var(--white) inset; }
.u-Available { background: var(--good-soft); color: var(--good); }
.u-Held { background: var(--warn-soft); color: var(--warn); }
.u-Booked { background: var(--ink); color: var(--white); }
.u-Blocked { background: var(--field); color: var(--muted); border-style: dashed; border-color: var(--grey); }
.unit-card h3 { font-size: 22px; margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 14px 0 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); text-align: right; }
.unit-card .btn-gold { margin-top: 18px; height: 44px; }

/* Drawer */
.scrim { position: fixed; inset: 0; background: rgba(28,28,29,.35); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 31; width: min(440px, 100%);
  background: var(--white); box-shadow: -8px 0 32px rgba(0,0,0,.12);
  transform: translateX(100%); transition: transform .22s ease; overflow-y: auto; padding: 24px;
}
.drawer.open { transform: none; }
.close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border: 0; background: var(--field); border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink); }
.drawer h3 { font-size: 24px; padding-right: 40px; }
.drawer .sub { color: var(--muted); font-size: 14px; margin: 2px 0 16px; }
.drawer .row-acts { display: flex; gap: 8px; margin-bottom: 18px; }
.drawer .row-acts button { flex: 1; height: 40px; border: 1px solid var(--border); border-radius: 6px; background: var(--white); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--ink); font-size: 14px; }
.drawer .row-acts button:hover { border-color: var(--gold); background: var(--gold-soft); }
.drawer .row-acts svg { width: 16px; height: 16px; }
.drawer h4 { font: 500 13px "Golos Text", sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 22px 0 8px; }
.drawer select, .drawer textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 6px; background: var(--field);
  font: inherit; font-size: 14px; color: var(--ink); padding: 10px 12px;
}
.drawer textarea { min-height: 70px; resize: vertical; }
.drawer .note-btn { margin-top: 8px; height: 40px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline time { display: block; font-size: 12px; color: var(--muted); }

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

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .me-text { display: none; }
}
@media (max-width: 860px) {
  .signin { grid-template-columns: 1fr; grid-template-rows: 180px 1fr; }
  .photo figcaption { left: 16px; bottom: 14px; font-size: 12px; }
  .photo figcaption b { font-size: 20px; }
  .panel { place-items: start center; padding: 32px 16px 40px; }
  .box .logo { width: 140px; margin-bottom: 24px; }

  .top { padding: 8px 16px; gap: 12px; }
  .top-logo { width: 72px; }
  .tabs { display: none; }
  .top-right { gap: 10px; }
  .top-right select { max-width: 150px; }
  .me { display: none; }
  .view { padding: 18px 16px 96px; }
  .head h2 { font-size: 24px; }
  .grid-2, .grid-inv { grid-template-columns: 1fr; gap: 0; }
  .kpi .value { font-size: 28px; }
  .bar { grid-template-columns: 110px 1fr 32px; }
  .bottom-tabs {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--white); border-top: 1px solid var(--border);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-tabs button { flex: 1; padding: 10px 4px; font-size: 14px; }
  .bottom-tabs button.on { color: var(--ink); font-weight: 500; background: var(--gold-soft); }
  .leads .hide-sm { display: none; }
  .toast { bottom: 84px; }
}
@media (max-width: 420px) {
  .kpis { gap: 10px; }
  .kpi { padding: 12px 14px; }
  .signout { padding: 6px 8px; }
}
