/* Portal + admin shared app styles (loaded after site.css) */
body.app { background: var(--paper); min-height: 100vh; }
.app-main { padding-top: 36px; padding-bottom: 80px; }
.app-hello { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.app-hello h1 { font-size: clamp(32px, 4.4vw, 48px); }
.app-hello p { color: var(--muted); margin-top: 6px; }

/* auth */
.auth-shell { min-height: calc(100vh - 72px); display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { background: var(--ink); color: var(--ivory); position: relative; overflow: hidden; padding: clamp(40px, 6vw, 80px); display: flex; flex-direction: column; justify-content: flex-end; }
.auth-art::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, transparent 0 58%, var(--grape) 58% 100%); }
.auth-art > * { position: relative; }
.auth-art .big-m { position: absolute; top: 48px; left: clamp(40px, 6vw, 80px); width: 96px; height: 96px; }
.auth-art h2 { font-size: clamp(34px, 4vw, 52px); max-width: 460px; }
.auth-art ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; color: rgba(255, 253, 237, .82); }
.auth-art li { display: flex; gap: 12px; align-items: center; }
.auth-art li svg { width: 18px; height: 18px; color: var(--lav); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px var(--gutter); background: var(--ivory); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 36px; margin-bottom: 6px; }
.auth-card > p { color: var(--muted); margin-bottom: 24px; }
.link-btn { background: none; border: 0; padding: 4px; color: var(--grape); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--ink); }
.tabs { display: flex; background: var(--lav-soft); border-radius: 999px; padding: 4px; margin-bottom: 24px; }
.tabs button { flex: 1; border: 0; background: none; padding: 10px; border-radius: 999px; font-weight: 600; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--white); color: var(--ink); box-shadow: var(--shadow); }
@media (max-width: 860px) { .auth-shell { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* dashboard layout */
.dash { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.dash-side { display: grid; gap: 20px; }
@media (max-width: 980px) { .dash { grid-template-columns: 1fr; } }
.panel { background: var(--white); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 24px; }
.panel h2 { font-size: 22px; }
.panel h3 { font-size: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel .muted { color: var(--muted); font-size: 14px; }
.kv { display: grid; gap: 12px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.kv div:last-child { border-bottom: 0; padding-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }

.project { background: var(--white); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 20px; }
.project-head { background: var(--ink); color: var(--ivory); padding: 22px 24px; position: relative; overflow: hidden; }
.project-head::after { content: ''; position: absolute; right: -30px; top: -30px; width: 140px; height: 140px; background: var(--grape); transform: rotate(45deg); }
.project-head > * { position: relative; z-index: 1; }
.project-head h2 { font-size: 26px; }
.project-head .date { margin-top: 8px; color: rgba(255, 253, 237, .75); font-size: 15px; display: flex; align-items: center; gap: 8px; }
.project-head .date svg { width: 18px; height: 18px; color: var(--lav); }
.project-body { padding: 24px; display: grid; gap: 22px; }

.tracker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tracker div { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.tracker div::before { content: ''; display: block; height: 6px; border-radius: 999px; background: var(--lav-soft); margin-bottom: 8px; }
.tracker div.done { color: var(--ink); }
.tracker div.done::before { background: var(--grape); }
.tracker div.current::before { background: linear-gradient(90deg, var(--grape) 50%, var(--lav) 50%); }
@media (max-width: 560px) { .tracker div { font-size: 10px; } }

.money-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.money-row div { background: var(--paper); border-radius: 12px; padding: 14px; }
.money-row span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.money-row b { font-family: var(--font-display); font-size: 22px; }
@media (max-width: 480px) { .money-row { grid-template-columns: 1fr; } }

.banner { display: flex; gap: 12px; align-items: flex-start; border-radius: 12px; padding: 14px 16px; font-size: 14px; }
.banner svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.banner b { display: block; }
.banner--info { background: var(--lav-soft); color: var(--ink); }
.banner--warn { background: #fdf0dd; color: #6b3f0c; }
.banner--ok { background: #e3f3ea; color: #1d5a3c; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge--requested, .badge--new { background: #fdf0dd; color: #6b3f0c; }
.badge--estimate_sent, .badge--contacted, .badge--quoted, .badge--sent { background: var(--lav-soft); color: var(--grape); }
.badge--scheduled { background: #dde9fb; color: #1d4a8a; }
.badge--in_progress { background: var(--grape); color: var(--ivory); }
.badge--complete, .badge--won, .badge--paid { background: #e3f3ea; color: #1d5a3c; }
.badge--cancelled, .badge--lost { background: #f1eeee; color: #6d6060; }
.badge--none { background: #f1eeee; color: #6d6060; }
.badge--alert { background: #fde3e1; color: var(--err); }

.empty { text-align: center; padding: 48px 24px; }
.empty h2 { font-size: 26px; margin-bottom: 8px; }
.empty p { color: var(--muted); margin-bottom: 20px; }

.ref-box { display: flex; gap: 8px; }
.ref-box input { font-size: 13px; }

.radio-cards { display: grid; gap: 10px; }
.radio-cards label { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--line-strong); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.radio-cards label:has(input:checked) { border-color: var(--grape); background: var(--lav-soft); }
.radio-cards input { margin-top: 4px; accent-color: var(--grape); }
.radio-cards b { display: block; font-size: 14px; }
.radio-cards span { font-size: 13px; color: var(--muted); }

/* admin */
.admin-tabs { display: flex; gap: 6px; box-shadow: inset 0 -1px 0 var(--line); margin-bottom: 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs button { border: 0; background: none; padding: 12px 16px; font-weight: 600; color: var(--muted); cursor: pointer; box-shadow: inset 0 -3px 0 transparent; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; flex-shrink: 0; }
.admin-tabs button.on { color: var(--ink); box-shadow: inset 0 -3px 0 var(--grape); }
.admin-tabs button:hover { color: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip-btn { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 14px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--white); font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .15s; }
.chip-btn span { background: var(--paper); color: var(--muted); border-radius: 999px; padding: 0 7px; font-size: 12px; min-width: 22px; text-align: center; }
.chip-btn:hover { border-color: var(--grape); color: var(--ink); }
.chip-btn.on { background: var(--ink); border-color: var(--ink); color: var(--ivory); }
.chip-btn.on span { background: rgba(255, 253, 237, .18); color: var(--ivory); }
.search { width: auto; min-width: 260px; padding: 10px 14px !important; }
.status-pick { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.status-pick select { width: auto; padding: 8px 12px; font-size: 14px; letter-spacing: 0; text-transform: none; color: var(--ink); }
button.stat { border: 0; text-align: left; cursor: pointer; font: inherit; color: inherit; transition: transform .15s, box-shadow .15s; }
button.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.badge--converted { background: #dde9fb; color: #1d4a8a; }
.modal--wide { max-width: 720px; }

/* calendar */
.cal-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .cal-layout { grid-template-columns: 1fr; } }
.cal-panel { padding: 20px; }
.cal-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.cal-head h2 { font-size: 26px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-dow { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--paper); }
.cal-day { min-height: 110px; padding: 6px 0 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.out { background: #fbfaf4; }
.cal-day.out .cal-num { color: #b9b3c6; }
.cal-day.sun { background: repeating-linear-gradient(135deg, #faf8ee 0 6px, #f4f1e3 6px 12px); }
.cal-num { font-size: 13px; font-weight: 600; padding: 0 8px; width: fit-content; }
.cal-day.today .cal-num { background: var(--grape); color: var(--ivory); border-radius: 999px; margin-left: 4px; padding: 1px 8px; }
.cal-ev { display: block; margin: 0 4px; padding: 3px 7px; border: 0; border-radius: 6px; font-size: 12px; font-weight: 600; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 22px; }
.cal-ev.cont { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-ev.more { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-ev:hover { filter: brightness(1.08); }
.cal-ev--estimate_sent, .cal-legend .cal-ev--estimate_sent { background: var(--lav-soft); color: var(--grape); box-shadow: inset 0 0 0 1.5px var(--lav); }
.cal-ev--requested { background: #fdf0dd; color: #6b3f0c; }
.cal-ev--scheduled, .cal-legend .cal-ev--scheduled { background: var(--grape); color: var(--ivory); }
.cal-ev--in_progress, .cal-legend .cal-ev--in_progress { background: var(--ink); color: var(--ivory); }
.cal-ev--complete, .cal-legend .cal-ev--complete { background: #e3f3ea; color: #1d5a3c; }
.cal-ev--ghost, .cal-legend .cal-ev--ghost { background: transparent !important; color: #8a5a1c !important; box-shadow: inset 0 0 0 1.5px #d9a35b !important; border: 0; }
.cal-legend .cal-ev--ghost { box-shadow: inset 0 0 0 1.5px #d9a35b; }
.cal-more { border: 0; background: none; color: var(--grape); font-size: 12px; font-weight: 600; text-align: left; padding: 0 8px; cursor: pointer; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
@media (max-width: 700px) {
  .cal-day { min-height: 64px; }
  .cal-ev { font-size: 0; min-height: 8px; padding: 0; margin: 0 3px; }
  .cal-ev.cont { margin-left: 0; } .cal-ev.more { margin-right: 0; }
  .cal-dow { font-size: 10px; padding: 6px 4px; }
}
.agenda { display: grid; gap: 8px; }
.agenda-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--white); border-radius: 12px; padding: 10px 12px; cursor: pointer; transition: border-color .15s; font: inherit; color: inherit; }
.agenda-item:hover { border-color: var(--grape); }
.agenda-item > span:nth-child(2), .agenda-item > span:first-child:not(.agenda-date) { flex: 1; min-width: 0; }
.agenda-item b { display: block; font-size: 14px; }
.agenda-item small { display: block; font-size: 12px; color: var(--muted); }
.agenda-item .badge { flex-shrink: 0; }
.agenda-date { width: 44px; flex-shrink: 0; text-align: center; background: var(--paper); border-radius: 8px; padding: 4px 0; font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.agenda-date b { font-family: var(--font-display); font-size: 20px; color: var(--ink); line-height: 1.1; }
.admin-tabs .count { background: var(--grape); color: var(--ivory); font-size: 11px; padding: 1px 7px; border-radius: 999px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--white); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.stat b { display: block; font-family: var(--font-display); font-size: 30px; margin-top: 4px; }
@media (max-width: 760px) { .stats { grid-template-columns: 1fr 1fr; } }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input, .toolbar select { width: auto; min-width: 180px; padding: 10px 12px; }
.list { display: grid; gap: 12px; }
.item { background: var(--white); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; }
.item-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.item-top h3 { font-size: 19px; }
.item-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.item-sub a { color: var(--grape); }
.item-flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.item details { margin-top: 12px; }
.item summary { cursor: pointer; color: var(--grape); font-weight: 600; font-size: 14px; }
.item .detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; font-size: 14px; }
.item .detail-grid h4 { font-family: var(--font-body); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
@media (max-width: 700px) { .item .detail-grid { grid-template-columns: 1fr; } }
.photo-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo-strip a { width: 84px; height: 84px; border-radius: 10px; overflow: hidden; display: block; background: var(--lav-soft); }
.photo-strip img { width: 100%; height: 100%; object-fit: cover; }
.edit-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-top: 14px; }
.edit-grid .field { margin-bottom: 0; }
.edit-grid input, .edit-grid select { padding: 10px 12px; font-size: 14px; }
@media (max-width: 800px) { .edit-grid { grid-template-columns: 1fr 1fr; } }
.admin-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.admin-gallery figure { margin: 0; background: var(--white); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.admin-gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.admin-gallery figcaption { padding: 10px; display: grid; gap: 8px; }
.admin-gallery input { padding: 8px 10px; font-size: 13px; }
.note-box { background: var(--paper); border-radius: 10px; padding: 12px 14px; font-size: 14px; white-space: pre-wrap; }
