:root {
  /* Colors - Modern Dashboard (Inspired by images) */
  --bg-body: #f7f9fc;
  --bg-surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --marketing-bg: #f4efe8;
  --marketing-ink: #201a18;
  --marketing-panel: rgba(255, 252, 247, 0.72);
  --marketing-line: rgba(48, 33, 24, 0.12);
  
  /* Primary Accent: Emerald/Dark Green */
  --accent: #10b582;
  --accent-hover: #0d9668;
  --accent-light: #d1fae5;
  --accent-dark: #064e3b;
  
  --danger: #ef4444;
  --success: #10b981;
  
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.06), 0 4px 6px -2px rgba(15, 23, 42, 0.03);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-main);
  background-color: var(--bg-body);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.auth-body {
  background:
    radial-gradient(circle at top left, rgba(16, 181, 130, 0.14), transparent 32%),
    linear-gradient(180deg, #f8fbfd 0%, #eef4f7 100%);
}

body.marketing-body {
  background:
    radial-gradient(circle at top left, rgba(16, 185, 130, 0.14), transparent 36%),
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.12), transparent 42%),
    linear-gradient(180deg, #f7f9fc 0%, #eef2f7 100%);
  color: var(--text-main);
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

body.marketing-body h1,
body.marketing-body h2,
body.marketing-body h3,
body.marketing-body h4 {
  color: var(--marketing-ink);
}

p {
  margin: 0 0 1rem 0;
  line-height: 1.5;
  color: var(--text-muted);
}

/* -----------------------------
 * DASHBOARD LAYOUT
 * ----------------------------- */
.dashboard-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  align-items: start;
  position: relative;
}

/* -----------------------------
 * SIDEBAR
 * ----------------------------- */
.dashboard-sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  position: relative;
  min-height: 100vh;
  transition: transform 0.24s ease, opacity 0.24s ease;
  z-index: 31;
}

/* Brand */
.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding: 0 8px;
}

.brand-text {
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sidebar-collapse-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.24s ease;
}

.sidebar-collapse-button:hover {
  color: var(--text-main);
  border-color: var(--line-strong);
  background: #f8fafc;
}

.sidebar-collapse-icon {
  transition: transform 0.24s ease;
}

/* Navigation */
.sidebar-section {
  flex: 1;
}

.sidebar-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 12px 8px;
}

.site-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.site-nav a, .sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.site-nav a svg, .sidebar-footer a svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.site-nav a:hover, .sidebar-footer a:hover {
  background: var(--bg-body);
  color: var(--text-main);
}

.site-nav a.is-active {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.site-nav a.is-active svg {
  color: var(--accent);
  opacity: 1;
}

/* Footer in sidebar */
.sidebar-footer {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgba(15, 23, 42, 0.36);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 25;
}

/* -----------------------------
 * MAIN CONTENT AREA
 * ----------------------------- */
.dashboard-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dashboard-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
  margin: 0;
  padding: 14px 32px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle {
  flex-shrink: 0;
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text-main);
}

.topbar-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
}

.topbar-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.topbar-icon:hover {
  color: var(--text-main);
  border-color: var(--line-strong);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.icon-button:hover {
  color: var(--text-main);
  border-color: var(--line-strong);
}

.topbar-avatar img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
}

.topbar-logout {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--text-main);
  font-weight: 600;
  background: var(--bg-surface);
}

.topbar-logout:hover {
  background: #f8fafc;
}

.app-shell {
  flex: 1;
  padding: 12px 32px 40px;
  max-width: 1600px;
}

.auth-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 0 0 40px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 auto 22px;
  font-weight: 700;
  color: var(--text-main);
}

.auth-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.auth-brand-text {
  font-size: 1.05rem;
}

.auth-shell {
  width: 100%;
}

.auth-topbar {
  width: 100%;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.auth-topbar-inner {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.auth-topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text-main);
}

.auth-topbar-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-topbar-links a:not(.button) {
  color: var(--text-muted);
  font-weight: 600;
}

.auth-topbar-links a:not(.button):hover {
  color: var(--text-main);
}

.marketing-layout {
  min-height: 100vh;
}

/* -----------------------------
 * CARDS & PANELS
 * ----------------------------- */
