:root {
  --maroon: #7D1D31; --maroon-dark: #5f1525; --cream: #F5F0E8; --accent: #B37D83; --ink: #231F20; --muted: #6f655d;
  --line: #d8cfc3; --cell-line: #bdbdbd; --white: #fff; --hold: #D9D9D9; --follow: #F9D5E5; --review: #FFF9C4;
  --vacation: #D9D2E9; --active-row: #C9DAF8; --red: #CC0000; --orange: #B45F06; --green: #38761D; --purple: #351C75; --ok: #1b6b3a;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 13px/1.35 Arial, Helvetica, sans-serif; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: Georgia, 'Times New Roman', serif; color: var(--maroon); font-weight: 700; margin: 0; }
h1 { font-size: 18px; } h2 { font-size: 15px; } h3 { font-size: 13px; }
a { color: var(--maroon); }
.muted { color: var(--muted); } .pad { padding: 16px; }

#top { background: var(--maroon); color: #fff; display: flex; align-items: center; gap: 4px; padding: 0 12px; min-height: 44px; flex-wrap: wrap; }
#top img { width: 28px; height: 28px; border-radius: 3px; margin-right: 6px; background: #fff; }
.brand { font: 700 15px Georgia, serif; margin-right: 14px; white-space: nowrap; }
#top a.nav { color: #fff; text-decoration: none; padding: 7px 10px; border-radius: 4px; white-space: nowrap; }
#top a.nav:hover { background: var(--maroon-dark); }
#top a.nav.on { background: var(--cream); color: var(--maroon); font-weight: 700; }
#top select { background: var(--maroon-dark); color: #fff; border: 1px solid var(--accent); border-radius: 4px; padding: 5px; max-width: 190px; font-size: 13px; }
.spacer { flex: 1; }
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; color: #fff; padding: 7px 10px; border-radius: 4px; white-space: nowrap; user-select: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary::after { content: '▾'; margin-left: 6px; font-size: 11px; }
details.menu > summary:hover, details.menu[open] > summary { background: var(--maroon-dark); }
details.menu.on > summary { background: var(--cream); color: var(--maroon); font-weight: 700; }
details.menu.new > summary { background: #fff; color: var(--maroon); font-weight: 700; margin-right: 6px; }
.menu-list { position: absolute; top: calc(100% + 4px); z-index: 50; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.18); min-width: 190px; max-height: 70vh; overflow: auto; padding: 4px 0; }
.menu-list.left { left: 0; } .menu-list.right { right: 0; }
.menu-list a, .menu-list button { display: block; width: 100%; text-align: left; padding: 8px 14px; color: var(--ink); text-decoration: none; background: none; border: 0; border-radius: 0; font: inherit; cursor: pointer; white-space: nowrap; }
.menu-list a:hover, .menu-list button:hover { background: var(--cream); }
.menu-list a.on { font-weight: 700; color: var(--maroon); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
#offline { background: #fff3cd; color: #664d03; text-align: center; padding: 4px; font-size: 12px; }

#page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; flex-wrap: wrap; }
.toolbar input[type=search] { width: 220px; }
.scroller { flex: 1; min-height: 0; overflow: auto; background: #fff; border-top: 1px solid var(--line); -webkit-overflow-scrolling: touch; }

button, .btn { font: inherit; border: 1px solid var(--accent); background: #fff; color: var(--maroon); border-radius: 4px; padding: 5px 11px; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: var(--cream); }
.primary { background: var(--maroon); border-color: var(--maroon); color: #fff; font-weight: 700; }
.primary:hover { background: var(--maroon-dark); }
.danger { color: #a02020; border-color: #a02020; }
button:disabled { opacity: .55; cursor: default; }
input, select, textarea { font: inherit; color: var(--ink); border: 1px solid #cbb9a8; border-radius: 4px; padding: 5px 7px; background: #fff; max-width: 100%; }
:focus-visible { outline: 2px solid #2b6cb0; outline-offset: 1px; }

table.grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 12px; width: max-content; }
.grid th { position: sticky; top: 0; z-index: 2; background: var(--maroon); color: #fff; font-weight: 700; padding: 5px 4px; text-align: center; border-right: 1px solid var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid td { padding: 3px 4px; border-right: 1px solid #e3e3e3; border-bottom: 1px solid var(--cell-line); text-align: center; vertical-align: top; overflow: hidden; text-overflow: ellipsis; overflow-wrap: break-word; }
.grid td.left, .grid th.left { text-align: left; }
.grid tr.band td { background: var(--band, var(--cream)); }
.grid td.can-edit { cursor: text; }
.grid td.can-edit:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.grid td.editing { padding: 0; overflow: visible; }
.grid td.editing input, .grid td.editing select, .grid td.editing textarea { width: 100%; height: 100%; min-height: 24px; border: 2px solid #2b6cb0; border-radius: 0; padding: 2px 3px; font-size: 12px; display: block; }
.grid td.editing textarea { min-height: 60px; resize: vertical; }
.grid td.editing { position: relative; }
.grid td.editing.frozen { position: sticky; }
.grid td.editing select.listpick { position: absolute; top: 0; left: 0; height: auto; min-width: 100%; width: max-content; max-width: 280px; z-index: 30; box-shadow: 0 6px 16px rgba(0,0,0,.25); background: #fff; }
.grid td.editing select.listpick option { padding: 3px 6px; }
.grid input[type=checkbox] { width: 15px; height: 15px; margin: 1px; vertical-align: middle; }

.grid tr.r-divorce td { color: var(--green); font-weight: 700; }
.grid tr.r-bank td { color: var(--purple); font-weight: 700; }
.grid tr.r-lit td { color: #000; font-weight: 700; }
.grid tr.followup td { background: var(--follow); }
.grid tr.hold td { background: var(--hold); }
.grid tr.review td:not(.keep) { background: var(--review); }
.grid tr.selected td { background: var(--active-row); }
.grid td.due-now, .grid td.inq { color: var(--red) !important; font-weight: 700; }
.grid td.due-soon { color: var(--orange) !important; font-weight: 700; }
.grid td.dnc { font-weight: 700; }
.grid tr.week td { border-top: 2px solid var(--maroon); }
.grid tr.vac td { background: var(--vacation); color: var(--maroon); font-weight: 700; text-align: left; padding-left: 44px; }
.grid td.frozen { position: sticky; z-index: 1; background-color: #fff; }
.grid tr.band td.frozen { background-color: var(--band, var(--cream)); }
.grid tr.followup td.frozen { background-color: var(--follow); }
.grid tr.hold td.frozen { background-color: var(--hold); }
.grid tr.review td.frozen:not(.keep) { background-color: var(--review); }
.grid tr.selected td.frozen { background-color: var(--active-row); }
.grid th.frozen { position: sticky; z-index: 3; }
.grid .frozen-last { box-shadow: 3px 0 4px -2px rgba(0,0,0,.25); }
.grid td.empty { text-align: left; color: var(--muted); padding: 14px; }
.row-x { border: 0; background: none; color: #a02020; padding: 0 3px; font-size: 14px; line-height: 1; }

dialog { border: 0; border-radius: 6px; padding: 0; width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 8px 30px rgba(0,0,0,.35); color: var(--ink); }
dialog::backdrop { background: rgba(35,31,32,.45); }
.dlg-head { background: var(--maroon); color: #fff; font: 700 16px Georgia, serif; padding: 8px 10px 8px 16px; display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 2; }
.dlg-head > span { flex: 1; }
.dlg-x { background: #fff; color: var(--maroon); border: 0; border-radius: 4px; font: 700 14px Arial, sans-serif; padding: 4px 10px; cursor: pointer; }
.dlg-x:hover { background: #f3e6e9; }
.dlg-body { padding: 14px 16px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; }
.dlg-msg { min-height: 16px; font-size: 12px; margin-right: auto; align-self: center; }
.err { color: #a02020; font-weight: 700; }
.form-row { display: flex; gap: 10px; margin-bottom: 9px; flex-wrap: wrap; }
.form-row > div { flex: 1 1 110px; min-width: 0; }
.form-row label, .lbl { display: block; font-size: 11px; font-weight: 700; color: var(--maroon); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 3px; }
.form-row input:not([type=checkbox]), .form-row select, .form-row textarea { width: 100%; }
.section { font: 700 13px Georgia, serif; color: var(--maroon); border-bottom: 1px solid var(--accent); padding-bottom: 3px; margin: 13px 0 8px; }
.hint { font-size: 11px; color: var(--muted); margin-top: 3px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
gmp-place-autocomplete { width: 100%; }

#toasts { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; max-width: min(380px, calc(100vw - 28px)); }
.toast { background: var(--ink); color: #fff; padding: 9px 12px; border-radius: 5px; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.toast.bad { background: #8f1d1d; }

.content { padding: 14px; overflow: auto; flex: 1; min-height: 0; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button.on { background: var(--maroon); color: #fff; }
.simple { border-collapse: collapse; font-size: 12px; width: 100%; }
.simple th { text-align: left; color: var(--maroon); border-bottom: 1px solid var(--accent); padding: 4px 6px; white-space: nowrap; }
.simple td { border-bottom: 1px solid #eee; padding: 4px 6px; vertical-align: middle; }
.simple td.num, .simple th.num { text-align: right; font-variant-numeric: tabular-nums; }
.wrap-x { overflow-x: auto; }
.list-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 12px; align-items: start; }
.list-row { display: flex; gap: 5px; margin-bottom: 4px; align-items: center; }
.list-row input { flex: 1; min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 10px; margin-bottom: 12px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; }
.tile b { display: block; font: 700 23px Georgia, serif; color: var(--ink); }
.tile span { color: var(--muted); font-size: 12px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.bars { display: grid; grid-template-columns: minmax(90px, max-content) 1fr 54px; gap: 4px 8px; align-items: center; margin-top: 8px; font-size: 12px; }
.bar { height: 14px; background: #f1ece4; border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--maroon); border-radius: 0 4px 4px 0; min-width: 2px; }
.bars .v { text-align: right; font-variant-numeric: tabular-nums; }
.colchart { display: flex; align-items: flex-end; gap: 2px; height: 130px; margin-top: 10px; }
.colchart div { flex: 1; background: var(--maroon); border-radius: 4px 4px 0 0; min-height: 1px; }
.colchart div:hover { background: var(--accent); }
.collabels { display: flex; gap: 2px; font-size: 10px; color: var(--muted); margin-top: 3px; }
.collabels span { flex: 1; text-align: center; overflow: hidden; }
textarea.paste { width: 100%; min-height: 150px; font: 12px monospace; }

.center-page { justify-content: center; align-items: center; min-height: 100%; padding: 16px; }
.sign-card { background: #fff; border-radius: 8px; padding: 26px 30px; text-align: center; border: 1px solid var(--line); width: min(380px, 100%); display: flex; flex-direction: column; gap: 10px; align-items: center; }

@media (max-width: 700px) {
  .toolbar input[type=search] { width: 100%; }
  .brand { display: none; }
}
@media (pointer: coarse) {
  .grid td { padding: 6px 4px; }
  .grid input[type=checkbox] { width: 20px; height: 20px; }
}
.grid td.actions { white-space: nowrap; text-align: left; }
.grid td.actions .btn, .grid td.actions button:not(.row-x) { padding: 2px 8px; font-size: 12px; }
@media (max-width: 900px) { .grid td.frozen, .grid th.frozen { position: static; } .grid th.frozen { position: sticky; } .grid .frozen-last { box-shadow: none; } }

/* Email and phone icons with a hover card */
.contact-icon { text-decoration: none; font-size: 15px; color: var(--maroon); padding: 0 4px; white-space: nowrap; }
.contact-icon sup { font-size: 9px; margin-left: 1px; }
.contact-card { position: absolute; z-index: 1000; background: #fff; border: 1px solid #c9b8bd; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.18); padding: 8px 10px; max-width: 420px; font-size: 13px; }
.contact-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 4px; }
.contact-copy { font-size: 12px; padding: 2px 10px; }
.contact-list { user-select: all; word-break: break-word; }

/* Elena: MGMT "Info Received" rows in a calm yellow */
.grid tr.info-rcvd td, .grid tr.info-rcvd td.frozen { background-color: #fff6cc; }
/* Two clients: one box each */
.grid td.pair { white-space: nowrap; padding: 0 2px; }
.pairbox { display: inline-flex; flex-direction: column; align-items: center; font-size: 9px; line-height: 1; margin: 0 1px; color: #555; max-width: 30px; }
.pairbox span { max-width: 30px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pairbox input { margin: 1px 0; }
/* Several appraisers */
.grid td.editing .peoplepick { position: absolute; top: 0; left: 0; z-index: 30; background: #fff; border: 2px solid #2b6cb0; box-shadow: 0 6px 16px rgba(0,0,0,.25); padding: 4px 0; min-width: 190px; max-height: 300px; overflow: auto; }
.peoplepick .pick { display: block; padding: 3px 10px; font-size: 12px; white-space: nowrap; cursor: pointer; text-align: left; }
.peoplepick .pick:focus-within { background: #e8f0fb; }
.peoplepick .pick-hint { font-size: 10px; color: #777; padding: 4px 10px 2px; border-top: 1px solid #eee; margin-top: 4px; }
.grid td.editing input.wide { position: absolute; top: 0; left: 0; width: 320px; z-index: 30; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* A row that just arrived from Next */
.grid tr.flash td { background-color: #ffeb99 !important; transition: background-color 1s; }
.grid tr.flash td:first-child { box-shadow: inset 4px 0 0 #e0a800; }
.grid td.editing .peoplepick .pick { display: flex; align-items: center; gap: 8px; }
.grid td.editing .peoplepick input { width: auto; height: auto; min-height: 0; border: 0; padding: 0; display: inline-block; margin: 0; }

/* Inspection cell and pop-up */
.grid td.can-insp { cursor: pointer; }
.grid td.can-insp:empty::after { content: '+'; color: #b9a2a8; font-weight: 700; }
.grid td.can-insp:hover { outline: 2px solid #2b6cb0; outline-offset: -2px; }
.insp-contact { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.3fr 26px; gap: 6px; margin-bottom: 6px; }
.insp-contact input { width: 100%; min-width: 0; }
.info-lines div { margin: 2px 0; max-width: 380px; white-space: pre-wrap; }
button.danger-link { background: none; border: 0; color: #b00020; text-decoration: underline; margin-right: auto; }
/* The sender's "Ready to send" rows: calm orange, at the top of the list */
.grid tr.ready-row td, .grid tr.ready-row td.frozen { background-color: #ffe0bf; }
.grid tr.ready-row td:first-child { box-shadow: inset 4px 0 0 #f08c2e; }
.grid .tiny, .grid a.btn.tiny { font-size: 11px; padding: 2px 6px; line-height: 1.3; }
.grid button.tiny.is-ready { background: #ffe0bf; border-color: #f08c2e; color: #8a4a0c; }

/* Calendar tab */
.cal { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.cal-bar { flex-wrap: wrap; gap: 8px; }
.cal-title { font: 600 18px Georgia, serif; margin-left: 6px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0 16px 8px; font-size: 12px; color: #444; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--c); display: inline-block; }
.cal-scroll { flex: 1; overflow: auto; padding: 0 16px 16px; }
.cal-week { display: grid; grid-template-columns: 64px repeat(7, minmax(120px, 1fr)); border: 1px solid #d8cdd0; background: #fff; min-width: 900px; }
.cal-dayhead { padding: 6px 8px; border-bottom: 1px solid #d8cdd0; border-left: 1px solid #eee; background: #faf6f7; display: flex; gap: 6px; align-items: baseline; position: sticky; top: 0; z-index: 3; }
.cal-dayhead.today { background: #f3e6e9; color: var(--maroon); }
.cal-dayhead b { font-size: 18px; }
.cal-corner { border-bottom: 1px solid #d8cdd0; background: #faf6f7; position: sticky; top: 0; z-index: 3; }
.cal-allday-label { font-size: 11px; color: #777; padding: 6px; border-bottom: 2px solid #d8cdd0; }
.cal-allday { border-left: 1px solid #eee; border-bottom: 2px solid #d8cdd0; padding: 3px; min-height: 30px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.cal-gutter { font-size: 11px; color: #777; text-align: right; }
.cal-gutter div { padding: 2px 6px 0 0; border-top: 1px solid #eee; box-sizing: border-box; }
.cal-col { position: relative; border-left: 1px solid #eee; cursor: pointer;
  background-image: repeating-linear-gradient(to bottom, #eee 0 1px, transparent 1px 24px, #f6f6f6 24px 25px, transparent 25px 48px); }
.cal-col.today { background-color: #fdf7f8; }
.cal-chip { --c: #888; position: relative; font-size: 12px; line-height: 1.25; padding: 2px 6px; border-radius: 4px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 22%, white); border-left: 4px solid var(--c); color: #222; }
.cal-chip:hover, .cal-chip:focus { background: color-mix(in srgb, var(--c) 35%, white); outline: none; }
.cal-chip.timed { position: absolute; white-space: normal; z-index: 1; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.cal-chip.holiday { background: #ececec; border-left-color: #8a8a8a; font-weight: 600; }
.cal-chip.muted { background: color-mix(in srgb, var(--c) 10%, #f4f4f4); font-style: italic; }
.cal-chip.done { opacity: .6; }
.cal-time { color: #555; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); border: 1px solid #d8cdd0; background: #fff; min-width: 800px; }
.cal-cell { min-height: 112px; border-left: 1px solid #eee; border-top: 1px solid #eee; padding: 4px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.cal-cell.other { background: #fafafa; color: #aaa; }
.cal-cell.today .cal-num { background: var(--maroon); color: #fff; border-radius: 10px; padding: 0 6px; align-self: flex-start; }
.cal-num { font-size: 12px; font-weight: 700; }
.cal-more { font-size: 11px; color: var(--maroon); }
.cal-orders { max-height: 220px; overflow: auto; border: 1px solid #ddd; border-radius: 4px; margin-top: 6px; padding: 4px 6px; }
.cal-order { display: block; padding: 3px 0; font-size: 13px; text-transform: none; font-weight: 400; color: inherit; cursor: pointer; }
