
:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --paper: #f7f8fa;
  --surface: #ffffff;
  --blue: #2457f5;
  --blue-deep: #173ec4;
  --green: #16825d;
  --red: #b42318;
  --sidebar: #0c111d;
  --sidebar-muted: #98a2b3;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); }
button, input, select { font: inherit; }
a { color: inherit; }

.shell { min-height: 100svh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100svh; padding: 26px 20px; color: #fff; background: var(--sidebar); display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; font-weight: 720; letter-spacing: -.025em; }
.brand-mark { width: 28px; height: 28px; border-radius: 9px; background: var(--blue); display: grid; place-items: center; font-size: 13px; font-weight: 800; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.workspace-label { margin: 44px 10px 10px; color: #667085; font-size: 10px; font-weight: 760; letter-spacing: .14em; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; min-height: 42px; margin: 2px 0; padding: 0 10px; border-radius: 9px; color: var(--sidebar-muted); text-decoration: none; font-size: 14px; transition: color .18s ease, background .18s ease, transform .18s ease; }
.nav-link:hover, .nav-link[aria-current="page"] { color: #fff; background: rgba(255,255,255,.075); transform: translateX(2px); }
.sidebar-foot { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-name { margin: 0; color: #fff; font-size: 13px; font-weight: 650; }
.sidebar-email { margin: 3px 0 14px; overflow: hidden; color: var(--sidebar-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.logout { padding: 0; border: 0; color: var(--sidebar-muted); background: transparent; cursor: pointer; font-size: 12px; }
.logout:hover { color: #fff; }

.main { min-width: 0; padding: 52px clamp(24px, 5vw, 72px) 72px; }
.main-inner { width: min(1160px, 100%); margin: 0 auto; }
.eyebrow { margin: 0 0 9px; color: var(--blue); font-size: 11px; font-weight: 780; letter-spacing: .14em; text-transform: uppercase; }
.page-title { margin: 0; font-size: clamp(31px, 4vw, 48px); line-height: 1.02; letter-spacing: -.05em; }
.page-intro { max-width: 620px; margin: 15px 0 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; }
.live-state { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(22,130,93,.1); }

.metrics { display: flex; flex-wrap: wrap; gap: 34px; margin: 44px 0 0; padding: 23px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric { min-width: 130px; }
.metric-value { display: block; font-size: 25px; font-weight: 720; letter-spacing: -.04em; }
.metric-label { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }

.notice { margin: 28px 0 0; padding: 12px 15px; border-left: 3px solid var(--green); color: #095c41; background: #ecfdf5; font-size: 13px; }
.notice.error { border-color: var(--red); color: #8f1f17; background: #fff1f0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
details.action-panel { position: relative; }
details.action-panel > summary { list-style: none; }
details.action-panel > summary::-webkit-details-marker { display: none; }
.action-sheet { position: absolute; z-index: 10; top: calc(100% + 9px); left: 0; width: min(420px, calc(100vw - 52px)); padding: 20px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); box-shadow: 0 18px 48px rgba(16,24,40,.14); transform-origin: top left; animation: sheet-in .16s ease-out; }
.action-sheet.wide { width: min(520px, calc(100vw - 52px)); }
.action-sheet.provision-sheet { width: min(680px, calc(100vw - 52px)); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(-5px) scale(.985); } to { opacity: 1; transform: none; } }
.sheet-title { margin: 0 0 5px; font-size: 17px; letter-spacing: -.02em; }
.sheet-copy { margin: 0 0 18px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field.full { grid-column: 1 / -1; }
label { display: block; margin-bottom: 6px; color: #344054; font-size: 11px; font-weight: 680; }
input, select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 9px; outline: none; color: var(--ink); background: #fff; font-size: 13px; transition: border-color .16s ease, box-shadow .16s ease; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36,87,245,.12); }
.form-actions { display: flex; justify-content: flex-end; margin-top: 18px; }

.button { display: inline-flex; min-height: 39px; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 1px solid var(--line-strong); border-radius: 9px; color: #344054; background: #fff; cursor: pointer; font-size: 12px; font-weight: 680; text-decoration: none; transition: transform .16s ease, border-color .16s ease, background .16s ease, color .16s ease; }
.button:hover { border-color: #98a2b3; transform: translateY(-1px); }
.button.primary { border-color: var(--blue); color: #fff; background: var(--blue); }
.button.primary:hover { border-color: var(--blue-deep); background: var(--blue-deep); }
.button-arrow { transition: transform .16s ease; }
.button:hover .button-arrow { transform: translateX(3px); }

.section { margin-top: 54px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin-bottom: 13px; }
.section-title { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.section-meta { color: var(--muted); font-size: 11px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 11px 12px; border-bottom: 1px solid var(--line-strong); color: var(--muted); font-size: 10px; font-weight: 740; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 17px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.data-table th:first-child, .data-table td:first-child { padding-left: 0; }
.data-table th:last-child, .data-table td:last-child { padding-right: 0; text-align: right; }
.data-row { animation: row-settle .38s both ease-out; }
.data-row:nth-child(2) { animation-delay: .04s; }
.data-row:nth-child(3) { animation-delay: .08s; }
.data-row:nth-child(4) { animation-delay: .12s; }
@keyframes row-settle { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.entity { display: flex; align-items: center; gap: 11px; }
.entity-mark { width: 32px; height: 32px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 9px; display: grid; place-items: center; color: var(--blue); background: #f5f7ff; font-size: 11px; font-weight: 800; }
.entity-name { display: block; font-weight: 660; }
.entity-sub { display: block; max-width: 300px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 6px; color: #344054; font-size: 11px; }
.status::before { content: ""; width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--green); }
.status.suspended::before, .status.failed::before { background: var(--red); }
.status.simulated::before, .status.pending::before { background: #f79009; }
.cell-note { display: block; max-width: 260px; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.empty { padding: 38px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.inline-form { display: inline; }
.row-actions { display: inline-flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.button.danger { border-color: #f0c2bd; color: var(--red); }
.button.danger:hover { border-color: var(--red); color: #fff; background: var(--red); }
.button[disabled] { opacity: .45; cursor: not-allowed; }
.button[disabled]:hover { transform: none; border-color: var(--line-strong); }
.hint { display: inline-flex; align-items: center; color: var(--muted); font-size: 12px; }

.panel-stack { display: grid; gap: 18px; margin-top: 30px; }
.panel { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel .section-title { margin: 0 0 6px; }
.panel .sheet-copy { margin-bottom: 16px; }
.panel code { padding: 2px 5px; border-radius: 5px; background: var(--paper); font-size: 12px; }
.code-block { margin: 0 0 18px; padding: 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: #0c111d; color: #e4e7ec; font-size: 12px; line-height: 1.7; }
.code-block code { padding: 0; background: none; color: inherit; font-size: inherit; white-space: pre; }
.live-dot.warn { background: #f79009; box-shadow: 0 0 0 4px rgba(247,144,9,.12); }
.field-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }
.field-hint code { padding: 1px 4px; border-radius: 4px; background: var(--paper); }

.progress-list { margin: 4px 0 18px; padding: 0; list-style: none; }
.progress-step { display: flex; align-items: center; gap: 11px; padding: 7px 0; color: var(--faint); font-size: 13px; }
.progress-dot { width: 9px; height: 9px; flex: 0 0 auto; border: 2px solid var(--line-strong); border-radius: 50%; }
.progress-step.done { color: var(--ink); }
.progress-step.done .progress-dot { border-color: var(--green); background: var(--green); }
.progress-step.active { color: var(--ink); font-weight: 620; }
.progress-step.active .progress-dot { border-color: var(--blue); background: var(--blue); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(36,87,245,.16); } }

.mail-meta { display: grid; gap: 8px; margin: 34px 0 20px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); background: var(--surface); font-size: 13px; }
.mail-meta strong { display: inline-block; min-width: 64px; color: var(--ink); }
.mail-preview { margin: 20px 0; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #f5f7fa; }
.mail-preview > * { margin-top: 0 !important; margin-bottom: 0 !important; }
.mail-open { margin-bottom: 16px; }

.site-list { margin-top: 34px; border-top: 1px solid var(--line-strong); }
.site-item { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(150px, .8fr) auto; gap: 24px; align-items: center; padding: 24px 0; border-bottom: 1px solid var(--line); animation: row-settle .38s both ease-out; }
.site-item:nth-child(2) { animation-delay: .05s; }
.site-item:nth-child(3) { animation-delay: .1s; }
.site-domain { color: var(--muted); font-size: 12px; }

.auth-page { min-height: 100svh; display: grid; grid-template-columns: minmax(330px, 42%) 1fr; background: #fff; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(32px, 7vw, 96px); }
.auth-brand { position: absolute; top: 32px; left: clamp(32px, 7vw, 96px); color: var(--ink); }
.auth-title { max-width: 460px; margin: 0; font-size: clamp(38px, 5vw, 64px); line-height: .98; letter-spacing: -.06em; }
.auth-copy { max-width: 440px; margin: 18px 0 30px; color: var(--muted); line-height: 1.65; }
.auth-form { width: min(420px, 100%); }
.auth-form .field { margin-top: 15px; }
.auth-form .button { width: 100%; margin-top: 20px; min-height: 46px; }
.auth-visual { position: relative; overflow: hidden; background: #0c111d; }
.auth-visual::before { content: ""; position: absolute; width: 72%; aspect-ratio: 1; top: 8%; left: 14%; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.018); }
.auth-visual::after { content: "CRM / CLOUD"; position: absolute; right: 8%; bottom: 8%; color: rgba(255,255,255,.82); font-size: clamp(40px, 8vw, 120px); font-weight: 760; letter-spacing: -.07em; line-height: .8; writing-mode: vertical-rl; transform: rotate(180deg); }
.auth-signal { position: absolute; top: 50%; left: 50%; width: 13px; height: 13px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 18px rgba(36,87,245,.16), 0 0 60px 25px rgba(36,87,245,.32); animation: signal 2.8s ease-in-out infinite; }
@keyframes signal { 50% { transform: scale(1.18); opacity: .78; } }
.auth-error { width: min(420px, 100%); margin: 0 0 10px; padding: 11px 13px; border-left: 3px solid var(--red); color: #8f1f17; background: #fff1f0; font-size: 12px; }

.oauth-list { display: grid; gap: 9px; width: min(420px, 100%); }
.oauth-button { width: 100%; min-height: 46px; gap: 10px; font-size: 13px; }
.oauth-icon { width: 17px; height: 17px; flex: 0 0 auto; }
.auth-divider { display: flex; align-items: center; gap: 12px; width: min(420px, 100%); margin: 22px 0 0; color: var(--faint); font-size: 10px; font-weight: 740; letter-spacing: .12em; text-transform: uppercase; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; padding: 18px 20px; flex-direction: row; align-items: center; gap: 16px; }
  .workspace-label, .sidebar-email { display: none; }
  .nav-link { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .sidebar-name { display: none; }
  .main { padding: 36px 20px 56px; }
  .page-head { display: block; }
  .live-state { margin-top: 20px; }
  .field-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .data-table th:nth-child(2), .data-table td:nth-child(2), .data-table th:nth-child(3), .data-table td:nth-child(3) { display: none; }
  .site-item { grid-template-columns: 1fr auto; gap: 12px; }
  .site-item .status { display: none; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100svh; padding: 92px 26px 40px; }
  .auth-brand { left: 26px; }
}

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