/* The slide-in panel ("sheet") used for Add a customer. Opens from the right over whatever page you're on. */
#aws-sheet { position: fixed; inset: 0 0 0 auto; width: min(860px, 100vw); height: 100vh; max-height: none; margin: 0;
             padding: 0; border: 0; border-left: 1px solid var(--aws-line); background: var(--aws-card); color: var(--aws-ink);
             box-shadow: -24px 0 60px rgba(20, 20, 18, .16); }
#aws-sheet::backdrop { background: rgba(30, 30, 28, .32); }
#aws-sheet:popover-open { animation: aws-slide .18s ease-out; }
@keyframes aws-slide { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #aws-sheet:popover-open { animation: none; } }
#aws-sheet .sheet-loading { padding: 40px; color: var(--aws-quiet); }

.sheet { height: 100%; }
.sheet-form { display: flex; flex-direction: column; height: 100%; }
.sheet-body { flex: 1; overflow-y: auto; padding: 18px 40px 28px; }
.sheet-close { border: 0; background: none; padding: 4px 0; font: inherit; font-size: .92rem; color: var(--aws-quiet); cursor: pointer; }
.sheet-close:hover { color: var(--aws-ink); }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 14px 0 18px; margin-bottom: 18px; border-bottom: 1px solid var(--aws-line); }
.sheet-head h1 { margin: 0 !important; font-size: 1.6rem !important; font-weight: 700; font-stretch: 88%; color: var(--aws-ink); }
.sheet-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #ffe3c2; color: #8a4200; }
.sheet-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.sheet .lbl { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; color: var(--aws-ink); }
.sheet .lbl em { font-style: normal; font-weight: 500; color: #b4340f; font-size: .82rem; margin-left: 4px; }
.sheet input:not([type=radio]):not([type=checkbox]), .sheet select, .sheet textarea {
  box-sizing: border-box; width: 100%; padding: 10px 12px; font: inherit; font-size: .95rem; border: 1px solid #cfcfca;
  border-radius: 8px; background: var(--aws-card); color: var(--aws-ink); }
.sheet select { height: auto; min-height: 42px; padding: 8px 34px 8px 12px; line-height: 1.3; cursor: pointer;
  /* Safari draws its own small grey select and ignores padding; switch that off and draw our own arrow. */
  -webkit-appearance: none; appearance: none;
  background: var(--aws-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555550' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center / 15px 15px; }
.sheet select:hover { border-color: #a9a9a3; }
/* Attach > Solar job: the job picker in its own orange card so it stands out. */
.sheet .attach-job { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 4px 14px; align-items: start;
  background: #fff6eb; border: 1px solid #ffd9ad; border-radius: 12px; padding: 14px 16px; margin-bottom: 8px; }
.sheet .attach-job .ic { width: 40px; height: 40px; border-radius: 50%; background: var(--aws-orange); color: #fff;
  display: grid; place-items: center; grid-row: 1 / span 2; }
.sheet .attach-job .ic svg { width: 21px; height: 21px; }
.sheet .attach-job .field { margin: 0; }
.sheet .attach-job .lbl { font-size: 1rem; font-weight: 700; }
.sheet .attach-job .lbl small { display: block; font-weight: 400; font-size: .85rem; color: var(--aws-quiet); margin-top: 2px; }
.sheet .attach-job select { min-height: 48px; font-size: 1rem; font-weight: 600; border: 2px solid var(--aws-orange); margin-top: 4px; }
.sheet .attach-job select:focus { border-color: var(--aws-ink); box-shadow: 0 0 0 3px rgba(255, 125, 0, .25); }
.sheet .attach-job .hint { margin: 6px 0 0; grid-column: 2; }
.sheet input:focus, .sheet select:focus, .sheet textarea:focus { outline: none; border-color: var(--aws-ink); box-shadow: 0 0 0 1px var(--aws-ink); }
.sheet textarea { resize: vertical; min-height: 44px; }
.sheet .field { display: block; margin-bottom: 18px; }
.sheet .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet .row2.task { grid-template-columns: 1fr 180px; }
.sheet .err { color: #b4340f; font-size: .85rem; margin: 6px 0 0; }
.sheet-error { background: #fde4e1; color: #7c1d12; border-radius: 8px; padding: 10px 14px; margin: 0 0 16px; }
.sheet-dupes { border: 2px solid var(--aws-orange); border-radius: 10px; padding: 12px 16px; margin: 0 0 18px; background: #fff8ef; }
.sheet-dupes ul { margin: 8px 0; padding-left: 18px; }
.sheet-dupes li span { color: var(--aws-quiet); font-size: .85rem; margin-left: 6px; }
.sheet-check { display: flex; gap: 8px; align-items: center; font-weight: 600; }

.sheet-kind { display: inline-flex; border: 1px solid #cfcfca; border-radius: 999px; padding: 3px; margin-bottom: 16px; }
.sheet-kind label { padding: 6px 16px; border-radius: 999px; font-size: .88rem; font-weight: 600; cursor: pointer; color: var(--aws-quiet); }
.sheet-kind input { position: absolute; opacity: 0; pointer-events: none; }
.sheet-kind label:has(input:checked) { background: var(--aws-ink); color: var(--aws-card); }
.sheet-kind label:has(input:focus-visible) { outline: 2px solid var(--aws-orange); }

.sheet-name { margin-bottom: 22px; }
.sheet-name-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sheet-assigned { font-size: .88rem; color: var(--aws-quiet); display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.sheet .sheet-assigned select { width: auto; padding: 4px 26px 4px 8px; background-position: right 6px center; background-size: 13px 13px; font-size: .88rem; border-color: transparent; color: var(--aws-link); font-weight: 600; }
.sheet-name .row2 input, .sheet-name .for-company input { padding: 12px 14px; font-size: 1.05rem; border: 2px solid var(--aws-ink); }
.sheet .for-company { display: none; }
.sheet-form:has(input[name=kind][value=company]:checked) .for-company { display: block; }
.sheet-form:has(input[name=kind][value=company]:checked) .for-person { display: none; }

.sheet-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 0 36px; }
.sheet .line { display: grid; grid-template-columns: minmax(0, 1fr) 128px 28px; gap: 8px; align-items: center; margin-bottom: 6px; }
.sheet .line.addr { grid-template-columns: minmax(0, 1fr) 92px 96px 28px; }
.sheet .line.addr .street { grid-column: 1 / -1; }
.sheet .line.addr select[name=address_label] { grid-column: 1; grid-row: 3; width: 150px; }
.sheet .line.addr .x { grid-column: 4; grid-row: 2; }
.sheet .x { border: 0; background: none; font-size: 1.3rem; line-height: 1; color: var(--aws-quiet); cursor: pointer; border-radius: 6px; height: 32px; }
.sheet .x:hover { background: var(--darkened-bg); color: var(--aws-ink); }
.sheet .more { display: block; margin-left: auto; border: 0; background: none; font: inherit; font-size: .88rem;
               color: var(--aws-link); cursor: pointer; padding: 2px 0; text-decoration: underline; text-underline-offset: 2px; }
.sheet .hint { color: var(--aws-quiet); font-size: .85rem; margin: -10px 0 8px; }

.sheet-attach { border-top: 1px solid var(--aws-line); padding-top: 20px; margin-top: 6px; }
.sheet-attach h2 { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; margin: 0 0 14px; }
.sheet-attach .plus { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #ffe3c2; color: #8a4200; font-weight: 700; }
.sheet .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.sheet .chip { border: 1px solid #cfcfca; background: var(--aws-card); border-radius: 8px; padding: 8px 16px; font: inherit;
               font-size: .92rem; font-weight: 600; color: var(--aws-ink); cursor: pointer; }
.sheet .chip:hover { border-color: var(--aws-ink); }
.sheet .chip[aria-pressed=true] { background: var(--aws-ink); color: var(--aws-card); border-color: var(--aws-ink); }

.sheet-foot { display: flex; align-items: center; gap: 22px; padding: 16px 40px; border-top: 1px solid var(--aws-line); background: var(--aws-card); }
.sheet-save { border: 0; border-radius: 999px; padding: 13px 30px; background: var(--aws-orange); color: #1a1a1a; font: inherit;
              font-size: 1rem; font-weight: 700; cursor: pointer; }
.sheet-save:hover { background: var(--aws-orange-deep); }
.sheet-save[disabled] { opacity: .6; cursor: progress; }
.sheet-cancel { border: 0; background: none; font: inherit; color: var(--aws-ink) !important; text-decoration: underline; cursor: pointer; }

/* The same form as a normal page (if the panel can't open, or someone opens the link directly). */
.aws-addpage .sheet { max-width: 900px; background: var(--aws-card); border: 1px solid var(--aws-line); border-radius: 12px; }
.aws-addpage .sheet-form { height: auto; }

@media (max-width: 760px) {
  .sheet-body { padding: 14px 18px 24px; }
  .sheet-foot { padding: 12px 18px; }
  .sheet-grid { grid-template-columns: minmax(0, 1fr); }
  .sheet .row2 { grid-template-columns: 1fr; }
}
.sheet .line.addr select[name=state] { padding-right: 22px; }

/* On/off switches (task Done, login "Can sign in", job status settings). */
.tk-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 700; font-size: .95rem; position: relative; }
.tk-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tk-switch .track { position: relative; width: 52px; height: 32px; border-radius: 999px; background: #d9d9d4; transition: background .18s ease; flex: none; }
.tk-switch .knob { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .18s ease; }
.tk-switch input:checked + .track { background: #2f9e5b; }
.tk-switch input:checked + .track .knob { transform: translateX(20px); }
.tk-switch input:focus-visible + .track { outline: 2px solid var(--aws-ink); outline-offset: 2px; }
.tk-switch input:disabled + .track { opacity: .55; }
.tk-switch.sm .track { width: 44px; height: 26px; } .tk-switch.sm .knob { width: 20px; height: 20px; }
.tk-switch.sm input:checked + .track .knob { transform: translateX(18px); }
.tk-switch.orange input:checked + .track { background: var(--aws-orange); }
.tk-switch.ink input:checked + .track { background: var(--aws-ink); }

@media (max-width: 520px) {
  /* Phones: suburb gets its own line so it isn't cut off; state and postcode share the next. */
  .sheet .line.addr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 28px; }
  .sheet .line.addr input[name=suburb] { grid-column: 1 / 3; }
  .sheet .line.addr .x { grid-column: 3; grid-row: 2; }
  .sheet .line.addr select[name=state] { grid-column: 1; grid-row: 3; }
  .sheet .line.addr input[name=postcode] { grid-column: 2; grid-row: 3; }
  .sheet .line.addr select[name=address_label] { grid-row: 4; }
  .sheet .line { grid-template-columns: minmax(0, 1fr) 112px 28px; }
}
