:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef2f8;
  color: #172033;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 38%) minmax(420px, 1fr);
  background: #fff;
}

.brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(40px, 8vw, 110px);
  color: #fff;
  background:
    radial-gradient(circle at 15% 10%, rgba(93, 144, 255, .45), transparent 36%),
    radial-gradient(circle at 85% 85%, rgba(31, 188, 142, .22), transparent 30%),
    #172b5b;
}

.eyebrow, .section-label {
  margin: 0 0 16px;
  color: #75a0ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
}

h1 { margin: 0; font-size: clamp(48px, 6vw, 82px); line-height: .95; letter-spacing: -.05em; }
.lead { max-width: 460px; margin: 28px 0; color: rgba(255,255,255,.72); font-size: 20px; line-height: 1.55; }
.service-status { display: flex; align-items: center; gap: 10px; margin-top: 28px; color: rgba(255,255,255,.78); font-size: 14px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.status-dot.pending { background: #f3ad32; box-shadow: 0 0 0 5px rgba(243,173,50,.16); }
.status-dot.ready { background: #38d6a9; box-shadow: 0 0 0 5px rgba(56,214,169,.16); }
.status-dot.failed { background: #ff6f87; box-shadow: 0 0 0 5px rgba(255,111,135,.16); }

.workspace { display: grid; place-items: center; min-height: 100vh; padding: clamp(28px, 7vw, 92px); background: #f7f9fc; }
.view { width: min(1040px, 100%); }
.auth-view { max-width: 480px; }
.loading-view { text-align: center; color: #70798a; }
.spinner { width: 38px; height: 38px; margin: 0 auto; border: 3px solid #dfe5ef; border-top-color: #3566ff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
h2 { margin: 0; font-size: clamp(36px, 5vw, 54px); letter-spacing: -.04em; }
h3 { margin: 0; font-size: 25px; letter-spacing: -.025em; }
.muted { margin: 14px 0 28px; color: #6b7586; line-height: 1.55; }

.form-stack { display: grid; gap: 20px; margin-top: 30px; }
.form-grid { display: grid; grid-template-columns: 1fr 180px; gap: 16px; margin-top: 24px; }
.form-grid button { grid-column: 1 / -1; width: fit-content; }
label { display: grid; gap: 8px; color: #343d4d; font-size: 14px; font-weight: 700; }
label small, .invite-result small { color: #818a99; font-weight: 400; }
input, select {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  color: #172033;
  border: 1px solid #d9e0eb;
  border-radius: 12px;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: #3566ff; box-shadow: 0 0 0 4px rgba(53,102,255,.1); }
button {
  min-height: 50px;
  padding: 0 24px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: #3566ff;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s, opacity .15s;
}
button:hover { transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-secondary { color: #354052; border: 1px solid #d9e0eb; background: #fff; }
.button-secondary.compact { min-height: 42px; padding: 0 16px; font-size: 14px; }
.form-message { margin: 0; padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.form-message.error { color: #a92c43; background: #fff0f3; }
.form-message.success { color: #167657; background: #ebfaf4; }
.text-button { min-height: 38px; margin-top: 16px; padding: 0; color: #3566ff; background: transparent; font-weight: 700; }
.text-button:hover { transform: none; text-decoration: underline; }

.dashboard-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.welcome-card { display: flex; gap: 15px; margin-top: 34px; padding: 20px; border: 1px solid #dff0ea; border-radius: 16px; background: #f1fbf7; }
.welcome-card p { margin: 5px 0 0; color: #63736d; }
.welcome-icon { display: grid; place-items: center; flex: 0 0 32px; height: 32px; border-radius: 50%; color: #fff; background: #1fbc8e; font-weight: 900; }
.admin-panel { margin-top: 28px; padding: 28px; border: 1px solid #e0e6ef; border-radius: 20px; background: #fff; box-shadow: 0 14px 40px rgba(23,32,51,.06); }
.panel-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.heading-actions { display: flex; align-items: center; gap: 10px; }
.role-badge { padding: 7px 10px; border-radius: 999px; color: #234ac0; background: #eaf0ff; font-size: 12px; font-weight: 800; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 28px; }
.metrics div { padding: 18px; border-radius: 14px; background: #f5f7fb; }
.metrics strong { display: block; font-size: 28px; letter-spacing: -.04em; }
.metrics span { color: #747e8f; font-size: 13px; }
.admin-section { margin-top: 34px; padding-top: 28px; border-top: 1px solid #e8ecf2; }
.admin-section h4 { margin: 0; font-size: 19px; }
.invite-result { margin-top: 20px; padding: 16px; border-radius: 12px; background: #f5f7fb; }
.invite-result p { margin: 0 0 12px; color: #535d6f; font-size: 14px; }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-bottom: 10px; }
.copy-row input { min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.table-wrap { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 10px 8px; color: #7b8494; border-bottom: 1px solid #e5eaf1; text-align: left; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
td { padding: 14px 8px; border-bottom: 1px solid #edf0f4; vertical-align: top; }
td strong, td small { display: block; }
td small { margin-top: 4px; color: #7b8494; }
.table-select { width: auto; min-height: 34px; padding: 0 28px 0 9px; border-radius: 8px; font-size: 12px; }
.badge { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge.good { color: #127154; background: #e5f8f1; }
.badge.bad { color: #a92c43; background: #ffedf1; }
.badge.neutral { color: #596476; background: #edf1f6; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 150px; }
.mini-button { min-height: 32px; padding: 0 9px; border-radius: 8px; font-size: 11px; }
.mini-button.secondary { color: #465166; border: 1px solid #dce2eb; background: #fff; }
.empty-state { margin: 16px 0 0; color: #818a99; }
.audit-list { display: grid; margin-top: 14px; }
.audit-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; border-bottom: 1px solid #edf0f4; }
.audit-item strong, .audit-item small { display: block; }
.audit-item small { margin-top: 3px; color: #7b8494; }
.audit-item time { flex: 0 0 auto; color: #7b8494; font-size: 12px; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .brand-panel { min-height: auto; padding: 36px 26px; }
  .brand-panel h1 { font-size: 42px; }
  .brand-panel h1 br { display: none; }
  .lead { margin: 16px 0 0; font-size: 16px; }
  .service-status { margin-top: 18px; }
  .workspace { min-height: calc(100vh - 240px); padding: 42px 24px; }
  .form-grid { grid-template-columns: 1fr; }
  .dashboard-header { flex-direction: column; }
  .copy-row { grid-template-columns: 1fr; }
  .admin-panel { padding: 20px; }
  .panel-heading { flex-direction: column; }
  .metrics { grid-template-columns: 1fr; }
  .row-actions { min-width: 130px; }
}
