/* =============================================================================
   Ticket Monkey Organiser — Keycloak login theme
   Dense / pro · dark dashboard preview on left · compact form on right
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --tm-brand-50:  #ecf3ff;
  --tm-brand-100: #dde9ff;
  --tm-brand-500: #465fff;
  --tm-brand-600: #3641f5;
  --tm-brand-700: #2a31d8;

  --tm-navy:       #0f1729;
  --tm-navy-2:     #131b30;
  --tm-navy-3:     #1a2440;
  --tm-navy-4:     #232f4f;

  --tm-orange:     #f28a3c;

  --tm-fg-1: #0c111d;
  --tm-fg-2: #344054;
  --tm-fg-3: #667085;
  --tm-fg-4: #98a2b3;

  --tm-bg-app:    #f7f8fa;
  --tm-surface:   #ffffff;
  --tm-border-light: #e4e7ec;
  --tm-border:       #d0d5dd;

  /* Primary action token — must NOT track the foreground colour (which flips
     in dark mode and produced the white-on-white sign-in button). Pinned to
     the dashboard's primary-button slate so both apps render identically in
     light and dark. */
  --tm-btn-primary-bg:        #0c111d;
  --tm-btn-primary-bg-hover:  #1d2939;
  --tm-btn-primary-bg-active: #344054;
  --tm-btn-primary-fg:        #ffffff;
  --tm-btn-primary-disabled-bg: #98a2b3;
  --tm-btn-primary-disabled-fg: #ffffff;

  --tm-success-50: #ecfdf3; --tm-success-500: #12b76a; --tm-success-600: #039855;
  --tm-warning-50: #fffaeb; --tm-warning-700: #b54708;
  --tm-error-50:   #fef3f2; --tm-error-500: #f04438; --tm-error-600: #d92d20; --tm-error-700: #b42318;

  --tm-shadow-xs: 0 1px 2px 0 rgba(16,24,40,0.05);
  --tm-shadow-sm: 0 1px 3px 0 rgba(16,24,40,0.10), 0 1px 2px 0 rgba(16,24,40,0.06);
  --tm-shadow-focus: 0 0 0 4px rgba(70,95,255,0.14);

  --tm-radius-sm: 6px;
  --tm-radius-md: 8px;
  --tm-radius-lg: 10px;

  --tm-font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --tm-font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tm-bg-app: #0c111d;
    --tm-surface: #1a2231;
    --tm-fg-1: #f9fafb;
    --tm-fg-2: #e4e7ec;
    --tm-fg-3: #98a2b3;
    --tm-fg-4: #667085;
    --tm-border-light: #2a3447;
    --tm-border: #3b475c;
  }
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%;
  font-family: var(--tm-font-sans);
  background: var(--tm-bg-app); color: var(--tm-fg-1);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--tm-brand-500); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.tm-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
}
@media (max-width: 960px) {
  .tm-shell { grid-template-columns: 1fr; }
  .tm-stage { display: none !important; }
}

/* ===== Left: dark dashboard preview ===== */
.tm-stage {
  position: relative; overflow: hidden;
  background: var(--tm-navy);
  color: #e4e7ec;
  padding: 28px 36px 0;
  display: flex; flex-direction: column; gap: 24px;
  border-right: 1px solid #000;
}
.tm-stage::before {
  /* subtle grid */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at top left, black 30%, transparent 75%);
}
.tm-stage::after {
  /* glow */
  content: ''; position: absolute; right: -200px; top: -200px;
  width: 500px; height: 500px; border-radius: 50%;
  background: radial-gradient(circle, rgba(70,95,255,0.35), transparent 60%);
  pointer-events: none;
}

.tm-stage-top {
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 1;
}
.tm-stage-top img { height: 26px; }
.tm-stage-tag {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--tm-orange);
  display: inline-flex; align-items: center; gap: 6px;
}
.tm-stage-tag::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--tm-orange); box-shadow: 0 0 0 4px rgba(242,138,60,0.18);
}

