/* Canonical administration UI for control-center and site-admin surfaces. */
/* Shared visual shell for the master and site administration UIs. */
:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --panel: #ffffff;
  --panel-soft: #f7f9fc;
  --ink: #172033;
  --muted: #6d7890;
  --line: #e3e9f2;
  --blue: #3268f3;
  --blue-dark: #1949cf;
  --blue-soft: #edf3ff;
  --green: #16a47a;
  --green-soft: #e9f8f3;
  --amber: #e79a22;
  --amber-soft: #fff5df;
  --red: #e45168;
  --red-soft: #ffedf1;
  --nav: #0d1930;
  --nav-soft: #142440;
  --shadow: 0 16px 40px rgba(24, 48, 88, .08);
  --radius: 18px;
}
.theme-live-preview{position:relative;isolation:isolate;overflow:hidden;min-height:360px;border:1px solid #dce6f5;border-radius:24px;background:linear-gradient(145deg,#f7faff,#e9f0fb);color:#17233a;box-shadow:0 18px 46px rgba(28,65,120,.13)}
.theme-live-preview>img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:68% center;opacity:.88}
.theme-live-preview:after{content:"";position:absolute;z-index:0;inset:0;background:linear-gradient(90deg,rgba(8,22,48,.88),rgba(8,22,48,.42) 50%,rgba(8,22,48,.1))}
.theme-live-preview-copy{position:relative;z-index:1;display:flex;flex-direction:column;align-items:flex-start;gap:12px;padding:38px 32px;color:#fff}
.theme-live-preview-copy strong{font-size:25px}.theme-live-preview-copy span{opacity:.78}.theme-live-preview-copy div{display:flex;gap:9px}
.theme-live-preview-copy i{width:62px;height:48px;border-radius:14px;background:rgba(255,255,255,.14);border:1px solid rgba(255,255,255,.22)}
.theme-live-preview-copy button{height:42px;padding:0 22px;border:0;border-radius:13px;color:#fff;background:linear-gradient(135deg,#2f6bff,#22bdc6)}
.theme-live-preview[data-preview-theme=aurora] .theme-live-preview-copy button{background:linear-gradient(135deg,#31d7b1,#8f68ff)}.theme-live-preview[data-preview-theme=particles] .theme-live-preview-copy button{border-radius:6px;background:linear-gradient(135deg,#18b7ff,#735cff)}.theme-live-preview[data-preview-theme=esports] .theme-live-preview-copy button{border-radius:5px;clip-path:polygon(8px 0,100% 0,100% calc(100% - 8px),calc(100% - 8px) 100%,0 100%,0 8px);background:linear-gradient(135deg,#4a61ff,#ff4f74)}.theme-live-preview[data-preview-theme=arcade] .theme-live-preview-copy button{background:linear-gradient(135deg,#7955ff,#ff7345);box-shadow:inset 0 -3px 0 rgba(75,26,140,.35)}.theme-live-preview[data-preview-theme=gold] .theme-live-preview-copy button{color:#291c07;background:linear-gradient(135deg,#f4df9c,#c49035)}
@media(max-width:720px){.theme-live-preview{min-height:320px}.theme-live-preview-copy{padding:28px 22px}}

* { box-sizing: border-box; }
html,
body { width: 100%; min-width: 0; max-width: 100%; overflow-x: hidden; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg); font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif; }
img,
video,
iframe { max-width: 100%; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 16px; color: #fff; background: linear-gradient(180deg, #0c1a33 0%, #0b162a 100%); overflow: auto; z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 23px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: linear-gradient(145deg, #5a89ff, #2457e7); box-shadow: 0 10px 25px rgba(43,100,245,.35); font-size: 13px; font-weight: 900; letter-spacing: .04em; }
.brand-copy strong { display: block; font-size: 15px; }
.brand-copy span { display: block; margin-top: 3px; color: #8191ad; font-size: 11px; letter-spacing: .08em; }
.side-caption { margin: 21px 10px 9px; color: #60728f; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.side-nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 13px; border: 0; border-radius: 13px; color: #9cabc3; background: transparent; text-align: left; transition: .2s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-item.is-active { color: #fff; background: linear-gradient(90deg, rgba(57,108,246,.32), rgba(57,108,246,.12)); box-shadow: inset 3px 0 #4a7bff; }
.nav-icon { display: grid; place-items: center; flex: 0 0 29px; height: 29px; border-radius: 9px; background: rgba(255,255,255,.07); color: #b9c7dd; font-size: 12px; font-weight: 900; }
.nav-item.is-active .nav-icon { color: #fff; background: #3569f2; }
.nav-label { font-size: 14px; font-weight: 700; }
.side-profile { margin-top: 24px; padding: 14px; border: 1px solid rgba(255,255,255,.07); border-radius: 15px; background: rgba(255,255,255,.035); }
.side-profile-top { display: flex; align-items: center; gap: 10px; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; color: #fff; background: linear-gradient(145deg,#7b5cff,#4b63f4); font-size: 13px; font-weight: 900; }
.profile-copy strong, .profile-copy span { display: block; }
.profile-copy strong { font-size: 13px; }
.profile-copy span { margin-top: 3px; color: #72839e; font-size: 11px; }
.side-logout { width: 100%; min-height: 36px; margin-top: 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; color: #9babc4; background: rgba(255,255,255,.04); font-size: 11px; font-weight: 800; }
.side-logout:hover { color: #fff; border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.08); }

.workspace,
.main-content,
.view { min-width: 0; max-width: 100%; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 74px; padding: 14px 30px; border-bottom: 1px solid rgba(220,228,239,.88); background: rgba(255,255,255,.9); backdrop-filter: blur(18px); }
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.menu-toggle { display: none; border: 0; width: 40px; height: 40px; border-radius: 12px; color: var(--ink); background: var(--panel-soft); font-size: 20px; }
.page-heading strong { display: block; font-size: 18px; letter-spacing: -.02em; }
.page-heading span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 15px; border: 1px solid var(--line); border-radius: 11px; color: #3e4b63; background: #fff; font-weight: 750; transition: .18s ease; }
.button:hover { border-color: #b8c9ee; transform: translateY(-1px); box-shadow: 0 8px 18px rgba(33,74,161,.08); }
.button.primary { border-color: var(--blue); color: #fff; background: linear-gradient(135deg, #3b73ff, #2c5fe7); box-shadow: 0 10px 22px rgba(48,103,240,.22); }
.button.soft { border-color: #d9e4ff; color: var(--blue); background: var(--blue-soft); }
.button.danger { border-color: #ffd3db; color: var(--red); background: var(--red-soft); }
.button.small { min-height: 34px; padding: 0 11px; border-radius: 9px; font-size: 12px; }
.main-content { padding: 26px 30px 40px; }
.view { display: none; animation: fadeIn .22s ease; }
.view.is-active { display: block; }
.view > .panel + .panel { margin-top: 18px; }
.inline-form { display: flex; align-items: center; gap: 9px; }
.inline-form label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 800; }
.inline-form select { min-height: 34px; padding: 0 28px 0 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.hero-strip { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 22px; min-height: 158px; padding: 30px 32px; border-radius: 22px; color: #fff; background: radial-gradient(circle at 82% 20%, rgba(90,137,255,.48), transparent 30%), linear-gradient(115deg, #102246, #15366f 63%, #2858cb); box-shadow: 0 20px 45px rgba(16,43,93,.2); overflow: hidden; }
.hero-strip::after { content: ''; position: absolute; right: -64px; bottom: -116px; width: 300px; height: 300px; border: 38px solid rgba(255,255,255,.07); border-radius: 50%; }
.hero-copy { position: relative; z-index: 1; }
.hero-kicker { margin: 0 0 10px; color: #8eb2ff; font-size: 11px; font-weight: 850; letter-spacing: .15em; }
.hero-copy h1 { margin: 0; font-size: clamp(24px, 3vw, 36px); letter-spacing: -.04em; }
.hero-copy p:last-child { margin: 11px 0 0; color: #b8c9e9; font-size: 14px; }
.hero-health { position: relative; z-index: 1; flex: 0 0 260px; padding: 18px; border: 1px solid rgba(255,255,255,.16); border-radius: 17px; background: rgba(7,22,53,.3); backdrop-filter: blur(10px); }
.health-top { display: flex; align-items: center; justify-content: space-between; }
.health-top span { color: #aabbdc; font-size: 12px; }
.health-top strong { color: #7df0c6; font-size: 13px; }
.health-bar { height: 7px; margin: 14px 0 10px; border-radius: 10px; background: rgba(255,255,255,.12); overflow: hidden; }
.health-bar i { display: block; width: 92%; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#3dd9aa,#82eabf); box-shadow: 0 0 14px rgba(83,231,183,.45); }
.health-meta { display: flex; justify-content: space-between; color: #9baed1; font-size: 11px; }

.stat-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 15px; margin-top: 18px; }
.stat-card { position: relative; min-height: 134px; padding: 19px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.stat-card::after { content: ''; position: absolute; top: -38px; right: -38px; width: 95px; height: 95px; border-radius: 50%; background: var(--card-wash,#edf3ff); }
.stat-head { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.stat-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: var(--card-color,var(--blue)); background: var(--card-wash,#edf3ff); font-weight: 900; }
.stat-card strong { position: relative; z-index: 1; display: block; margin-top: 12px; font-size: 27px; letter-spacing: -.04em; }
.stat-foot { position: relative; z-index: 1; display: flex; align-items: center; gap: 5px; margin-top: 6px; color: #8490a5; font-size: 11px; }
.trend-up { color: var(--green); font-weight: 800; }

.grid-2 { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(310px,.8fr); gap: 18px; margin-top: 18px; }
.grid-even { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; margin-top: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 64px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-title strong { display: block; font-size: 15px; }
.panel-title span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.panel-body { padding: 20px; }
.chart-area { display: grid; grid-template-rows: 1fr auto; min-height: 250px; }
.bar-chart { display: flex; align-items: end; gap: clamp(8px,1.4vw,18px); height: 185px; padding-top: 18px; border-bottom: 1px solid var(--line); background-image: linear-gradient(to bottom, rgba(221,229,240,.65) 1px, transparent 1px); background-size: 100% 46px; }
.bar-group { display: flex; flex: 1; align-items: end; justify-content: center; height: 100%; }
.bar { position: relative; width: min(24px,70%); min-height: 12px; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg,#73a0ff,#3268f3); box-shadow: 0 8px 15px rgba(50,104,243,.16); }
.bar:hover::after { content: attr(data-value); position: absolute; left: 50%; bottom: calc(100% + 7px); transform: translateX(-50%); padding: 4px 6px; border-radius: 6px; color: #fff; background: #17233a; font-size: 10px; white-space: nowrap; }
.chart-labels { display: flex; justify-content: space-between; padding-top: 12px; color: #8a96aa; font-size: 10px; }
.source-list { display: grid; gap: 16px; }
.source-row { display: grid; grid-template-columns: 96px minmax(80px,1fr) auto; align-items: center; gap: 12px; }
.source-name { color: #415069; font-size: 12px; font-weight: 700; }
.mini-track { height: 7px; border-radius: 20px; background: #eef2f7; overflow: hidden; }
.mini-track i { display: block; height: 100%; border-radius: inherit; }
.source-value { min-width: 36px; color: #516078; font-size: 12px; font-weight: 800; text-align: right; }
.rank-list { display: grid; gap: 10px; }
.rank-row { display: grid; grid-template-columns: 26px minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 38px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafd; }
.rank-row b { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 8px; color: var(--blue); background: var(--blue-soft); font-size: 10px; }
.rank-row span { overflow: hidden; color: #4c5b73; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.rank-row strong { color: var(--ink); font-size: 12px; }
.analytics-group + .analytics-group { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.analytics-group-title { display: block; margin-bottom: 9px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .04em; }

/* Management productivity layer: compact actions, list filtering, pagination and
   explicit form-save state are shared by master and tenant consoles. */
.row-actions[data-actions-enhanced="true"] { align-items: center; }
.row-action-menu { position: relative; }
.row-action-menu > summary { list-style: none; cursor: pointer; user-select: none; }
.row-action-menu > summary::-webkit-details-marker { display: none; }
.row-action-menu > summary span { display: inline-block; margin-left: 3px; transition: transform .18s ease; }
.row-action-menu[open] > summary span { transform: rotate(180deg); }
.row-action-menu-popover { position: absolute; top: calc(100% + 7px); right: 0; z-index: 45; display: grid; width: max-content; min-width: 142px; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: 0 18px 48px rgba(17,35,68,.2); }
.row-action-menu-popover .button { width: 100%; justify-content: flex-start; }
.table-productivity-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 15px; border-top: 1px solid var(--line); background: linear-gradient(180deg,#fff,#fafcff); }
.collection-productivity-bar { margin: 18px 0 0; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 28px rgba(22,47,89,.06); }
.site-grid > [hidden] { display: none !important; }
.table-search { display: flex; align-items: center; min-width: min(320px,42%); height: 40px; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; color: #738198; background: #f8fafd; }
.table-search:focus-within { border-color: #7ca1ff; box-shadow: 0 0 0 3px rgba(50,104,243,.1); background: #fff; }
.table-search input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font: inherit; }
.table-pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--muted); font-size: 10px; font-weight: 750; }
.table-pager label { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.table-pager select { height: 34px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; }
.table-page-meta { white-space: nowrap; }
.admin-table-enhanced thead th { position: sticky; top: 0; z-index: 3; box-shadow: 0 1px var(--line); }
.admin-table-enhanced tr[hidden] { display: none !important; }
.form-save-status { display: inline-flex; align-items: center; gap: 7px; margin-right: auto; color: #77849a; font-size: 10px; font-weight: 800; }
.form-save-status i { width: 8px; height: 8px; border-radius: 50%; background: #25aa7b; box-shadow: 0 0 0 4px rgba(37,170,123,.1); }
.is-dirty .form-save-status { color: #a16a10; }
.is-dirty .form-save-status i { background: #e6a02b; box-shadow: 0 0 0 4px rgba(230,160,43,.12); }
.long-form > .form-actions { position: sticky; z-index: 15; bottom: 12px; margin: 24px 12px 0; padding: 13px 14px; border: 1px solid #dbe4f3; border-radius: 14px; background: rgba(255,255,255,.94); box-shadow: 0 15px 42px rgba(23,46,86,.16); backdrop-filter: blur(16px); }
.side-caption-inline { display: block; margin: 18px 10px 7px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.operations-history { margin-top: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfd; }
.operations-history > summary { cursor: pointer; color: #647187; font-size: 11px; font-weight: 850; }
.operations-history > .result-list { margin-top: 11px; }
.collector-settings-disclosure { margin-top: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fafbfd; overflow: hidden; }
.collector-settings-disclosure > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; padding: 11px 14px; cursor: pointer; list-style: none; }
.collector-settings-disclosure > summary::-webkit-details-marker { display: none; }
.collector-settings-disclosure > summary span, .collector-settings-disclosure > summary strong, .collector-settings-disclosure > summary small { display: block; }
.collector-settings-disclosure > summary strong { color: #42516a; font-size: 12px; }
.collector-settings-disclosure > summary small { margin-top: 4px; color: #8793a6; font-size: 10px; }
.collector-settings-disclosure > summary b { flex: 0 0 auto; padding: 7px 9px; border-radius: 9px; color: var(--blue); background: var(--blue-soft); font-size: 10px; }
.collector-settings-disclosure[open] > summary { border-bottom: 1px solid var(--line); background: #fff; }
.collector-settings-disclosure > .collector-rule-fields { margin: 0; padding: 15px; }

@media (max-width: 620px) {
  .table-productivity-bar { position: sticky; top: 66px; z-index: 12; align-items: stretch; flex-direction: column; gap: 9px; padding: 10px; }
  .table-search { width: 100%; min-width: 0; }
  .table-pager { justify-content: space-between; flex-wrap: wrap; }
  .table-page-meta { flex: 1 1 100%; }
  .table-pager label { display: none; }
  .table-wrap { overflow: visible; }
  .data-table.admin-table-enhanced { display: block; min-width: 0; }
  .data-table.admin-table-enhanced thead { display: none; }
  .data-table.admin-table-enhanced tbody { display: grid; gap: 10px; padding: 10px; }
  .data-table.admin-table-enhanced tr { display: grid; gap: 0; padding: 8px 11px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 8px 22px rgba(22,47,89,.07); }
  .data-table.admin-table-enhanced td { display: grid; grid-template-columns: minmax(88px,.44fr) minmax(0,1fr); align-items: center; min-height: 39px; gap: 9px; padding: 7px 2px; border-top: 1px dashed #e9edf4; overflow-wrap: anywhere; }
  .data-table.admin-table-enhanced td:first-child { border-top: 0; }
  .data-table.admin-table-enhanced td::before { content: attr(data-label); color: #8b97a9; font-size: 9px; font-weight: 850; }
  .data-table.admin-table-enhanced td .site-cell { min-width: 0; }
  .data-table.admin-table-enhanced td:has(.row-actions) { grid-template-columns: 1fr; }
  .data-table.admin-table-enhanced td:has(.row-actions)::before { content: none; }
  .data-table.admin-table-enhanced .row-actions { justify-content: flex-end; white-space: normal; }
  .row-action-menu-popover { position: fixed; inset: auto 12px max(12px,env(safe-area-inset-bottom)) 12px; width: auto; max-height: 60vh; overflow: auto; padding: 12px; border-radius: 17px; box-shadow: 0 24px 70px rgba(8,17,34,.34); }
  .row-action-menu-popover .button { min-height: 44px; }
  .long-form > .form-actions { bottom: 8px; margin-inline: 0; }
  .form-save-status { flex-basis: 100%; }
}

.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 780px; }
.data-table th { padding: 12px 16px; color: #8490a4; background: #fafbfd; font-size: 11px; font-weight: 800; text-align: left; white-space: nowrap; }
.data-table td { padding: 15px 16px; border-top: 1px solid #edf0f5; color: #4b5870; font-size: 12px; vertical-align: middle; }
.data-table tbody tr:hover { background: #fbfcff; }
.site-cell { display: flex; align-items: center; gap: 11px; min-width: 190px; }
.site-cell > .site-badge { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; margin: 0; border-radius: 12px; color: #fff; background: linear-gradient(145deg,#608dff,#2d62ec); font-size: 11px; font-weight: 900; line-height: 1; text-align: center; }
.site-copy { display: block; min-width: 0; margin: 0; }
.site-copy > strong, .site-copy > span { display: block; }
.site-copy > strong { overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.site-copy > span { overflow: hidden; margin-top: 3px; color: #8b96a9; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.asset-thumb { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; margin: 0 !important; border: 1px solid var(--line); border-radius: 12px; color: var(--blue); background: #f5f8fd; font-size: 10px; font-weight: 900; overflow: hidden; }
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tool-thumb img { object-fit: contain; padding: 5px; }
.link-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 9px; border-radius: 20px; font-size: 10px; font-weight: 850; white-space: nowrap; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb,currentColor 14%,transparent); }
.status.healthy, .status.running, .status.ready, .status.active { color: var(--green); background: var(--green-soft); }
.status.warning, .status.maintenance, .status.syncing { color: var(--amber); background: var(--amber-soft); }
.status.offline, .status.disabled { color: var(--red); background: var(--red-soft); }
.row-actions { display: flex; gap: 7px; white-space: nowrap; }

.activity-list { display: grid; gap: 0; }
.activity-item { position: relative; display: grid; grid-template-columns: 43px 1fr; gap: 12px; padding: 13px 0; }
.activity-item + .activity-item { border-top: 1px solid #edf0f5; }
.activity-time { color: #94a0b2; font-size: 10px; }
.activity-copy strong { display: block; color: #3d4b63; font-size: 12px; }
.activity-copy span { display: block; margin-top: 4px; color: #8b96a9; font-size: 10px; }

.page-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-tools h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.page-tools p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.tool-actions { display: flex; align-items: center; gap: 9px; }
.search-box { display: flex; align-items: center; min-width: 230px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }

.collector-grid, .site-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.collector-card, .site-summary-card { padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.collector-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.collector-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--blue); background: var(--blue-soft); font-size: 13px; font-weight: 900; }
.collector-card h3 { margin: 15px 0 5px; font-size: 14px; }
.collector-card p { margin: 0; color: #8490a4; font-size: 11px; word-break: break-all; }
.deployment-note { margin-top: 13px; padding: 11px 12px; border: 1px dashed #d9e3f2; border-radius: 11px; background: #fafbfd; }
.deployment-note strong, .deployment-note span { display: block; }
.deployment-note strong { color: #405069; font-size: 10px; }
.deployment-note span { margin-top: 5px; color: #8995a8; font-size: 9px; word-break: break-all; }
.domain-metrics { display: grid; grid-template-columns: repeat(2,1fr); gap: 9px; margin-top: 16px; }
.metric-box { padding: 10px; border-radius: 11px; background: #f6f8fc; }
.metric-box span, .metric-box strong { display: block; }
.metric-box span { color: #8b96a9; font-size: 9px; }
.metric-box strong { margin-top: 5px; color: #39465e; font-size: 12px; }
.domain-footer, .collector-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; min-width: 0; margin-top: 16px; padding-top: 14px; border-top: 1px solid #edf0f5; }
.domain-footer > *, .collector-footer > * { min-width: 0; max-width: 100%; }
.domain-footer small, .collector-footer small { flex: 1 1 120px; color: #8792a6; overflow-wrap: anywhere; }
.domain-footer :where(.row-actions, .tool-actions), .collector-footer :where(.row-actions, .tool-actions) { display: flex; flex: 1 1 auto; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
.domain-footer :where(.button, button), .collector-footer :where(.button, button) { max-width: 100%; white-space: normal; text-align: center; }

.collector-progress { height: 7px; margin-top: 16px; border-radius: 8px; background: #edf1f7; overflow: hidden; }
.collector-progress i { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#2c67f3,#55d1ba); }
.collector-info { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; margin-top: 14px; }
.collector-info span { display: block; color: #8995a8; font-size: 9px; }
.collector-info strong { display: block; margin-top: 4px; color: #3d4b63; font-size: 12px; }
.collector-source-data { display: grid; gap: 8px; margin-top: 14px; padding: 12px; border: 1px solid #e3e9f3; border-radius: 12px; background: #f8faff; }
.collector-source-data-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.collector-source-data-head strong { color: #405069; font-size: 11px; }
.collector-source-data-head span { color: #8a96aa; font-size: 9px; }
.collector-source-data-row { display: grid; grid-template-columns: minmax(110px,.7fr) minmax(0,1.7fr) auto; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid #e5eaf2; border-radius: 10px; background: #fff; }
.collector-source-data-row > span { display: grid; gap: 3px; min-width: 0; }
.collector-source-data-row strong { color: #34425a; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collector-source-data-row small { color: #8c98aa; font-size: 9px; }
.collector-source-data-row code { min-width: 0; color: #68768c; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collector-rule-fields { display: grid; grid-template-columns: minmax(0,1fr) 76px; gap: 10px; margin-top: 14px; }
.collector-rule-fields label { display: grid; gap: 5px; color: #77849a; font-size: 10px; }
.collector-rule-fields input { width: 100%; min-width: 0; height: var(--admin-control-md, 42px); padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; color: #34425a; background: #f8faff; }
.collector-rule-fields textarea, .collector-rule-fields select { width: 100%; min-width: 0; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; color: #34425a; background: #f8faff; font: inherit; }
.collector-rule-fields textarea { min-height: 102px; resize: vertical; line-height: 1.55; }
.collector-rule-fields select { height: var(--admin-control-md, 42px); }
.collector-rule-fields .collector-enabled { display: flex; grid-column: 1 / -1; align-items: center; gap: 7px; }
.collector-rule-fields .collector-enabled input { width: 16px; height: 16px; }
.collector-error { margin-top: 10px !important; color: #d04455 !important; }
.collector-card-wide { grid-column: span 1; }
.collector-rule-expanded { grid-template-columns: repeat(2,minmax(0,1fr)); }
.collector-rule-expanded .full { grid-column: 1 / -1; }
.collector-logs { margin-top: 14px; border-top: 1px solid #edf0f5; padding-top: 12px; color: #647187; font-size: 11px; }
.collector-logs summary { cursor: pointer; font-weight: 800; }
.collector-logs ul { display: grid; gap: 7px; margin: 10px 0 0; padding: 0; list-style: none; }
.collector-logs li { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; align-items: center; }
.collector-logs small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-success { color: #118361; }
.log-failed { color: #c13f51; }

.form-panel { padding: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #526078; font-size: 11px; font-weight: 800; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; outline: none; color: var(--ink); background: #fbfcfe; transition: .18s ease; }
.field input, .field select { height: 43px; padding: 0 12px; }
.field textarea { min-height: 92px; padding: 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #7ca1ff; box-shadow: 0 0 0 3px rgba(50,104,243,.1); background: #fff; }
.field-hint { color: #949fb0; font-size: 10px; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.bt-status-line { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 13px 14px; border-radius: 12px; color: #6f7c91; background: #f7f9fc; font-size: 10px; }
.check-field { display: flex; align-items: center; gap: 9px; min-height: 43px; align-self: end; color: #526078; font-size: 11px; font-weight: 800; }
.check-field.full { grid-column: 1 / -1; }
.check-field input { width: 17px; height: 17px; accent-color: var(--blue); }
.upload-button { width: fit-content; margin-top: 8px; }
.inline-image-preview { width: 72px; height: 72px; margin-top: 10px; border: 1px dashed #cdd8e9; border-radius: 14px; background: #f7f9fc; overflow: hidden; }
.inline-image-preview img { width: 100%; height: 100%; object-fit: contain; }
.inline-image-preview.banner-preview { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.inline-image-preview.banner-preview img { object-fit: contain; }
.home-popup-editor { margin-top: 16px; }
.home-popup-preview { width: min(100%, 520px); height: auto; aspect-ratio: 16 / 9; }
.home-popup-preview img { object-fit: contain; }
.color-control { display: grid; grid-template-columns: 54px minmax(0,1fr); gap: 9px; }
.field .color-control input[type="color"] { width: 54px; padding: 4px; cursor: pointer; }
.logo-editor-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.upload-card { padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: #fafbfd; }
.upload-label { display: block; margin-bottom: 10px; color: #526078; font-size: 11px; font-weight: 850; }
.logo-preview { display: grid; place-items: center; height: 88px; margin-bottom: 13px; border: 1px solid #e0e6ef; border-radius: 13px; background: #fff; overflow: hidden; }
.logo-preview.dark { border-color: #253650; background: #0e1b30; }
.logo-preview img { max-width: 88%; max-height: 62px; object-fit: contain; }
.line-logo-title { margin: 20px 0 14px; padding-top: 18px; border-top: 1px solid var(--line); }
.line-logo-editor { margin-bottom: 2px; }
.line-logo-preview img { width: 62px; height: 62px; object-fit: contain; }
.favicon-editor-row { display: grid; grid-template-columns: 64px minmax(0,1fr) auto; align-items: end; gap: 14px; margin-top: 15px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: #fafbfd; }
.favicon-preview { display: grid; width: 64px; height: 64px; place-items: center; overflow: hidden; border: 1px solid #e0e6ef; border-radius: 15px; background: #fff; }
.favicon-preview img { width: 48px; height: 48px; object-fit: contain; }
.banner-list { display: grid; gap: 0; }
.banner-manage-card { display: grid; grid-template-columns: 126px minmax(140px,1fr) auto auto; align-items: center; gap: 14px; padding: 15px 18px; }
.banner-manage-card + .banner-manage-card { border-top: 1px solid var(--line); }
.banner-manage-card > img { width: 126px; height: auto; aspect-ratio: 16 / 9; border-radius: 11px; object-fit: contain; background: #f2f5f9; }
.banner-manage-card > div:nth-child(2) { min-width: 0; }
.banner-manage-card strong, .banner-manage-card span { display: block; }
.banner-manage-card strong { color: var(--ink); font-size: 12px; }
.banner-manage-card div > span { margin-top: 6px; color: #8490a4; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.permission-banner { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; padding: 16px 18px; border: 1px solid #cfe0ff; border-radius: 15px; color: #2858b8; background: linear-gradient(90deg,#edf4ff,#f7faff); }
.permission-banner strong { display: block; font-size: 13px; }
.permission-banner span { display: block; margin-top: 4px; color: #6683bb; font-size: 10px; }
.permission-scope { flex: 0 0 auto; padding: 8px 11px; border-radius: 10px; color: var(--blue); background: #fff; font-size: 10px; font-weight: 850; }

.switch { position: relative; width: 46px; height: 28px; border: 0; border-radius: 20px; background: #cfd7e5; transition: .2s; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(18,35,64,.24); transition: .2s; }
.switch.is-on { background: var(--blue); }
.switch.is-on::after { left: 22px; }

.empty-state { padding: 42px 20px; color: #8995a8; text-align: center; }
.empty-state strong { display: block; margin-bottom: 7px; color: #4d5a70; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(8,17,34,.58); backdrop-filter: blur(5px); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(620px,100%); max-height: calc(100vh - 40px); border-radius: 21px; background: #fff; box-shadow: 0 26px 70px rgba(3,12,31,.28); overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.modal-head strong { font-size: 17px; }
.modal-close { position: relative; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; color: #647087; background: #f2f5f9; font-size: 0; line-height: 0; }
.modal-close::before, .modal-close::after { content: ''; position: absolute; top: 50%; left: 50%; width: 14px; height: 2px; border-radius: 999px; background: currentColor; pointer-events: none; transform-origin: center; }
.modal-close::before { transform: translate(-50%,-50%) rotate(45deg); }
.modal-close::after { transform: translate(-50%,-50%) rotate(-45deg); }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 17px 22px; border-top: 1px solid var(--line); }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 160; max-width: 360px; padding: 13px 16px; border: 1px solid #cfe0ff; border-radius: 13px; color: #315087; background: #fff; box-shadow: 0 18px 46px rgba(22,47,89,.2); font-size: 12px; font-weight: 750; transform: translateY(20px); opacity: 0; pointer-events: none; transition: .24s ease; }
.toast.is-visible { transform: none; opacity: 1; }
.deployment-result-modal { width: min(760px,100%); }
.result-summary { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.result-summary > strong { color: var(--ink); font-size: 17px; }
.result-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.result-grid > div { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #f8fafd; }
.result-grid span, .result-grid strong, .result-grid a, .result-grid code { display: block; }
.result-grid span { margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 800; }
.result-grid strong, .result-grid a, .result-grid code { color: #35445d; font-size: 12px; overflow-wrap: anywhere; }
.result-grid a { color: var(--blue); }
.result-grid .credential-once { grid-column: 1 / -1; border-color: #f1d49a; background: #fff8e9; }
.credential-once code { padding: 10px 12px; border-radius: 9px; color: #7d5410; background: #fff; font-size: 14px; font-weight: 900; user-select: all; }
.result-list { display: grid; gap: 8px; margin-top: 15px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; }
.result-list > strong, .result-list summary { color: #405069; font-size: 11px; font-weight: 900; }
.result-list > a { color: var(--blue); font-size: 11px; overflow-wrap: anywhere; }
.result-domain { display: grid; grid-template-columns: minmax(150px,.7fr) minmax(0,1.3fr); gap: 12px; padding: 9px 10px; border-radius: 9px; background: #f8fafd; }
.result-domain span { color: #3f4e66; font-size: 11px; font-weight: 800; overflow-wrap: anywhere; }
.result-domain small { color: #7d899d; font-size: 10px; }
.result-errors { margin-top: 15px; padding: 12px 14px; border: 1px solid #f3c9cf; border-radius: 12px; color: #b63c4f; background: #fff3f5; font-size: 11px; }
.result-errors p { margin: 0; }
.mobile-backdrop { display: none; }

@media (max-width: 680px) {
  .result-grid { grid-template-columns: 1fr; }
  .result-grid .credential-once { grid-column: 1; }
  .result-domain { grid-template-columns: 1fr; gap: 5px; }
}

.tenant-hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px; padding: 23px 25px; border: 1px solid #dbe5f6; border-radius: 20px; background: linear-gradient(135deg,#fff,#f1f6ff); box-shadow: var(--shadow); }
.tenant-hero h1 { margin: 6px 0 7px; font-size: 25px; letter-spacing: -.04em; }
.tenant-hero p { margin: 0; color: var(--muted); font-size: 12px; }
.content-shortcuts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 18px; }
.eyebrow { color: var(--blue); font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.online-orb { position: relative; display: grid; place-items: center; width: 96px; height: 96px; border: 1px solid #ccdaf5; border-radius: 30px; background: #fff; }
.online-orb::before { content: ''; position: absolute; width: 64px; height: 64px; border-radius: 50%; background: rgba(50,104,243,.12); animation: pulse 2.2s infinite; }
.online-orb strong { position: relative; color: var(--blue); font-size: 21px; }
.online-orb span { position: absolute; bottom: 17px; color: #7a88a0; font-size: 9px; }
@keyframes pulse { 0%,100% { transform: scale(.8); opacity: .45; } 50% { transform: scale(1.12); opacity: 1; } }

.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 28px; color: #fff; background: radial-gradient(circle at 18% 12%, rgba(50,104,243,.28), transparent 31%), radial-gradient(circle at 88% 86%, rgba(20,180,150,.13), transparent 28%), #091426; }
.auth-shell { display: grid; grid-template-columns: minmax(320px,1.15fr) minmax(360px,.85fr); width: min(980px,100%); min-height: 570px; border: 1px solid rgba(255,255,255,.1); border-radius: 28px; background: rgba(12,27,52,.8); box-shadow: 0 34px 90px rgba(0,0,0,.34); overflow: hidden; }
.auth-story { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 64px; background: linear-gradient(145deg,rgba(30,65,132,.72),rgba(12,29,58,.72)); overflow: hidden; }
.auth-story::after { content: ''; position: absolute; right: -110px; bottom: -150px; width: 370px; height: 370px; border: 50px solid rgba(255,255,255,.045); border-radius: 50%; }
.auth-brand-mark { position: relative; z-index: 1; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 19px; color: #fff; background: linear-gradient(145deg,#6792ff,#2e64ed); box-shadow: 0 15px 32px rgba(29,82,220,.42); font-weight: 950; }
.auth-kicker { position: relative; z-index: 1; margin: 34px 0 12px; color: #86aaff; font-size: 11px; font-weight: 900; letter-spacing: .22em; }
.auth-story h1 { position: relative; z-index: 1; margin: 0; font-size: clamp(32px,5vw,48px); letter-spacing: -.05em; }
.auth-story > p:not(.auth-kicker) { position: relative; z-index: 1; max-width: 470px; margin: 18px 0 0; color: #aebddd; font-size: 15px; line-height: 1.8; }
.auth-features { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 9px; margin-top: 34px; }
.auth-features span { padding: 8px 11px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; color: #c4d1e8; background: rgba(255,255,255,.045); font-size: 11px; font-weight: 800; }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: 52px; color: var(--ink); background: #fff; }
.auth-role { display: inline-flex; padding: 7px 10px; border-radius: 9px; color: var(--blue); background: var(--blue-soft); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.auth-role.tenant { color: var(--green); background: var(--green-soft); }
.auth-card-head h2 { margin: 19px 0 8px; font-size: 27px; letter-spacing: -.04em; }
.auth-card-head p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.auth-form { display: grid; gap: 17px; margin-top: 30px; }
.auth-form label { display: grid; gap: 8px; color: #4b5870; font-size: 11px; font-weight: 850; }
.auth-form input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; outline: 0; color: var(--ink); background: #f8fafd; }
.auth-form input:focus { border-color: #7ca1ff; box-shadow: 0 0 0 3px rgba(50,104,243,.1); background: #fff; }
.auth-submit { width: 100%; min-height: 48px; margin-top: 2px; }
.auth-error { min-height: 16px; margin: -7px 0 -4px; color: var(--red); font-size: 11px; }
.captcha-question { width: fit-content; max-width: 100%; min-height: 44px; justify-self: start; margin-left: 8px; border: 0; padding: 4px 12px; border-radius: 999px; background: #edf3ff; color: #2f68e8; font: inherit; font-weight: 850; cursor: pointer; }
.auth-switch { margin: 24px 0 0; color: #8792a6; font-size: 11px; text-align: center; }
.auth-switch a { color: var(--blue); font-weight: 850; }

@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .collector-grid, .site-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .auth-page { padding: 16px; }
  .auth-shell { grid-template-columns: 1fr; min-height: 0; }
  .auth-story { padding: 34px; }
  .auth-story > p:not(.auth-kicker), .auth-features { display: none; }
  .auth-story h1 { font-size: 29px; }
  .auth-kicker { margin-top: 22px; }
  .auth-card { padding: 34px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-104%); width: 248px; box-shadow: 20px 0 50px rgba(7,17,36,.3); transition: .25s ease; }
  .sidebar.is-open { transform: none; }
  .mobile-backdrop { position: fixed; inset: 0; z-index: 25; display: block; background: rgba(5,13,29,.4); }
  .mobile-backdrop[hidden] { display: none; }
  .menu-toggle { display: grid; place-items: center; }
  .topbar { padding: 12px 16px; }
  .main-content { padding: 18px 16px 30px; }
  .hero-strip { align-items: stretch; flex-direction: column; padding: 24px; }
  .hero-health { flex-basis: auto; width: 100%; }
  .page-tools { align-items: stretch; flex-direction: column; }
  .tool-actions { align-items: stretch; flex-wrap: wrap; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .inline-form label { align-items: flex-start; flex-direction: column; }
  .search-box { min-width: 0; flex: 1 1 220px; }
  .grid-even { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .auth-page { padding: 0; background: #fff; }
  .auth-shell { width: 100%; min-height: 100vh; border: 0; border-radius: 0; }
  .auth-story { padding: 28px 24px; }
  .auth-card { justify-content: flex-start; padding: 32px 24px; }
  .top-actions .button:not(.primary) { display: none; }
  .page-heading span { display: none; }
  .main-content { padding-inline: 12px; }
  .stat-grid, .collector-grid, .site-grid { grid-template-columns: 1fr; }
  .collector-rule-expanded { grid-template-columns: 1fr; }
  .collector-rule-expanded .full { grid-column: auto; }
  .collector-source-data-head { align-items: flex-start; flex-direction: column; gap: 3px; }
  .collector-source-data-row { grid-template-columns: 1fr; align-items: stretch; }
  .stat-card { min-height: 120px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .permission-banner { align-items: flex-start; flex-direction: column; }
  .tenant-hero { grid-template-columns: 1fr; }
  .online-orb { display: none; }
  .source-row { grid-template-columns: 82px 1fr auto; }
  .modal-body { padding: 18px; }
  .logo-editor-grid { grid-template-columns: 1fr; }
  .favicon-editor-row { grid-template-columns: 54px minmax(0,1fr); align-items: center; }
  .favicon-editor-row .upload-button { grid-column: 1 / -1; justify-self: stretch; }
  .favicon-preview { width: 54px; height: 54px; }
  .banner-manage-card { grid-template-columns: 92px minmax(120px,1fr); }
  .banner-manage-card > img { width: 92px; height: auto; }
  .banner-manage-card > .status, .banner-manage-card > .row-actions { grid-column: 2; }
  .table-wrap:has(.admin-table-enhanced) { overflow: visible; }
}

.engagement-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:20px}.engagement-summary>div{padding:18px;border:1px solid #dce6f5;border-radius:16px;background:#f7faff}.engagement-summary strong,.engagement-summary span{display:block}.engagement-summary strong{font-size:22px}.engagement-summary span{margin-top:5px;color:#728199;font-size:12px}.engagement-card-preview{display:grid;gap:8px;padding:14px;border:1px dashed #cbd9ee;border-radius:14px;background:#f8fbff}.engagement-card-preview img{display:block;width:100%;max-height:180px;object-fit:contain;border-radius:12px;background:#edf3fb}.engagement-modal-backdrop{position:fixed;inset:0;z-index:120;display:grid;place-items:center;padding:24px;background:rgba(6,15,33,.58);backdrop-filter:blur(7px)}.engagement-modal-backdrop[hidden]{display:none!important}.engagement-modal{width:min(720px,100%);max-height:calc(100vh - 48px);overflow:auto;border-radius:22px;background:#fff;box-shadow:0 30px 90px rgba(0,12,35,.3)}.engagement-modal-head{position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;padding:20px 22px;border-bottom:1px solid #e3e9f2;background:#fff}.engagement-modal-head button{display:grid;width:44px;height:44px;place-items:center;padding:0;border:0;border-radius:12px;color:#64748b;background:#f1f5f9;cursor:pointer}.engagement-modal-head button svg{display:block;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round}.engagement-modal-body{padding:20px 22px}.engagement-modal-foot{display:flex;justify-content:flex-end;gap:10px;padding:16px 22px;border-top:1px solid #e3e9f2}.engagement-table small{color:#7b899e}.engagement-link{max-width:320px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.engagement-review-actions{display:flex;flex-wrap:wrap;gap:7px}@media(max-width:860px){.engagement-summary{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:640px){.engagement-summary{grid-template-columns:1fr}.engagement-review-actions{flex-direction:column}.engagement-review-actions .button{width:100%}}

/* Shared product tokens for master admin, site admin and both auth pages. */
:root {
  --admin-space-1: 4px;
  --admin-space-2: 8px;
  --admin-space-3: 12px;
  --admin-space-4: 16px;
  --admin-space-5: 20px;
  --admin-space-6: 24px;
  --admin-control-sm: 34px;
  --admin-control-md: 42px;
  --admin-control-lg: 48px;
  --admin-radius-sm: 10px;
  --admin-radius-md: 14px;
  --admin-radius-lg: 18px;
  --admin-motion-fast: 160ms;
  --admin-motion-base: 220ms;
  --admin-ease: cubic-bezier(.2, .8, .2, 1);
}

body :where(button, input, select, textarea, a, [role="button"]):focus-visible {
  outline: 3px solid rgba(50, 104, 243, .24);
  outline-offset: 2px;
}

body :where(button, input, select, textarea):disabled,
body :where(button, [role="button"])[aria-disabled="true"] {
  cursor: not-allowed !important;
  filter: saturate(.55);
  opacity: .55;
  pointer-events: none;
  transform: none !important;
}

body :where(button, [role="button"])[aria-busy="true"] {
  cursor: wait;
  pointer-events: none;
}

.button {
  min-height: var(--admin-control-md);
  padding-inline: 15px;
  border-radius: 11px;
  line-height: 1.2;
  transition-duration: var(--admin-motion-fast);
  transition-timing-function: var(--admin-ease);
}

.button.small {
  min-height: var(--admin-control-sm);
  padding-inline: 11px;
}

.domain-footer :is(.button, button),
.collector-footer :is(.button, button) {
  min-height: 44px;
}

:where(.field input, .field select, .inline-form select, .search-box, .table-search, .auth-form input) {
  min-height: var(--admin-control-md);
  border-radius: 11px;
}

:where(.muted, .result-hint) {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.field textarea {
  min-height: 104px;
  border-radius: 11px;
  line-height: 1.6;
}

:where(.field input, .field select, .field textarea, .auth-form input)::placeholder {
  color: #9aa5b7;
  opacity: 1;
}

:where(.field input, .field select, .field textarea, .search-box, .table-search, .auth-form input):focus-within {
  border-color: #7ca1ff;
  box-shadow: 0 0 0 3px rgba(50,104,243,.1);
}

:where(.panel, .collector-card, .site-summary-card, .stat-card, .tenant-hero, .engagement-summary > div) {
  border-radius: var(--admin-radius-lg);
}

.panel-head {
  min-height: 62px;
  gap: var(--admin-space-4);
  padding: var(--admin-space-4) var(--admin-space-5);
}

.panel-body {
  padding: var(--admin-space-5);
}

.page-tools {
  gap: var(--admin-space-4);
  margin-bottom: var(--admin-space-5);
}

.tool-actions,
.top-actions,
.row-actions,
.modal-foot,
.engagement-modal-foot {
  gap: var(--admin-space-2);
}

.form-grid {
  gap: var(--admin-space-4);
}

.field {
  min-width: 0;
  gap: 7px;
}

.field :where(input, select, textarea),
.search-box input,
.table-search input {
  min-width: 0;
}

.data-table th {
  height: 44px;
  padding: 10px 14px;
}

.data-table td {
  padding: 13px 14px;
}

.table-productivity-bar,
.table-pager {
  gap: var(--admin-space-2);
}

.table-pager :where(button, select) {
  min-height: var(--admin-control-sm);
}

.empty-state {
  min-height: 160px;
  display: grid;
  place-content: center;
  padding: var(--admin-space-6);
}

.modal-backdrop,
.engagement-modal-backdrop {
  padding: max(var(--admin-space-5), env(safe-area-inset-top)) max(var(--admin-space-5), env(safe-area-inset-right)) max(var(--admin-space-5), env(safe-area-inset-bottom)) max(var(--admin-space-5), env(safe-area-inset-left));
}

.modal,
.engagement-modal {
  display: flex;
  max-height: min(88dvh, 860px);
  flex-direction: column;
  overflow: hidden;
  border-radius: 21px;
}

.modal {
  width: min(620px, 100%);
}

.deployment-result-modal {
  width: min(760px, 100%);
}

.engagement-modal {
  width: min(720px, 100%);
}

.modal-head,
.engagement-modal-head {
  flex: 0 0 auto;
  min-height: 68px;
  padding: 12px 18px 12px 22px;
}

.modal-body,
.engagement-modal-body {
  min-height: 0;
  flex: 1 1 auto;
  padding: var(--admin-space-5) 22px;
  overflow: auto;
  overscroll-behavior: contain;
}

.modal-foot,
.engagement-modal-foot {
  flex: 0 0 auto;
  padding: var(--admin-space-4) 22px;
}

.modal-close,
.engagement-modal-head button {
  display: grid;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
  min-height: 44px;
  padding: 0 !important;
  place-items: center;
}

.toast {
  max-width: min(380px, calc(100vw - 32px));
  border-radius: 13px;
  transition-duration: var(--admin-motion-base);
  transition-timing-function: var(--admin-ease);
}

.auth-card,
.auth-story,
.auth-shell {
  min-width: 0;
}

.auth-form input,
.auth-submit {
  min-height: var(--admin-control-lg);
}

@media (max-width: 1024px) {
  .main-content {
    padding: 22px 20px 34px;
  }
}

@media (max-width: 820px) {
  .main-content {
    padding: 18px 16px 30px;
  }

  .panel-head {
    align-items: stretch;
    gap: var(--admin-space-3);
  }

  .panel-head > :where(.tool-actions, .row-actions, .inline-form) {
    width: 100%;
  }

  .tool-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 620px) {
  :root {
    --admin-control-md: 44px;
    --admin-control-sm: 40px;
  }

  .main-content {
    padding: 14px 12px 26px;
  }

  .topbar {
    min-height: 64px;
    padding: 10px 12px;
  }

  .page-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .page-tools h2 {
    font-size: 20px;
  }

  .tool-actions,
  .top-actions {
    min-width: 0;
  }

  .tool-actions > :where(.button, .search-box),
  .modal-foot .button,
  .engagement-modal-foot .button {
    min-width: 0;
    flex: 1 1 auto;
  }

  .panel-head,
  .panel-body {
    padding-inline: 14px;
  }

  .modal-backdrop,
  .engagement-modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal,
  .engagement-modal {
    width: 100%;
    max-height: 92dvh;
    border-radius: 22px 22px 0 0;
  }

  .modal-head,
  .engagement-modal-head {
    min-height: 64px;
    padding: 10px 12px 10px 16px;
  }

  .modal-body,
  .engagement-modal-body {
    padding: 16px;
  }

  .modal-foot,
  .engagement-modal-foot {
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  }

  .toast {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    max-width: none;
  }
}

@media (max-width: 430px) {
  .form-grid,
  .result-grid,
  .content-shortcuts {
    grid-template-columns: 1fr;
  }

  .row-actions {
    flex-wrap: wrap;
  }

  .row-actions .button {
    flex: 1 1 auto;
  }

  .domain-footer,
  .collector-footer {
    align-items: stretch;
  }

  .domain-footer > :where(.row-actions, .tool-actions),
  .collector-footer > :where(.row-actions, .tool-actions) {
    flex-basis: 100%;
    justify-content: stretch;
  }

  .domain-footer :where(.row-actions, .tool-actions) .button,
  .collector-footer :where(.row-actions, .tool-actions) .button,
  .domain-footer > .button,
  .collector-footer > .button {
    flex: 1 1 120px;
  }
}

.builder-contact-settings { margin-top: 18px; }
.builder-contact-notice {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 20%, #dce5f4);
  border-radius: 14px;
  background: color-mix(in srgb, var(--primary) 6%, #fff);
}
.builder-contact-notice .nav-icon { width: 42px; height: 42px; }
.builder-contact-notice > div { display: grid; min-width: 0; gap: 2px; }
.builder-contact-notice strong { color: var(--text); font-size: 13px; }
.builder-contact-notice div span { color: var(--muted); font-size: 12px; line-height: 1.55; }
.builder-contact-settings input[readonly] { color: var(--muted); background: #f3f6fa; cursor: not-allowed; }

@media (max-width: 620px) {
  .builder-contact-settings { margin-top: 14px; }
  .builder-contact-notice { padding: 11px 12px; }
}

.status.pending {
  color: #58657a;
  background: #eef2f7;
}

.expiry-center {
  margin-bottom: 18px;
}

.expiry-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.expiry-alert-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(110px, .7fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.expiry-alert-row:last-child {
  border-bottom: 0;
}

.expiry-alert-row > span:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.expiry-alert-row small,
.expiry-alert-row time {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.portfolio-modal {
  width: min(900px, 100%);
}

.portfolio-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.portfolio-section-title > div,
.portfolio-domain-name {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.portfolio-section-title strong,
.portfolio-domain-name strong {
  color: var(--text);
  font-size: 14px;
}

.portfolio-section-title span,
.portfolio-domain-name span,
.portfolio-domain-row label > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.portfolio-domain-title {
  margin: 24px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.portfolio-domain-rows {
  display: grid;
  gap: 10px;
}

.portfolio-domain-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.25fr) repeat(3, minmax(120px, .85fr));
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8faff;
}

.portfolio-domain-row label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.portfolio-domain-row input {
  width: 100%;
  min-width: 0;
}

@media (max-width: 820px) {
  .expiry-alert-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .expiry-alert-row time {
    text-align: right;
  }

  .portfolio-domain-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .expiry-summary {
    justify-content: flex-start;
  }

  .expiry-alert-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .expiry-alert-row > .button {
    grid-column: 1 / -1;
  }

  .portfolio-domain-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
