:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbe3ec;
  --surface: #ffffff;
  --canvas: #f5f7fa;
  --navy: #111c2f;
  --navy-soft: #1e293b;
  --green: #059669;
  --green-dark: #047857;
  --green-pale: #ecfdf5;
  --red: #b91c1c;
  --red-pale: #fef2f2;
  --amber: #92400e;
  --amber-pale: #fffbeb;
  --radius: 14px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; margin: 0; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
::selection { background: #a7f3d0; color: #064e3b; }

.login-page { display: grid; min-height: 100vh; grid-template-columns: minmax(340px, 0.9fr) minmax(480px, 1.1fr); }
.login-story { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(36px, 6vw, 86px); background: var(--navy); color: white; }
.login-story::after { content: ""; position: absolute; right: -18%; bottom: -28%; width: 62%; aspect-ratio: 1; border: 1px solid rgba(52, 211, 153, .26); border-radius: 50%; box-shadow: 0 0 0 54px rgba(52, 211, 153, .055), 0 0 0 108px rgba(52, 211, 153, .035); }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: rgba(16, 185, 129, .14); border: 1px solid rgba(52, 211, 153, .38); color: #6ee7b7; font-size: 14px; letter-spacing: .04em; }
.story-copy { position: relative; z-index: 1; max-width: 620px; }
.story-copy h1 { max-width: 12ch; margin: 0 0 24px; font-size: clamp(40px, 5.4vw, 74px); line-height: .98; letter-spacing: -.04em; }
.story-copy p { max-width: 58ch; margin: 0; color: #cbd5e1; font-size: 17px; line-height: 1.7; }
.story-proof { position: relative; z-index: 1; display: flex; gap: 14px; align-items: center; color: #cbd5e1; font-size: 13px; }
.proof-line { width: 46px; height: 2px; background: #34d399; }
.login-form-shell { display: grid; place-items: center; padding: 32px; background: #fbfcfd; }
.login-form { width: min(430px, 100%); }
.login-form h2 { margin: 0 0 10px; font-size: 30px; letter-spacing: -.03em; }
.login-form > p { margin: 0 0 34px; color: var(--muted); line-height: 1.6; }

.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { font-size: 13px; font-weight: 700; color: #334155; }
.field input, .field select, .field textarea { width: 100%; min-height: 46px; padding: 11px 13px; color: var(--ink); background: white; border: 1px solid #cbd5e1; border-radius: 10px; outline: none; transition: border-color .16s, box-shadow .16s; }
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(5, 150, 105, .14); }
.field-hint { margin-top: -2px; color: var(--muted); font-size: 12px; }

.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; font-weight: 720; text-decoration: none; transition: background-color .16s, border-color .16s, transform .16s; }
.button:hover { transform: translateY(-1px); }
.button:focus-visible, a:focus-visible { outline: 3px solid rgba(5, 150, 105, .28); outline-offset: 2px; }
.button-primary { color: white; background: var(--green); }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { color: #334155; background: white; border-color: #cbd5e1; }
.button-secondary:hover { background: #f8fafc; border-color: #94a3b8; }
.button-danger { color: #991b1b; background: white; border-color: #fecaca; }
.button-full { width: 100%; }

.app-header { color: white; background: var(--navy); border-bottom: 1px solid #263449; }
.header-inner, .page { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-actions .button-secondary { color: #e2e8f0; background: #1e293b; border-color: #334155; }
.user-copy { text-align: right; }
.user-copy strong, .user-copy span { display: block; }
.user-copy span { margin-top: 3px; color: #94a3b8; font-size: 12px; }
.page { padding: 44px 0 70px; }
.page-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-title h1 { margin: 0 0 8px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.035em; }
.page-title p { margin: 0; color: var(--muted); line-height: 1.6; }
.section { margin-top: 34px; }
.section-heading { margin: 0 0 16px; font-size: 18px; letter-spacing: -.015em; }
.workspace-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: 22px 0; border-top: 1px solid var(--line); }
.workspace-line:last-child { border-bottom: 1px solid var(--line); }
.workspace-name { display: flex; align-items: center; gap: 14px; }
.workspace-letter { display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; color: #065f46; background: #d1fae5; font-weight: 800; }
.workspace-name h3 { margin: 0 0 5px; font-size: 16px; }
.workspace-meta { color: var(--muted); font-size: 13px; }
.workspace-actions { display: flex; align-items: center; gap: 8px; }
.empty-state { padding: 38px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.empty-state h3 { margin: 0 0 8px; }
.empty-state p { max-width: 60ch; margin: 0 0 20px; color: var(--muted); }
.notice { margin-bottom: 22px; padding: 14px 16px; border-radius: 12px; font-size: 14px; line-height: 1.5; border: 1px solid; }
.notice-success { color: #065f46; background: var(--green-pale); border-color: #a7f3d0; }
.notice-error { color: #991b1b; background: var(--red-pale); border-color: #fecaca; }
.notice-warning { color: #78350f; background: var(--amber-pale); border-color: #fde68a; }
.subscription-strip { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 19px; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.subscription-strip strong { display: block; margin-bottom: 3px; }
.subscription-strip span { color: var(--muted); font-size: 13px; }
.status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; padding: 7px 10px; border-radius: 999px; font-size: 12px; font-weight: 750; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-active, .status-trial { color: #047857; background: #d1fae5; }
.status-overdue { color: #92400e; background: #fef3c7; }
.status-suspended, .status-cancelled, .status-expired { color: #b91c1c; background: #fee2e2; }
.panel { padding: 24px; background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 28px rgba(15, 23, 42, .055); }
.panel h2 { margin: 0 0 22px; font-size: 20px; }
.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.admin-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 28px; align-items: start; }
.org-row { padding: 20px 0; border-top: 1px solid var(--line); }
.org-row:first-of-type { border-top: 0; padding-top: 0; }
.org-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 16px; }
.org-head h3 { margin: 0 0 5px; }
.org-head p { margin: 0; color: var(--muted); font-size: 13px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.quiet-link { color: #475569; font-size: 13px; text-underline-offset: 4px; }
.access-manager { margin-top: 14px; }
.access-list { display: grid; gap: 10px; margin-top: 14px; }
.access-row { display: grid; grid-template-columns: minmax(180px, 1.3fr) minmax(150px, .85fr) minmax(120px, .65fr) auto; gap: 12px; align-items: end; padding: 14px; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; }
.access-identity { align-self: center; min-width: 0; }
.access-identity strong, .access-identity span, .access-identity small { display: block; }
.access-identity span { margin-top: 4px; overflow: hidden; color: #475569; font-size: 13px; text-overflow: ellipsis; }
.access-identity small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.access-field { margin-bottom: 0; }
.access-field select { min-height: 42px; padding-block: 8px; }
.access-empty { margin: 0; color: var(--muted); font-size: 13px; }

.generator-context { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 9px max(16px, calc((100vw - 1280px) / 2)); color: #334155; background: #ecfdf5; border-bottom: 1px solid #a7f3d0; font-family: ui-sans-serif, system-ui, sans-serif; font-size: 12px; }
.generator-context strong { color: #065f46; }
.generator-context-actions { display: flex; align-items: center; gap: 12px; }
.generator-context a, .generator-context button { color: #065f46; font: inherit; font-weight: 700; background: none; border: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.generator-context form { margin: 0; }

@media (max-width: 860px) {
  .login-page { grid-template-columns: 1fr; }
  .login-story { min-height: 360px; padding: 36px 26px; }
  .story-copy h1 { font-size: 43px; }
  .login-form-shell { padding: 42px 24px; }
  .admin-layout, .grid-two { grid-template-columns: 1fr; }
  .access-row { grid-template-columns: 1fr; }
  .header-inner, .page { width: min(100% - 28px, 1180px); }
  .user-copy { display: none; }
  .page-title-row, .subscription-strip, .workspace-line { align-items: stretch; flex-direction: column; }
  .page-title-row { display: flex; }
  .workspace-line { display: grid; grid-template-columns: 1fr; }
  .workspace-actions { justify-content: flex-start; flex-wrap: wrap; }
  .generator-context { align-items: flex-start; flex-direction: column; }
}
