/* ============================================================
   Montecito CRM — shared stylesheet
   ============================================================ */
:root {
  --brand-pink: #C4218A;
  --brand-pink-dark: #993556;
  --brand-pink-tint: #FBEAF0;
  --brand-yellow: #F0A81E;

  --text-primary: #1f1f1d;
  --text-secondary: #5f5e5a;
  --text-muted: #88877f;
  --text-faint: #a3a29a;

  --surface-page: #fbfbfa;
  --surface-card: #ffffff;
  --border: #ecebe4;
  --border-strong: #dedcd3;
  --border-soft: #f4f3ee;

  --ok: #639922;
  --ok-tint: #EAF3DE;
  --ok-dark: #3B6D11;
  --warn: #BA7517;
  --danger: #A32D2D;
  --danger-tint: #FCEBEB;

  --radius: 12px;
  --radius-sm: 8px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-sans); color: var(--text-primary); background: var(--surface-page); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 500; }

.app { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar { width: 220px; flex-shrink: 0; background: var(--surface-card); border-right: 0.5px solid var(--border); padding: 1.5rem 1rem; }
.wordmark { font-family: var(--font-serif); line-height: 1; margin: 0 0.5rem 2rem; }
.wordmark .m { color: var(--brand-yellow); font-size: 22px; font-weight: 700; }
.wordmark .ontecito { color: var(--text-primary); font-size: 22px; font-weight: 700; }
.wordmark .crm { display: block; color: var(--brand-pink); font-size: 28px; font-weight: 700; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--radius-sm); font-size: 14px; color: var(--text-secondary); cursor: pointer; transition: background .12s, color .12s; }
.nav a:hover { background: var(--surface-page); color: var(--text-primary); }
.nav a.active { background: var(--brand-pink-tint); color: var(--brand-pink-dark); font-weight: 500; }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; }

:focus-visible { outline: 2px solid var(--brand-pink); outline-offset: 2px; }

/* ---- Main + topbar ---- */
.main { flex: 1; min-width: 0; padding: 1.75rem 2rem; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.topbar h1 { font-size: 20px; }
.topbar .subtitle { font-size: 13px; color: var(--text-muted); margin-top: 12px; }
.topbar-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.topbar-utility { justify-content: flex-end; margin-bottom: 1rem; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-actions form { display: inline-flex; margin: 0; }
.btn-icon-only { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 0.5px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-card); color: var(--text-secondary); flex-shrink: 0; }
.btn-icon-only:hover { color: var(--text-primary); border-color: var(--border); background: var(--surface-page); }
.btn-icon-only svg { width: 18px; height: 18px; }

.icon-btn { position: relative; background: none; border: none; cursor: pointer; color: var(--text-secondary); display: flex; padding: 4px; border-radius: 6px; }
.icon-btn .dot { position: absolute; top: 2px; right: 2px; width: 7px; height: 7px; background: var(--brand-pink); border-radius: 50%; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-pink-tint); color: var(--brand-pink-dark); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500; }

/* ---- Back link ---- */
.back-link { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--brand-pink-dark); margin-bottom: 1.25rem; }
.back-link svg { width: 15px; height: 15px; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13px; font-weight: 500; border-radius: var(--radius-sm); padding: 8px 14px; cursor: pointer; border: 0.5px solid var(--border-strong); background: var(--surface-card); color: var(--text-primary); transition: background .12s, border-color .12s, transform .08s; white-space: nowrap; }
.btn:hover { background: var(--surface-page); border-color: var(--text-muted); }
.btn:active { transform: scale(.98); }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--brand-pink); border-color: var(--brand-pink); color: #fff; }
.btn-primary:hover { background: var(--brand-pink-dark); border-color: var(--brand-pink-dark); }
.btn-danger { color: var(--danger); border-color: #f0d3d3; }
.btn-danger:hover { background: var(--danger-tint); border-color: var(--danger); }
.btn-sm { padding: 6px 11px; font-size: 12px; }

/* ---- Form controls (shared) ---- */
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=date], select, textarea {
  font: inherit; font-size: 13px; color: var(--text-primary); background: var(--surface-card);
  border: 0.5px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 11px; min-height: 36px; outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-pink); box-shadow: 0 0 0 3px var(--brand-pink-tint); }
