:root {
  color-scheme: light;
  --paper: #f3f5f2;
  --paper-card: #ffffff;
  --ink: #142322;
  --ink-secondary: #4a5c59;
  --muted: #6f7f7c;
  --teal: #17645c;
  --teal-deep: #0f3632;
  --teal-light: #e5efec;
  --amber: #c8832a;
  --amber-soft: #fcf4e8;
  --line: #d3dbd7;
  --line-strong: #a8b8b2;
  --error: #b91c1c;
  --error-bg: #fef2f2;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'DM Mono', monospace;
  --font-editorial: 'Newsreader', Georgia, serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 4px 24px -2px rgba(18, 63, 58, 0.08), 0 1px 4px rgba(18, 63, 58, 0.04);
  --shadow-input: 0 1px 2px rgba(18, 63, 58, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.08;
  z-index: 10;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.13'/%3E%3C/svg%3E");
}

.wrap {
  width: min(100% - 48px, 1120px);
  margin-inline: auto;
}

/* Header */
.portal-header {
  border-bottom: 1px solid var(--line);
  background: rgba(243, 245, 242, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
}

.brand-mark i {
  display: block;
  width: 4px;
  border-radius: 1px;
  background: var(--teal);
}
.brand-mark i:nth-child(1) { height: 11px; }
.brand-mark i:nth-child(2) { height: 18px; background: var(--teal-deep); }
.brand-mark i:nth-child(3) { height: 14px; background: var(--amber); }

.wordmark {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.wordmark span {
  color: var(--teal);
  font-weight: 500;
  margin-left: 2px;
}

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-link:hover {
  color: var(--teal);
}

/* Main Layout */
.main-content {
  flex: 1;
  padding: 60px 0;
  display: flex;
  align-items: center;
}

.portal-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 40px;
  align-items: start;
}

/* Card */
.portal-card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 44px 48px;
  box-shadow: var(--shadow-card);
}

.card-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: 14px;
}

.eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
}

.card-title {
  font-family: var(--font-editorial);
  font-size: 34px;
  line-height: 1.2;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}

.card-subtitle {
  font-size: 15px;
  color: var(--ink-secondary);
  margin-bottom: 30px;
  line-height: 1.6;
}

/* Form */
.workspace-form {
  margin-bottom: 28px;
}

.input-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.input-group {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--paper-card);
  transition: border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
  box-shadow: var(--shadow-input);
}

.input-group:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 100, 92, 0.18);
}

.workspace-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 500;
  padding: 14px 16px;
  color: var(--ink);
  background: transparent;
}

.workspace-input::placeholder {
  color: #a4b3ae;
}

.input-suffix {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--muted);
  background: #f7f9f7;
  padding: 14px 18px;
  border-left: 1px solid var(--line);
  user-select: none;
}

.preview-bar {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  font-family: var(--font-mono);
  padding: 6px 4px;
}

.preview-bar strong {
  color: var(--teal-deep);
  font-weight: 600;
}

.error-banner {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--error-bg);
  border: 1px solid #fecaca;
  color: var(--error);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}

.submit-button {
  width: 100%;
  margin-top: 20px;
  padding: 15px 24px;
  background: var(--teal-deep);
  color: #ffffff !important;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none !important;
  transition: background 0.15s, transform 0.08s ease;
}

.submit-button:hover {
  background: var(--teal);
}

.submit-button:active {
  transform: translateY(1px);
}

.btn-arrow {
  font-size: 17px;
  transition: transform 0.15s ease;
}

.submit-button:hover .btn-arrow {
  transform: translateX(4px);
}

/* Recent Workspaces */
.recent-workspaces {
  border-top: 1px dashed var(--line);
  padding-top: 20px;
  margin-top: 20px;
}

.recent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.clear-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
}

.clear-btn:hover {
  color: var(--error);
}

