@layer base, components, layout, responsive;

@layer base {
  :root {
    color-scheme: light;
    --ink: #10273a;
    --body: #233b4a;
    --muted: #546775;
    --paper: #fff;
    --canvas: #f4f6f7;
    --line: #dce4e8;
    --accent: #d9b761;
    --accent-soft: #f8f0d9;
    --green: #22654e;
    --focus: #28679b;
    font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
    font-size: 100%;
    background: var(--canvas);
    color: var(--body);
  }
  * { box-sizing: border-box; }
  body { margin: 0; }
  [hidden] { display: none !important; }
  h1, h2, h3, p, dl, dd { margin: 0; }
  h1, h2, h3 { color: var(--ink); line-height: 1.1; }
  h1 { font-size: clamp(2rem, 4.4vw, 3.8rem); letter-spacing: -.055em; font-weight: 740; }
  h2 { font-size: clamp(1.25rem, 2.5vw, 1.65rem); letter-spacing: -.025em; }
  h3 { font-size: 1.16rem; letter-spacing: -.015em; }
  p { line-height: 1.55; }
  img { display: block; max-width: 100%; }
  a { color: inherit; }
  button, input, select { font: inherit; }
  button, a, input, select { -webkit-tap-highlight-color: transparent; }
  button { cursor: pointer; }
  button:disabled { cursor: wait; opacity: .65; }
  :focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
}
@layer components {
  .muted { color: var(--muted); }
  .primary, .secondary {
    border-radius: .5rem; border: 1px solid transparent; padding: .78rem 1rem;
    min-height: 2.8rem; font-weight: 650; font-size: .93rem; line-height: 1.15;
  }
  .primary { color: white; background: var(--ink); }
  .primary:hover:not(:disabled) { background: #21445d; }
  .secondary { color: var(--ink); background: white; border-color: #b9c9d0; }
  .secondary:hover:not(:disabled), .icon-button:hover { background: #edf2f4; }
  .text-button {
    border: 0; background: transparent; color: var(--ink); text-decoration: none;
    font-size: .94rem; font-weight: 650; padding: .48rem .55rem; border-radius: .4rem;
  }
  .text-button:hover { background: var(--canvas); }
  .icon-button {
    background: white; border: 1px solid var(--line); border-radius: .5rem;
    min-width: 2.65rem; min-height: 2.65rem; color: var(--ink); font-size: 1.32rem;
  }
  .notice, .inline-error, .settings-message {
    padding: .75rem .9rem; font-size: .9rem; border-radius: .45rem;
    background: #f8f0dc; color: #624611; border: 1px solid #e8d6aa;
  }
  .inline-error, .settings-message.error { background: #fceae7; color: #8b2c22; border-color: #f4c8c3; }
  .settings-message.success { background: #edf8f0; color: #285b43; border-color: #c7e5d2; }
  .loading { color: var(--muted); padding: 2.5rem; text-align: center; }
  label { display: grid; gap: .42rem; font-size: .91rem; font-weight: 650; min-width: 0; }
  input, select {
    width: 100%; border: 1px solid #b9c9d0; background: white; border-radius: .45rem;
    padding: .73rem .8rem; min-height: 2.78rem; font-weight: 500; color: var(--ink);
  }
  select {
    appearance: none;
    padding-right: 2.05rem;
    background-image: linear-gradient(45deg, transparent 50%, #435a66 50%), linear-gradient(135deg, #435a66 50%, transparent 50%);
    background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
  }
  .demo-tag {
    background: var(--accent-soft); color: #5c460f; font-weight: 650; font-size: .82rem;
    padding: .28rem .55rem; border-radius: .25rem;
  }
  .eyebrow { font-size: .88rem; font-weight: 690; color: #466170; margin-bottom: .65rem; }
  .tag { font-size: .81rem; padding: .23rem .55rem; border-radius: .28rem; background: #eaf3ef; color: #245d49; font-weight: 675; }
}
@layer layout {
  .login-layout { display: grid; grid-template-columns: minmax(26rem, .9fr) 1.1fr; min-height: 100svh; background: white; }
  .login-panel { display: grid; align-items: center; padding: clamp(2rem, 6vw, 6rem); }
  .login-inner { width: min(100%, 28rem); margin-inline: auto; }
  .login-logo { width: 13.5rem; margin: 0 0 3rem -.35rem; }
  .login-inner h1 { margin-bottom: .7rem; }
  .login-inner .notice { margin-top: 1rem; }
  .form-stack { display: grid; gap: 1rem; margin-top: 1.9rem; }
  .login-photo { background: #394d49 url("/static/roofing-hero.png") center 48% / cover; min-height: 36rem; }
  .topbar { background: white; border-bottom: 1px solid var(--line); }
  .topbar-inner { max-width: 87rem; min-height: 4.85rem; margin-inline: auto; display: flex; align-items: center; justify-content: space-between; padding: .5rem clamp(1rem, 4vw, 3rem); gap: 1rem; }
  .brand img { width: clamp(7.9rem, 16vw, 10.75rem); }
  .topbar-tools { display: flex; align-items: center; gap: clamp(.35rem, 2vw, 1rem); }
  #rep-name { color: var(--muted); font-size: .9rem; white-space: nowrap; }
  .shell { max-width: 87rem; margin-inline: auto; padding: clamp(1.35rem, 4vw, 3rem); }
  .dashboard-head { margin-bottom: 2rem; }
  .appointments { display: grid; gap: 1.4rem; }
  .appointment-section { background: white; border: 1px solid var(--line); border-radius: .85rem; overflow: hidden; }
  .appointment-section.current { border-top: 4px solid var(--accent); }
  .section-title { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.35rem; }
  .section-title span { color: var(--muted); font-size: .9rem; }
  .empty { padding: 1.15rem 1.35rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .96rem; }
  .appointment-row {
    display: grid; grid-template-columns: minmax(9rem, 1fr) minmax(12rem, 2fr) auto;
    padding: 1rem 1.35rem; gap: .8rem 1.2rem; align-items: center; border-top: 1px solid var(--line);
  }
  .appointment-time { color: var(--muted); font-size: .86rem; }
  .appointment-time strong { display: block; color: var(--ink); font-size: 1rem; }
  .customer-name { font-weight: 710; color: var(--ink); }
  .customer-address { color: var(--muted); font-size: .91rem; overflow-wrap: anywhere; }
  .appointment-row a { display: inline-flex; align-items: center; text-decoration: none; justify-content: center; }
  .more { margin: .9rem 1.35rem; }
  .quote-head {
    border-radius: .95rem; padding: clamp(1.5rem, 3.8vw, 3rem); margin-bottom: 1.55rem;
    background: radial-gradient(ellipse at top right, #285064, transparent 65%), var(--ink);
    color: #d9e6eb; border-bottom: 4px solid var(--accent);
  }
  .quote-head h1 { color: white; margin-bottom: .65rem; font-size: clamp(2rem, 4.2vw, 3.5rem); }
  .quote-head .eyebrow { color: #f1d587; }
  .quote-head p:last-child { overflow-wrap: anywhere; }
  .quote-notice { margin-bottom: 1rem; }
  .package-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr)); gap: 1rem; }
  .package {
    background: white; border: 1px solid var(--line); border-radius: .75rem; padding: clamp(1.1rem, 2.3vw, 1.65rem);
    display: flex; flex-direction: column; min-width: 0;
  }
  .package.selected { border-color: #a78237; box-shadow: inset 0 3px var(--accent), 0 8px 20px #10273a0c; }
  .package-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; min-height: 1.65rem; }
  .package-top .eyebrow { margin: 0; }
  .package h2 { margin-bottom: .75rem; }
  .price-focus { margin-top: .55rem; padding: .9rem 0; }
  .price-focus strong { font-size: clamp(2rem, 3.8vw, 3.3rem); color: var(--ink); letter-spacing: -.062em; display: block; line-height: 1.05; overflow-wrap: anywhere; }
  .price-focus span { font-size: .91rem; color: var(--muted); display: inline-block; margin-top: .2rem; }
  .package-change { min-height: 1.6rem; color: var(--muted); font-size: .85rem; font-weight: 630; }
  .price-rows > div { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .48rem 0; border-bottom: 1px solid #e8edf0; }
  .price-rows dt, .price-rows dd { font-size: .89rem; }
  .price-rows dd { font-weight: 680; color: var(--ink); text-align: right; white-space: nowrap; }
  .price-rows .saving dd { color: var(--green); }
  .highlights { margin: 1rem 0 0; padding-left: 1.15rem; color: var(--muted); font-size: .91rem; }
  .highlights li { margin-block: .36rem; padding-left: .15rem; }
  .highlights li::marker { color: #9c7427; }
  .single-quote { background: white; border: 1px solid var(--line); border-radius: .8rem; display: grid; grid-template-columns: 1.25fr 1fr; overflow: hidden; }
  .single-quote > div { padding: clamp(1.25rem, 3vw, 2rem); }
  .single-quote .payment-area { background: #eaf1f4; }
  .single-quote h2 { margin-bottom: .55rem; }
  .fine-print { font-size: .85rem; color: var(--muted); margin-top: 1rem; }
  dialog {
    width: min(38rem, calc(100% - 1.5rem)); max-height: calc(100% - 2rem); padding: 1.4rem;
    color: var(--body); border: 1px solid var(--line); border-radius: .8rem; box-shadow: 0 20px 65px #00162455;
  }
  dialog::backdrop { background: #071b2bbb; }
  .dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
  .dialog-header p { font-size: .9rem; margin-top: .35rem; }
  .settings-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: .95rem; }
  .settings-inputs label:has(select) { grid-column: 1 / -1; }
  .number-input { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .75rem; }
  .number-input.prefix { grid-template-columns: auto 1fr; }
  .margin-panel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin: 1.05rem 0; padding: .85rem; background: #edf3f5; border-radius: .5rem; }
  .margin-panel dt { color: var(--muted); font-size: .83rem; }
  .margin-panel dd { margin-top: .24rem; font-weight: 750; color: var(--ink); overflow-wrap: anywhere; }
  .dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .65rem; margin-top: 1rem; }
  .push-confirmation p { margin-top: .6rem; }
}
@layer responsive {
  @media (max-width: 730px) {
    .login-layout { grid-template-columns: 1fr; }
    .login-panel { min-height: 80svh; }
    .login-photo { display: none; }
    .appointment-row { grid-template-columns: minmax(0, 1fr) auto; }
    .appointment-time { grid-column: 1/-1; }
    .appointment-time strong { display: inline; margin-right: .45rem; }
    .single-quote { grid-template-columns: 1fr; }
  }
  @media (max-width: 425px) {
    .topbar-inner { gap: .3rem; }
    #rep-name { display: none; }
    .appointment-row, .section-title { padding-inline: .85rem; }
    .appointment-row a { padding-inline: .65rem; }
    .dialog-actions > button { flex: 1; }
  }
  @media print {
    .topbar-tools, dialog, .fine-print[hidden] { display: none !important; }
    .shell { padding: 0; }
    .quote-head { background: white; color: var(--ink); border: 1px solid var(--line); }
    .quote-head h1, .quote-head .eyebrow { color: var(--ink); }
    .package-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .package { break-inside: avoid; padding: .65rem; }
  }
}