input::placeholder { color: var(--text-faint); }
select { cursor: pointer; padding-right: 30px; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235f5e5a' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 9px center; }
label { font-size: 13px; color: var(--text-secondary); }
textarea { min-height: 80px; resize: vertical; }

/* ---- Toolbar (search / filters / actions above a table) ---- */
.toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar-group { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.search-inline { display: flex; gap: 8px; }
.search-inline input { width: 240px; }
.filter { display: flex; flex-direction: column; gap: 4px; }
.filter label { font-size: 12px; color: var(--text-muted); }

/* ---- Cards / tables ---- */
.card { background: var(--surface-card); border: 0.5px solid var(--border); border-radius: var(--radius); }
.flash-message { padding: 12px 18px; font-size: 13px; line-height: 1.45; margin-bottom: 1rem; border-radius: var(--radius-sm); border: 0.5px solid; background: var(--surface-card); }
.flash-error { background: var(--danger-tint); border-color: var(--danger); color: var(--danger); }
.flash-success { background: var(--ok-tint); border-color: var(--ok); color: var(--ok-dark); }
.table-wrap { background: var(--surface-card); border: 0.5px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data thead th { text-align: left; font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; padding: 12px 16px; border-bottom: 0.5px solid var(--border); background: var(--surface-page); }
table.data tbody td { padding: 13px 16px; border-bottom: 0.5px solid var(--border-soft); color: var(--text-primary); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: #fcfbf8; }
table.data td.muted { color: var(--text-muted); }
.cell-strong { font-weight: 500; }
.col-actions { text-align: right; width: 1%; white-space: nowrap; }

/* row action icon buttons */
.row-actions { display: inline-flex; gap: 4px; justify-content: flex-end; }
.row-actions button { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 6px; border-radius: 6px; display: inline-flex; transition: background .12s, color .12s; }
.row-actions button:hover { background: var(--surface-page); color: var(--text-primary); }
.row-actions button.danger:hover { background: var(--danger-tint); color: var(--danger); }
.row-actions svg { width: 16px; height: 16px; }

/* ---- Badges ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 20px; }
.badge-ok { background: var(--ok-tint); color: var(--ok-dark); }
.badge-ok .d { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.badge-role { background: var(--brand-pink-tint); color: var(--brand-pink-dark); }
.badge-warn { background: #fff4e5; color: #9a6700; }
.badge-info { background: #e8f1ff; color: #1a56db; }
.badge-muted { background: var(--surface-2); color: var(--text-secondary); border: 0.5px solid var(--border-soft); }
.badge-danger { background: var(--danger-tint); color: var(--danger); }
.ad-view-skipped { text-decoration: line-through; color: var(--text-muted); }
.ad-view-pause-log { display: flex; flex-direction: column; gap: 12px; }
.ad-view-pause-log-item { padding-bottom: 12px; border-bottom: 0.5px solid var(--border-soft); }
.ad-view-pause-log-item:last-child { padding-bottom: 0; border-bottom: 0; }
.ad-view-pause-log-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.ad-view-pause-log-meta,
.ad-view-pause-log-skipped { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.45; }

.filter-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-tab { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; font-size: 13px; color: var(--text-muted); border: 0.5px solid var(--border-soft); background: var(--surface-card); text-decoration: none; }
.filter-tab:hover { color: var(--text-primary); border-color: var(--border); }
.filter-tab.active { background: var(--brand-pink-tint); color: var(--brand-pink-dark); border-color: transparent; font-weight: 500; }
.filter-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 10px; font-size: 11px; font-weight: 600; background: var(--warn, #f59e0b); color: #fff; }
.data tr.row-highlight { background: #fffbf0; }
.data tr.row-highlight:hover { background: #fff6e0; }
.table-sort-link { color: inherit; text-decoration: none; font-weight: inherit; }
.table-sort-link:hover { color: var(--brand-pink-dark); }
.table-sort-link.active { color: var(--brand-pink-dark); font-weight: 600; }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; max-width: none; }
.detail-grid .section { max-width: none; }
.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.detail-list dt { color: var(--text-muted); margin: 0; }
.detail-list dd { margin: 0; }

.ad-view-topbar { align-items: flex-start; }
.ad-view-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.ad-view-title-row h1 { margin: 0; }
.ad-view-meta-line { margin-top: 6px; font-size: 13px; color: var(--text-muted); line-height: 1.4; }

.ad-view-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, 360px); gap: 20px; align-items: start; }
.ad-view-main-card { padding: 0; overflow: hidden; }
.ad-view-sidebar { display: flex; flex-direction: column; gap: 16px; }

.ad-view-section { padding: 20px 22px; }
.ad-view-section-divider { border-top: 0.5px solid var(--border-soft); }
.ad-view-section-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 14px; }
.ad-view-section-body { font-size: 14px; line-height: 1.55; color: var(--text-primary); white-space: pre-wrap; }

.ad-view-proof-layout { display: flex; gap: 18px; align-items: flex-start; }
.ad-view-proof-media { position: relative; flex-shrink: 0; width: 296px; }
.ad-view-proof-image { display: block; width: 296px; height: 224px; object-fit: cover; border-radius: 6px; background: var(--surface-page); }
.ad-view-proof-filename { display: block; margin-top: 6px; font-size: 11px; color: var(--text-muted); line-height: 1.3; word-break: break-all; }
.ad-view-proof-text { min-width: 0; flex: 1; }
.ad-view-proof-headline { font-size: 15px; font-weight: 600; margin-bottom: 8px; line-height: 1.35; }
.ad-view-proof-copy { font-size: 14px; line-height: 1.55; color: var(--text-primary); white-space: pre-wrap; }
.ad-view-proof-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ad-view-proof-thumb { max-width: 72px; max-height: 52px; object-fit: cover; border-radius: 4px; }
.ad-view-proof-file { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--brand-pink-dark); text-decoration: none; }
.ad-view-proof-file:hover { text-decoration: underline; }

.ad-view-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.ad-view-pill { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--text-secondary); background: var(--surface-page); border: 0.5px solid var(--border-soft); }
.ad-view-pill-muted { color: var(--text-muted); font-style: italic; }

.ad-view-meta-panel { padding: 16px 18px; }
.ad-view-meta-title { font-size: 13px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 12px; padding-bottom: 10px; border-bottom: 0.5px solid var(--border-soft); }
.ad-view-fields { display: flex; flex-direction: column; gap: 0; }
.ad-view-field { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px 14px; align-items: baseline; padding: 7px 0; }
.ad-view-field:first-child { padding-top: 0; }
.ad-view-field:last-child { padding-bottom: 0; }
.ad-view-field-label { font-size: 13px; color: var(--text-muted); line-height: 1.35; margin: 0; }
.ad-view-field-value { font-size: 14px; font-weight: 500; color: var(--text-primary); line-height: 1.45; word-break: break-word; }
.ad-view-field-value a { color: var(--brand-pink-dark); font-weight: 500; text-decoration: none; }
.ad-view-field-value a:hover { text-decoration: underline; }

.ad-view-fields-pricing .ad-view-field { grid-template-columns: minmax(0, 1fr) auto; }
.ad-view-field-money { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; font-weight: 500; }
.ad-view-price-original { display: block; font-size: 12px; color: var(--text-muted); text-decoration: line-through; margin-bottom: 2px; }
.ad-view-price-current { display: block; }
.ad-view-field-total .ad-view-price-current { font-size: 16px; font-weight: 600; color: var(--brand-pink-dark); }
.ad-view-field-total { margin-top: 2px; padding-top: 12px; border-top: 0.5px solid var(--border); border-bottom: none; }
.ad-view-field-total .ad-view-field-label { font-weight: 600; color: var(--text-primary); }
.ad-view-field-total .ad-view-field-value { font-size: 16px; font-weight: 600; color: var(--brand-pink-dark); }
.ad-view-pricing-note { margin: 12px 0 0; font-size: 12px; color: var(--text-muted); line-height: 1.4; }

.admin-ad-form.section { max-width: 760px; }
.admin-ad-form .form-row textarea { width: 100%; max-width: 100%; min-height: 120px; }
.settings-wide.section { max-width: none; }
.category-form { margin-bottom: 1rem; }
.category-form-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.category-form-row input[type=text] { width: min(100%, 360px); max-width: 360px; }

.review-steps { display: flex; gap: 0; list-style: none; margin: 0 0 1.25rem; padding: 0; border: 0.5px solid var(--border-soft); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-card); max-width: 720px; }
.review-step { flex: 1; border-right: 0.5px solid var(--border-soft); }
.review-step:last-child { border-right: none; }
.review-step-link { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-size: 13px; color: var(--text-muted); text-decoration: none; transition: background .12s, color .12s; }
.review-step-link:hover { background: var(--surface-page); color: var(--text-primary); }
.review-step.active { background: var(--brand-pink-tint); }
.review-step.active .review-step-link { color: var(--brand-pink-dark); font-weight: 500; }
.review-step.active .review-step-link:hover { background: var(--brand-pink-tint); color: var(--brand-pink-dark); }
.review-step.done .review-step-link { color: var(--text-secondary); }
.review-step-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; font-weight: 600; background: var(--surface-page); color: var(--text-secondary); flex-shrink: 0; }
.review-step.active .review-step-num { background: var(--brand-pink); color: #fff; }
.review-panel.section { max-width: none; }
.review-section-title { font-size: 14px; margin: 0 0 12px; }
.review-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; margin-bottom: 1.5rem; }
.review-proofbox { max-width: none; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.review-proofbox .headline { font-weight: 600; margin-bottom: 8px; }
.review-proofbox .copy { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.review-proof-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.review-proof-thumb { max-width: 120px; max-height: 80px; object-fit: cover; border-radius: 4px; }
.review-note { margin-top: 16px; font-size: 14px; line-height: 1.5; }
.review-note-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.review-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 1rem; border-top: 0.5px solid var(--border-soft); }
.review-schedule-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 1.25rem; padding: 16px; background: var(--surface-page); border-radius: var(--radius-sm); }
.review-summary-label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.review-calendar-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--text-muted); margin-bottom: 1rem; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.legend-run { background: var(--brand-pink-tint); border: 1px solid var(--brand-pink); }
.legend-start { background: var(--ok); }
.legend-end { background: var(--danger); }
.review-calendars { display: flex; flex-wrap: nowrap; gap: 12px; margin-bottom: 1rem; overflow-x: auto; }
.review-calendar { border: 0.5px solid var(--border-soft); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-card); }
.review-calendar-compact { width: 196px; flex-shrink: 0; }
.review-calendar-title { font-size: 12px; font-weight: 500; margin-bottom: 8px; color: var(--text-secondary); }
.review-calendar-grid { display: grid; grid-template-columns: repeat(7, 24px); gap: 2px; justify-content: start; }
.review-calendar-dow { width: 24px; height: 18px; font-size: 10px; color: var(--text-faint); text-align: center; line-height: 18px; }
.review-calendar-day { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 11px; border-radius: 4px; color: var(--text-secondary); }
.review-calendar-day.empty { visibility: hidden; }
.review-calendar-day.is-run { background: var(--brand-pink-tint); color: var(--brand-pink-dark); font-weight: 500; }
.review-calendar-day.is-start { background: var(--ok-tint); color: var(--ok-dark); font-weight: 600; box-shadow: inset 0 0 0 1px var(--ok); }
.review-calendar-day.is-end { background: var(--danger-tint); color: var(--danger); font-weight: 600; box-shadow: inset 0 0 0 1px var(--danger); }
.review-calendar-day.is-start.is-end { background: var(--ok-tint); color: var(--ok-dark); box-shadow: inset 0 0 0 1px var(--ok); }
.review-run-list { margin-bottom: 1rem; }
.review-run-dates { display: flex; flex-wrap: wrap; gap: 8px; }
.review-run-date { display: inline-flex; padding: 4px 10px; border-radius: 20px; font-size: 12px; background: var(--surface-page); color: var(--text-secondary); }
.review-pricing { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 280px); gap: 24px; margin-bottom: 1rem; }
.review-price-table-wrap { max-width: 560px; }
.review-price-table th:nth-child(2),
.review-price-table td:nth-child(2) { text-align: right; }
.review-price-table td:last-child { width: 140px; }
.review-price-adjustment { width: 100%; max-width: 120px; font-size: 13px; padding: 6px 8px; }
.review-price-cell { white-space: nowrap; }
.review-price-cell .price-original { text-decoration: line-through; color: var(--text-muted); margin-right: 8px; }
.review-price-cell .price-current { font-weight: 500; }
.review-total-amount .price-original { display: block; font-size: 16px; font-weight: 500; text-decoration: line-through; color: var(--brand-pink-dark); opacity: 0.55; margin-bottom: 4px; }
.review-total-amount .price-current { display: block; }
.review-total-card { padding: 18px; border-radius: var(--radius-sm); background: var(--brand-pink-tint); border: 0.5px solid #f0b8da; }
.review-total-label { font-size: 12px; color: var(--brand-pink-dark); margin-bottom: 6px; }
.review-total-amount { font-size: 28px; font-weight: 600; color: var(--brand-pink-dark); line-height: 1.2; }
.review-total-note { font-size: 12px; color: var(--text-muted); margin: 10px 0 0; line-height: 1.5; }
.confirm-dialog { border: 0.5px solid var(--border-strong); border-radius: var(--radius); padding: 24px; max-width: 440px; width: calc(100% - 48px); background: var(--surface-card); box-shadow: 0 20px 60px -20px rgba(29, 27, 23, .25); }
.confirm-dialog::backdrop { background: rgba(29, 27, 23, 0.45); }
.confirm-dialog h2 { font-size: 18px; font-weight: 500; margin: 0 0 12px; }
.confirm-dialog p { font-size: 14px; color: var(--text-secondary); margin: 0 0 12px; line-height: 1.6; }
.confirm-dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

@media (max-width: 760px) {
  .review-steps { flex-direction: column; }
  .review-step { border-right: none; border-bottom: 0.5px solid var(--border-soft); }
  .review-step:last-child { border-bottom: none; }
  .review-grid, .review-pricing, .review-schedule-summary { grid-template-columns: 1fr; }
}
.admin-ad-form .custom-category { display: none; margin-top: -8px; }
.admin-ad-form .custom-category.show { display: block; }
.admin-ad-form .photo-upload { position: relative; max-width: 420px; }
.admin-ad-form .photo-box {
  border: 1px dashed var(--border-strong);
  background: var(--surface-page);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  display: block;
}
.admin-ad-form .photo-box:hover { border-color: var(--brand-pink); color: var(--text-secondary); }
.admin-ad-form .photo-box-title { display: block; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.admin-ad-form .photo-box .hint { font-size: 12px; color: var(--text-muted); }
.admin-ad-form .photo-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0, 0, 0, 0); }
.admin-ad-form .photo-upload.is-dragover .photo-box { border-color: var(--brand-pink); background: var(--brand-pink-tint); }
.admin-ad-form .photo-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.admin-ad-form .photo-item-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  font-size: 13px;
}
.admin-ad-form .photo-item-label.is-invalid { border-color: #fecaca; background: var(--danger-tint); }
.admin-ad-form .photo-item-label.is-valid { border-color: var(--border-strong); }
.admin-ad-form .photo-item-label.is-pending { border-color: var(--border); background: var(--surface-page); }
.admin-ad-form .photo-item-main { display: flex; align-items: flex-start; gap: 12px; flex: 1; min-width: 0; }
.admin-ad-form .photo-item-body { flex: 1; min-width: 0; }
.admin-ad-form .photo-item-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.admin-ad-form .photo-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 0.5px solid var(--border); flex-shrink: 0; }
.admin-ad-form .photo-file-icon {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--surface-page);
  border: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}
.admin-ad-form .photo-name { display: block; color: var(--text-primary); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-ad-form .photo-meta { display: block; color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.admin-ad-form .photo-meta.is-ok { color: var(--ok-dark); }
.admin-ad-form .photo-error { display: block; color: var(--danger); font-size: 12px; margin-top: 4px; line-height: 1.45; }
.admin-ad-form .photo-item.is-new .photo-item-label { border-style: dashed; }
.admin-ad-form .photo-item.is-new.is-valid .photo-item-label { border-style: solid; }
.admin-ad-form .priceline { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; color: var(--text-secondary); border-bottom: 0.5px dotted var(--border-soft); }
.admin-ad-form .priceline.total { font-weight: 600; color: var(--text-primary); border-top: 0.5px solid var(--border); border-bottom: none; margin-top: 8px; padding-top: 12px; }

/* ---- Settings sections ---- */
.section { max-width: 640px; }
.section + .section { margin-top: 1.5rem; }
.section-head { padding: 16px 20px; border-bottom: 0.5px solid var(--border-soft); }
.section-head h2 { font-size: 15px; }
.section-body { padding: 18px 20px; }
.form-row { display: grid; grid-template-columns: 180px 1fr; align-items: center; gap: 14px; margin-bottom: 14px; }
.form-row-start { align-items: start; }
.form-row-start > label { padding-top: 8px; }
.form-row:last-of-type { margin-bottom: 18px; }
.form-row input:not([type=checkbox]):not([type=radio]), .form-row select, .form-row textarea { width: 100%; max-width: 320px; }
.form-option-group { display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.form-option { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.4; color: var(--text-primary); cursor: pointer; }
.form-option input[type=checkbox], .form-option input[type=radio] { width: 16px; height: 16px; min-height: 16px; margin: 2px 0 0; padding: 0; accent-color: var(--brand-pink); flex-shrink: 0; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ok-dark); margin-top: 4px; }
.status-line .d { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- Form groups for create/edit pages ---- */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea { width: 100%; }
.form-actions { display: flex; gap: 10px; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 0.5px solid var(--border-soft); }

/* ---- Assignments detail ---- */
.assign-card { max-width: 560px; padding: 20px 22px; }
.assign-card .company-name { font-size: 17px; font-weight: 500; }
.assign-card .company-meta { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.assign-card .count { font-size: 13px; color: var(--text-muted); margin-top: 10px; }
.assign-list { margin: 14px 0; border-top: 0.5px solid var(--border-soft); }
.assign-list .label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; padding: 12px 0 8px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 0.5px solid var(--border-soft); font-size: 13px; }
.user-row .u-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-pink-tint); color: var(--brand-pink-dark); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 500; }
.assign-form { display: flex; gap: 10px; margin-top: 16px; }
.assign-form select { min-width: 240px; }

/* ---- Pricing matrix ---- */
.matrix-wrap { background: var(--surface-card); border: 0.5px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
table.matrix { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
table.matrix th { font-size: 13px; font-weight: 500; color: var(--text-secondary); padding: 12px 10px; text-align: center; border-bottom: 0.5px solid var(--border); background: var(--surface-page); position: sticky; top: 0; }
table.matrix th.corner { text-align: left; }
table.matrix td { padding: 6px 10px; border-bottom: 0.5px solid var(--border-soft); }
table.matrix .size-cell { font-weight: 500; color: var(--text-primary); white-space: nowrap; border-right: 0.5px solid var(--border-soft); vertical-align: middle; }
table.matrix .color-cell { color: var(--text-secondary); white-space: nowrap; padding-right: 14px; }
table.matrix .color-cell.is-color { color: var(--brand-pink); }
table.matrix tr.group-end td { border-bottom: 0.5px solid var(--border); }
.money { display: flex; align-items: center; gap: 4px; }
.money .sym { color: var(--text-muted); font-size: 13px; }
.money input { width: 100%; min-width: 84px; text-align: right; height: 32px; padding: 6px 9px; }
.matrix-foot { display: flex; justify-content: flex-end; margin-top: 1rem; }

/* ---- Dashboard bits ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 1.75rem; }
.stat { background: var(--surface-card); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { font-size: 13px; color: var(--text-muted); }
.stat .value { font-size: 28px; font-weight: 500; margin-top: 4px; }
.stat .value.alert { color: var(--danger); }
.stat .trend { font-size: 12px; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.stat .trend svg { width: 13px; height: 13px; }
.trend.up { color: var(--ok); } .trend.warn { color: var(--warn); } .trend.danger { color: var(--danger); }
.section-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); margin: 0 0 10px; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 1.75rem; }
.qa { display: block; border-radius: var(--radius); padding: 16px 18px; cursor: pointer; border: 0.5px solid var(--border); background: var(--surface-card); transition: border-color .12s, transform .08s; }
.qa:hover { border-color: var(--brand-pink); } .qa:active { transform: scale(.99); }
.qa .t { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; color: var(--brand-pink-dark); }
.qa .d { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.qa svg { width: 17px; height: 17px; }
.qa.primary { background: var(--brand-pink); border-color: var(--brand-pink); }
.qa.primary .t { color: #fff; } .qa.primary .d { color: #F4C0D1; }
.panel { background: var(--surface-card); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 4px 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 0.5px solid var(--border-soft); }
.panel-head .title { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.panel-head .link { font-size: 13px; color: var(--brand-pink-dark); }
.activity { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 0.5px solid var(--border-soft); font-size: 13px; }
.activity:last-child { border-bottom: none; }
.activity svg { width: 16px; height: 16px; flex-shrink: 0; }
.activity .desc { flex: 1; } .activity .desc strong { font-weight: 500; }
.activity .time { color: var(--text-faint); font-size: 12px; white-space: nowrap; }
.ic-ok { color: var(--ok); } .ic-info { color: #378ADD; } .ic-warn { color: var(--warn); }

/* ---- Login Page ---- */
.stage { display: flex; min-height: 100vh; }

/* Login masthead (shared) */
.mast { line-height: 1; text-align: center; }
.mast .the { font-family: var(--font-serif); font-style: italic; font-size: 15px; opacity: .8; display: inline-block; margin-bottom: -4px; }
.mast .mont { font-family: var(--font-serif); font-weight: 600; font-size: 40px; letter-spacing: -0.01em; display: block; }
.mast .mont .m { color: var(--brand-yellow); }
.mast .journal { font-family: var(--font-serif); font-size: 15px; letter-spacing: 0.42em; text-transform: uppercase; display: block; margin-top: 4px; padding-left: 0.42em; }

/* Left editorial panel */
.brandside { flex: 0 0 46%; background: var(--text-primary); color: #efe9dc; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px 56px; }
.brandside::before { content: ""; position: absolute; right: -80px; bottom: -80px; width: 340px; height: 340px; border-radius: 50%; border: 2px dashed rgba(240,168,30,.18); }
.brandside::after { content: ""; position: absolute; right: 10px; bottom: 10px; width: 160px; height: 160px; border-radius: 50%; border: 1px solid rgba(240,168,30,.12); }
.brandside .top .mast { text-align: left; }
.brandside .top .mast .mont { font-size: 34px; }
.brandside .top .mast .journal { padding-left: 0; }
.brandside .top .kicker { display: inline-flex; align-items: center; gap: 8px; margin-top: 22px; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: #EBC46A; }
.brandside .top .kicker .rule { width: 26px; height: 1px; background: rgba(235,196,106,.5); }

.brandside .middle { position: relative; z-index: 1; }
.brandside .middle h1 { font-family: var(--font-serif); font-weight: 500; font-size: clamp(2rem, 3.4vw, 2.9rem); line-height: 1.08; letter-spacing: -0.01em; color: #fff; margin: 0; }
.brandside .middle h1 em { font-style: italic; color: #EBC46A; }
.brandside .middle p { color: #b9b2a3; font-size: 15px; line-height: 1.6; margin: 18px 0 0; max-width: 30em; }
.brandside .caps { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.brandside .caps li { display: flex; align-items: center; gap: 11px; font-size: 14px; color: #d9d3c6; }
.brandside .caps svg { width: 16px; height: 16px; color: var(--brand-pink); flex-shrink: 0; }

.brandside .foot { position: relative; z-index: 1; font-size: 12px; color: #7d7869; letter-spacing: 0.02em; }

/* Right form panel */
.formside { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; background: var(--surface-page); }
.form-inner { width: 100%; max-width: 380px; }
.m-mobile { display: none; margin-bottom: 32px; }

.eyebrow { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--brand-pink-dark); }
.eyebrow svg { width: 14px; height: 14px; }
.formside h2 { font-family: var(--font-serif); font-weight: 500; font-size: 34px; letter-spacing: -0.015em; margin: 14px 0 6px; }
.formside .sub { color: var(--text-secondary); font-size: 15px; margin: 0 0 30px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.input-wrap { position: relative; }
.field input { width: 100%; font: inherit; font-size: 15px; color: var(--text-primary); background: #fff; border: 1px solid var(--border-strong); border-radius: 9px; padding: 13px 14px; outline: none; transition: border-color .12s, box-shadow .12s; }
.field input:focus { border-color: var(--brand-pink); box-shadow: 0 0 0 3px var(--brand-pink-tint); }
.field input::placeholder { color: var(--text-muted); }
.field input.pw { padding-right: 44px; }
.toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 8px; border-radius: 6px; display: flex; }
.toggle:hover { color: var(--text-secondary); }
.toggle svg { width: 18px; height: 18px; }

.row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 22px; }
.remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.remember input { width: 16px; height: 16px; accent-color: var(--brand-pink); }
.forgot { font-size: 13px; font-weight: 600; color: var(--brand-pink-dark); }
.forgot:hover { text-decoration: underline; }

.signin { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-family: var(--font-sans); font-size: 15px; font-weight: 600; color: #fff; background: var(--brand-pink); border: none; border-radius: 9px; padding: 14px; cursor: pointer; transition: background .15s, transform .08s; }
.signin:hover { background: var(--brand-pink-dark); }
.signin:active { transform: translateY(1px); }
.signin svg { width: 17px; height: 17px; }

.below { text-align: center; margin-top: 26px; }
.below .back { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--text-secondary); }
.below .back:hover { color: var(--brand-pink-dark); }
.below .back svg { width: 16px; height: 16px; }
.below .help { font-size: 12.5px; color: var(--text-muted); margin-top: 18px; }

.login-error { background: var(--danger-tint); color: var(--danger); border: 1px solid var(--danger); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 20px; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.login-error svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ---- Responsive ---- */
@media (max-width: 880px) {
  .brandside { display: none; }
  .m-mobile { display: block; }
  .m-mobile .mast .mont { font-size: 34px; }
  .formside { padding: 40px 24px; }
}
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .detail-grid { grid-template-columns: 1fr; }
  .ad-view-layout { grid-template-columns: 1fr; }
  .ad-view-proof-layout { flex-direction: column; }
  .ad-view-proof-media { width: 100%; max-width: 440px; }
  .ad-view-proof-image { width: 100%; height: auto; max-height: 360px; }
  .sidebar { width: 100%; display: flex; align-items: center; gap: 4px; overflow-x: auto; padding: .75rem 1rem; border-right: none; border-bottom: 0.5px solid var(--border); }
  .wordmark { margin: 0 1rem 0 0; } .wordmark .crm { display: inline; margin-left: 4px; }
  .nav { flex-direction: row; }
  .nav a span { display: none; }
  .main { padding: 1.25rem; }
  .form-row { grid-template-columns: 1fr; gap: 5px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-inline input { width: 100%; }
}