.tm-stage-headline {
  position: relative; z-index: 1;
  font-size: 28px; font-weight: 700; letter-spacing: -0.02em;
  line-height: 1.15; margin: 0; color: #fff;
  max-width: 440px;
}
.tm-stage-headline em { color: var(--tm-orange); font-style: normal; }

/* Dashboard preview window */
.tm-preview {
  position: relative; z-index: 1;
  background: linear-gradient(180deg, var(--tm-navy-2) 0%, var(--tm-navy-3) 100%);
  border: 1px solid var(--tm-navy-4);
  border-radius: 12px 12px 0 0;
  border-bottom: 0;
  margin-top: auto;
  box-shadow: 0 -20px 60px rgba(0,0,0,0.4);
  overflow: hidden;
}
.tm-preview-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--tm-navy-4);
  background: rgba(0,0,0,0.2);
}
.tm-preview-bar .dots { display: inline-flex; gap: 5px; }
.tm-preview-bar .dots i { width: 9px; height: 9px; border-radius: 50%; background: #2c3656; display: inline-block; }
.tm-preview-bar .url {
  font: 500 11px var(--tm-font-mono);
  color: #98a2b3; flex: 1; text-align: center;
  background: rgba(0,0,0,0.25);
  padding: 3px 10px; border-radius: 6px; max-width: 280px; margin: 0 auto;
}
.tm-preview-body {
  display: grid; grid-template-columns: 140px 1fr;
  min-height: 280px;
}
.tm-preview-side {
  background: rgba(0,0,0,0.3);
  border-right: 1px solid var(--tm-navy-4);
  padding: 12px 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.tm-preview-side .sec {
  font-size: 9px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: #667085; padding: 2px 8px 4px;
}
.tm-preview-side .nav {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px;
  font-size: 11px; color: #98a2b3;
}
.tm-preview-side .nav.active { background: rgba(70,95,255,0.18); color: #fff; }
.tm-preview-side .nav .ico {
  width: 14px; height: 14px; border-radius: 4px;
  background: rgba(255,255,255,0.1);
  flex: 0 0 auto;
}
.tm-preview-side .nav.active .ico { background: var(--tm-brand-500); }

.tm-preview-main { padding: 14px; }
.tm-preview-h {
  font-size: 11px; font-weight: 600; color: #fff; margin: 0 0 10px;
  letter-spacing: 0.02em;
}
.tm-preview-h .muted { color: #98a2b3; font-weight: 400; }
.tm-preview-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 12px; }
.tm-preview-stat {
  position: relative;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--tm-navy-4);
  border-radius: 8px;
  padding: 8px;
}
/* Tinted icon tile, mirroring the dashboard's metric-card icons */
.tm-preview-stat .tile {
  width: 16px; height: 16px; border-radius: 5px; display: block; margin-bottom: 6px;
}
.tm-preview-stat .tile.brand  { background: rgba(70,95,255,0.22);  box-shadow: inset 0 0 0 1px rgba(70,95,255,0.45); }
.tm-preview-stat .tile.info   { background: rgba(11,165,236,0.22); box-shadow: inset 0 0 0 1px rgba(11,165,236,0.45); }
.tm-preview-stat .tile.orange { background: rgba(242,138,60,0.22); box-shadow: inset 0 0 0 1px rgba(242,138,60,0.45); }
.tm-preview-stat .tile.error  { background: rgba(240,68,56,0.22);  box-shadow: inset 0 0 0 1px rgba(240,68,56,0.45); }
.tm-preview-stat .label { font-size: 8px; color: #98a2b3; text-transform: uppercase; letter-spacing: 0.05em; }
.tm-preview-stat .val { font-size: 15px; font-weight: 700; color: #fff; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tm-preview-stat .delta { font-size: 9px; color: var(--tm-success-500); margin-top: 1px; }
.tm-preview-stat .delta.down { color: #fda29b; }

/* Revenue chart card, mirroring the dashboard's card-head + chart body */
.tm-preview-card {
  border: 1px solid var(--tm-navy-4); border-radius: 8px;
  background: rgba(255,255,255,0.02); overflow: hidden;
}
.tm-preview-card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 8px 10px 6px;
}
.tm-preview-card-head .t { font-size: 11px; font-weight: 700; color: #fff; }
.tm-preview-card-head .muted { font: 500 9px var(--tm-font-mono); color: #98a2b3; }
.tm-preview-chart {
  height: 64px; padding: 0 8px 8px;
  position: relative;
  overflow: hidden;
}
.tm-preview-chart svg { width: 100%; height: 100%; }

/* ===== Right: form pane ===== */
.tm-form-wrap {
  background: var(--tm-surface);
  display: flex; align-items: center; justify-content: center;
  padding: 48px 32px;
}
.tm-form { width: 100%; max-width: 380px; }

.tm-form-mobile-logo { display: none; margin-bottom: 24px; }
.tm-form-mobile-logo img { height: 26px; }
@media (max-width: 960px) {
  .tm-form-mobile-logo { display: block; }
}

.tm-eyebrow {
  display: inline-block;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--tm-brand-600);
  background: var(--tm-brand-50);
  padding: 4px 10px; border-radius: 4px;
  margin-bottom: 12px;
}
.tm-h1 {
  font-size: 24px; font-weight: 700; color: var(--tm-fg-1);
  letter-spacing: -0.01em; margin: 0;
}
.tm-sub {
  font-size: 14px; color: var(--tm-fg-3);
  margin: 6px 0 0; line-height: 1.5;
}

/* ===== SSO buttons (primary in this theme) ===== */
.tm-sso { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
/* On the sign-in page the brokers follow the "or" divider, which already
   carries the gap — without this the two margins stack to 40px. */
.tm-or + .tm-sso { margin-top: 0; }
.tm-sso .tm-idp {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  background: var(--tm-surface);
  border: 1px solid var(--tm-border-light);
  border-radius: var(--tm-radius-md);
  color: var(--tm-fg-1);
  font: inherit; font-size: 14px; font-weight: 500;
  text-decoration: none;
  transition: border-color .15s, background .15s, transform .05s;
  cursor: pointer;
}
.tm-sso .tm-idp:hover { border-color: var(--tm-fg-3); background: #fafbfc; text-decoration: none; }
.tm-sso .tm-idp:active { transform: translateY(1px); }
.tm-sso .tm-idp svg { width: 18px; height: 18px; flex: 0 0 auto; }
.tm-sso .tm-idp .label { flex: 1; }
.tm-sso .tm-idp .meta { font-size: 11px; color: var(--tm-fg-4); font-weight: 400; }
.tm-sso .tm-idp.featured { border-color: var(--tm-brand-500); box-shadow: var(--tm-shadow-focus); }

/* ===== Auth tabs (Sign in / Create account) ===== */
.tm-tabs {
  display: flex;
  gap: 4px;
  margin: 18px 0 4px;
  border-bottom: 1px solid var(--tm-border-light);
  position: relative;
}
.tm-tab {
  flex: 1;
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 10px 8px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--tm-fg-3);
  cursor: pointer;
  text-align: center;
  transition: color .15s, border-color .15s;
}
.tm-tab:hover { color: var(--tm-fg-1); }
.tm-tab[aria-selected="true"] {
  color: var(--tm-fg-1);
  border-bottom-color: var(--tm-brand-500);
}
.tm-tab:focus-visible {
  outline: 0;
  box-shadow: var(--tm-shadow-focus);
  border-radius: 4px;
}
.tm-tab-panel[hidden] { display: none; }


/* ===== Form fields ===== */
.tm-field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.tm-field-row { display: flex; align-items: center; justify-content: space-between; }
.tm-label { font-size: 12px; font-weight: 600; color: var(--tm-fg-2); }

.tm-input {
  width: 100%;
  background: var(--tm-surface); color: var(--tm-fg-1);
  border: 1px solid var(--tm-border-light);
  border-radius: var(--tm-radius-md);
  padding: 10px 12px;
  font: inherit; font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.tm-input::placeholder { color: var(--tm-fg-4); }
.tm-input:focus {
  border-color: var(--tm-brand-500);
  box-shadow: var(--tm-shadow-focus);
}
.tm-field.has-error .tm-input,
.tm-input.has-error {
  border-color: var(--tm-error-500);
  box-shadow: 0 0 0 4px rgba(240,68,56,0.12);
}
.tm-error {
  font-size: 12px; color: var(--tm-error-700);
  margin-top: 2px;
}
.tm-hint {
  font-size: 12px; color: var(--tm-fg-3);
  margin: 0 0 4px; line-height: 1.45;
}
/* Required-field marker on User Profile driven forms */
.tm-req { color: var(--tm-error-500); margin-left: 3px; }

.tm-input:disabled, .tm-input[readonly] {
  background: var(--tm-bg-app); color: var(--tm-fg-3); cursor: not-allowed;
}
.tm-textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
.tm-select { padding-right: 10px; }
.tm-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.tm-group-header {
  font-size: 13px; font-weight: 700; color: var(--tm-fg-1);
  margin: 20px 0 0;
}

.tm-input-wrap { position: relative; }
.tm-input-wrap .tm-input { padding-right: 40px; }
.tm-pw-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 30px; height: 30px;
  border: 0; background: transparent; cursor: pointer;
  color: var(--tm-fg-3); border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
}
.tm-pw-toggle:hover { color: var(--tm-fg-1); background: rgba(0,0,0,0.04); }
.tm-pw-toggle svg { width: 16px; height: 16px; }

.tm-check {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--tm-fg-2); cursor: pointer; user-select: none;
}
.tm-check input { accent-color: var(--tm-brand-500); width: 16px; height: 16px; }
.tm-check-block {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; color: var(--tm-fg-2); user-select: none;
  margin-top: 12px; line-height: 1.45;
}
.tm-check-block input {
  accent-color: var(--tm-brand-500);
  width: 16px; height: 16px;
  margin-top: 2px; flex: 0 0 auto;
}
.tm-check-block .tm-check-text a { color: var(--tm-brand-500); }
.tm-check-block.has-error { color: var(--tm-error-700); }

/* ===== Buttons ===== */
.tm-btn {
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 10px 14px; border-radius: var(--tm-radius-md);
  border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: all .15s ease-in-out;
}
.tm-btn:focus-visible { box-shadow: var(--tm-shadow-focus); outline: 0; }
.tm-btn-primary {
  background: var(--tm-btn-primary-bg);
  color: var(--tm-btn-primary-fg);
}
.tm-btn-primary:hover   { background: var(--tm-btn-primary-bg-hover);  color: var(--tm-btn-primary-fg); }
.tm-btn-primary:active  { background: var(--tm-btn-primary-bg-active); color: var(--tm-btn-primary-fg); }
.tm-btn-primary:focus,
.tm-btn-primary:focus-visible { background: var(--tm-btn-primary-bg); color: var(--tm-btn-primary-fg); }
.tm-btn-primary:disabled,
.tm-btn-primary[aria-disabled="true"] {
  background: var(--tm-btn-primary-disabled-bg);
  color: var(--tm-btn-primary-disabled-fg);
  cursor: not-allowed;
}
.tm-btn-ghost { background: var(--tm-surface); color: var(--tm-fg-2); border-color: var(--tm-border-light); }
.tm-btn-ghost:hover { background: #f9fafb; }
.tm-btn-block { width: 100%; }

/* ===== Misc ===== */
.tm-bottom { text-align: center; font-size: 13px; color: var(--tm-fg-3); margin-top: 22px; }

/* Wrong-door cross-link (to the customer app) */
.tm-crosslink {
  margin-top: 20px;
  padding: 11px 14px;
  border: 1px solid var(--tm-border-light);
  border-radius: var(--tm-radius-md);
  background: var(--tm-bg-app);
  font-size: 13px; color: var(--tm-fg-3);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.tm-crosslink a { color: var(--tm-brand-600); font-weight: 600; white-space: nowrap; }
.tm-footer {
  margin-top: 28px; text-align: center; font-size: 11px; color: var(--tm-fg-4);
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
}
.tm-locale {
  appearance: none; background: transparent; border: 0; color: var(--tm-fg-3);
  font: inherit; font-size: 11px; cursor: pointer; padding: 2px 4px;
}

.tm-alert {
  padding: 10px 12px; border-radius: var(--tm-radius-md);
  font-size: 13px; line-height: 1.45;
  margin-top: 14px; border: 1px solid;
}
.tm-alert-error   { background: var(--tm-error-50);   color: var(--tm-error-700);   border-color: rgba(240,68,56,0.2); }
.tm-alert-warning { background: var(--tm-warning-50); color: var(--tm-warning-700); border-color: rgba(247,144,9,0.2); }
.tm-alert-success { background: var(--tm-success-50); color: var(--tm-success-600); border-color: rgba(18,183,106,0.2); }
.tm-alert-info    { background: var(--tm-brand-50);   color: var(--tm-brand-700);   border-color: var(--tm-brand-100); }

.tm-steps { display: flex; align-items: center; gap: 8px; margin: 10px 0 18px; font-size: 12px; color: var(--tm-fg-3); }
.tm-steps b { color: var(--tm-fg-1); font-weight: 600; }
.tm-steps i { width: 18px; height: 1px; background: var(--tm-border); display: inline-block; }

.tm-id-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 999px;
  background: #f2f4f7; color: var(--tm-fg-2);
  font-size: 13px; margin-top: 6px; max-width: 100%;
}
.tm-id-chip strong { color: var(--tm-fg-1); font-weight: 600; }
.tm-id-chip a { font-size: 12px; }

.tm-otp { display: flex; gap: 8px; justify-content: space-between; margin-top: 4px; }
.tm-otp input {
  width: 100%; aspect-ratio: 1/1.1; max-width: 50px;
  text-align: center; font-size: 20px; font-weight: 700;
  border: 1px solid var(--tm-border-light);
  border-radius: var(--tm-radius-md);
  background: var(--tm-surface); color: var(--tm-fg-1);
  font-family: var(--tm-font-mono);
  outline: none;
}
.tm-otp input:focus { border-color: var(--tm-brand-500); box-shadow: var(--tm-shadow-focus); }

.tm-big-icon {
  width: 48px; height: 48px; border-radius: 10px;
  display: grid; place-items: center; margin: 0 0 14px;
}
.tm-big-icon svg { width: 24px; height: 24px; }
.tm-big-icon.brand   { background: var(--tm-brand-50);   color: var(--tm-brand-600); }
.tm-big-icon.warning { background: var(--tm-warning-50); color: var(--tm-warning-700); }
.tm-big-icon.error   { background: var(--tm-error-50);   color: var(--tm-error-600); }
.tm-big-icon.success { background: var(--tm-success-50); color: var(--tm-success-600); }

.tm-or {
  position: relative; text-align: center; margin: 18px 0;
}
.tm-or::before {
  content: ''; position: absolute; top: 50%; left: 0; right: 0;
  border-top: 1px solid var(--tm-border-light);
}
.tm-or span {
  position: relative; background: var(--tm-surface);
  padding: 0 12px; font-size: 11px; color: var(--tm-fg-4);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}
