/* Token Quota Checker — Option 1: Hardware Spec / Industrial Grid Theme */
:root {
  color-scheme: light;
  --bg-page: #F4F3EF;
  --bg-card: #FFFFFF;
  --bg-subtle: #EAE8E1;
  --border-color: #1C1917;
  --border-muted: #D6D3CD;
  --text-primary: #1C1917;
  --text-secondary: #57534E;
  --text-muted: #78716C;
  --accent: #EA580C;
  --accent-hover: #C2410C;
  --accent-text: #FFFFFF;
  --accent-light: #FFEDD5;
  --badge-bg: #FFEDD5;
  --badge-text: #9A3412;
  --table-hover: #F5EFE6;
  --cta-tint: rgba(234, 88, 12, 0.07);
  --grid-line: rgba(28, 25, 23, 0.08);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #121212;
  --bg-card: #1B1B1B;
  --bg-subtle: #242424;
  --border-color: #3F3F46;
  --border-muted: #2E2E2E;
  --text-primary: #F5F5F4;
  --text-secondary: #A8A29E;
  --text-muted: #78716C;
  --accent: #F97316;
  --accent-hover: #FB923C;
  --accent-text: #09090B;
  --accent-light: rgba(249, 115, 22, 0.16);
  --badge-bg: #431407;
  --badge-text: #FDBA74;
  --table-hover: #2C2723;
  --cta-tint: rgba(249, 115, 22, 0.1);
  --grid-line: rgba(245, 245, 244, 0.07);
}

