/* Corvia CRM. Corporate palette: navy #01235d, mint #40ad98, ivory #fffef9. */

:root {
  --navy: #01235d;
  --teal: #01525d;
  --mint: #40ad98;
  --mint-soft: #e3f3ef;
  --gold: #c88929;
  --gold-soft: #f8ecd9;
  --ivory: #fffef9;
  --white: #ffffff;
  --ink-soft: #4a5866;
  --line: #e2e7e8;
  --wash: #f4f5ef;
  --red: #b3412e;
  --red-soft: #f7e3df;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(1, 35, 93, 0.10);
  --shadow-lift: 0 18px 40px rgba(1, 35, 93, 0.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--navy);
  background: var(--ivory);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-weight: 500; margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--ink-soft); font-weight: 400; }
[hidden] { display: none !important; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--white); color: var(--navy);
  padding: 10px 18px; border-radius: 999px; cursor: pointer; font-weight: 500;
  text-decoration: none; transition: background .15s, border-color .15s, transform .15s;
}
.btn:hover { border-color: var(--navy); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: var(--white); }
.btn.primary:hover { background: #02307f; }
.btn.small { padding: 7px 14px; font-size: 14px; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--mint); outline-offset: 2px;
}

/* sign in */
body.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 80% -10%, #e7f4f0 0, transparent 60%), var(--ivory); }
.signin-card { width: 100%; max-width: 380px; background: var(--white); border-radius: 24px; padding: 36px 32px; box-shadow: var(--shadow); }
.signin-logo { height: 40px; margin-bottom: 28px; }
.signin-card h1 { font-size: 26px; margin-bottom: 6px; }
.signin-card form { margin-top: 24px; display: grid; gap: 10px; }
.signin-card label { font-size: 13px; color: var(--ink-soft); }
.signin-card input { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.signin-card .btn { margin-top: 8px; }
.error { color: var(--red); font-size: 14px; margin: 0; }

/* top bar */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  padding: 14px 32px; background: rgba(255, 254, 249, 0.92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 30px; }
.brand span { font-size: 12px; letter-spacing: .14em; font-weight: 600; color: var(--white);
  background: var(--mint); padding: 3px 8px; border-radius: 6px; }
.views { display: flex; gap: 4px; }
.views a { text-decoration: none; padding: 8px 14px; border-radius: 999px; font-weight: 500; color: var(--ink-soft); }
.views a.on { background: var(--navy); color: var(--white); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.signout { font-size: 14px; color: var(--ink-soft); }

main#app { padding: 28px 32px 80px; max-width: 1600px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; }
.page-head p { margin: 4px 0 0; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 32px; }
.stat { background: var(--navy); color: var(--white); border-radius: var(--radius); padding: 18px 20px; position: relative; overflow: hidden; }
.stat:nth-child(n+2) { background: var(--white); color: var(--navy); box-shadow: var(--shadow); }
.stat b { display: block; font-size: 30px; font-weight: 500; letter-spacing: -0.02em; }
.stat span { font-size: 13px; opacity: .85; font-weight: 400; }
.stat:first-child::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: 0; height: 3px; background: var(--mint); border-radius: 3px 3px 0 0; }

/* today sections */
.today-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; align-items: start; }
.section { background: var(--wash); border-radius: 20px; padding: 18px; }
.section h2 { font-size: 17px; display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.section > p { margin: 0 0 14px; font-size: 13px; }
.count { font-size: 12px; font-weight: 600; background: var(--white); border-radius: 999px; padding: 2px 9px; }
.section.urgent .count { background: var(--navy); color: var(--white); }
.empty { padding: 18px; text-align: center; color: var(--ink-soft); font-size: 14px; background: rgba(255,255,255,.6); border-radius: 12px; }
.stack { display: grid; gap: 10px; }

/* the card */
.card {
  background: var(--white); border-radius: 14px; padding: 13px 14px; cursor: pointer;
  border: 1px solid transparent; box-shadow: 0 1px 2px rgba(1,35,93,.06);
  transition: transform .15s, box-shadow .15s, border-color .15s; position: relative;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.card.hot { border-color: var(--gold); }
.card.unread::before { content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--mint); }
.card .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card .who { font-weight: 500; line-height: 1.3; }
.card .co { font-size: 13px; color: var(--ink-soft); font-weight: 400; margin-top: 1px; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.card .next { font-size: 13px; margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line); color: var(--ink-soft); font-weight: 400; }
.card .next b { font-weight: 500; color: var(--navy); }
.card .next.late b { color: var(--red); }
.chip { font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--wash); white-space: nowrap; }
.chip.hot { background: var(--gold-soft); color: #7a4f10; }
.chip.clock { background: var(--mint-soft); color: var(--teal); }
.chip.clock.warm { background: var(--gold-soft); color: #7a4f10; }
.chip.clock.cold { background: var(--red-soft); color: var(--red); }
.chip.won { background: var(--mint-soft); color: var(--teal); }
.chip.lost { background: var(--wash); color: var(--ink-soft); }

/* pipeline tabs and board */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 20px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 1px solid var(--line); background: var(--white); padding: 8px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; font-weight: 500; }
.tabs button.on { background: var(--navy); color: var(--white); border-color: var(--navy); }
.tabs button small { opacity: .7; margin-left: 4px; font-weight: 400; }

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(205px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x proximity; }
.col { background: var(--wash); border-radius: 18px; padding: 12px; min-height: 260px; scroll-snap-align: start; transition: background .15s, box-shadow .15s; }
.col.won { background: #ecf6f3; }
.col.lost { background: #f1f1ee; }
.col.drop { box-shadow: inset 0 0 0 2px var(--mint); background: var(--mint-soft); }
.col-head { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 4px 12px; }
.col-head h3 { font-size: 14px; font-weight: 600; }
.col-head span { font-size: 12px; color: var(--ink-soft); }
.card[draggable="true"] { cursor: grab; }
.card.dragging { opacity: .5; }

/* list */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.filters input, .filters select, .next-box input, .field input, .field select, .field textarea, .composer textarea {
  border: 1px solid var(--line); background: var(--white); border-radius: 12px; padding: 10px 12px; width: 100%;
}
.filters input { min-width: 240px; flex: 1; }
.filters select { width: auto; }
.table-wrap { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 400; vertical-align: top; }
td b { font-weight: 500; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--wash); }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(1, 35, 93, .28); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); z-index: 40;
  background: var(--ivory); box-shadow: -20px 0 50px rgba(1,35,93,.18);
  transform: translateX(105%); transition: transform .25s ease, visibility 0s linear .25s; overflow-y: auto;
  visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; transition: transform .25s ease; }
