/* DermaSense — clinical SaaS aesthetic */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1a2332;
  --muted: #5c6b7f;
  --border: #e2e8f0;
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-soft: rgba(13, 148, 136, 0.12);
  --accent: #0ea5e9;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 12px;
  --shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--primary-dark);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}
.brand:hover {
  text-decoration: none;
  color: var(--primary-dark);
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
}
.nav-links a:hover {
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  border: none;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s;
}
.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
}
.btn-primary:hover {
  color: #fff;
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--surface);
  color: var(--text);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.flash-wrap {
  width: min(1120px, 92vw);
  margin: 1rem auto 0;
}
.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
}
.flash-success {
  background: #ecfdf3;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.flash-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.flash-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.site-footer {
  margin-top: 4rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  background: var(--surface);
}

/* Auth pages */
.auth-layout {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
  padding: 2rem 1rem 4rem;
}
.auth-card {
  width: min(440px, 100%);
  padding: 2rem;
}
.auth-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
}
.auth-card .sub {
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-family: var(--font);
  font-size: 0.95rem;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 520px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

/* User app shell */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 60px);
}
.app-sidebar {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1.25rem 0;
}
.app-sidebar .side-brand {
  padding: 0 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1rem;
  font-weight: 700;
  font-size: 0.95rem;
}
.app-sidebar nav a {
  display: block;
  padding: 0.65rem 1.25rem;
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.app-sidebar nav a:hover,
.app-sidebar nav a.active {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
}
.app-sidebar nav a.active {
  border-left-color: var(--primary);
}
.app-main {
  padding: 1.75rem 2rem 3rem;
}
.page-title {
  margin: 0 0 0.25rem;
  font-size: 1.65rem;
}
.page-sub {
  margin: 0 0 1.75rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.stat-card {
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.stat-card .label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.stat-card .value {
  font-size: 1.75rem;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th,
table.data td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.data th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
table.data tr:last-child td {
  border-bottom: none;
}

.thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #f1f5f9;
  font-size: 0.82rem;
  color: var(--text);
}

.result-hero {
  display: grid;
  grid-template-columns: minmax(0, 320px) 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 800px) {
  .result-hero {
    grid-template-columns: 1fr;
  }
  .app-shell {
    grid-template-columns: 1fr;
  }
  .app-sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
  }
  .app-sidebar .side-brand {
    width: 100%;
    margin-bottom: 0;
    padding-bottom: 0.75rem;
  }
  .app-sidebar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  .app-sidebar nav a {
    border-radius: 8px;
    border-left: none;
    padding: 0.45rem 0.75rem;
  }
}

.upload-preview {
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  margin-top: 0.75rem;
  display: none;
}
.upload-preview.visible {
  display: block;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: flex-end;
}
.filters .form-group {
  margin: 0;
  min-width: 140px;
}

.landing-hero {
  padding: 4.5rem 0 3rem;
  background: radial-gradient(1200px 500px at 10% -10%, rgba(14, 165, 233, 0.15), transparent),
    radial-gradient(900px 400px at 90% 0%, rgba(13, 148, 136, 0.18), transparent),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
}
.landing-hero h1 {
  font-size: clamp(2.1rem, 4vw, 3rem);
  line-height: 1.15;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}
.landing-hero p.lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 0 1.75rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  padding: 3rem 0 4rem;
}
.feature-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}
.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  margin-bottom: 0.85rem;
}

.section-muted {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 3.5rem 0;
}
.section-muted h2 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
}
.section-muted .lead {
  color: var(--muted);
  max-width: 640px;
  margin: 0 0 2rem;
}

.cta-band {
  margin: 3rem 0 0;
  padding: 2.5rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #e2e8f0;
  text-align: center;
}
.cta-band h2 {
  margin: 0 0 0.5rem;
  color: #fff;
}
.cta-band p {
  margin: 0 0 1.25rem;
  color: #94a3b8;
}
