/* Global styles */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --steel-blue:  #4A90E2;
  --steel-dark:  #2E5C8A;
  --black:       #111111;
  --gray-900:    #1a1a1a;
  --gray-800:    #2a2a2a;
  --gray-200:    #e5e5e5;
  --gray-100:    #f5f5f5;
  --white:       #ffffff;
  --text:        #1a1a1a;
  --text-muted:  #6b6b6b;
  --radius:      10px;
  --shadow:      0 4px 24px rgba(0,0,0,0.10);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--gray-100);
  min-height: 100vh;
}

/* Home Page */

.home-body {
  background: var(--white);
}

.home-nav {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 0;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.home-logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--black);
  letter-spacing: -0.02em;
}

.nav-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 5rem 1.5rem;
  text-align: center;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
}

.hero-eyebrow {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hero-headline {
  font-family: 'DM Serif Display', serif;
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--black);
  letter-spacing: -0.02em;
}

.hero-headline em {
  font-style: italic;
  display: block;
}

.hero-sub {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.hero-rule {
  width: 60px;
  height: 2px;
  background: var(--steel-blue);
  margin-top: 2rem;
}

/* Sections */

.section-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section-inner.center {
  text-align: center;
}

.mission {
  background: var(--gray-100);
  padding: 4rem 1.5rem;
}

.mission-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 3rem;
  align-items: start;
}

.mission-label {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--black);
}

.mission-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.mission-body p {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
}

/* Features */

.features {
  padding: 4rem 1.5rem;
}

.section-title {
  font-family: 'DM Serif Display', serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--black);
  text-align: center;
  margin-bottom: 3rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.feat-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.feat-icon {
  font-size: 2.5rem;
}

.feat-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--black);
}

.feat-card p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Bottom CTA */

.bottom-cta {
  background: var(--black);
  color: var(--white);
  padding: 4rem 1.5rem;
  text-align: center;
}

.bottom-cta h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  margin-bottom: 1rem;
}

.bottom-cta p {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

/* Footer */

.home-footer {
  background: var(--gray-100);
  border-top: 1px solid var(--gray-200);
  padding: 2rem 1.5rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-logo {
  font-size: 1.25rem;
  font-weight: 700;
}

.footer-copy {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Auth pages */

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--black) 0%, var(--gray-900) 100%);
  padding: 1.5rem;
}

.auth-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.auth-logo {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--black);
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
  text-align: center;
}

.logo-v {
  color: var(--steel-blue);
}

.auth-tagline {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}

/* Forms */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.optional {
  color: var(--text-muted);
  font-weight: 400;
}

.form-group input {
  padding: 0.65rem 0.875rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s;
  outline: none;
  width: 100%;
}

.form-group input:focus {
  border-color: var(--steel-blue);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
  background: var(--steel-blue);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--steel-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--text-muted);
}

.btn-ghost:hover {
  background: var(--gray-100);
}

.btn-outline {
  background: transparent;
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,0.4);
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

.btn-outline:hover {
  background: rgba(255,255,255,0.1);
}

.btn-full {
  width: 100%;
  margin-top: 0.5rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1.5px solid #fca5a5;
}

.btn-danger:hover {
  background: #fecaca;
  border-color: #f87171;
}

.btn-lg {
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
}

/* Messages */

.message-box {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.message-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.message-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.message-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.auth-footer {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
}

.auth-footer a {
  color: var(--steel-blue);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Dashboard */

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--gray-100);
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.topbar-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--black);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.logo-mark {
  color: var(--steel-blue);
  font-weight: 800;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.role-badge {
  display: inline-block;
  padding: 0.4rem 0.875rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.role-owner {
  background: #dbeafe;
  color: #1e40af;
}

.role-manager {
  background: #fef3c7;
  color: #92400e;
}

.role-technician {
  background: #dcfce7;
  color: #166534;
}

.topbar-email {
  font-size: 0.875rem;
  color: var(--text-muted);
  min-width: 180px;
}

.topbar-right form {
  margin: 0;
}

.dashboard-main {
  flex: 1;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.dashboard-main > * {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.welcome-card {
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.welcome-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.welcome-card h1 {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.welcome-sub {
  color: rgba(255,255,255,0.7);
  font-size: 0.95rem;
  margin: 0;
}

.widget-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.widget {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  color: inherit;
}

a.widget:hover {
  border-color: var(--steel-blue);
  box-shadow: 0 2px 12px rgba(74,127,165,0.15);
}

.widget-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--steel-blue);
  margin: 0;
}

.widget-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  margin: 0;
}

.section-header {
  margin-bottom: 1.5rem;
  margin-top: 2rem;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
}

.feature-card:not(.coming-soon):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.feature-icon {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.badge {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 99px;
  background: var(--gray-100);
  color: var(--text-muted);
  border: 1px solid var(--gray-200);
  width: fit-content;
}

.coming-soon {
  opacity: 0.6;
}

/* Responsive */

@media (max-width: 768px) {
  .hero-headline {
    font-size: 2rem;
  }

  .section-title {
    font-size: 1.75rem;
  }

  .mission-grid {
    grid-template-columns: 1fr;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .topbar-right {
    gap: 1rem;
    flex-wrap: wrap;
  }

  .topbar-email {
    min-width: auto;
    font-size: 0.75rem;
  }

  .widget-row {
    grid-template-columns: 1fr;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }
}

/* Dark mode */

html[data-theme="dark"] {
  --white:      #1e293b;   /* card / surface backgrounds */
  --gray-100:   #0f172a;   /* page background */
  --gray-200:   #334155;   /* borders */
  --black:      #f1f5f9;   /* heading / strong text */
  --text:       #e2e8f0;
  --text-muted: #94a3b8;
  --shadow:     0 4px 24px rgba(0,0,0,0.5);
}

/* Elements using --black as a background stay dark */
html[data-theme="dark"] .welcome-card {
  background: #0f172a;
  border: 1px solid #334155;
  color: #f1f5f9;
}
html[data-theme="dark"] .bottom-cta {
  background: #020617;
}
html[data-theme="dark"] .auth-wrapper {
  background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
}

/* Text set via color:var(--white) on coloured backgrounds */
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-small,
html[data-theme="dark"] .badge-small { color: #ffffff; }

html[data-theme="dark"] .history-dot { border-color: #1e293b; }

/* Override browser white defaults on form controls */
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background: #1e293b;
  color: var(--text);
  border-color: var(--gray-200);
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: var(--text-muted); }

/* Message boxes (hardcoded light colours) */
html[data-theme="dark"] .error-message {
  background: #3b0a0a;
  color: #fca5a5;
  border-color: #7f1d1d;
}
html[data-theme="dark"] .message-error {
  background: #3b0a0a;
  color: #fca5a5;
  border-color: #7f1d1d;
}
html[data-theme="dark"] .message-success {
  background: #052e16;
  color: #86efac;
  border-color: #14532d;
}
html[data-theme="dark"] .message-warning {
  background: #1c1003;
  color: #fde68a;
  border-color: #78350f;
}
html[data-theme="dark"] .job-closed-banner {
  background: #1c1003;
  color: #fde68a;
  border-color: #78350f;
}
