/**
 * TOORCE Partner Portal — Design tokens & shared components
 * Matches toorce.com: red / black / white enterprise security brand
 */
:root {
  --t-red: #d11111;
  --t-red-hover: #b80e0e;
  --t-red-soft: rgba(209, 17, 17, 0.12);
  --t-black: #0a0a0a;
  --t-ink: #111111;
  --t-white: #ffffff;
  --t-gray-50: #fafafa;
  --t-gray-100: #f4f4f5;
  --t-gray-200: #e4e4e7;
  --t-gray-400: #a1a1aa;
  --t-gray-500: #71717a;
  --t-gray-600: #52525b;
  --t-border: rgba(0, 0, 0, 0.08);
  --t-border-dark: rgba(255, 255, 255, 0.1);
  --t-shadow: 0 18px 50px rgba(0, 0, 0, 0.12);
  --t-radius: 2px;
  --t-font: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --t-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
  --t-header-h: 72px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--t-font);
  color: var(--t-ink);
  background: var(--t-white);
  line-height: 1.6;
  min-height: 100vh;
}

body.t-dark {
  color: var(--t-white);
  background: var(--t-black);
}

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

img {
  max-width: 100%;
}

/* ── Header ── */
.t-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--t-header-h);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--t-border);
  backdrop-filter: blur(12px);
}

body.t-dark .t-header {
  background: rgba(10, 10, 10, 0.94);
  border-bottom-color: var(--t-border-dark);
}

.t-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.t-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.t-logo-mark {
  width: 36px;
  height: 36px;
  background: var(--t-red);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.t-logo-mark svg {
  width: 20px;
  height: 20px;
  fill: white;
}

.t-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.t-logo-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.t-logo-tag {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t-gray-500);
}

body.t-dark .t-logo-tag {
  color: var(--t-gray-400);
}

.t-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.t-nav a,
.t-nav button.t-nav-btn {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t-gray-600);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 0;
  font-family: inherit;
}

body.t-dark .t-nav a,
body.t-dark .t-nav button.t-nav-btn {
  color: var(--t-gray-400);
}

.t-nav a:hover,
.t-nav button.t-nav-btn:hover,
.t-nav a.is-active {
  color: var(--t-red);
}

.t-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Buttons ── */
.t-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.t-btn-primary {
  background: var(--t-red);
  color: var(--t-white);
}

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

.t-btn-secondary {
  background: var(--t-white);
  color: var(--t-ink);
  border: 1px solid var(--t-gray-200);
}

.t-btn-secondary:hover {
  border-color: var(--t-ink);
}

body.t-dark .t-btn-secondary {
  background: transparent;
  color: var(--t-white);
  border-color: var(--t-border-dark);
}

body.t-dark .t-btn-secondary:hover {
  border-color: var(--t-white);
}

.t-btn-ghost {
  background: transparent;
  color: var(--t-ink);
  border: 1px solid var(--t-gray-200);
}

.t-btn-ghost:hover {
  border-color: var(--t-red);
  color: var(--t-red);
}

.t-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Hero ── */
.t-hero {
  position: relative;
  padding: 80px 24px 64px;
  background:
    linear-gradient(rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.82)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='600' viewBox='0 0 1200 600'%3E%3Crect fill='%231a1a1a' width='1200' height='600'/%3E%3Cg fill='%23333' opacity='0.4'%3E%3Ccircle cx='200' cy='150' r='80'/%3E%3Ccircle cx='900' cy='400' r='120'/%3E%3Crect x='500' y='100' width='300' height='200' rx='4'/%3E%3C/g%3E%3C/svg%3E") center/cover;
  color: var(--t-white);
  text-align: center;
}

.t-hero-inner {
  max-width: 820px;
  margin: 0 auto;
}

.t-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 20px;
}

.t-kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--t-red);
}

.t-hero h1 {
  margin: 0 0 20px;
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.t-hero-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--t-red);
  margin-left: 4px;
  vertical-align: baseline;
}

.t-hero p {
  margin: 0 auto 32px;
  max-width: 640px;
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.78);
}

.t-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* ── Stats bar ── */
.t-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--t-white);
  border-bottom: 1px solid var(--t-border);
}

.t-stat {
  padding: 28px 20px;
  text-align: center;
  border-right: 1px solid var(--t-border);
}

.t-stat:last-child {
  border-right: none;
}

.t-stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--t-ink);
}

.t-stat-label {
  margin-top: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t-gray-500);
}

/* ── Layout ── */
.t-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.t-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--t-red);
  margin-bottom: 10px;
}

.t-section-title {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.t-section-desc {
  color: var(--t-gray-500);
  max-width: 640px;
  margin-bottom: 32px;
}

body.t-dark .t-section-desc {
  color: var(--t-gray-400);
}

/* ── Cards ── */
.t-card {
  background: var(--t-white);
  border: 1px solid var(--t-border);
  padding: 28px;
}

body.t-dark .t-card {
  background: #111;
  border-color: var(--t-border-dark);
}

.t-card-elevated {
  box-shadow: var(--t-shadow);
}

.t-grid {
  display: grid;
  gap: 24px;
}

.t-grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.t-grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* ── Forms ── */
.t-form-group {
  margin-bottom: 20px;
}

.t-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t-gray-600);
}

