/* Triple Management — design system aligned with Triple Hire (dark header, teal + blue accents). */
/* Inter font is loaded via <link> from Layout::headAssets() so dashboard rules aren’t gated on @import. */

:root {
  --thm-font: 'Inter', system-ui, -apple-system, sans-serif;
  /* Align with Triple Hire staff shell (`#f8f9fa` canvas under sticky chrome) */
  --thm-bg: var(--thm-tenant-bg, #f8f9fa);
  --thm-surface: #ffffff;
  --thm-text: var(--thm-tenant-text, #1e293b);
  --thm-text-muted: #64748b;
  --thm-border: #e9ecef;
  --thm-header-from: #1a1a1a;
  --thm-header-to: #2d2d2d;
  --thm-accent: var(--thm-tenant-accent, #20c997);
  --thm-accent-secondary: var(--thm-tenant-accent-secondary, #0d6efd);
  --thm-accent-blue: var(--thm-accent-secondary);
  --thm-accent-hover: #1aa179;
  --thm-danger-bg: #fef2f2;
  --thm-danger-border: #fecaca;
  --thm-danger-text: #b91c1c;
  --thm-radius: 10px;
  --thm-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
  --thm-shadow-card: 0 4px 16px rgba(0, 0, 0, 0.06);
}

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

body.thm-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--thm-font);
  color: var(--thm-text);
  background: var(--thm-bg);
  line-height: 1.5;
}

/* Full-height chrome + scrollable workspace (similar to Bootstrap staff layout) */
body.thm-body:not(.thm-auth-page) {
  display: flex;
  flex-direction: column;
}

.thm-main {
  flex: 1;
  width: 100%;
}

/* Centered sign-in / password flows (no app header) */
body.thm-body.thm-auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(1.25rem, env(safe-area-inset-top))
    max(1.25rem, env(safe-area-inset-right))
    max(1.25rem, env(safe-area-inset-bottom))
    max(1.25rem, env(safe-area-inset-left));
  box-sizing: border-box;
}

@media (max-width: 420px) {
  body.thm-body.thm-auth-page {
    align-items: flex-start;
    padding:
      max(1rem, env(safe-area-inset-top))
      max(0.25rem, env(safe-area-inset-right))
      max(1rem, env(safe-area-inset-bottom))
      max(0.25rem, env(safe-area-inset-left));
  }

  .thm-auth-stack { gap: 1rem; }
  .thm-auth-page .thm-card { padding: 1.25rem 1rem; }
  .thm-auth-page .thm-input { min-height: 44px; font-size: 16px; }
  .thm-auth-page .thm-btn { min-height: 44px; }
}

@media (max-height: 500px) {
  body.thm-body.thm-auth-page { align-items: flex-start; }
  .thm-shell { margin: 0.5rem auto; }
}

.thm-auth-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.35rem;
}

/* Match `.thm-brand img` sizing so login chrome matches signed-in chrome; cap width on wide marks. */
.thm-auth-brandmark {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.thm-workspace-address {
  margin: 0.5rem 0 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--thm-tenant-text, var(--thm-text-muted, #64748b));
  white-space: pre-line;
}

.thm-auth-brandmark img,
.thm-auth-brandmark-img {
  display: block;
  height: 36px;
  max-height: 36px !important;
  max-width: min(260px, 100%) !important;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

/* Triple Hire `.system-header` lineage: sticky bar, teal strip, centred fluid inner */
.thm-header-bar {
  position: sticky;
  top: 0;
  z-index: 500;
  flex-shrink: 0;
  background: linear-gradient(90deg, #1a1a1a 0%, #333333 100%);
  color: #fff;
  border-bottom: 3px solid var(--thm-accent);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.38);
}

.thm-header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px clamp(16px, 4vw, 28px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem 1.5rem;
}

.thm-header-bar a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.thm-header-bar a:hover {
  color: var(--thm-accent);
}

/* Triple Hire utility cluster: textual links + red uppercase sign-out pill */
.thm-header-bar .thm-nav a[href="/logout"] {
  display: inline-block;
  padding: 6px 15px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #dc3545 !important;
  color: #fff !important;
  border: none;
}

.thm-header-bar .thm-nav a[href="/logout"]:hover {
  color: #fff !important;
  filter: brightness(1.06);
}

.thm-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.85rem 1.65rem;
}

.thm-header-util {
  display: flex;
  align-items: center;
  gap: 0.52rem;
}

.thm-util-icon {
  appearance: none;
  box-sizing: border-box;
  position: relative;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.08rem;
  cursor: not-allowed;
}

.thm-util-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.thm-util-icon--badge {
  overflow: visible;
}

@media (max-width: 768px) {
  .thm-header-inner {
    justify-content: center;
    flex-direction: column;
    text-align: center;
  }

  .thm-brand {
    flex-direction: column;
    text-align: center;
  }

  .thm-header-actions {
    width: 100%;
    flex-direction: column;
    align-items: center;
  }

  .thm-header-util {
    justify-content: center;
  }

  .thm-header-bar .thm-nav {
    justify-content: center;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    width: 100%;
  }
}

.thm-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.thm-brand img {
  height: 38px;
  width: auto;
  max-width: min(260px, 42vw);
  object-fit: contain;
}

.thm-brand-mark {
  height: 36px;
  width: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--thm-accent), var(--thm-accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  letter-spacing: -0.02em;
}

.thm-brand-title {
  margin: 0;
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
}

/* Echo Triple Hire `.role-badge` beside the masthead title */
.thm-brand-sub {
  margin-top: 5px;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--thm-accent);
  background-color: rgba(32, 201, 151, 0.14);
  border: 1px solid rgba(32, 201, 151, 0.36);
}

.thm-nav {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.thm-shell {
  box-sizing: border-box;
  max-width: 480px;
  margin: 1.65rem auto 2.75rem;
  padding: 0 clamp(14px, 4vw, 22px);
}

.thm-shell-wide {
  box-sizing: border-box;
  max-width: 1180px;
  margin: 1.5rem auto 2.75rem;
  padding: 0 clamp(14px, 4vw, 26px);
}

.thm-card {
  background: var(--thm-surface);
  border-radius: var(--thm-radius);
  box-shadow: 0 0.125rem 0.35rem rgba(15, 23, 42, 0.07);
  border: 1px solid var(--thm-border);
  padding: 1.85rem clamp(1.25rem, 3vw, 1.85rem);
}

.thm-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--thm-tenant-text, var(--thm-text, #111827));
}

.thm-lead {
  color: var(--thm-text-muted);
  font-size: 0.95rem;
  margin: 0 0 1.25rem;
}

.thm-muted {
  font-size: 0.85rem;
  color: var(--thm-text-muted);
}

.thm-muted code {
  font-size: 0.8em;
}

.thm-form label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin: 1rem 0 0.35rem;
  color: var(--thm-tenant-text, var(--thm-text, #111827));
}

.thm-form label:first-child { margin-top: 0; }

.thm-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--thm-border);
  font-size: 1rem;
  font-family: inherit;
  background: #fafafa;
  color: var(--thm-text);
}

.thm-input:focus {
  outline: none;
  border-color: var(--thm-accent-secondary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.2);
  background: #fff;
}

.thm-password-wrap {
  position: relative;
  display: block;
}
.thm-password-wrap .thm-input {
  padding-right: 2.75rem;
}
.thm-password-toggle {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #888;
  width: 2rem;
  height: 2rem;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
}
.thm-password-toggle:hover,
.thm-password-toggle:focus {
  color: #555;
  background: rgba(15, 23, 42, 0.06);
}
.thm-password-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
  pointer-events: none;
}

