/* TomorrowTools — shadcn/ui design system (server-rendered) */

:root {
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 10% 6%;
  --card-foreground: 0 0% 98%;
  --popover: 240 10% 6%;
  --popover-foreground: 0 0% 98%;
  --primary: 142 71% 45%;
  --primary-foreground: 144 80% 10%;
  --secondary: 240 4% 16%;
  --secondary-foreground: 0 0% 98%;
  --muted: 240 4% 16%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 240 4% 16%;
  --accent-foreground: 0 0% 98%;
  --destructive: 0 62.8% 50%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 4% 16%;
  --input: 240 4% 16%;
  --ring: 142 71% 45%;
  --radius: 0.75rem;

  /* Legacy aliases (marketing base.html) */
  --surface-0: hsl(var(--background));
  --surface-1: hsl(var(--card));
  --surface-2: hsl(var(--secondary));
  --text-primary: hsl(var(--foreground));
  --text-secondary: hsl(var(--muted-foreground));
  --text-muted: hsl(var(--muted-foreground));
  --series-1: hsl(217 91% 60%);
  --series-5: hsl(var(--primary));
  --good: hsl(var(--primary));
  --critical: hsl(var(--destructive));
  --grid: hsl(var(--border));
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: hsl(var(--primary)); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Site marketing shell ── */
#tt-bg-network { position: fixed; inset: 0; z-index: 0; width: 100vw; height: 100vh; pointer-events: none; }
.site, .wrap, footer.site { position: relative; z-index: 1; }
.bg-network-tooltip {
  position: fixed; z-index: 2; pointer-events: none;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 4px); padding: 5px 10px;
  font-size: 12px; color: hsl(var(--muted-foreground));
  box-shadow: 0 6px 16px rgb(0 0 0 / 0.4);
}
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

header.site, .tt-site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 14px 24px;
  background: hsl(var(--background) / 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid hsl(var(--border));
}

.brand, .tt-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 15px;
  text-decoration: none; color: hsl(var(--foreground));
  letter-spacing: -0.02em;
}
.brand .dot, .tt-brand-dot {
  width: 8px; height: 8px; border-radius: 9999px;
  background: hsl(var(--primary));
  box-shadow: 0 0 10px hsl(var(--primary) / 0.5);
}

nav.top, .tt-nav {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
nav.top a, .tt-nav a {
  color: hsl(var(--muted-foreground));
  text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 6px 12px; border-radius: calc(var(--radius) - 4px);
  transition: color 0.15s, background 0.15s;
}
nav.top a:hover, nav.top a.active,
.tt-nav a:hover, .tt-nav a.active {
  color: hsl(var(--foreground));
  background: hsl(var(--accent));
  text-decoration: none;
}

.cta, .tt-btn, .tt-btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 2.25rem; padding: 0 16px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 14px; font-weight: 500; text-decoration: none;
  cursor: pointer; border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, filter 0.15s;
}
.cta, .tt-btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.cta:hover, .tt-btn-primary:hover { filter: brightness(1.06); text-decoration: none; }
.cta.secondary, .tt-btn-outline {
  background: transparent;
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
}
.cta.secondary:hover, .tt-btn-outline:hover {
  background: hsl(var(--accent));
  text-decoration: none;
}

.layout { display: block; }
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.in { opacity: 1; transform: none; }

.page-header { padding: 48px 0 28px; }
.page-header h1 {
  font-size: clamp(2rem, 4vw, 2.5rem);
  line-height: 1.15; margin: 0 0 12px; letter-spacing: -0.03em; font-weight: 600;
}
.page-header p.sub { font-size: 17px; color: hsl(var(--muted-foreground)); max-width: 620px; margin: 0; }

section { padding: 40px 0; border-top: 1px solid hsl(var(--border)); }
section:first-of-type { border-top: none; }
section h2 { font-size: 1.5rem; margin: 0 0 12px; letter-spacing: -0.02em; font-weight: 600; }
section p.lead { font-size: 15px; color: hsl(var(--muted-foreground)); max-width: 620px; margin: 0 0 24px; }

.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 800px) { .feature-grid { grid-template-columns: 1fr; } }

