:root {
  --navy-950: #230700;
  --navy-900: #280900;
  --navy-800: #300b01;
  --ink: #152332;
  --muted: #6f7b87;
  --line: #dfe5e8;
  --surface: #ffffff;
  --canvas: #f3f6f7;
  --teal: #f15b2b;
  --teal-dark: #f15b2b;
  --teal-soft: #fcded6;
  --orange: #e97731;
  --orange-soft: #fcded6;
  --green: #f15b2b;
  --green-soft: #fcded6;
  --red: #c84343;
  --red-soft: #fae9e9;
  --yellow: #9b6a00;
  --yellow-soft: #fff6d9;
  --shadow: 0 10px 30px rgba(20, 42, 61, .07);
  --radius: 16px;
  --sidebar: 258px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); display: flex; flex-direction: column; padding: 24px 18px; color: #dbe8ef; background: linear-gradient(180deg, var(--navy-950), var(--navy-900)); z-index: 30; }
.brand { display: flex; justify-content: center; align-items: center; padding: 0 8px 28px; color: #fff; }
.brand-logo { display: block; width: min(188px, 100%); height: auto; }
.brand-mark { display: inline-grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; border-radius: 13px; color: #fff; background: linear-gradient(135deg, var(--teal), #fcded6); font-weight: 800; letter-spacing: -.04em; box-shadow: 0 7px 18px rgba(241, 91, 43, .24); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: .01em; }
.brand small { margin-top: 1px; color: #93a8b6; font-size: 10px; }
.main-nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #fff; font-weight: 650; transition: .16s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: rgba(89, 89, 89, .62); box-shadow: inset 3px 0 var(--teal); }
.nav-icon { width: 22px; color: #f15b2b; text-align: center; font-size: 17px; }
.sidebar-footer { margin-top: auto; padding: 18px 8px 0; border-top: 1px solid rgba(255,255,255,.09); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip strong, .user-chip small { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip strong { color: #fff; font-size: 13px; }
.user-chip small { color: #ffdcd2; font-size: 10px; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; background: var(--teal-soft); color: var(--teal-dark); font-weight: 800; }
.sidebar-footer .avatar { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-footer .link-button { margin-top: 11px; color: #ffdcd2; }

.main-content { min-height: 100vh; margin-left: var(--sidebar); padding: 38px clamp(24px, 4vw, 58px) 60px; }
.mobile-header { display: none; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 27px; }
.page-heading h1, .company-hero h1 { margin: 1px 0 4px; font-size: clamp(27px, 3vw, 38px); line-height: 1.15; letter-spacing: -.035em; }
.page-heading p { margin: 0; color: var(--muted); }
.eyebrow { margin: 0 0 4px !important; color: var(--teal-dark) !important; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
h3 { letter-spacing: -.015em; }
.muted { color: var(--muted); }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 15px; border: 1px solid transparent; border-radius: 9px; font-weight: 750; line-height: 1; transition: .16s ease; }
.button:hover { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(20,42,61,.1); }
.button.primary { color: #fff; background: var(--teal); }
.button.primary:hover { background: var(--teal-dark); }
.button.success { color: #fff; background: var(--green); }
.button.secondary { color: var(--ink); background: #fff; border-color: var(--line); }
.button.ghost { color: var(--muted); background: transparent; }
.button.danger-outline { color: var(--red); background: #fff; border-color: #e8bcbc; }
.button.danger-outline:hover { background: var(--red-soft); }
.button.small { min-height: 34px; padding: 7px 11px; font-size: 13px; }
.button.tiny { min-height: 29px; padding: 6px 9px; font-size: 11px; }
.button.wide { width: 100%; }
.button-row, .form-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.link-button { padding: 0; border: 0; color: var(--teal-dark); background: transparent; font-weight: 700; font-size: 12px; }
.icon-button { border: 0; background: transparent; font-size: 21px; }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin-bottom: 20px; }
.metric-card { position: relative; min-height: 142px; padding: 21px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.metric-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #c5d0d5; }
.metric-card.accent::before { background: var(--teal); }
.metric-card.danger::before { background: var(--red); }
.metric-card > span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-card > strong { display: block; margin: 9px 0 8px; font-size: 30px; line-height: 1; letter-spacing: -.04em; }
.metric-card small, .metric-card a { color: var(--muted); font-size: 11px; }
.metric-card a { color: var(--teal-dark); font-weight: 750; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 20px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.dashboard-grid > .panel, .detail-panel, .form-panel, .settings-grid > .panel { padding: 22px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.panel-header a { color: var(--teal-dark); font-size: 12px; font-weight: 750; }
.compact-list { display: grid; }
.compact-row { display: flex; align-items: center; gap: 13px; padding: 13px 0; border-top: 1px solid #edf0f2; }
.compact-row:first-child { border-top: 0; }
.date-tile { display: grid; place-items: center; width: 43px; height: 48px; flex: 0 0 auto; border-radius: 9px; color: var(--teal-dark); background: var(--teal-soft); }
.date-tile.overdue { color: var(--red); background: var(--red-soft); }
.date-tile small { font-size: 9px; font-weight: 800; text-transform: uppercase; }
.date-tile strong { font-size: 17px; line-height: 1; }
.compact-main { min-width: 0; flex: 1; }
.compact-main strong, .compact-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-main small { color: var(--muted); font-size: 11px; }

.flash { max-width: 920px; margin: 0 0 20px; padding: 12px 15px; border-radius: 10px; font-weight: 650; }
.flash-success { color: #8a3016; background: var(--green-soft); border: 1px solid #f3b39e; }
.flash-error { color: #982f2f; background: var(--red-soft); border: 1px solid #edc3c3; }

.filter-bar { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; }
.filter-bar select, .filter-bar input { min-height: 40px; }
.search-field { display: flex; align-items: center; min-width: min(380px, 42vw); padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; }
.view-switcher { display: flex; margin-left: auto; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.view-switcher a { padding: 5px 10px; border-radius: 6px; color: var(--muted); font-size: 12px; font-weight: 750; }
.view-switcher a.active { color: var(--ink); background: var(--canvas); }
.view-preferences { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin: -7px 0 16px; color: var(--muted); font-size: 10px; }
.view-preferences form { display: inline-flex; }
.view-preferences span { padding-left: 12px; border-left: 1px solid var(--line); font-weight: 700; }

.table-panel { overflow: hidden; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 13px 17px; color: var(--muted); background: #f8fafb; border-bottom: 1px solid var(--line); font-size: 10px; letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.sort-link { display: inline-flex; align-items: center; gap: 6px; color: inherit; }
.sort-link span:last-child { color: #a9b2b8; font-size: 11px; }
.sort-link.active { color: var(--ink); }
.sort-link.active span:last-child { color: var(--teal-dark); }
.data-table td { padding: 15px 17px; border-bottom: 1px solid #edf0f2; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfcfc; }
.company-link { display: flex; align-items: center; gap: 11px; min-width: 230px; }
.company-link strong, .company-link small { display: block; }
.company-link small, .cell-subtext { color: var(--muted); font-size: 10px; }
.company-avatar { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 11px; color: var(--navy-800); background: #e6ecef; font-size: 12px; font-weight: 850; }
.company-avatar.large { width: 62px; height: 62px; border-radius: 17px; font-size: 18px; }
.cell-subtext { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.row-action { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 8px; color: var(--teal-dark); background: var(--teal-soft); font-weight: 800; }
.text-link { color: var(--teal-dark); font-weight: 700; }
.client-charge-link { display: block; }
.text-danger { color: var(--red); font-weight: 700; }
.attention-row { background: rgba(239, 158, 48, .08); }

.badge-row { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; width: fit-content; padding: 4px 8px; border-radius: 99px; color: #50606d; background: #edf1f3; font-size: 9px; font-weight: 850; letter-spacing: .035em; text-transform: uppercase; white-space: nowrap; }
.badge-high, .badge-overdue, .badge-lost { color: var(--red); background: var(--red-soft); }
.badge-interested, .badge-active, .badge-active_client, .badge-won, .badge-completed { color: var(--green); background: var(--green-soft); }
.badge-proposal_sent, .badge-follow_up, .badge-medium, .badge-paused, .badge-paused_client { color: var(--yellow); background: var(--yellow-soft); }
.badge-not_contacted { color: #5e6871; background: #e8ebed; }
.badge-contacted, .badge-prospect { color: var(--teal-dark); background: var(--teal-soft); }
.badge-do_not_contact, .badge-former_client, .badge-cancelled, .badge-declined { color: #5e6871; background: #e8ebed; }
.badge-hot { color: var(--red); background: var(--red-soft); }
.badge-warm { color: var(--yellow); background: var(--yellow-soft); }
.badge-cold { color: #33677a; background: #e4f1f5; }
.badge-inactive { color: #5e6871; background: #e8ebed; }

.pipeline-board { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.pipeline-column { min-height: 520px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #eaf0f2; }
.pipeline-column > header { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 12px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.pipeline-column > header strong { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #d8e1e5; }
.pipeline-stack { display: grid; gap: 9px; }
.pipeline-card { padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 4px 12px rgba(20,42,61,.05); }
.pipeline-card:hover { border-color: #abc9c7; transform: translateY(-1px); }
.pipeline-card h3 { margin: 10px 0 2px; font-size: 14px; }
.pipeline-card p, .pipeline-card small { display: block; margin: 0; color: var(--muted); font-size: 10px; }
.pipeline-empty { padding: 24px 8px; color: #99a4ad; text-align: center; font-size: 11px; }

.company-hero { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 24px; }
.company-title { display: flex; align-items: center; gap: 16px; }
.company-title h1 { font-size: 31px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.company-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: 18px; align-items: start; }
.company-main { display: grid; gap: 18px; }
.company-main > .panel { padding: 22px; }
.company-side { display: grid; gap: 15px; }
.contact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.contact-card { display: flex; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfc; }
.contact-card-main { min-width: 0; flex: 1; }
.contact-card strong, .contact-card small, .contact-card a { display: block; }
.contact-card small, .contact-card a { color: var(--muted); font-size: 11px; }
.contact-card a:hover { color: var(--teal-dark); }
.contact-card a { overflow-wrap: anywhere; }
.contact-edit-action { align-self: flex-start; }
.contact-field-label { display: inline-block !important; min-width: 53px; margin-right: 5px; color: #8a969f; font-size: 8px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.primary-label { color: var(--teal-dark); font-size: 8px; letter-spacing: .04em; text-transform: uppercase; }
.card-list { display: grid; }
.engagement-row, .charge-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 13px 0; border-top: 1px solid #edf0f2; }
.engagement-row:first-child, .charge-row:first-of-type { border-top: 0; }
.engagement-row small, .charge-row small { display: block; color: var(--muted); font-size: 10px; }
.engagement-value { display: flex; align-items: center; gap: 10px; text-align: right; }
.engagement-main { min-width: 0; }
.engagement-value > strong { font-size: 17px; }
.engagement-value > strong small, .charge-row > strong small { display: inline; }
.timeline { display: grid; }
.timeline-item { position: relative; display: flex; gap: 13px; padding: 0 0 20px; }
.timeline-item::before { content: ""; position: absolute; top: 10px; bottom: -2px; left: 4px; width: 1px; background: var(--line); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { position: relative; z-index: 1; width: 9px; height: 9px; margin-top: 7px; flex: 0 0 auto; border: 2px solid #fff; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 2px #a9d3d1; }
.timeline-item strong, .timeline-item small { display: block; }
.timeline-item p { margin: 3px 0; color: #485765; font-size: 12px; }
.timeline-item small { color: var(--muted); font-size: 10px; }
.timeline.compact .timeline-item { padding-bottom: 15px; }
.detail-list { margin: 0; }
.detail-list > div { display: grid; grid-template-columns: 88px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid #edf0f2; }
.detail-list > div:first-child { border-top: 0; }
.detail-list dt { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.detail-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-size: 12px; }
.note-block { margin-top: 15px; padding: 13px; border-radius: 10px; background: #f7f9fa; }
.note-block strong { font-size: 11px; }
.note-block p { margin: 5px 0 0; color: #52606b; font-size: 12px; }
.side-followup { padding: 11px 0; border-top: 1px solid #edf0f2; }
.side-followup:first-of-type { border-top: 0; }
.side-followup.overdue { margin: 0 -10px; padding: 10px; border: 0; border-radius: 8px; background: var(--red-soft); }
.side-followup strong, .side-followup small { display: block; }
.side-followup small { color: var(--muted); font-size: 10px; }

.stack-form { display: grid; gap: 14px; }
.form-grid { display: grid; gap: 13px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack-form label { display: grid; gap: 5px; color: #394956; font-size: 12px; font-weight: 750; }
input, select, textarea { width: 100%; border: 1px solid #cfd8dd; border-radius: 8px; color: var(--ink); background: #fff; outline: none; }
input, select { min-height: 42px; padding: 9px 11px; }
textarea { padding: 10px 11px; resize: vertical; }
.stack-form input, .stack-form select, .stack-form textarea { font-size: 14px; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(241,91,43,.13); }
.stack-form h3 { margin: 8px 0 -2px; font-size: 15px; }
.checkbox-row { display: flex !important; align-items: center; gap: 8px !important; }
.checkbox-row input { width: 17px; min-height: 17px; }
.form-panel { max-width: 950px; }
.field-span-2 { grid-column: 1 / -1; }
.stack-form label > small, .form-help { color: var(--muted); font-size: 10px; font-weight: 500; }
.form-help { margin: -2px 0 0 !important; }
.custom-checkbox { display: flex; align-items: center; gap: 8px; min-height: 42px; }
.custom-checkbox input { width: 18px; min-height: 18px; }

.modal { width: min(560px, calc(100vw - 28px)); max-height: calc(100vh - 34px); padding: 26px; border: 0; border-radius: 16px; color: var(--ink); box-shadow: 0 24px 90px rgba(5,18,29,.28); overflow-y: auto; }
.wide-modal { width: min(880px, calc(100vw - 28px)); }
.modal::backdrop { background: rgba(7,21,34,.67); backdrop-filter: blur(3px); }
.modal h2 { margin: 0 0 5px; font-size: 23px; }
.modal > p { margin-top: 0; color: var(--muted); }
.modal-close { position: sticky; z-index: 2; top: -18px; display: flex; justify-content: flex-end; height: 0; }
.modal-close button { display: grid; place-items: center; width: 33px; height: 33px; border: 1px solid var(--line); border-radius: 50%; background: #fff; font-size: 20px; }
.company-edit-form { margin-top: 22px; }

.tabs { display: flex; gap: 6px; margin-bottom: 15px; }
.tabs a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 12px; font-weight: 750; }
.tabs a.active { color: var(--teal-dark); background: var(--teal-soft); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.settings-grid p { color: var(--muted); }
.settings-wide { grid-column: 1 / -1; }
.settings-table td { font-size: 12px; }
.company-picker { margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; }
.company-picker legend { padding: 0 6px; color: #394956; font-size: 12px; font-weight: 750; }
.company-picker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 14px; max-height: 230px; overflow-y: auto; }
.company-picker .checkbox-row { font-size: 12px; font-weight: 600; }
.row-buttons { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; }
.row-buttons form { display: inline-flex; }
.mini-action { width: auto; min-height: 27px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; font-size: 10px; font-weight: 750; white-space: nowrap; }
.mini-action:hover { color: var(--teal-dark); border-color: #f3ae96; background: var(--teal-soft); }
.payment-action { color: #fff; border-color: var(--teal); background: var(--teal); }
.payment-action:hover { color: #fff; border-color: var(--teal-dark); background: var(--teal-dark); }
.outstanding-label { color: var(--red) !important; font-weight: 750; }
.charge-actions { display: flex; align-items: center; gap: 8px; text-align: right; }
.charge-actions > strong { font-size: 14px; }
.danger-zone { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.button.danger { color: #fff; background: var(--red); }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { display: inline-flex; padding: 3px 7px; border-radius: 99px; color: #6e2a16; background: var(--teal-soft); font-size: 10px; font-weight: 750; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.check-list { display: grid; gap: 8px; padding: 0; list-style: none; }
.check-list li::before { content: "✓"; margin-right: 8px; color: var(--green); font-weight: 900; }
.empty-state { padding: 28px 14px; color: var(--muted); text-align: center; }
.empty-state strong { color: var(--ink); }
.empty-state p { margin: 3px 0 0; }

.login-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at top right, rgba(241,91,43,.22), transparent 33%), linear-gradient(145deg, var(--navy-950), var(--navy-800)); }
.login-card { width: min(430px, 100%); padding: 36px; border: 1px solid rgba(255,255,255,.2); border-radius: 20px; background: rgba(255,255,255,.97); box-shadow: 0 28px 80px rgba(0,0,0,.28); }
.login-brand { display: flex; justify-content: center; margin: -8px -8px 22px; padding: 18px; border-radius: 14px; background: var(--navy-900); }
.login-brand .brand-logo { width: min(285px, 88%); height: auto; }
.login-card h1 { margin: 2px 0 4px; font-size: 32px; letter-spacing: -.04em; }
.login-card > .muted { margin: 0 0 22px; }
.login-security { margin: 18px 0 0; color: var(--muted); font-size: 10px; text-align: center; }
.remember-row { color: var(--muted) !important; font-size: 12px !important; font-weight: 600 !important; }
.contacts-table td { min-width: 105px; font-size: 12px; }
.contacts-table td:first-child, .contacts-table td:nth-child(2), .contacts-table td:nth-child(5) { min-width: 170px; }
.bulk-toolbar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid #f3ae96; color: var(--ink); background: var(--teal-soft); }
.bulk-toolbar[hidden] { display: none; }
.select-column { width: 42px; min-width: 42px !important; padding-right: 0 !important; text-align: center; }
.select-column input { width: 16px; height: 16px; accent-color: var(--teal); }
.bulk-field { display: grid; grid-template-columns: minmax(150px, .45fr) 1fr; align-items: center; gap: 14px; }
.bulk-field .checkbox-row { margin: 0; }
.optional-label { color: var(--muted); font-size: 10px; font-weight: 650; }
.reminder-empty, .settings-note { margin: 0; padding: 12px; border-radius: 9px; color: var(--muted); background: var(--canvas); font-size: 12px; }
.reminder-picker { max-height: 150px; }
.followup-actions { display: flex; align-items: center; gap: 12px; margin-top: 5px; }
.followup-actions form { display: inline-flex; }
.record-history-panel { border-color: #dce4e7; background: #fafcfc; }
.record-history-item .timeline-dot { background: var(--muted); }
.followup-section-header { padding: 18px 18px 12px; }
.followup-section-header p { margin: 3px 0 0; }
.someday-panel { margin-top: 20px; }
.confirmation-actions { display: flex; justify-content: flex-end; gap: 10px; }
.confirmation-actions form { margin: 0; }
.settings-reminder-form { max-width: 760px; }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .company-layout { grid-template-columns: 1fr; }
  .company-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 20px 0 60px rgba(0,0,0,.25); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 0 17px 44px; }
  .mobile-header { display: flex; align-items: center; gap: 12px; margin: 0 -17px 24px; padding: 14px 17px; border-bottom: 1px solid var(--line); background: #fff; }
  .dashboard-grid, .settings-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-wrap: wrap; }
  .search-field { width: 100%; min-width: 100%; }
  .view-switcher { margin-left: 0; }
  .company-side { grid-template-columns: 1fr; }
}

@media (max-width: 590px) {
  .page-heading, .company-hero { align-items: stretch; flex-direction: column; }
  .page-heading .button, .hero-actions .button { flex: 1; }
  .metric-grid, .contact-grid, .form-grid.two { grid-template-columns: 1fr; }
  .metric-card { min-height: 125px; }
  .company-title { align-items: flex-start; }
  .company-avatar.large { width: 50px; height: 50px; }
  .hero-actions { width: 100%; }
  .data-table th, .data-table td { padding: 12px; }
  .modal { padding: 22px 17px; }
  .login-card { padding: 28px 23px; }
  .engagement-row { align-items: flex-start; flex-direction: column; }
  .engagement-value { width: 100%; flex-wrap: wrap; justify-content: flex-start; text-align: left; }
  .engagement-value .row-buttons { width: 100%; justify-content: flex-start; }
  .company-picker-grid { grid-template-columns: 1fr; }
  .bulk-field { grid-template-columns: 1fr; gap: 6px; }
  .confirmation-actions { align-items: stretch; flex-direction: column-reverse; }
  .confirmation-actions .button { width: 100%; }
}

/* v1.4 recovery and reminder controls */
.contact-actions, .followup-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.contact-card .contact-actions { flex-basis: 100%; }
.contact-card { flex-wrap: wrap; }
.danger-action { color: var(--danger, #b42318); }
.confirmation-cancel { margin-top: .75rem; }
.reminder-indicator { margin: .45rem 0; font-size: .8rem; max-width: 23rem; }
.reminder-indicator details { margin-top: .35rem; overflow-wrap: anywhere; }
.reminder-indicator summary { cursor: pointer; color: var(--muted, #667085); }
.reminder-indicator details span, .reminder-indicator details small { display: block; margin-top: .3rem; }
.badge-failed { color: #9f2525; background: #ffeded; }
.badge-sent { color: #17613c; background: #e7f6ed; }
.badge-scheduled { color: #27569b; background: #eaf1ff; }

/* Keep overview actions together; legacy phone fields remain available elsewhere. */
.contacts-table .contact-actions-heading, .contacts-table .contact-actions-cell { text-align: right; }
.contacts-table .contact-actions-cell { min-width: 180px; }
.contacts-table .contact-actions { justify-content: flex-end; }
.contacts-table .contact-actions .mini-action { white-space: nowrap; }
@media (max-width: 640px) {
    .contacts-table .contact-actions { flex-direction: column; align-items: flex-end; }
    .contacts-table .contact-actions .mini-action { min-height: 44px; }
}

/* Monthly agreements and flexible account values. */
.app-version { display:block; color:var(--muted); margin-bottom:12px; font-size:11px; }
.ongoing-services-panel { border-top:3px solid var(--orange, #f77727); }
.ongoing-service-row { align-items:flex-start; padding:18px 0; }
.engagement-main, .company-values dd { min-width:0; overflow-wrap:anywhere; }
.service-company { display:block; margin-bottom:6px; }
.service-deliverables { margin-top:12px; }
.service-deliverables > strong { font-size:12px; }
.service-deliverables p { margin:6px 0 0; white-space:normal; line-height:1.6; }
.retainer-summary, .retainer-list { padding:22px; margin-bottom:22px; }
.retainer-summary > strong { display:block; font-size:30px; margin-top:8px; }
.retainer-summary small { font-size:14px; font-weight:400; margin-left:6px; }
[data-engagement-form] [hidden] { display:none; }
@media (max-width:600px) {
  .ongoing-service-row { flex-direction:column; align-items:stretch; gap:14px; }
  .ongoing-service-row .engagement-value { align-items:flex-start; text-align:left; }
  .ongoing-service-row .row-buttons { justify-content:flex-start; flex-wrap:wrap; }
}

/* Move a monthly price as one unit when the row runs out of room. */
.monthly-price { white-space:nowrap; flex-shrink:0; }
.ongoing-service-row { flex-wrap:wrap; }
.ongoing-service-row .engagement-value { flex-wrap:wrap; }
/* Keep Settings cards within the phone viewport; wide tables scroll inside their wrapper. */
.settings-grid > .panel { min-width:0; }


/* Active Retainers page compnay title font */

.engagement-main .service-company {
  font-size: 23px;
}
