/* KB App. Ray White brand in brief: white first, light grey panels, dark grey type, yellow as
   the accent. Lato Light body, SemiBold headings. Works at phone width; 16px gutters. */
:root {
  --white: #FFFFFF; --grey: #EBEBEC; --yellow: #FFE512; --dark: #595959;
  --ink: #3a3a3a; --mid: #8a8a8a; --line: #d9d9db;
  --red: #b3261e; --amber: #b26a00; --green: #2e7d32;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--white); color: var(--dark); font: 300 16px/1.5 Lato, 'Helvetica Neue', Arial, Helvetica, sans-serif; }
h1, h2, h3, h4 { font-weight: 600; margin: 0 0 .4em; color: var(--dark); line-height: 1.2; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; margin-top: 1.4em; } h3 { font-size: 1rem; }
p { margin: .4em 0; }
a { color: var(--dark); }
b, strong { font-weight: 600; }
.muted { color: var(--mid); } .small { font-size: .85rem; }
.error { color: var(--red); } .ok { color: var(--green); } .warn { color: var(--amber); }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 4px solid var(--yellow); background: var(--white); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.mark { display: inline-grid; place-items: center; width: 34px; height: 34px; background: var(--yellow); color: var(--dark); font-weight: 700; border-radius: 4px; font-size: .9rem; }
.who { font-size: .9rem; color: var(--mid); }
.link { background: none; border: 0; color: var(--dark); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

main { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; }
.narrow { max-width: 420px; margin: 40px auto; }
.greeting { font-size: 2rem; font-weight: 300; margin: 8px 0 18px; }
.greeting b { font-weight: 600; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; margin: 14px 0; }
.card.grey { background: var(--grey); border-color: var(--grey); }
.card h2 { margin-top: 0; }

label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 4px; }
label .hint { font-weight: 300; color: var(--mid); }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-weight: 400; color: var(--ink); background: var(--white);
  border: 1px solid var(--line); border-radius: 8px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--dark); box-shadow: 0 0 0 3px var(--yellow); }
textarea { min-height: 80px; resize: vertical; }
.row { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .row.two { grid-template-columns: 1fr 1fr; } .row.three { grid-template-columns: 2fr 1fr 1fr; } }
.check { display: flex; align-items: center; gap: 8px; font-weight: 300; margin: 8px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--dark); }
.radios { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 4px 0; }
.radios label { display: flex; align-items: center; gap: 6px; font-weight: 300; margin: 0; }

button.primary { background: var(--yellow); color: var(--dark); border: 0; border-radius: 8px; padding: 12px 20px; font: 600 1rem Lato, Arial, sans-serif; cursor: pointer; }
button.primary:disabled { opacity: .5; cursor: default; }
button.secondary { background: var(--white); color: var(--dark); border: 1px solid var(--dark); border-radius: 8px; padding: 10px 16px; font: 600 .95rem Lato, Arial, sans-serif; cursor: pointer; }
button.small { padding: 6px 10px; font-size: .85rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }

.picker { position: relative; }
.picker ul { position: absolute; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 0; list-style: none; background: var(--white); border: 1px solid var(--line); border-radius: 8px; max-height: 260px; overflow: auto; z-index: 4; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.picker li { padding: 10px 12px; cursor: pointer; font-weight: 400; }
.picker li:hover, .picker li.active { background: var(--grey); }
.picker li .stage { float: right; color: var(--mid); font-size: .8rem; }
.chosen { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--grey); border-radius: 8px; padding: 10px 12px; font-weight: 400; }

.purchaser { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 6px; }
.purchaser:first-of-type { border-top: 0; margin-top: 0; }

details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary h2 { display: inline; margin: 0; }
details > summary h2::before { content: '+ '; color: var(--mid); font-weight: 300; }
details[open] > summary h2::before { content: '- '; }
details > summary .muted { display: block; margin: 4px 0 8px; }
.clauses details.group { margin: 8px 0; }
.clauses details.group > summary { font-size: .95rem; font-weight: 600; color: var(--dark); padding: 8px 10px; background: var(--grey); border-radius: 8px; }
.clauses details.group > summary .n { color: var(--mid); font-weight: 300; }
.front-cond { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--grey); }
.front-cond:first-child { border-top: 0; }
.front-cond .check { margin: 0; }
.front-cond input[type=number] { width: 150px; }
.clauses .group { margin: 10px 0; }
.clauses .group > h3 { font-size: .9rem; color: var(--mid); font-weight: 600; margin: 10px 0 4px; }
.clause { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 6px 0; background: var(--white); }
.clause.on { border-color: var(--dark); background: #fffdf0; }
.clause .head { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.clause .head input { width: 18px; height: 18px; accent-color: var(--dark); flex: none; }
.clause .params { display: grid; gap: 8px; grid-template-columns: 1fr; margin: 8px 0 4px 28px; }
@media (min-width: 640px) { .clause .params { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); } }
.clause .params label { margin: 0; font-size: .8rem; }
.clause .params input, .clause .params textarea { padding: 8px 10px; font-size: .95rem; }
.clause .note { font-size: .8rem; color: var(--mid); margin: 4px 0 0 28px; }

table.dates { width: 100%; border-collapse: collapse; font-size: .95rem; margin: 8px 0; }
table.dates th { text-align: left; font-weight: 600; border-bottom: 2px solid var(--yellow); padding: 6px 8px; }
table.dates td { padding: 6px 8px; border-bottom: 1px solid var(--grey); font-weight: 400; vertical-align: top; }
table.dates tr.key td { font-weight: 600; }

.status { border-left: 4px solid var(--yellow); background: var(--grey); padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 12px 0; font-weight: 400; }
.status.bad { border-left-color: var(--red); }
.status.good { border-left-color: var(--green); }
ul.errors { margin: 6px 0; padding-left: 18px; color: var(--red); font-weight: 400; }
pre.existing { white-space: pre-wrap; font: 400 .85rem/1.4 Lato, Arial, sans-serif; background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; max-height: 220px; overflow: auto; }

.preview { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin: 12px 0; }
.preview figure { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--white); }
.preview img { display: block; width: 100%; height: auto; }
.preview figcaption { font-size: .8rem; color: var(--mid); padding: 6px 10px; border-top: 1px solid var(--grey); }
.foot { display: flex; justify-content: space-between; color: var(--mid); font-size: .8rem; padding: 14px 16px; border-top: 1px solid var(--grey); max-width: 860px; margin: 0 auto; }