.feature-card, .tt-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.2s;
}
.feature-card:hover { border-color: hsl(var(--primary) / 0.4); }
.feature-card h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.feature-card p { margin: 0; color: hsl(var(--muted-foreground)); font-size: 14px; }
.feature-card .ico {
  width: 36px; height: 36px; border-radius: calc(var(--radius) - 4px);
  background: hsl(var(--secondary)); display: flex; align-items: center;
  justify-content: center; margin-bottom: 14px; font-size: 18px;
}

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 800px) { .steps { grid-template-columns: 1fr; } }
.step {
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius); padding: 24px;
}
.step .num {
  width: 32px; height: 32px; border-radius: calc(var(--radius) - 4px);
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; margin-bottom: 12px;
}
.step h3 { margin: 0 0 8px; font-size: 16px; }
.step p { margin: 0; color: hsl(var(--muted-foreground)); font-size: 14px; }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.pill, .tt-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 9999px;
  font-size: 12px; font-weight: 500;
  background: hsl(var(--secondary));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
}

.faq-item { border-bottom: 1px solid hsl(var(--border)); padding: 16px 0; }
.faq-item summary {
  cursor: pointer; font-weight: 500; font-size: 15px;
  list-style: none; display: flex; justify-content: space-between;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item p { color: hsl(var(--muted-foreground)); margin: 12px 0 0; font-size: 14px; }

.code-block {
  background: hsl(var(--background)); border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px); padding: 16px;
  font-family: ui-monospace, monospace; font-size: 13px;
  color: hsl(var(--muted-foreground)); overflow-x: auto;
}

footer.site, .tt-site-footer {
  border-top: 1px solid hsl(var(--border));
  padding: 32px 0; margin-top: 40px;
}
footer.site .foot-row, .tt-site-footer .foot-row {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
}
footer.site .foot-links { display: flex; gap: 20px; }
footer.site .foot-links a, footer.site small { color: hsl(var(--muted-foreground)); font-size: 13px; text-decoration: none; }

/* ── App shell (portal / hub) ── */
body.tt-app, body.tt-auth {
  min-height: 100vh;
  background-color: hsl(var(--background));
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, hsl(var(--primary) / 0.1), transparent),
    radial-gradient(ellipse 50% 40% at 100% 100%, hsl(217 91% 60% / 0.06), transparent);
}

.tt-app-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 20px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background) / 0.9);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 40;
}

.tt-app-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 53px);
}
@media (max-width: 768px) {
  .tt-app-layout { grid-template-columns: 1fr; }
  .tt-sidebar { display: none; }
}

.tt-sidebar {
  border-right: 1px solid hsl(var(--border));
  padding: 16px 12px;
  background: hsl(var(--card) / 0.5);
}
.tt-sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.tt-sidebar a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: calc(var(--radius) - 4px);
  font-size: 14px; font-weight: 500;
  color: hsl(var(--muted-foreground)); text-decoration: none;
}
.tt-sidebar a:hover, .tt-sidebar a.active {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
}

.tt-app-main, .tt-auth-shell {
  padding: 24px;
  max-width: 900px;
  width: 100%;
}
.tt-auth-shell {
  max-width: none;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}

.tt-page-head { margin-bottom: 8px; }
.tt-page-desc { margin: 0 0 24px; color: hsl(var(--muted-foreground)); font-size: 14px; }

.tt-card-header { padding: 1.5rem 1.5rem 0; }
.tt-card-title { margin: 0 0 6px; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; }
.tt-card-description { margin: 0; font-size: 0.875rem; color: hsl(var(--muted-foreground)); line-height: 1.5; }
.tt-card-content { padding: 1.5rem; }
.tt-card-footer { padding: 0 1.5rem 1.5rem; display: flex; flex-direction: column; gap: 12px; }

.tt-auth-brand {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 1.5rem; font-weight: 600; font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}
.tt-auth-brand-dot {
  width: 8px; height: 8px; border-radius: 9999px;
  background: hsl(var(--primary));
  box-shadow: 0 0 12px hsl(var(--primary) / 0.5);
}

.tt-auth .tt-card { width: 100%; max-width: 400px; box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.45); }

.tt-alert {
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--destructive) / 0.5);
  background: hsl(var(--destructive) / 0.1);
  color: hsl(var(--destructive-foreground));
  padding: 12px 16px; font-size: 0.875rem; margin-bottom: 16px;
}
.tt-alert-destructive { border-color: hsl(var(--destructive) / 0.5); }

.tt-muted {
  font-size: 0.75rem; color: hsl(var(--muted-foreground));
  text-align: center; margin-top: 12px; line-height: 1.5;
}
.tt-link { color: hsl(var(--primary)); font-size: 0.875rem; font-weight: 500; text-decoration: none; }
.tt-link:hover { text-decoration: underline; }