/* Base Typography & Industrial Surface */
body {
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* Global Anti-Template Overrides (Light & Dark via CSS Variables, beating Tailwind CDN cascade) */
html .bg-\[\#F8FAFC\],
html body {
  background-color: var(--bg-page);
  color: var(--text-primary);
}

html .bg-white {
  background-color: var(--bg-card);
}

html .bg-slate-50,
html .bg-slate-100 {
  background-color: var(--bg-subtle);
}

html .hover\:bg-slate-100:hover {
  background-color: var(--table-hover);
}

html .text-\[\#0F172A\],
html .text-slate-900,
html .text-slate-800 {
  color: var(--text-primary);
}

html .text-\[\#475569\],
html .text-slate-700,
html .text-slate-600,
html .text-slate-500 {
  color: var(--text-secondary);
}

html .text-slate-400 {
  color: var(--text-muted);
}

html .border-\[\#E2E8F0\],
html .border-slate-300,
html .divide-\[\#E2E8F0\] > :not(:last-child) {
  border-color: var(--border-muted);
}

html .text-\[\#0F766E\],
html .hover\:text-\[\#0F766E\]:hover,
html .text-\[\#047857\] {
  color: var(--accent);
}

html .bg-\[\#0F766E\] {
  background-color: var(--accent);
  color: var(--accent-text);
}

html .border-l-\[\#0F766E\] {
  border-left-color: var(--accent);
}

html .hover\:border-\[\#0F766E\]:hover {
  border-color: var(--accent);
}

html .bg-\[\#ECFDF5\]\/50 {
  background-color: var(--badge-bg);
}

html .bg-\[\#F0FDFA\] {
  background-color: var(--bg-subtle);
}

html .bg-teal-100 {
  background-color: var(--badge-bg);
  border: 1px solid var(--border-color);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html .text-teal-800 {
  color: var(--badge-text);
}

html .bg-\[\#0F766E\]\/5 {
  background-color: var(--cta-tint);
}

html .border-\[\#0F766E\]\/20 {
  border-color: var(--accent);
}

html .text-amber-700 {
  color: #D97706;
}

[data-theme="dark"] .text-amber-700 {
  color: #FBBF24;
}

html .text-red-600 {
  color: #DC2626;
}

[data-theme="dark"] .text-red-600 {
  color: #F87171;
}

html .hover\:bg-red-50:hover {
  background-color: rgba(239, 68, 68, 0.14);
}

/* Strip generic SaaS rounded corners & soft shadows across utility classes */
html .rounded,
html .rounded-md,
html .rounded-lg,
html .rounded-xl,
html .rounded-2xl,
html .rounded-full {
  border-radius: 2px;
}

html .shadow,
html .shadow-sm,
html .shadow-md,
html .shadow-lg {
  box-shadow: none;
}

/* Strict Tabular Nums & Forced Monospace on Numbers, Readouts, Badges & Table Cells */
.tabular-nums,
.font-mono,
input[type="number"],
[id$="-val"],
.price-display,
.metric-value,
table,
th,
td {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

input,
select {
  font-variant-numeric: tabular-nums;
}

/* Top Navigation Bar */
header {
  background-color: var(--bg-card);
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  max-width: 100%;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.brand-mark {
  width: 0.65rem;
  height: 0.65rem;
  background-color: var(--accent);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

.brand-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.59rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.2;
  padding: 0.14rem 0.32rem;
  background-color: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  white-space: nowrap;
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.65rem;
  padding: 0.25rem 0.24rem;
  border: 1px solid transparent;
  border-radius: 2px;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

@media (min-width: 1180px) {
  .nav-link {
    font-size: 0.68rem;
    padding: 0.26rem 0.28rem;
  }
}

@media (min-width: 1400px) {
  .nav-link {
    font-size: 0.7rem;
    padding: 0.28rem 0.32rem;
  }
}

.nav-link:hover {
  color: var(--text-primary);
  background-color: var(--bg-subtle);
  border-color: var(--border-muted);
}

.nav-link.active {
  color: var(--badge-text);
  background-color: var(--badge-bg);
  border-color: var(--border-color);
}

/* Main Workspace Header — Subtle Industrial Grid Texture */
main > .ad-slot-top + div,
.workspace-header {
  background-color: var(--bg-card);
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 16px 16px;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  padding: 1.25rem 1.5rem;
}

/* Cards & Surfaces */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  box-shadow: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

/* Tactile Industrial Buttons */
.btn-primary {
  background-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  box-shadow: none;
  transition: background-color 0.15s ease, transform 0.1s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

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

.btn-primary:active {
  transform: translate(1px, 1px);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 2px;
  box-shadow: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-secondary:hover {
  background-color: var(--bg-subtle);
  border-color: var(--border-color);
}

.btn-secondary:active {
  transform: translate(1px, 1px);
}

/* Compact Tactile Language Selector & Theme Toggle */
#lang-selector {
  height: 2rem;
  padding: 0 0.45rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: 1px 1px 0 var(--border-color);
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

#lang-selector:hover {
  background-color: var(--bg-card);
  border-color: var(--accent);
}

#theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 2px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  box-shadow: 1px 1px 0 var(--border-color);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

#theme-toggle:hover {
  background-color: var(--bg-card);
  border-color: var(--accent);
  color: var(--accent);
}

#theme-toggle:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

#theme-toggle svg {
  width: 0.95rem;
  height: 0.95rem;
  pointer-events: none;
}

/* Zero CLS AdSense Containers */
.ad-slot-top {
  min-height: 90px;
  width: 100%;
  margin: 16px 0;
  background-color: var(--bg-subtle);
  border: 1px dashed var(--border-muted);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.ad-slot-mid {
  min-height: 250px;
  width: 100%;
  margin: 24px 0;
  background-color: var(--bg-subtle);
  border: 1px dashed var(--border-muted);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.ad-label {
  position: absolute;
  top: 4px;
  left: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}

/* Range Sliders & Crisp Structural Inputs */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  cursor: pointer;
  accent-color: var(--accent);
  margin: 0;
}

input[type="range"]:focus {
  outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 18px;
  margin-top: -7px;
  background-color: var(--accent);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background-color: var(--accent-hover);
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input[type="range"]::-moz-range-track {
  width: 100%;
  height: 6px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 2px;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 18px;
  background-color: var(--accent);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

input[type="range"]::-moz-range-thumb:hover {
  background-color: var(--accent-hover);
}

input[type="checkbox"] {
  accent-color: var(--accent);
  border-radius: 2px;
}

input[type="number"],
input[type="text"],
input[type="email"],
select,
textarea {
  border: 1px solid var(--border-color);
  border-radius: 2px;
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
  background-color: var(--bg-card);
  color: var(--text-primary);
  outline: none;
  box-shadow: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

input[type="number"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  box-shadow: none;
}

/* Data Tables */
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

th {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.6rem 0.48rem;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

td {
  padding: 0.65rem 0.48rem;
  border-bottom: 1px solid var(--border-muted);
  font-size: 0.78rem;
  color: var(--text-primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

tbody tr:nth-child(even) td {
  background-color: var(--bg-subtle);
}

tbody tr:hover td {
  background-color: var(--table-hover);
}

tbody tr.winning-row td,
tbody tr:has(.lowest-cost-badge) td {
  background-color: var(--badge-bg);
}

tbody tr.winning-row td:first-child,
tbody tr:has(.lowest-cost-badge) td:first-child {
  border-left: 3px solid var(--accent);
}

/* Badges */
.lowest-cost-badge {
  background-color: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 2px;
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-success {
  background-color: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.55rem;
  border-radius: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: 0.72rem;
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.16);
  color: #B45309;
  border: 1px solid #D97706;
  padding: 0.2rem 0.55rem;
  border-radius: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: 0.72rem;
}

[data-theme="dark"] .badge-warning {
  color: #FBBF24;
}

.badge-danger {
  background-color: rgba(239, 68, 68, 0.16);
  color: #B91C1C;
  border: 1px solid #DC2626;
  padding: 0.2rem 0.55rem;
  border-radius: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: 0.72rem;
}

[data-theme="dark"] .badge-danger {
  color: #F87171;
}

/* Skill / Capability Horizontal Bars (0-100) */
.skill-bar-track {
  width: 100%;
  height: 7px;
  background-color: var(--bg-subtle);
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.skill-bar-fill {
  height: 100%;
  background-color: var(--accent);
  border-radius: 0;
  transition: width 0.2s ease;
}

.skill-bar-fill-muted {
  height: 100%;
  background-color: var(--text-muted);
  border-radius: 0;
}

.seg-tab {
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 2px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.seg-tab:hover {
  color: var(--text-primary);
  background-color: var(--bg-subtle);
  border-color: var(--border-muted);
}

.seg-tab.active {
  background-color: var(--badge-bg);
  color: var(--badge-text);
  border-color: var(--border-color);
  font-weight: 700;
}

/* Footer */
footer {
  background-color: var(--bg-card);
  border-top: 2px solid var(--border-color);
  color: var(--text-secondary);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

/* Friendly Non-Blocking Adblock Notice Modal */
.tql-modal-backdrop {
  background-color: rgba(18, 18, 18, 0.72);
  backdrop-filter: blur(2px);
}

.tql-modal-card {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--accent);
  border-radius: 2px;
}

.tql-modal-note {
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-muted);
  border-radius: 2px;
}

.tql-modal-status {
  background-color: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--border-color);
  border-radius: 2px;
}

.tql-modal-close {
  color: var(--text-secondary);
  border: 1px solid var(--border-muted);
  border-radius: 2px;
  background-color: var(--bg-subtle);
  cursor: pointer;
  line-height: 1.2;
}

.tql-modal-close:hover {
  color: var(--text-primary);
  border-color: var(--border-color);
}

/* Pixel Sprites & Interactive Pointer Tour */
.tql-sprite-icon {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  user-select: none;
  flex-shrink: 0;
}

#tour-replay-btn {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  color: var(--text-primary);
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

#tour-replay-btn:hover {
  background-color: var(--badge-bg);
  color: var(--badge-text);
  border-color: var(--accent);
}

.tql-tour-spotlight {
  position: fixed;
  z-index: 92;
  pointer-events: none;
  border: 2px solid var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 0 9999px rgba(18, 18, 18, 0.56);
  transition: top 0.42s cubic-bezier(0.22, 1, 0.36, 1),
              left 0.42s cubic-bezier(0.22, 1, 0.36, 1),
              width 0.42s cubic-bezier(0.22, 1, 0.36, 1),
              height 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.tql-tour-pointer {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 98;
  pointer-events: none;
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  transition: transform 0.52s cubic-bezier(0.22, 1, 0.36, 1);
}

.tql-tour-cursor-svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
  filter: drop-shadow(0 1px 0 var(--border-color));
}

.tql-tour-pulse {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
  border-radius: 2px;
  opacity: 0;
}

.tql-tour-pointer.is-clicking .tql-tour-pulse {
  animation: tql-pointer-click 0.65s ease-out;
}

.tql-tour-pointer .tql-sprite-buddy {
  animation: tql-sprite-bob 1.4s ease-in-out infinite;
}

.tql-tour-tooltip {
  position: fixed;
  z-index: 99;
  pointer-events: auto;
  width: min(350px, calc(100vw - 24px));
  animation: tql-tooltip-pop 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  transition: top 0.36s cubic-bezier(0.22, 1, 0.36, 1),
              left 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes tql-pointer-click {
  0% {
    transform: scale(0.5);
    opacity: 0.95;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

@keyframes tql-sprite-bob {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes tql-tooltip-pop {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Opt-In Corner Pixel-Art Tour Badge */
.tql-tour-badge {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-top: 2px solid var(--accent);
  border-radius: 2px;
  animation: tql-tooltip-pop 0.22s ease-out;
}

.tql-tour-badge:hover {
  border-color: var(--accent);
}
