/* Contractor app shell: dark top bar, full-width content, cards. Loads after site.css + auth.css. */
.app-body { background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
.app-bar { background: var(--anthracite); color: #fff; position: sticky; top: 0; z-index: 40; }
.app-bar-inner { max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter); min-height: 64px; display: flex; align-items: center; gap: 24px; }
.app-logo img { height: 32px; width: auto; }
.app-menu { display: flex; gap: 4px; margin-left: 8px; }
.app-menu a { color: #C9C9C4; text-decoration: none; font-weight: 600; font-size: .9375rem; padding: 22px 12px; border-bottom: 3px solid transparent; margin-bottom: -3px; }
.app-menu a:hover { color: #fff; }
.app-menu a[aria-current="page"] { color: #fff; border-color: var(--yellow); }
.app-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.app-user-email { font-size: .875rem; color: #C9C9C4; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-signout { border-color: #555; color: #fff; }
.app-signout:hover { background: #fff; color: var(--black); }
.app-burger { display: none; width: 42px; height: 42px; padding: 11px 9px; border: 1px solid #555; border-radius: 6px; background: transparent; flex-direction: column; justify-content: space-between; cursor: pointer; }
.app-burger span { display: block; height: 2px; background: #fff; border-radius: 2px; }
.app-main { flex: 1; padding: 20px 0 48px; }
.app-container { max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter); display: grid; gap: 16px; }
.app-plan-line { font-size: .875rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 2.5vw, 24px); display: grid; gap: 14px; align-content: start; }
.app-title { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; font-size: clamp(1.625rem, 3vw, 2.25rem); line-height: 1; }
.app-hero-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.app-hero .app-limit { margin-top: 10px; }
.app-stats { margin: 0; }
.stat-btn { text-align: left; cursor: pointer; position: relative; font: inherit; color: inherit; transition: border-color .15s ease, transform .15s ease; }
.stat-btn:hover { border-color: var(--black); transform: translateY(-1px); }
.stat-btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.stat-more { position: absolute; right: 12px; top: 14px; color: var(--text-muted); }
.stat-more .icon { width: 18px; height: 18px; transform: rotate(-90deg); }
.app-back { font-size: .9375rem; }
.app-footer { display: flex; justify-content: center; align-items: center; gap: 18px; padding: 16px; font-size: .875rem; color: var(--text-muted); border-top: 1px solid var(--line); }
.app-footer a { color: var(--text-muted); text-decoration: none; }
.app-footer a:hover { color: var(--black); }
.app-dialog-body { padding: clamp(20px, 4vw, 28px); display: grid; gap: 14px; max-height: calc(100vh - 64px); overflow: auto; }
.info-list { list-style: none; display: grid; gap: 8px; }
.info-list li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.info-list li a { text-decoration: none; color: inherit; font-weight: 600; }
.info-list small { color: var(--text-muted); grid-column: 1; }
.info-list .amount { font-weight: 600; white-space: nowrap; }
.info-list .overdue { color: var(--no); font-weight: 600; }
.info-total { display: flex; justify-content: space-between; font-weight: 600; padding-top: 8px; border-top: 1px solid var(--line); }
.object-card .role-tag { font-size: .6875rem; color: var(--text-muted); }

/* Rates page */
.rates-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rates-toolbar input[type="search"], .rates-toolbar select { min-height: 40px; padding: 0 10px; border: 1.5px solid #CFCFCA; border-radius: var(--radius-sm); font: inherit; font-size: .9375rem; background: #fff; }
.rates-toolbar input[type="search"] { flex: 1 1 220px; }
.rates-table td { padding: 4px 6px; }
.rates-table .cell-spec { max-width: 170px; }
.rates-count { font-size: .875rem; color: var(--text-muted); }

/* Team page */
.team-form { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr auto; gap: 8px; align-items: end; }
.team-form .field { gap: 4px; }
.team-form input, .team-form select { min-height: 42px; }
.team-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.team-card { display: grid; gap: 4px; padding: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.team-card strong { font-size: 1.0625rem; }
.team-card small { color: var(--text-muted); }
.team-card .pill { justify-self: start; }
.team-card .icon-btn { justify-self: end; }
.team-card .team-invite { font-size: .8125rem; }
.team-card .button-small { justify-self: start; }
.assign-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.assign-list label { display: flex; gap: 10px; align-items: center; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.assign-list input { width: 20px; height: 20px; accent-color: var(--black); }
.member-note { background: rgba(255, 196, 0, .18); border-left: 4px solid var(--yellow); padding: 10px 12px; border-radius: var(--radius-sm); font-size: .9375rem; }

@media (max-width: 899px) {
  .app-menu { display: none; position: absolute; left: 0; right: 0; top: 64px; background: var(--anthracite); flex-direction: column; padding: 8px 0 12px; border-top: 1px solid #333; }
  .app-menu.open { display: flex; }
  .app-menu a { padding: 14px var(--gutter); border-bottom: 0; border-left: 3px solid transparent; }
  .app-menu a[aria-current="page"] { border-left-color: var(--yellow); }
  .app-burger { display: flex; }
  .app-user-email, .app-signout { display: none; }
  .team-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) { .team-form { grid-template-columns: 1fr; } }

/* Stage 1: object workflow – stepper, next step, status pills */
.pill-no { background: rgba(210, 59, 46, .12); color: var(--no); }
.pill-no::before { background: var(--no); }
.object-card-muted { opacity: .72; }
.object-head-side { display: grid; gap: 8px; justify-items: end; }
.object-head-side .account-buttons { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.stepper { list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 4px 0; counter-reset: step; }
.stepper li { position: relative; padding-top: 12px; font-size: .75rem; line-height: 1.2; color: var(--text-muted); text-align: center; }
.stepper li::before { content: ''; display: block; height: 6px; border-radius: 3px; background: var(--line); position: absolute; top: 0; left: 0; right: 0; }
.stepper li.done::before { background: var(--black); }
.stepper li.current::before { background: var(--yellow); }
.stepper li.current { color: var(--black); font-weight: 600; }
.stepper li.done { color: var(--black); }
.next-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 16px; background: var(--bg); border-left: 4px solid var(--yellow); border-radius: var(--radius-sm); }
.next-card p { margin: 2px 0 0; color: var(--text-muted); font-size: .9375rem; }
.cal-nodate li { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.cal-nodate input { min-height: 36px; }
.share-stage { margin: -4px 0 8px; }
@media (max-width: 640px) {
  .stepper { grid-template-columns: repeat(4, 1fr); }
  .stepper li span { display: none; }
  .stepper li.current span { display: inline; }
}

/* Stage 2: autocomplete, expenses, team groups */
.ac-list { position: absolute; z-index: 60; list-style: none; margin: 0; padding: 4px 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0, 0, 0, .12); max-height: 320px; overflow: auto; }
.ac-list li { display: grid; gap: 2px; padding: 8px 12px; cursor: pointer; }
.ac-list li small { color: var(--text-muted); }
.ac-list li:hover, .ac-list li.active { background: rgba(255, 196, 0, .22); }
.exp-form { grid-template-columns: auto 1fr auto auto 2fr auto; }
.team-group { display: grid; gap: 8px; }
.team-group-title { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; font-size: 1rem; letter-spacing: .02em; }
.team-group-title .count { font-family: var(--font-body); font-weight: 600; font-size: .75rem; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; margin-left: 4px; }
.totals dd small { font-weight: 400; color: var(--text-muted); font-size: .8125rem; }
@media (max-width: 899px) { .exp-form { grid-template-columns: 1fr 1fr; } }

/* Stage 3: documents */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.doc-card { display: grid; gap: 8px; align-content: start; padding: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.doc-card h3 { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; font-size: 1.0625rem; }
.doc-card .billing-actions { gap: 6px; }
.doc-row-actions { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.inv-form { grid-template-columns: auto 1fr auto 2fr auto; }
@media (max-width: 899px) { .inv-form { grid-template-columns: 1fr 1fr; } }

/* Stage 4: photos + AI assistant */
.photo-row td { padding: 0 6px 8px; background: #fff; }
.photo-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.photo-strip figure { position: relative; margin: 0; }
.photo-strip img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); display: block; }
.photo-strip .icon-btn { position: absolute; top: -6px; right: -6px; background: #fff; border-radius: 50%; width: 22px; height: 22px; line-height: 20px; font-size: 14px; padding: 0; border: 1px solid var(--line); }
.app-dialog-wide { width: min(920px, calc(100vw - 32px)); }
.ai-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.ai-thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }

/* Stage 5 */
.logo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo-row img { max-height: 56px; max-width: 200px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px; background: #fff; }
.works-table td.wrap { min-width: 180px; }
.works-table .cell { min-width: 0; }

/* Stage 7: workers (contacts) */
.team-card .team-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.team-card .team-rate { font-weight: 600; }
.team-card .team-notes { color: var(--text-muted); font-style: italic; }
.team-form { grid-template-columns: 1.2fr 1fr 1fr 1fr .7fr .6fr auto; }
.team-form .field-wide { grid-column: 1 / -1; }
.assign-list label { flex-wrap: wrap; }
.assign-list .assign-dates { display: flex; gap: 6px; width: 100%; margin-top: 6px; }
.assign-list .assign-dates input { min-height: 34px; font-size: .875rem; }
.bf-box { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-left: 4px solid var(--yellow); border-radius: var(--radius-sm); background: var(--bg); }
@media (max-width: 899px) { .team-form { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .team-form { grid-template-columns: 1fr; } }