/* Hub */
.tt-hub { min-height: 100vh; padding: 24px 20px 48px; max-width: 1100px; margin: 0 auto; }
.tt-hub-header {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: 16px; margin-bottom: 32px;
}
.tt-hub-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
}
.tt-product-card {
  border-radius: var(--radius); border: 1px solid hsl(var(--border));
  background: hsl(var(--card)); padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  transition: border-color 0.15s;
}
.tt-product-card:hover { border-color: hsl(var(--primary) / 0.35); }
.tt-product-card.locked { opacity: 0.55; }
.tt-product-card h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.tt-product-card p { margin: 0; font-size: 0.8125rem; color: hsl(var(--muted-foreground)); flex: 1; }
.tt-section-title {
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: hsl(var(--muted-foreground));
  margin: 32px 0 12px;
}

/* Forms */
label.tt-label, .grid label {
  display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 12px;
}
.tt-input, input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%; margin-top: 6px;
  height: 2.5rem; padding: 0 12px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 0.875rem;
}
textarea { min-height: 100px; padding: 10px 12px; height: auto; }
.tt-input:focus, input:focus, textarea:focus {
  outline: none; border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.25);
}

.grid { display: grid; gap: 12px; }
@media (min-width: 640px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .grid label:first-child { grid-column: 1 / -1; }
}

.btn, button.tt-btn {
  border: 0; border-radius: calc(var(--radius) - 2px);
  padding: 0 16px; height: 2.5rem;
  font-size: 0.875rem; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.primary, button.tt-btn-primary {
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
}
.btn.primary:hover { filter: brightness(1.05); }
.btn:disabled, .tt-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.danger, .tt-btn-destructive {
  background: hsl(var(--destructive) / 0.15);
  color: hsl(var(--destructive));
  border: 1px solid hsl(var(--destructive) / 0.3);
}
.btn.linkish, .tt-btn-ghost {
  background: transparent; color: hsl(var(--muted-foreground));
  padding: 0; height: auto; border: none;
}
.btn.linkish:hover { color: hsl(var(--foreground)); }

/* Tables / lists */
.tt-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.tt-table th, .tt-table td {
  text-align: left; padding: 10px 12px;
  border-bottom: 1px solid hsl(var(--border));
}
.tt-table th { color: hsl(var(--muted-foreground)); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }

.user-list { list-style: none; padding: 0; margin: 0; }
.user-list li {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 12px 0; border-bottom: 1px solid hsl(var(--border));
}
.user-list.compact li { font-size: 0.875rem; }
.pill.pending { background: hsl(45 90% 50% / 0.15); color: hsl(45 90% 60%); border: 1px solid hsl(45 90% 50% / 0.3); }
.pill.approved { background: hsl(var(--primary) / 0.15); color: hsl(var(--primary)); border: 1px solid hsl(var(--primary) / 0.3); }
.pill.rejected { background: hsl(var(--destructive) / 0.15); color: hsl(var(--destructive)); border: 1px solid hsl(var(--destructive) / 0.3); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Wizard / portal */
.shell { max-width: 900px; margin: 0 auto; }
.wizard .step, .card { margin-bottom: 16px; }
.wizard .step h2, .card h2 { margin: 0 0 16px; font-size: 1.1rem; font-weight: 600; }
.hint { color: hsl(var(--muted-foreground)); font-size: 0.875rem; }
.lede, .hero .lede { color: hsl(var(--muted-foreground)); font-size: 1rem; }
.hero .eyebrow { color: hsl(var(--primary)); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.75rem; font-weight: 600; }
.hero h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); margin: 0 0 12px; font-weight: 600; letter-spacing: -0.03em; }
.wizard-head { margin-bottom: 24px; }
.wizard-head h1 { margin: 0 0 8px; }
.wizard-head p { margin: 4px 0; color: hsl(var(--muted-foreground)); font-size: 0.875rem; }