.d-head { padding: 24px 28px 18px; background: var(--navy); color: var(--white); position: sticky; top: 0; z-index: 2; }
.d-head h2 { font-size: 22px; padding-right: 40px; }
.d-head .sub { opacity: .8; font-weight: 400; margin-top: 2px; }
.d-head .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.d-head .chip { background: rgba(255,255,255,.12); color: var(--white); }
.d-head .chip.hot { background: var(--gold); color: var(--white); }
.close { position: absolute; top: 18px; right: 18px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: var(--white); cursor: pointer; font-size: 20px; line-height: 1; }
.d-body { padding: 22px 28px 60px; display: grid; gap: 22px; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick .btn { padding: 11px 8px; font-size: 14px; }
.quick .btn.wa { background: var(--mint); border-color: var(--mint); color: var(--white); }
.block { background: var(--white); border-radius: var(--radius); padding: 18px; box-shadow: 0 1px 2px rgba(1,35,93,.06); }
.block h3 { font-size: 13px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 12px; }
.stages { display: flex; flex-wrap: wrap; gap: 6px; }
.stages button { border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.stages button.on { background: var(--navy); color: var(--white); border-color: var(--navy); }
.stages button.won-s.on { background: var(--teal); border-color: var(--teal); }
.stages button.lost-s.on { background: var(--ink-soft); border-color: var(--ink-soft); }
.next-box { display: grid; grid-template-columns: 1fr 150px; gap: 8px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.field { display: grid; gap: 4px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--ink-soft); }
.field input, .field select, .field textarea { padding: 8px 10px; border-radius: 10px; }
dl.details { margin: 0; display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 14px; }
dl.details dt { color: var(--ink-soft); font-weight: 400; }
dl.details dd { margin: 0; }
.message { white-space: pre-wrap; font-weight: 400; margin: 0; }
.composer { display: grid; gap: 8px; }
.composer textarea { min-height: 70px; resize: vertical; }
.composer .row { display: flex; gap: 6px; flex-wrap: wrap; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.timeline li { display: grid; grid-template-columns: 12px 1fr; gap: 12px; font-size: 14px; }
.timeline .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); margin-top: 6px; }
.timeline .dot.form { background: var(--mint); }
.timeline .dot.stage { background: var(--navy); }
.timeline .dot.call, .timeline .dot.whatsapp, .timeline .dot.email { background: var(--gold); }
.timeline p { margin: 0; white-space: pre-wrap; font-weight: 400; }
.timeline time { font-size: 12px; color: var(--ink-soft); }
.others a { display: inline-block; margin: 0 8px 6px 0; }
.hot-toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 400; }

/* dialogs inside the drawer */
.dialog { background: var(--gold-soft); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: var(--white); padding: 12px 20px; border-radius: 999px; z-index: 50; box-shadow: var(--shadow-lift); font-size: 14px; }

@media (max-width: 1100px) {
  .today-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .top { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .brand img { height: 24px; }
  .views { order: 3; width: 100%; }
  .views a { flex: 1; text-align: center; padding: 8px 6px; font-size: 14px; }
  .top-actions { gap: 10px; }
  main#app { padding: 18px 16px 60px; }
  .page-head h1 { font-size: 24px; }
  .stats { gap: 10px; margin-bottom: 22px; }
  .stat { padding: 14px; }
  .stat b { font-size: 24px; }
  .board { grid-auto-columns: 82%; }
  .filters input { min-width: 0; }
  .d-head { padding: 20px 16px 16px; }
  .d-body { padding: 18px 16px 50px; }
  .fields { grid-template-columns: 1fr; }
  .next-box { grid-template-columns: 1fr; }
  dl.details { grid-template-columns: 1fr; gap: 2px; }
  dl.details dd { margin-bottom: 8px; }
  th:nth-child(n+5), td:nth-child(n+5) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