.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recent-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f1f4f2;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.recent-item:hover {
  background: var(--teal-light);
  border-color: var(--teal);
  color: var(--teal-deep);
}

/* Right Sidebar */
.info-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.info-box {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
}

.architecture-box {
  background: #f7f9f7;
  border-color: #cad8d2;
}

.box-icon {
  font-size: 24px;
  margin-bottom: 12px;
}

.info-box h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
}

.info-box p {
  font-size: 13.5px;
  color: var(--ink-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.features-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.features-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}

.features-list span {
  color: var(--teal);
  font-weight: 700;
}

.help-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-links a {
  font-size: 13px;
  color: var(--teal);
  text-decoration: none;
  font-weight: 500;
}

.help-links a:hover {
  text-decoration: underline;
}

/* Footer */
.portal-footer {
  border-top: 1px solid var(--line);
  padding: 24px 0;
  margin-top: auto;
  font-size: 13px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-right a {
  color: var(--ink-secondary);
  text-decoration: none;
}

.footer-right a:hover {
  color: var(--teal);
}

/* =========================================
   Sorry Page Styles
   ========================================= */
.sorry-wrap {
  width: min(100% - 32px, 620px) !important;
  margin-inline: auto;
}

.sorry-card {
  padding: 44px 48px;
}

.eyebrow-warning {
  color: #b45309 !important;
}

.dot-warning {
  background: #f59e0b !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

.notfound-callout {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fffbeb !important;
  border: 1.5px solid #fde68a !important;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 26px;
}

.callout-icon {
  font-size: 24px;
  line-height: 1;
}

.callout-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.callout-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #92400e;
  font-weight: 600;
}

.callout-domain {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: #78350f;
  word-break: break-all;
}

.callout-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 5px 12px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 20px;
  white-space: nowrap;
}

.troubleshoot-box {
  background: #f8faf8 !important;
  border: 1px solid #dce5e0 !important;
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 30px;
}

.troubleshoot-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.troubleshoot-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.troubleshoot-list li {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-secondary);
  position: relative;
  padding-left: 22px;
}

.troubleshoot-list li::before {
  content: "•";
  position: absolute;
  left: 6px;
  color: var(--teal);
  font-size: 20px;
  line-height: 1;
}

.troubleshoot-list code {
  font-family: var(--font-mono);
  background: #e6ede8;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--teal-deep);
  font-weight: 500;
}

.troubleshoot-list a {
  color: var(--teal);
  text-decoration: underline;
  font-weight: 500;
}

.troubleshoot-list a:hover {
  color: var(--teal-deep);
}

.sorry-actions {
  display: flex;
  gap: 14px;
  align-items: center;
}

.retry-btn {
  flex: 1.3;
  margin-top: 0;
}

.secondary-btn {
  flex: 1;
  padding: 14px 20px;
  background: #ffffff;
  border: 1.5px solid #c2cec8;
  color: var(--ink) !important;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.secondary-btn:hover {
  border-color: var(--teal);
  background: var(--teal-light);
  color: var(--teal-deep) !important;
}

/* Responsive */
@media (max-width: 900px) {
  .portal-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .portal-card {
    padding: 32px 24px;
  }
  .card-title {
    font-size: 28px;
  }
}

@media (max-width: 640px) {
  .sorry-card {
    padding: 32px 20px;
  }
  .card-title {
    font-size: 26px;
  }
  .notfound-callout {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .callout-badge {
    align-self: flex-start;
  }
  .sorry-actions {
    flex-direction: column;
  }
  .submit-button, .secondary-btn {
    width: 100%;
    flex: none;
  }
}

/* Subtle Environment & Version Indicator */
.corner-badge {
  position: fixed;
  bottom: 12px;
  right: 16px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: rgba(18, 63, 58, 0.7);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(18, 63, 58, 0.18);
  border-radius: 6px;
  padding: 3px 8px;
  pointer-events: none;
  z-index: 999;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

