:root {
  /* Gogh Business Professional Light Palette */
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-glow: rgba(29, 78, 216, 0.08);
  --accent: #059669;
  --accent-hover: #047857;
  --accent-glow: rgba(5, 150, 105, 0.08);
  --warning: #b45309;
  --danger: #dc2626;
  --text-main: #0f172a;
  --text-muted: #334155;
  --text-dim: #64748b;

  /* Elevation & Concentric Radii */
  --sidebar-width: 280px;
  --header-height: 60px;
  --radius-outer: 12px;
  --radius-inner: 8px;
  --radius-sm: 6px;

  /* Shadows (Diffuse Layered) */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);

  /* Fonts */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, -apple-system-subheading, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography & Headings (Gogh Rules: text-wrap balance & pretty) */
h1, h2, h3, h4 {
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

h1 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1.25;
}

.lead {
  font-size: 15px;
  color: var(--text-dim);
  margin-bottom: 28px;
  text-wrap: pretty;
}

h2 {
  font-size: 20px;
  margin-top: 36px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
}

h3 {
  font-size: 16px;
  margin-top: 24px;
  margin-bottom: 10px;
}

p {
  margin-bottom: 14px;
  font-size: 14.5px;
  color: var(--text-muted);
  text-wrap: pretty;
}

ul, ol {
  margin-bottom: 16px;
  padding-left: 24px;
  font-size: 14px;
  color: var(--text-muted);
}

li {
  margin-bottom: 6px;
}

strong {
  color: var(--text-main);
}

/* Mobile Header */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  align-items: center;
  justify-content: space-between;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}

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

.menu-toggle-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.menu-toggle-btn:hover {
  background: var(--bg-surface-hover);
}

/* Sidebar Navigation */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-xs);
  transition: transform 0.25s ease;
}

.brand {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(29, 78, 216, 0.25);
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.nav-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  -webkit-overflow-scrolling: touch;
}

.nav-group-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 14px 12px 6px 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-inner);
  transition: all 0.15s ease;
  min-height: 44px;
}

.nav-link:hover {
  background-color: var(--bg-surface-elevated);
  color: var(--text-main);
}

.nav-link.active {
  background-color: var(--primary-glow);
  color: var(--primary);
  font-weight: 600;
}

.nav-link .badge {
  margin-left: auto;
  background-color: var(--bg-surface-elevated);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-elevated);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}

.quick-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  min-height: 44px;
  background-color: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-inner);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.quick-btn:hover {
  background-color: var(--bg-surface-hover);
}

.quick-btn:active {
  transform: scale(0.98);
}

.quick-btn.primary {
  background-color: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 2px 4px rgba(29, 78, 216, 0.2);
}

.quick-btn.primary:hover {
  background-color: var(--primary-hover);
}

/* Main Content Area */
#main-content {
  flex: 1;
  min-height: 100vh;
  background-color: var(--bg-body);
  position: relative;
  overflow-y: auto;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-xs);
}

.top-breadcrumbs {
  font-size: 13px;
  color: var(--text-dim);
}

.top-breadcrumbs span {
  color: var(--text-main);
  font-weight: 600;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.btn-sm {
  padding: 8px 14px;
  min-height: 40px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-inner);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-main);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.btn-sm:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--primary);
}

.btn-sm:active {
  transform: scale(0.98);
}

.btn-sm.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 2px 4px rgba(29, 78, 216, 0.18);
}

.btn-sm.primary:hover {
  background: var(--primary-hover);
}

.content-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 36px 32px 100px 32px;
}

/* Cards & Concentric Containers */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-outer);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 15.5px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

/* Data Tables */
.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
  border-radius: var(--radius-inner);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 500px;
  font-variant-numeric: tabular-nums;
}

.data-table th, .data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  background-color: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table tr:hover td {
  background-color: #f8fafc;
}

/* Callout Alerts */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius-inner);
  border-left: 4px solid var(--primary);
  background-color: #eff6ff;
  border-top: 1px solid #dbeafe;
  border-right: 1px solid #dbeafe;
  border-bottom: 1px solid #dbeafe;
  color: #1e3a8a;
  margin-bottom: 24px;
  font-size: 13.5px;
  box-shadow: var(--shadow-xs);
}