.hero-panel,
.info-panel,
.lookup-panel,
.form-panel,
.page-intro,
.toolbar-panel,
.empty-panel,
.project-card,
.detail-card,
.box-card {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.hero-panel {
  padding: 32px;
  display: flex;
  gap: 32px;
  align-items: stretch;
  background: linear-gradient(135deg, var(--bg-surface), #f1f5f9);
}

.hero-copy h2 {
  font-size: 1.75rem;
  margin-bottom: 16px;
}

/* -----------------------------
 * FORMS & BUTTONS
 * ----------------------------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.button-primary {
  background: var(--accent);
  color: #fff;
}

.button-primary:hover {
  background: var(--accent-hover);
}

.button-secondary {
  background: var(--bg-surface);
  border-color: var(--line-strong);
  color: var(--text-main);
}

.button-secondary:hover {
  background: #f1f5f9;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.field span {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
}

input,
textarea,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-main);
  font: inherit;
  font-size: 0.95rem;
  transition: all 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.status-message {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--danger);
  font-weight: 500;
  font-size: 0.9rem;
}

.status-message.is-success {
  color: var(--success);
}

/* Utilities */
.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.dashboard-layout.is-sidebar-collapsed {
  grid-template-columns: 92px 1fr;
}

.dashboard-layout.is-sidebar-collapsed .brand-text,
.dashboard-layout.is-sidebar-collapsed .sidebar-eyebrow,
.dashboard-layout.is-sidebar-collapsed .site-nav a span,
.dashboard-layout.is-sidebar-collapsed .sidebar-footer a span {
  display: none;
}

.dashboard-layout.is-sidebar-collapsed .dashboard-sidebar {
  padding: 24px 12px;
  align-items: center;
}

.dashboard-layout.is-sidebar-collapsed .brand-block {
  padding: 0;
  width: 100%;
  justify-content: center;
}

.dashboard-layout.is-sidebar-collapsed .site-nav a,
.dashboard-layout.is-sidebar-collapsed .sidebar-footer a {
  justify-content: center;
  padding: 12px;
}

.dashboard-layout.is-sidebar-collapsed .sidebar-collapse-button {
  margin-left: 0;
}

.dashboard-layout.is-sidebar-collapsed .sidebar-collapse-icon {
  transform: rotate(180deg);
}

.dashboard-layout.is-sidebar-collapsed .site-nav,
.dashboard-layout.is-sidebar-collapsed .sidebar-footer {
  align-items: center;
  width: 100%;
}

.dashboard-layout.is-sidebar-collapsed .site-nav a,
.dashboard-layout.is-sidebar-collapsed .sidebar-footer a,
.dashboard-layout.is-sidebar-collapsed .sidebar-collapse-button {
  width: 48px;
}

@media (max-width: 900px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, calc(100vw - 56px));
    z-index: 30;
    box-shadow: var(--shadow-lg);
  }

  .dashboard-layout:not(.is-sidebar-open) .dashboard-sidebar {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
  }

  .dashboard-layout.is-sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .dashboard-layout.is-sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .dashboard-layout.is-sidebar-collapsed .brand-text,
  .dashboard-layout.is-sidebar-collapsed .sidebar-eyebrow,
  .dashboard-layout.is-sidebar-collapsed .site-nav a span,
  .dashboard-layout.is-sidebar-collapsed .sidebar-footer a span {
    display: initial;
  }

  .dashboard-layout.is-sidebar-collapsed .dashboard-sidebar {
    padding: 24px 20px;
    align-items: stretch;
  }

  .dashboard-layout.is-sidebar-collapsed .brand-block {
    justify-content: flex-start;
  }

  .dashboard-layout.is-sidebar-collapsed .site-nav a,
  .dashboard-layout.is-sidebar-collapsed .sidebar-footer a {
    justify-content: flex-start;
    padding: 12px 14px;
  }

  .dashboard-layout.is-sidebar-collapsed .site-nav,
  .dashboard-layout.is-sidebar-collapsed .sidebar-footer {
    align-items: stretch;
  }

  .dashboard-layout.is-sidebar-collapsed .site-nav a,
  .dashboard-layout.is-sidebar-collapsed .sidebar-footer a,
  .dashboard-layout.is-sidebar-collapsed .sidebar-collapse-button {
    width: auto;
  }

  .dashboard-topbar,
  .app-shell {
    padding-left: 20px;
    padding-right: 20px;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .sidebar-collapse-button {
    display: none;
  }

  .topbar-inner {
    padding: 14px 20px;
  }

}

@media (min-width: 901px) {
  .sidebar-backdrop {
    display: none;
  }
}

body.is-sidebar-locked {
  overflow: hidden;
}

@media (max-width: 760px) {
  .auth-topbar-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