.preview-box {
  margin-top: 16px; border: 1px solid hsl(var(--border));
  border-radius: var(--radius); overflow: hidden;
  background: hsl(var(--background));
}
.preview-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: hsl(var(--card));
  border-bottom: 1px solid hsl(var(--border)); font-size: 0.875rem;
}
.preview-pages {
  max-height: 70vh; overflow: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 12px; align-items: center;
}
.preview-pages img {
  width: 100%; max-width: 640px; border: 1px solid hsl(var(--border));
  border-radius: 4px; background: #fff;
}
.scores { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.score-pill {
  background: hsl(var(--secondary)); border: 1px solid hsl(var(--border));
  border-radius: 9999px; padding: 4px 12px; font-size: 0.8125rem;
}
.status { color: hsl(var(--muted-foreground)); margin-top: 8px; font-size: 0.875rem; }
.error { color: hsl(var(--destructive)); }
.success { color: hsl(var(--primary)); }
.hidden { display: none !important; }
.log {
  margin-top: 12px; padding: 12px; background: hsl(var(--background));
  border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) - 2px);
  overflow: auto; max-height: 240px; font-size: 0.8rem;
  font-family: ui-monospace, monospace;
}
.checklist { padding-left: 1.25rem; }
.checklist li { margin: 6px 0; color: hsl(var(--muted-foreground)); }
.fine-print { color: hsl(var(--muted-foreground)); font-size: 0.875rem; }

.tt-separator { height: 1px; background: hsl(var(--border)); margin: 16px 0; }

.tt-avatar {
  width: 40px; height: 40px; border-radius: 9999px;
  border: 2px solid hsl(var(--border)); object-fit: cover;
}
.tt-hub-user {
  display: flex; align-items: center; gap: 14px; margin-top: 8px;
}

/* Wizard stepper */
.tt-stepper {
  display: flex; gap: 8px; margin-bottom: 28px; flex-wrap: wrap;
}
.tt-stepper-item {
  flex: 1; min-width: 120px;
  padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card) / 0.6);
  font-size: 0.8125rem; color: hsl(var(--muted-foreground));
}
.tt-stepper-item strong {
  display: block; color: hsl(var(--foreground));
  font-size: 0.875rem; margin-bottom: 2px;
}
.tt-stepper-item.active {
  border-color: hsl(var(--primary) / 0.5);
  background: hsl(var(--primary) / 0.08);
  color: hsl(var(--primary));
}
.tt-stepper-item.active strong { color: hsl(var(--primary)); }
.tt-stepper-item.done {
  border-color: hsl(var(--primary) / 0.35);
}
.tt-stepper-item.done strong::after {
  content: " ✓"; font-size: 0.75rem;
}

.tt-step-card {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  margin-bottom: 20px;
  overflow: hidden;
}
.tt-step-card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 20px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--secondary) / 0.35);
}
.tt-step-card-header h2 {
  margin: 0; font-size: 1rem; font-weight: 600;
}
.tt-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: calc(var(--radius) - 4px);
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  font-size: 0.8125rem; font-weight: 600; flex-shrink: 0;
}
.tt-step-card-body { padding: 20px; }

.tt-file-drop {
  border: 2px dashed hsl(var(--border));
  border-radius: var(--radius);
  padding: 24px; text-align: center;
  background: hsl(var(--background) / 0.5);
  transition: border-color 0.15s;
}
.tt-file-drop:hover { border-color: hsl(var(--primary) / 0.4); }
.tt-file-drop input[type="file"] { margin-top: 8px; width: 100%; }

/* Admin dashboard */
.tt-stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.tt-stat-card {
  padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
}
.tt-stat-card .label {
  font-size: 0.75rem; color: hsl(var(--muted-foreground));
  text-transform: uppercase; letter-spacing: 0.06em;
}
.tt-stat-card .value {
  font-size: 1.75rem; font-weight: 600; margin-top: 4px;
  letter-spacing: -0.03em;
}
.tt-stat-card.warn .value { color: hsl(45 90% 55%); }
.tt-stat-card.ok .value { color: hsl(var(--primary)); }

.tt-empty {
  text-align: center; padding: 40px 20px;
  color: hsl(var(--muted-foreground)); font-size: 0.875rem;
}
.tt-empty-icon {
  width: 48px; height: 48px; margin: 0 auto 12px;
  border-radius: 9999px; border: 1px solid hsl(var(--border));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
}

.tt-pending-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px; border-radius: var(--radius);
  border: 1px solid hsl(var(--border)); background: hsl(var(--background));
  margin-bottom: 10px;
}
.tt-pending-card:last-child { margin-bottom: 0; }
.tt-pending-meta strong { display: block; font-size: 0.9375rem; }
.tt-pending-meta span { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
