.agency-content { padding: 24px clamp(18px, 3vw, 34px) 44px; }
.sidebar.is-open { transform: translateX(0); }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.agency-name { color: #475569; font-size: .82rem; font-weight: 700; }
.agency-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 28px; margin-bottom: 22px; border: 1px solid #dbeafe; border-radius: 18px; background: linear-gradient(135deg, #eff6ff, #ffffff 62%); box-shadow: var(--shadow-sm); }
.agency-hero h1, .section-heading h1 { margin: 5px 0 7px; color: #0f172a; font-size: clamp(1.45rem, 3vw, 2.2rem); line-height: 1.15; }
.agency-hero p, .section-heading p, .panel-heading p { margin: 0; color: #64748b; font-size: .88rem; line-height: 1.6; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.overview-top-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric-card { min-height: 128px; padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm); }
.metric-card span { display: block; color: #64748b; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.metric-card strong { display: block; margin-top: 9px; color: #0f172a; font-size: 1.85rem; line-height: 1; }
.metric-card small { display: block; margin-top: 9px; color: #94a3b8; font-size: .74rem; }
.agency-grid { display: grid; gap: 18px; margin-bottom: 18px; }
.agency-grid.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { margin-bottom: 18px; padding: 22px; border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm); }
.panel-heading, .section-heading, .modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading { margin-bottom: 18px; }
.panel h2 { margin: 0 0 4px; color: #0f172a; font-size: 1.02rem; }
.panel-badge { flex: 0 0 auto; padding: 5px 10px; border-radius: 999px; background: #eff6ff; color: #2563eb; font-size: .72rem; font-weight: 700; }
.panel-badge.success { background: #ecfdf5; color: #047857; }
.text-button { border: 0; background: transparent; color: #2563eb; font-size: .78rem; font-weight: 700; cursor: pointer; }
.text-button:hover { color: #1d4ed8; }
.performance-panel .panel-heading { align-items: center; }
.performance-filter { display: inline-flex; align-items: center; gap: 8px; color: #64748b; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.performance-filter select { min-height: 38px; padding: 0 30px 0 11px; border: 1px solid #dbe2ea; border-radius: 8px; background: #fff; color: #334155; font-size: .78rem; font-weight: 600; }
.performance-layout { display: grid; grid-template-columns: minmax(230px, .72fr) minmax(0, 1.8fr); gap: 18px; align-items: stretch; }
.performance-metric-card { min-height: 150px; }
.performance-metric-title { margin-bottom: 22px; color: #64748b; font-size: .75rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.performance-metric-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.health-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.performance-metric-values > div + div { padding-left: 18px; border-left: 1px solid #e2e8f0; }
.performance-metric-values span { display: block; color: #64748b; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.performance-metric-values strong { display: block; margin-top: 9px; color: #0f172a; font-size: 1.85rem; line-height: 1; }
.performance-metric-values small { display: block; margin-top: 9px; color: #94a3b8; font-size: .72rem; }
.performance-chart-wrap { min-width: 0; padding: 12px 16px 8px; border: 1px solid #edf2f7; border-radius: 12px; background: #fcfdff; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; color: #64748b; font-size: .72rem; font-weight: 700; }
.chart-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.chart-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.cards-dot { background: #14b8a6; }
.interactions-dot { background: #f97316; }
.performance-chart { display: block; width: 100%; min-height: 250px; margin-top: 4px; overflow: visible; }
.chart-grid-line { stroke: #e8eef5; stroke-width: 1; }
.chart-axis-line { stroke: #cbd5e1; stroke-width: 1; }
.chart-axis-label, .chart-brand-label { fill: #94a3b8; font-size: 11px; }
.chart-brand-label { fill: #475569; font-size: 11px; font-weight: 600; }
.chart-bar-track { fill: #eef2f7; }
.chart-bar-fill { fill: #2563eb; }
.cards-bar-fill { fill: #14b8a6; }
.interactions-bar-fill { fill: #f97316; }
.chart-value-label { fill: #475569; font-size: 11px; font-weight: 700; }
.chart-caption { fill: #94a3b8; font-size: 11px; font-weight: 600; }
.chart-empty { fill: #94a3b8; font-size: 13px; }
.performance-attention { margin-top: 18px; padding-top: 16px; border-top: 1px solid #edf2f7; }
.performance-attention-title { margin-bottom: 9px; color: #64748b; font-size: .75rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.performance-attention-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.attention-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 10px 12px; border-radius: 9px; background: #fff7ed; }
.attention-item strong { overflow: hidden; color: #9a3412; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.attention-item span { color: #c2410c; font-size: .68rem; }
.activity-list { display: grid; gap: 2px; max-height: 280px; overflow-y: auto; }
.activity-item { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { display: grid; flex: 0 0 30px; width: 30px; height: 30px; place-items: center; border-radius: 9px; background: #eff6ff; color: #2563eb; font-size: .75rem; }
.activity-copy { min-width: 0; flex: 1; }
.activity-copy strong, .activity-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-copy strong { color: #334155; font-size: .78rem; }
.activity-copy span { margin-top: 2px; color: #94a3b8; font-size: .68rem; }
.activity-date { color: #94a3b8; font-size: .68rem; white-space: nowrap; }
.brand-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.brand-card { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 13px; border: 1px solid #edf2f7; border-radius: 12px; }
.brand-card-link { cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.brand-card-link:hover { border-color: #bfdbfe; box-shadow: 0 8px 18px rgba(37, 99, 235, .08); transform: translateY(-1px); }
.brand-avatar { display: grid; flex: 0 0 40px; width: 40px; height: 40px; place-items: center; overflow: hidden; border-radius: 11px; background: #dbeafe; color: #1d4ed8; font-weight: 800; }
.brand-avatar img { width: 100%; height: 100%; padding: 4px; object-fit: contain; background: #fff; }
.brand-copy { min-width: 0; flex: 1; }
.brand-copy strong, .brand-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-copy strong { color: #1e293b; font-size: .8rem; }
.brand-copy span { margin-top: 3px; color: #94a3b8; font-size: .68rem; }
.brand-card button { border: 0; background: transparent; color: #2563eb; cursor: pointer; }
.section-heading { margin-bottom: 22px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.search-field { display: flex; flex: 1 1 260px; align-items: center; gap: 9px; min-height: 42px; padding: 0 13px; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: #94a3b8; }
.search-field input { width: 100%; border: 0; outline: 0; color: #334155; font-size: .82rem; }
.toolbar select { min-height: 42px; padding: 0 13px; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: #475569; font-size: .8rem; }
.table-panel { padding: 0; overflow: hidden; }
.merchant-table { overflow-x: auto; }
.merchant-table-row { display: grid; grid-template-columns: minmax(260px, 1.6fr) 110px 130px 110px 110px; align-items: center; gap: 14px; min-width: 760px; padding: 15px 20px; border-bottom: 1px solid #f1f5f9; }
.merchant-table-row.header { color: #94a3b8; background: #f8fafc; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.merchant-table-row:not(.header) { color: #475569; font-size: .78rem; transition: background .16s ease; }
.merchant-table-row:not(.header):hover { background: #f8fbff; }
.merchant-table-row--interactive { cursor: pointer; }
.merchant-table-row--interactive:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; background: #f8fbff; }
.merchant-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.merchant-cell-copy { min-width: 0; }
.merchant-cell strong, .merchant-cell small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.merchant-cell strong { color: #1e293b; }
.merchant-cell small { margin-top: 3px; color: #94a3b8; font-size: .68rem; }
.status-pill { display: inline-flex; align-items: center; width: max-content; padding: 4px 8px; border-radius: 999px; background: #fef3c7; color: #a16207; font-size: .67rem; font-weight: 700; }
.status-pill.active { background: #dcfce7; color: #15803d; }
.row-action { padding: 6px 9px; border: 1px solid #dbeafe; border-radius: 7px; background: #eff6ff; color: #2563eb; font-size: .72rem; font-weight: 700; cursor: pointer; }
.row-action:hover { border-color: #93c5fd; background: #dbeafe; }
.empty-inline { padding: 25px 5px; color: #94a3b8; font-size: .8rem; text-align: center; }
.access-panel, .settings-card { display: flex; align-items: center; gap: 18px; }
.access-panel > i, .settings-icon { display: grid; flex: 0 0 48px; width: 48px; height: 48px; place-items: center; border-radius: 14px; background: #eff6ff; color: #2563eb; font-size: 1.1rem; }
.access-panel > div, .settings-card > div:nth-child(2) { flex: 1; }
.access-panel h2, .settings-card h2 { margin: 0 0 5px; color: #1e293b; font-size: 1rem; }
.access-panel p, .settings-card p { margin: 0; color: #64748b; font-size: .8rem; line-height: 1.55; }
.capability-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.capability-grid span { display: flex; align-items: center; gap: 8px; color: #475569; font-size: .82rem; }
.capability-grid i { color: #059669; }
.team-summary-grid { margin-bottom: 18px; }
.team-layout, .settings-layout { align-items: start; }
.team-members-panel { min-width: 0; }
.team-members-list { display: grid; gap: 0; }
.team-member-row { display: grid; grid-template-columns: minmax(190px, 1.35fr) minmax(110px, .7fr) minmax(150px, 1fr) minmax(110px, .7fr); align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid #f1f5f9; }
.team-member-row:first-child { padding-top: 0; border-top: 0; }
.team-member-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.team-member-avatar { display: grid; flex: 0 0 36px; width: 36px; height: 36px; place-items: center; border-radius: 11px; background: #dbeafe; color: #1d4ed8; font-size: .72rem; font-weight: 800; }
.team-member-copy { min-width: 0; }
.team-member-copy strong, .team-member-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-member-copy strong { color: #1e293b; font-size: .8rem; }
.team-member-copy span, .team-member-meta span { margin-top: 3px; color: #94a3b8; font-size: .68rem; }
.team-member-meta { min-width: 0; }
.team-member-meta > strong { display: block; color: #475569; font-size: .76rem; }
.team-member-status { justify-self: start; }
.team-member-status-detail { display: block; margin-top: 5px; color: #94a3b8; font-size: .68rem; white-space: nowrap; }
.team-member-row .label { display: block; margin-bottom: 3px; }
.settings-layout > .panel { min-height: 190px; }
.settings-workspace-card { align-items: flex-start; }
.settings-workspace-card > div:nth-child(2) { flex: 1; }
.settings-meta-grid, .settings-stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 19px; }
.settings-meta-grid > div { display: grid; gap: 5px; }
.settings-meta-grid strong { color: #334155; font-size: .78rem; }
.settings-stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 4px; }
.settings-stat-grid > div { padding: 12px; border-radius: 10px; background: #f8fafc; }
.settings-stat-grid span { display: block; color: #64748b; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.settings-stat-grid strong { display: block; margin-top: 7px; color: #0f172a; font-size: 1.35rem; }
.settings-info-panel { min-height: 205px; }
.settings-info-row { display: flex; align-items: flex-start; gap: 11px; padding: 12px 0; border-top: 1px solid #f1f5f9; }
.settings-info-row i { flex: 0 0 28px; width: 28px; height: 28px; padding-top: 7px; border-radius: 8px; background: #eff6ff; color: #2563eb; font-size: .75rem; text-align: center; }
.settings-info-row div { min-width: 0; }
.settings-info-row strong, .settings-info-row span { display: block; }
.settings-info-row strong { color: #334155; font-size: .78rem; }
.settings-info-row span { margin-top: 3px; color: #64748b; font-size: .72rem; line-height: 1.45; }
.label { color: #94a3b8; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.agency-feedback { margin-bottom: 16px; padding: 11px 14px; border: 1px solid #bfdbfe; border-radius: 9px; background: #eff6ff; color: #1d4ed8; font-size: .8rem; }
.agency-feedback.error, .form-feedback.error { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.agency-modal { position: fixed; z-index: 80; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(15, 23, 42, .45); backdrop-filter: blur(4px); }
.agency-modal.hidden { display: none; }
.agency-modal-card { width: min(760px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 25px; border-radius: 16px; background: #fff; box-shadow: 0 30px 80px rgba(15, 23, 42, .25); }
.modal-heading { align-items: center; margin-bottom: 21px; }
.modal-heading h2 { margin: 5px 0 0; color: #0f172a; font-size: 1.25rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid label { display: grid; gap: 6px; color: #475569; font-size: .75rem; font-weight: 700; }
.form-grid label.wide { grid-column: 1 / -1; }
.form-grid input, .program-box input { min-height: 40px; width: 100%; padding: 0 11px; border: 1px solid #dbe2ea; border-radius: 8px; outline: 0; color: #334155; font-size: .8rem; }
.form-grid input:focus, .program-box input:focus { border-color: #60a5fa; box-shadow: 0 0 0 3px #dbeafe; }
.program-box { margin-top: 18px; padding: 17px; border: 1px solid #dbeafe; border-radius: 12px; background: #f8fbff; }
.program-box h3 { margin: 0 0 4px; color: #1e293b; font-size: .95rem; }
.program-box p { margin: 0; color: #64748b; font-size: .75rem; }
.program-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 15px 0; }
.radio-choice { display: flex; align-items: flex-start; gap: 9px; padding: 12px; border: 1px solid #dbeafe; border-radius: 9px; background: #fff; cursor: pointer; }
.radio-choice input, .check-choice input { width: 16px; min-height: 16px; margin-top: 2px; accent-color: #2563eb; }
.radio-choice span { display: grid; gap: 3px; color: #334155; font-size: .78rem; }
.radio-choice small { color: #94a3b8; font-size: .67rem; font-weight: 400; }
.check-choice { display: flex; align-items: center; gap: 8px; margin-top: 13px; color: #475569; font-size: .77rem; font-weight: 600; }
.form-footer, .modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.form-feedback { margin-top: 12px; padding: 8px 10px; border: 1px solid transparent; border-radius: 7px; color: #64748b; font-size: .75rem; }
.credential-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 13px 0; border-bottom: 1px solid #f1f5f9; color: #64748b; font-size: .78rem; }
.credential-row code { padding: 6px 9px; border-radius: 6px; background: #f1f5f9; color: #1e293b; font-size: .82rem; }
.credentials-card > p { color: #64748b; font-size: .8rem; line-height: 1.6; }
.back-button { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 8px; padding: 0; }
.merchant-form-panel { max-width: 900px; }
.merchant-form-panel form { width: 100%; }
.brand-overview-header { display: flex; align-items: center; gap: 16px; padding: 18px 22px; border: 0; background: transparent; box-shadow: none; }
.brand-overview-logo { display: grid; flex: 0 0 64px; width: 64px; height: 64px; place-items: center; overflow: hidden; color: #1d4ed8; font-size: 1.25rem; font-weight: 800; }
.brand-overview-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-overview-copy { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.brand-overview-program-label { color: #64748b; font-size: .78rem; }
.brand-overview-program-label strong { color: #1e293b; }
.brand-overview-card-image { display: grid; flex: 0 0 132px; width: 132px; height: 76px; margin-left: auto; place-items: center; overflow: hidden; color: #94a3b8; font-size: .66rem; text-align: center; }
.brand-overview-card-image img { display: none; width: 100%; height: 100%; object-fit: contain; }
.brand-overview-card-image img.is-visible { display: block; }
.brand-overview-card-image span.hidden { display: none; }
.brand-overview-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.brand-analytics-panel { overflow: hidden; }
.brand-chart-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 4px; color: #64748b; font-size: .72rem; font-weight: 700; }
.brand-chart-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.stamps-dot { background: #2563eb; }
.coupons-dot { background: #f97316; }
.brand-overview-daily-chart { display: block; width: 100%; min-height: 250px; overflow: visible; }
.brand-detail-grid { align-items: start; }
.brand-detail-table-wrap { width: 100%; overflow-x: auto; }
.brand-detail-table { width: 100%; min-width: 560px; border-collapse: collapse; color: #475569; font-size: .74rem; text-align: left; white-space: nowrap; }
.table-scrollbar { display: none; }
.brand-detail-table th { padding: 10px 12px; background: #f8fafc; color: #64748b; font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.brand-detail-table td { padding: 10px 12px; border-top: 1px solid #f1f5f9; }
.brand-detail-table tr:hover td { background: #fbfdff; }
.brand-detail-empty { padding: 24px 12px !important; color: #94a3b8; text-align: center; }
.brand-alert-list { display: grid; gap: 10px; }
.brand-overview-alerts-slot { min-width: 0; margin-bottom: 0; }
.brand-overview-alerts-slot .panel-heading { margin-bottom: 10px; }
.brand-alert-item { padding: 12px 14px; border-left: 3px solid #f59e0b; border-radius: 8px; background: #fffbeb; }
.brand-alert-item.high { border-left-color: #ef4444; background: #fef2f2; }
.brand-alert-item.low { border-left-color: #3b82f6; background: #eff6ff; }
.brand-alert-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand-alert-heading strong { color: #1e293b; font-size: .78rem; }
.brand-alert-heading span { color: #92400e; font-size: .65rem; font-weight: 700; text-transform: uppercase; }
.brand-alert-item p { margin: 5px 0 0; color: #475569; font-size: .73rem; line-height: 1.45; white-space: normal; }
.brand-alert-item small { display: block; margin-top: 7px; color: #94a3b8; font-size: .66rem; }
.brand-program-summary { display: grid; gap: 14px; }
.brand-program-summary > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid #f1f5f9; }
.brand-program-summary > div:last-child { padding-bottom: 0; border-bottom: 0; }
.brand-program-summary span { color: #64748b; font-size: .76rem; }
.brand-program-summary strong { color: #1e293b; font-size: .82rem; }

@media (max-width: 980px) { .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .agency-grid.two-col { grid-template-columns: 1fr; } .brand-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .performance-layout { grid-template-columns: 1fr; } }
@media (max-width: 980px) { .brand-overview-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .team-member-row { grid-template-columns: minmax(190px, 1fr) minmax(110px, .7fr); } .team-member-row > :nth-child(3), .team-member-row > :nth-child(4) { margin-left: 46px; } .settings-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .agency-hero, .section-heading { display: grid; } .agency-hero .action-button, .section-heading .action-button { justify-self: start; } .metric-grid, .metric-grid.compact, .brand-grid, .capability-grid, .program-options, .form-grid, .health-kpi-grid, .performance-attention-list, .overview-top-metrics, .brand-overview-kpis, .settings-stat-grid, .role-matrix { grid-template-columns: 1fr; } .form-grid label.wide { grid-column: auto; } .panel, .agency-hero { padding: 17px; } .topbar-actions { gap: 7px; } .agency-name { display: none; } .brand-overview-header { align-items: flex-start; flex-wrap: wrap; } .brand-overview-card-image { margin-left: 0; } .team-member-row { grid-template-columns: 1fr; gap: 10px; } .team-member-row > :nth-child(3), .team-member-row > :nth-child(4) { margin-left: 46px; } .settings-subnav { overflow-x: auto; flex-wrap: nowrap; } .settings-subnav-link { flex: 0 0 auto; } .settings-section-heading { display: grid; } }
@media (max-width: 640px) { .merchant-table-row { grid-template-columns: minmax(190px, 1fr) 92px 105px 82px 92px; gap: 8px; padding: 12px 14px; } .merchant-table-row.header { font-size: .6rem; } .merchant-cell { gap: 8px; } .merchant-cell .brand-avatar { width: 36px; height: 36px; flex-basis: 36px; } }
@media (max-width: 1024px) {
  .topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; }
  .app-main { padding-top: var(--agency-topbar-height, 76px); }
}
@media (max-width: 768px) {
  .topbar-inner { display: block; min-height: 0; padding: 12px 18px 14px; }
  .topbar-inner > .flex { width: 100%; }
  .topbar-inner > .flex > .min-w-0 { flex: 1 1 auto; min-width: 0; }
  .topbar-actions { position: absolute; top: 12px; right: 18px; gap: 7px; }
  .agency-name { display: none; }
  .page-kicker, .page-title { padding-right: 112px; }
  .page-subtitle { width: 100%; max-width: none; white-space: normal; overflow-wrap: anywhere; }
}
.topbar { position: fixed; top: 0; left: 272px; right: 0; z-index: 1000; }
.app-main { padding-top: var(--agency-topbar-height, 76px); }

/* Settings are organized as focused internal views so the demo behaves like a real account area. */
.settings-subnav { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 22px; padding: 6px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; box-shadow: 0 4px 16px rgba(15,23,42,.04); }
.settings-subnav-link { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 13px; border: 0; border-radius: 8px; background: transparent; color: #64748b; cursor: pointer; font: inherit; font-size: .76rem; font-weight: 700; }
.settings-subnav-link:hover, .settings-subnav-link.active { color: #1d4ed8; background: #eff6ff; }
.settings-section { scroll-margin-top: 96px; }
.settings-section:not(.is-current) { display: none; }
.settings-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.settings-section-heading h2 { margin: 4px 0 5px; color: #0f172a; font-size: 1.2rem; }
.settings-section-heading p { margin: 0; color: #64748b; font-size: .82rem; line-height: 1.55; }
.settings-form { width: 100%; }
.settings-form .form-grid { margin: 0; }
.settings-form .form-footer { margin-top: 18px; }
.settings-form .form-feedback { flex: 1; min-height: 16px; margin: 0; padding: 0; }
.toggle-field { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; color: #334155; font-size: .78rem; cursor: pointer; }
.toggle-field input { width: 17px; height: 17px; margin-top: 2px; accent-color: #2563eb; }
.toggle-field strong, .toggle-field small { display: block; }
.toggle-field small { margin-top: 4px; color: #94a3b8; font-size: .7rem; font-weight: 400; line-height: 1.5; }
.role-matrix { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.role-card { min-width: 0; }
.role-card-heading { display: flex; align-items: flex-start; gap: 12px; padding-bottom: 15px; border-bottom: 1px solid #f1f5f9; }
.role-card-heading > i { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border-radius: 10px; background: #eff6ff; color: #2563eb; font-size: .85rem; }
.role-card-heading h3 { margin: 0 0 4px; color: #1e293b; font-size: .9rem; }
.role-card-heading span { display: block; color: #64748b; font-size: .7rem; line-height: 1.45; }
.permission-list { display: grid; gap: 10px; padding-top: 15px; }
.permission-list > span { display: flex; align-items: center; gap: 8px; color: #475569; font-size: .72rem; line-height: 1.4; }
.permission-list i { color: #16a34a; font-size: .7rem; }
.permission-list i.fa-lock { color: #94a3b8; }
.team-inline-select { width: 100%; min-height: 30px; margin-top: 4px; padding: 0 6px; border: 1px solid #dbe2ea; border-radius: 6px; background: #fff; color: #334155; font-size: .72rem; }
.team-save-button { margin-top: 7px; padding: 0; border: 0; background: transparent; color: #2563eb; cursor: pointer; font: inherit; font-size: .67rem; font-weight: 700; }
.team-save-button:hover { text-decoration: underline; }
.team-invite-panel { margin-bottom: 18px; }
.team-invite-panel .form-footer { align-items: center; }
@media (max-width: 1024px) {
  .topbar { left: 0; }
}

/* The selected brand follows the merchant overview visual language. */
.brand-overview-page .brand-overview-toolbar { align-items: center; margin-bottom: 16px; }
.brand-overview-page .brand-overview-toolbar .back-button { margin: 0; }
.brand-overview-page #merchant-name { color: #0f172a; font-size: clamp(1.45rem, 3vw, 2.2rem); font-weight: 800; line-height: 1.1; }
.brand-overview-page #merchant-logo-slot.is-empty .merchant-image-slot__icon,
.brand-overview-page #merchant-card-slot.is-empty .merchant-image-slot__icon { display: flex; }
.brand-overview-page #merchant-logo-slot:not(.is-empty) img,
.brand-overview-page #merchant-card-slot:not(.is-empty) img { position: relative; z-index: 2; display: block; width: 100%; height: 100%; }
.brand-overview-page #merchant-logo-slot:not(.is-empty) img { object-fit: cover; }
.brand-overview-page #merchant-card-slot:not(.is-empty) img { object-fit: contain; }
.brand-overview-page #overview-loyalty-metrics { margin-top: 20px; }
.brand-overview-page #overview-loyalty-metrics > .card:first-child { min-height: 190px; }
.brand-overview-page #overview-loyalty-metrics > .card:first-child #overview-statistics-label,
.brand-overview-page #overview-loyalty-metrics > .card > [id$="title"],
.brand-overview-page #overview-loyalty-metrics > .card > [id$="label"] { color: #64748b; font-size: .7rem; font-weight: 700; letter-spacing: .12em; }
.brand-overview-page #overview-statistics-label::before,
.brand-overview-page #overview-recent-activity-label::before,
.brand-overview-page #overview-merchant-users-title::before,
.brand-overview-page #overview-daily-activity-title::before { font-family: "Font Awesome 6 Free"; font-weight: 900; margin-right: 8px; color: #2563eb; }
.brand-overview-page #overview-statistics-label::before { content: "\f080"; }
.brand-overview-page #overview-recent-activity-label::before { content: "\f1da"; }
.brand-overview-page #overview-merchant-users-title::before { content: "\f0c0"; }
.brand-overview-page #overview-daily-activity-title::before { content: "\f201"; }
.brand-overview-page #overview-loyalty-metrics > .card:first-child #cards-count { margin-top: 30px; font-size: 2rem; letter-spacing: -.04em; }
.brand-overview-page #overview-loyalty-metrics > .card:first-child #stamps-total,
.brand-overview-page #overview-loyalty-metrics > .card:first-child #coupons-count { color: #475569; font-size: .95rem; font-weight: 500; }
.brand-overview-page #overview-loyalty-metrics > .card:first-child .metric-accent { height: 3px; background: #2563eb; }
.brand-overview-page #overview-loyalty-metrics > .card:nth-child(2),
.brand-overview-page #overview-loyalty-metrics > .card:nth-child(3) { padding: 24px !important; }
.brand-overview-page #brand-recent-activity { min-height: 126px; padding: 3px 2px 9px; scroll-padding-inline: 2px; }
.brand-overview-page #brand-recent-activity .activity-card { min-width: min(250px, 88%); max-width: 250px; border-radius: 8px; border-color: #e2e8f0; box-shadow: none; }
.brand-overview-page #merchant-users-list > * { border-radius: 6px; border: 1px solid #dbeafe; min-width: 0; min-height: 58px; display: grid; align-content: center; gap: 3px; padding: 9px 11px; color: #334155; font-size: .78rem; font-weight: 600; background: #f8fbff; }
.brand-overview-page #overview-loyalty-analytics { margin-top: 20px; padding: 22px 26px !important; background: #fff; }
.brand-overview-page #overview-daily-activity-title { color: #334155; font-size: .76rem; font-weight: 700; letter-spacing: .12em; }
.brand-overview-page #dailyCountsChart { min-height: 250px; }
.brand-overview-page .brand-detail-grid { margin-top: 20px; }

/* Keep every agency view inside the viewport on narrow screens. */
@media (max-width: 768px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
  .app-shell, .app-main, .topbar, .topbar-inner, .agency-content, .dashboard-page { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
  .agency-content { padding-left: 12px; padding-right: 12px; overflow-x: hidden; }
  .dashboard-page > *, .agency-hero > *, .section-heading > *, .panel-heading > *, .panel > * { min-width: 0; max-width: 100%; box-sizing: border-box; }
  .agency-hero, .section-heading, .panel-heading, .modal-heading { min-width: 0; flex-wrap: wrap; }
  .agency-hero > div:first-child, .section-heading > div:first-child, .panel-heading > div:first-child, .modal-heading > div:first-child { flex: 1 1 100%; min-width: 0; }
  .panel-heading .text-button, .section-heading .text-button, .agency-hero .action-button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: left; }
  .agency-hero p, .section-heading p, .panel-heading p, .settings-info-row span { overflow-wrap: anywhere; }
  .performance-panel .panel-heading { align-items: flex-start; }
  .performance-filter { width: 100%; max-width: 100%; white-space: normal; flex-wrap: wrap; }
  .performance-filter select { min-width: 0; max-width: 100%; flex: 1 1 140px; }
  .toolbar { width: 100%; max-width: 100%; min-width: 0; }
  .search-field, .toolbar select { min-width: 0; max-width: 100%; box-sizing: border-box; }
  .search-field { flex-basis: 100%; }
  .activity-item { min-width: 0; }
  .activity-date { flex: 0 1 6rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: normal; text-align: right; }
  .access-panel, .settings-card { align-items: flex-start; flex-wrap: wrap; }
  .access-panel > div, .settings-card > div:nth-child(2) { min-width: 0; flex: 1 1 calc(100% - 66px); }
  .access-panel > .panel-badge { margin-left: 66px; }
  .form-footer, .modal-actions { align-items: flex-start; flex-wrap: wrap; }
  .credential-row { grid-template-columns: 1fr; min-width: 0; }
  .merchant-table, .brand-detail-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
  .merchant-table, .brand-detail-table-wrap, .table-wrapper, #dailyCountsTable { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scrollbar-width: thin; }
  .merchant-table-row { min-width: 760px; }
  .brand-detail-table, #dailyCountsTable table { min-width: 560px; }
  .performance-chart-wrap, .brand-overview-page #overview-loyalty-analytics { max-width: 100%; overflow-x: auto; }
  .brand-overview-page .brand-overview-toolbar { flex-wrap: wrap; }
  .brand-overview-page .brand-overview-header { width: 100%; max-width: 100%; }
  .brand-overview-page #overview-loyalty-analytics { overflow-x: visible; }
  .brand-overview-page .chart-wrapper, .brand-overview-page #brand-overview-daily-chart { display: none !important; }
  .brand-overview-page #dailyCountsTable { display: block !important; width: 100%; max-width: 100%; overflow-x: auto; }
  .brand-overview-page #dailyCountsTable,
  .brand-overview-page .brand-detail-table-wrap { overflow-x: auto !important; overflow-y: hidden; padding-bottom: 8px; }
  .brand-overview-page #dailyCountsTable,
  .brand-overview-page .brand-detail-table-wrap { display: block; width: 100% !important; max-width: 100% !important; overflow-x: scroll !important; overflow-y: hidden !important; scrollbar-width: auto; scrollbar-color: #94a3b8 #e2e8f0; scroll-padding-inline: 12px; touch-action: pan-x; }
  .brand-overview-page #dailyCountsTable::-webkit-scrollbar,
  .brand-overview-page .brand-detail-table-wrap::-webkit-scrollbar { height: 12px; background: #e2e8f0; }
  .brand-overview-page #dailyCountsTable::-webkit-scrollbar-track,
  .brand-overview-page .brand-detail-table-wrap::-webkit-scrollbar-track { background: #e2e8f0; border-radius: 999px; }
  .brand-overview-page #dailyCountsTable::-webkit-scrollbar-thumb,
  .brand-overview-page .brand-detail-table-wrap::-webkit-scrollbar-thumb { min-width: 48px; border: 2px solid #e2e8f0; border-radius: 999px; background: #94a3b8; }
  .brand-overview-page .table-scrollbar { display: block; position: relative; width: 100%; height: 12px; margin: -1px 0 8px; border-radius: 999px; background: #e2e8f0; cursor: grab; touch-action: none; }
  .brand-overview-page .table-scrollbar > div { position: absolute; top: 2px; left: 0; width: 100%; height: 8px; border-radius: 999px; background: #94a3b8; cursor: grab; transform: translateX(0); }
  .brand-overview-page .table-scrollbar > div.is-scrollable { background: #64748b; }
  .brand-overview-page .table-scrollbar:active,
  .brand-overview-page .table-scrollbar:active > div { cursor: grabbing; }
  .brand-overview-page #dailyCountsTable > .brand-detail-table,
  .brand-overview-page .brand-detail-table-wrap > .brand-detail-table { display: table; width: 760px !important; min-width: 760px !important; max-width: none !important; }
  .brand-overview-page .brand-detail-grid,
  .brand-overview-page .brand-detail-grid > .panel,
  .brand-overview-page .brand-detail-grid > .panel > .brand-detail-table-wrap { min-width: 0 !important; width: 100% !important; max-width: 100% !important; }
  .form-grid, .program-box, .form-footer, .modal-actions { width: 100%; max-width: 100%; min-width: 0; }
  input, select, textarea, button { max-width: 100%; box-sizing: border-box; }
}