.alert strong {
  color: #172554;
}

.alert.warning {
  border-left-color: var(--warning);
  background-color: #fffbeb;
  border-top-color: #fef3c7;
  border-right-color: #fef3c7;
  border-bottom-color: #fef3c7;
  color: #78350f;
}

.alert.warning strong {
  color: #451a03;
}

.alert.success {
  border-left-color: var(--accent);
  background-color: #ecfdf5;
  border-top-color: #d1fae5;
  border-right-color: #d1fae5;
  border-bottom-color: #d1fae5;
  color: #064e3b;
}

.alert.success strong {
  color: #022c22;
}

/* Calculators Grid */
.calculator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.calc-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-outer);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.calc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

.input-group {
  margin-bottom: 16px;
}

.input-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* 16px prevents iOS Safari auto-zoom */
.input-control {
  width: 100%;
  background-color: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-inner);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 16px;
  font-family: var(--font-sans);
  outline: none;
  min-height: 44px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: all 0.15s ease;
}

.input-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.calc-results {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-inner);
  padding: 16px;
  margin-top: 18px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 13.5px;
  border-bottom: 1px dashed var(--border-strong);
}

.result-row:last-child {
  border-bottom: none;
  padding-top: 10px;
}

.result-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.result-value.primary {
  color: var(--primary);
  font-size: 17px;
}

/* Code Blocks & Email Scripts */
.code-block {
  background-color: #f8fafc;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-inner);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #1e293b;
  overflow-x: auto;
  white-space: pre-wrap;
  position: relative;
  margin-bottom: 16px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  padding: 6px 12px;
  min-height: 32px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.copy-btn:hover {
  color: white;
  background-color: var(--primary);
  border-color: var(--primary);
}

.copy-btn:active {
  transform: scale(0.96);
}

/* Interactive Checklists */
.checklist-category {
  margin-bottom: 24px;
}

.category-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-subtle);
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 11px 12px;
  border-radius: var(--radius-inner);
  transition: background 0.1s ease;
  cursor: pointer;
  min-height: 44px;
}

.check-item:hover {
  background-color: var(--bg-surface-elevated);
}

.check-item input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: 4px;
  background-color: #ffffff;
  cursor: pointer;
  margin-top: 2px;
  position: relative;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.check-item input[type="checkbox"]:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.check-item input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  color: white;
  font-size: 13px;
  font-weight: bold;
  top: -1px;
  left: 4px;
}

.check-text {
  font-size: 14px;
  color: var(--text-main);
}

.check-text.checked {
  text-decoration: line-through;
  color: var(--text-dim);
}

.progress-bar-wrap {
  width: 100%;
  height: 9px;
  background-color: var(--bg-surface-elevated);
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 20px 0;
  border: 1px solid var(--border-subtle);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 0%;
  transition: width 0.3s ease;
}

/* Badges & Tags */
.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
}

.tag.primary {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.tag.success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.tag.warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.tag.danger {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Toast Notifications */
#toast {
  visibility: hidden;
  min-width: 240px;
  background-color: #0f172a;
  border: 1px solid #334155;
  color: #ffffff;
  text-align: center;
  border-radius: var(--radius-inner);
  padding: 12px 20px;
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
}

#toast.show {
  visibility: visible;
  animation: fadein 0.3s, fadeout 0.3s 2.5s;
}

@keyframes fadein {
  from { bottom: 10px; opacity: 0; }
  to { bottom: 30px; opacity: 1; }
}

@keyframes fadeout {
  from { bottom: 30px; opacity: 1; }
  to { bottom: 10px; opacity: 0; }
}

/* Mobile & Touch Responsive Rules */
@media (max-width: 860px) {
  body {
    flex-direction: column;
  }

  .mobile-header {
    display: flex;
  }

  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 35;
  }

  #sidebar-overlay.open {
    display: block;
  }

  #main-content {
    margin-top: var(--header-height);
  }

  .top-bar {
    display: none;
  }

  .content-container {
    padding: 24px 16px 80px 16px;
  }

  .calculator-grid {
    grid-template-columns: 1fr;
  }
}