.thm-btn {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  background: var(--thm-tenant-button, var(--thm-accent, #20c997));
  color: var(--thm-tenant-button-text, #fff) !important;
  text-decoration: none !important;
}

.thm-btn:hover {
  filter: brightness(1.08);
}

.thm-btn-accent {
  background: var(--thm-tenant-button, var(--thm-accent, #20c997));
  color: var(--thm-tenant-button-text, #fff) !important;
}

.thm-btn-accent:hover {
  filter: brightness(0.95);
}

.thm-btn-block {
  width: 100%;
  text-align: center;
  margin-top: 1rem;
}

.thm-error {
  background: var(--thm-danger-bg);
  border: 1px solid var(--thm-danger-border);
  color: var(--thm-danger-text);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.thm-flash-ok {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.thm-form-foot {
  margin-top: 1.25rem;
  font-size: 0.88rem;
}

.thm-form-foot a {
  color: var(--thm-tenant-text, var(--thm-text, #111827));
  font-weight: 500;
}

.thm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.thm-table th,
.thm-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--thm-border);
}

.thm-table th {
  font-weight: 600;
  color: var(--thm-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.thm-page-actions {
  margin-bottom: 1.25rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Apex / marketing hero */
.thm-apex-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--thm-font);
  background: linear-gradient(165deg, #0f1419 0%, #1a2229 50%, #111923 100%);
  color: #e7ecf1;
}

.thm-apex-inner > h1 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.35rem, 4vw, 1.65rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.thm-apex-inner {
  max-width: 460px;
  margin: 0 auto;
  padding: min(11vh, 4.5rem) 1.35rem 3rem;
}

.thm-apex-logo-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.thm-apex-logo-row img {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.thm-apex-kicker {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--thm-accent);
}

.thm-apex-card {
  background: rgba(21, 27, 34, 0.95);
  border: 1px solid #2a3440;
  border-radius: var(--thm-radius);
  padding: 1.75rem 1.5rem;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.thm-apex-card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
}

.thm-apex-lead {
  color: #94a3b8;
  font-size: 0.98rem;
  margin: 0 0 1.35rem;
}

.thm-apex-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.thm-apex-row .thm-input {
  flex: 1;
  min-width: 140px;
  background: #0f1419;
  border-color: #334155;
  color: #e7ecf1;
}

.thm-apex-footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: #64748b;
}

.thm-apex-footer a {
  color: #38bdf8;
}

/* Error shell (404) */
.thm-error-page {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--thm-font);
  background: linear-gradient(160deg, #0c1014 0%, #111923 45%, #0c1014 100%);
  color: #e7ecf1;
}

.thm-error-inner {
  max-width: 420px;
  padding: 1.75rem;
  text-align: center;
}

.thm-error-card {
  background: #151b22;
  border: 1px solid #2a3440;
  border-radius: 12px;
  padding: 1.75rem 1.35rem;
}

.thm-rate-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--thm-font);
  background: var(--thm-bg);
}

.thm-rate-card {
  max-width: 400px;
  padding: 2rem;
}

code {
  background: #f1f5f9;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.88em;
}

.thm-apex-body code,
.thm-error-page code {
  background: #1e293b;
  color: #e2e8f0;
}