body.t-dark .t-label {
  color: var(--t-gray-400);
}

.t-input,
.t-select,
.t-textarea {
  width: 100%;
  padding: 13px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--t-ink);
  background: var(--t-white);
  border: 1px solid var(--t-gray-200);
  border-radius: var(--t-radius);
  transition: border-color 0.15s;
}

body.t-dark .t-input,
body.t-dark .t-select,
body.t-dark .t-textarea {
  color: var(--t-white);
  background: #0a0a0a;
  border-color: var(--t-border-dark);
}

.t-input:focus,
.t-select:focus,
.t-textarea:focus {
  outline: none;
  border-color: var(--t-red);
}

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

.t-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.t-hint {
  margin: -8px 0 16px;
  font-size: 0.88rem;
  color: var(--t-gray-500);
}

.t-form-section {
  padding-top: 24px;
  margin-top: 24px;
  border-top: 1px solid var(--t-border);
}

body.t-dark .t-form-section {
  border-top-color: var(--t-border-dark);
}

.t-form-section:first-of-type {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}

.t-form-section h3 {
  margin: 0 0 16px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t-red);
}

/* ── Alerts ── */
.t-alert {
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 0.92rem;
  border-left: 3px solid;
}

.t-alert-success {
  background: rgba(34, 197, 94, 0.08);
  border-color: #22c55e;
  color: #166534;
}

.t-alert-error {
  background: rgba(209, 17, 17, 0.08);
  border-color: var(--t-red);
  color: #991b1b;
}

.t-alert-info {
  background: rgba(59, 130, 246, 0.08);
  border-color: #3b82f6;
  color: #1e40af;
}

body.t-dark .t-alert-success { color: #86efac; }
body.t-dark .t-alert-error { color: #fca5a5; }
body.t-dark .t-alert-info { color: #93c5fd; }

/* ── Table ── */
.t-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--t-border);
}

body.t-dark .t-table-wrap {
  border-color: var(--t-border-dark);
}

.t-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

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

body.t-dark .t-table th,
body.t-dark .t-table td {
  border-bottom-color: var(--t-border-dark);
}

.t-table th {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t-gray-500);
  background: var(--t-gray-50);
}

body.t-dark .t-table th {
  background: #0a0a0a;
  color: var(--t-gray-400);
}

.t-table tr:last-child td {
  border-bottom: none;
}

/* ── Footer ── */
.t-footer {
  background: var(--t-ink);
  color: rgba(255, 255, 255, 0.65);
  padding: 48px 24px 32px;
  font-size: 0.88rem;
}

.t-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 40px;
}

.t-footer-brand .t-logo-name {
  color: var(--t-white);
}

.t-footer h4 {
  margin: 0 0 16px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--t-white);
}

.t-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.t-footer li {
  margin-bottom: 8px;
}

.t-footer a:hover {
  color: var(--t-red);
}

.t-footer-bottom {
  max-width: 1280px;
  margin: 32px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.78rem;
  text-align: center;
}

/* ── Installer splash ── */
.t-splash {
  min-height: calc(100vh - var(--t-header-h));
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--t-black);
  color: var(--t-white);
  text-align: center;
  padding: 40px 24px;
}

.t-splash-logo {
  margin-bottom: 32px;
}

.t-splash-logo .t-logo-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
}

.t-splash-logo .t-logo-mark svg {
  width: 28px;
  height: 28px;
}

.t-splash-logo .t-logo-name {
  font-size: 2rem;
  color: var(--t-white);
}

.t-splash-logo .t-logo-tag {
  color: var(--t-red);
  font-size: 0.72rem;
  margin-top: 6px;
}

.t-progress-line {
  width: min(320px, 80vw);
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  margin: 24px auto;
  position: relative;
  overflow: hidden;
}

.t-progress-line::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 40%;
  background: var(--t-red);
  animation: t-scan 1.8s ease-in-out infinite;
}

@keyframes t-scan {
  0% { left: -40%; }
  100% { left: 100%; }
}

.t-mono {
  font-family: var(--t-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--t-gray-500);
}

/* ── Status list (installer) ── */
.t-status-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.t-status-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--t-border-dark);
}

.t-status-item:last-child {
  border-bottom: none;
}

.t-status-dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  flex-shrink: 0;
  background: var(--t-gray-500);
}

.t-status-dot.ok { background: #22c55e; }
.t-status-dot.error { background: var(--t-red); }
.t-status-dot.pending { background: #f59e0b; }
.t-status-dot.warning { background: #eab308; }
.t-status-dot.running {
  background: var(--t-red);
  animation: t-pulse 1s infinite;
}

@keyframes t-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.t-status-label {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 4px;
}

.t-status-message {
  font-family: var(--t-mono);
  font-size: 0.72rem;
  color: var(--t-gray-400);
}

.t-install-summary {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.08);
  font-size: 0.92rem;
  line-height: 1.7;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .t-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .t-stat:nth-child(2) {
    border-right: none;
  }

  .t-footer-inner {
    grid-template-columns: 1fr;
  }

  .t-nav {
    display: none;
  }
}

@media (max-width: 600px) {
  .t-stats {
    grid-template-columns: 1fr;
  }

  .t-stat {
    border-right: none;
    border-bottom: 1px solid var(--t-border);
  }
}
