@import url('colors_and_type.css');
@import url('kit.css');

/* ── Utility ── */
.hidden { display: none !important; }

/* Toolbars: search stays left, filters/controls push to the right.
   kit.css caps .filter-bar .grow at 260px, which clusters everything left —
   lift the cap; the inputs inside carry their own max-widths. */
.filter-bar .grow { max-width: none; }

/* ──────────────────────────────────────────────────────────────────
   Auth pages — Clearspace Design System
     · Login: split-screen — dark brand panel + white sign-in card (single Microsoft SSO button)
     · Callback / Reset / Denied / 403 (Centered Minimal)
   Standalone-safe: every token has a hex fallback inside var().
   ────────────────────────────────────────────────────────────────── */

.auth-body {
  margin: 0;
  min-height: 100vh;
  background: var(--cs-dark-blue, #323D4C);
  color: var(--cs-charcoal, #16191A);
  font-family: var(--font-primary, 'Suisse Intl', 'Suisse Int\'l', 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.auth-body *, .auth-body *::before, .auth-body *::after { box-sizing: border-box; }

.login-body {
  /* kit.css defines .login-body as a centering flexbox for the old card login —
     override it so the split-screen page spans the full viewport. */
  display: block;
  align-items: initial;
  justify-content: initial;
  background: #fff;
  margin: 0;
  min-height: 100vh;
  color: var(--cs-charcoal, #16191A);
  font-family: var(--font-primary, 'Suisse Intl', 'Suisse Int\'l', 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.login-body *, .login-body *::before, .login-body *::after { box-sizing: border-box; }

.login-split { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; width: 100%; }

/* Left — dark brand panel */
.login-brand {
  position: relative; display: flex; flex-direction: column; justify-content: center;
  gap: 28px; padding: 56px 60px; background: var(--cs-dark-blue, #323D4C); color: #fff; overflow: hidden;
}
.login-hero-logo, .login-body img[alt="Clearspace"] { object-fit: contain; object-position: left center; }
.login-hero-logo { height: 64px; width: auto; max-width: 100%; align-self: flex-start; flex-shrink: 0; display: block; }
.login-lede { max-width: 420px; margin: 0; font-size: 18px; line-height: 1.6; color: rgba(255,255,255,0.62); }
.login-foot {
  position: absolute; left: 60px; right: 60px; bottom: 40px; display: flex; gap: 26px;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255,255,255,0.34);
}

/* Right — sign-in panel */
.login-signin { display: flex; align-items: center; justify-content: center; padding: 48px; background: #fff; }
.login-card {
  width: 100%; max-width: 400px; border: 1px solid var(--cs-n-200, #E5E7EB);
  border-radius: var(--radius-xl, 14px); padding: 36px; box-shadow: var(--shadow-card, 0 1px 4px rgba(22,25,26,0.06));
}
.login-card-title { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; color: var(--cs-charcoal, #16191A); }
.login-card-sub { font-size: 14px; line-height: 1.5; color: var(--cs-n-500, #6B7280); margin: 0 0 26px; }

.login-btn-ms {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: var(--btn-h-lg, 44px); padding: 0 16px;
  font-family: inherit; font-size: 15px; font-weight: 500;
  color: #1E293B; background: #fff; border: 1px solid var(--cs-n-300, #D1D5DB); border-radius: var(--radius-md, 8px);
  text-decoration: none; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease;
}
.login-btn-ms:hover { background: var(--cs-n-50, #F9FAFB); border-color: var(--cs-n-400, #9CA3AF); }
.login-btn-ms:focus-visible {
  outline: none; border-color: var(--cs-light-blue, #3BABFF);
  box-shadow: 0 0 0 3px rgba(59, 171, 255, 0.10);
}
.login-btn-ms svg { width: 18px; height: 18px; flex-shrink: 0; }

.login-note { margin: 22px 0 0; font-size: 13px; line-height: 1.5; color: var(--cs-n-400, #9CA3AF); }

@media (max-width: 767.98px) {
  .login-split { grid-template-columns: 1fr; }
  .login-brand { padding: 40px 28px; gap: 16px; min-height: 38vh; justify-content: flex-end; }
  .login-hero-logo { height: 44px; }
  .login-lede { font-size: 16px; }
  .login-foot { display: none; }
  .login-signin { padding: 28px 24px; align-items: flex-start; }
}

/* ─── Inline flash (single-line, above the product wordmark) ──────── */

.auth-flash {
  margin: 0 0 16px 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.005em;
}
.auth-flash--error   { color: var(--cs-light-red, #F05A5A); }
.auth-flash--success { color: var(--cs-dark-green, #3F4D32); }

/* ─── Centered Minimal — callback / reset / denied / 403 ──────────── */

.auth-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 64px 32px;
  background: #FFFFFF;
}
.auth-stack {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.auth-stack-mark {
  height: 26px;
  width: auto;
  display: block;
  margin-bottom: 48px;
}
.auth-stack-product {
  font-family: inherit;
  font-weight: 300;
  font-size: 48px;
  line-height: 1.0;
  letter-spacing: -0.03em;
  color: var(--cs-charcoal, #16191A);
  margin: 0;
}
.auth-stack-subtitle {
  font-family: inherit;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.45;
  color: var(--cs-n-500, #6B7280);
  margin: 16px 0 0;
  max-width: 38ch;
}
.auth-stack .auth-flash { margin-bottom: 24px; }

/* ─── Form fields (reset_password only) ───────────────────────────── */

.auth-form-fields {
  width: 100%;
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label {
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  color: var(--cs-n-700, #374151);
  letter-spacing: -0.005em;
}
.auth-field input {
  width: 100%;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 300;
  color: var(--cs-charcoal, #16191A);
  background: #FFFFFF;
  border: 1px solid var(--cs-n-300, #D1D5DB);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-field input::placeholder { color: var(--cs-n-400, #9CA3AF); font-weight: 300; }
.auth-field input:focus {
  border-color: var(--cs-light-blue, #3BABFF);
  box-shadow: 0 0 0 3px rgba(59, 171, 255, 0.10);
}

.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 4px;
  padding: 12px 18px;
  border: 1px solid var(--cs-light-blue, #3BABFF);
  border-radius: 8px;
  background: var(--cs-light-blue, #3BABFF);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.auth-btn:hover {
  background: var(--cs-dark-blue, #323D4C);
  border-color: var(--cs-dark-blue, #323D4C);
}
.auth-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 171, 255, 0.20);
}
.auth-btn--link { text-align: center; margin-top: 28px; }

/* ─── dc_space app-specific ───────────────────────────────────────── */

/* TFR / estimate status badges reuse .stage-badge sizing from the kit */
.status-awaiting-test-fit  { background: #EEF2F7; color: #475569; }
.status-reviewing-test-fit { background: #FEF3C7; color: #92400E; }
.status-awaiting-quote     { background: #E0EDFF; color: #1D4ED8; }
.status-quote-in-progress  { background: #DBEAFE; color: #1E40AF; }
.status-reviewing-quote    { background: #FDE68A; color: #78350F; }
.status-quote-completed    { background: #DCFCE7; color: #166534; }
.status-archived           { background: #F3F4F6; color: #9CA3AF; }
.status-open      { background: #E0EDFF; color: #1D4ED8; }
.status-active    { background: #DCFCE7; color: #166534; }
.status-completed { background: #F3F4F6; color: #374151; }
.status-lost      { background: #FEE2E2; color: #991B1B; }

/* Summary tab hierarchy */
.sum-hidden { display: none; }
.sum-chev { display: inline-block; width: 14px; color: var(--cs-n-400, #9CA3AF); font-size: 11px; }
.sum-group:hover, .sum-cat:hover { background: rgba(59, 171, 255, 0.04) !important; }

/* Compare diff badges + AI output */
.status-diff-added     { background: #DCFCE7; color: #166534; }
.status-diff-removed   { background: #FEE2E2; color: #991B1B; }
.status-diff-changed   { background: #FEF3C7; color: #92400E; }
.status-diff-unchanged { background: #F3F4F6; color: #9CA3AF; }
.active-filter { background: var(--cs-dark-blue, #323D4C) !important; color: #fff !important; }
.ai-output { font-size: 14px; line-height: 1.55; }
.ai-output h4, .ai-output h5 { margin: 12px 0 4px; color: var(--cs-charcoal, #16191A); }
.ai-output p { margin: 0 0 8px; }
.ai-output li { margin-left: 20px; }

/* Sortable table headers */
th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
th[data-sort]::after { content: '↕'; margin-left: 6px; opacity: 0.35; font-size: 11px; }
th[data-sort].sort-asc::after  { content: '↑'; opacity: 0.9; }
th[data-sort].sort-desc::after { content: '↓'; opacity: 0.9; }

/* Multi-select filter dropdown */
.filter-dd { position: relative; }
.filter-dd-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  min-width: 220px; max-height: 280px; overflow-y: auto;
  background: #fff; border: 1px solid var(--cs-n-200, #E5E7EB); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(22,25,26,0.12); padding: 8px;
}
.filter-dd-menu label {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  font-size: 13px; border-radius: 6px; cursor: pointer;
}
.filter-dd-menu label:hover { background: var(--cs-n-50, #F9FAFB); }

/* Modal (generic) */
.cs-modal-backdrop {
  position: fixed; inset: 0; background: rgba(22, 25, 26, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 24px;
}
.cs-modal {
  background: #fff; border-radius: 14px; padding: 28px; max-width: 720px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 16px 48px rgba(22, 25, 26, 0.25);
}
.cs-modal h3 { margin: 0 0 16px; font-size: 18px; font-weight: 600; }

/* Table reflows to cards on phones — never sideways scroll */
@media (max-width: 767.98px) {
  .table-card-reflow thead { display: none; }
  .table-card-reflow, .table-card-reflow tbody, .table-card-reflow tr, .table-card-reflow td { display: block; width: 100%; }
  .table-card-reflow tr {
    border: 1px solid var(--cs-n-200, #E5E7EB); border-radius: 10px;
    margin-bottom: 10px; padding: 10px 12px; background: #fff;
  }
  .table-card-reflow td { border: none !important; padding: 4px 0 !important; }
  .table-card-reflow td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--cs-n-400, #9CA3AF); margin-bottom: 1px;
  }
  .filter-bar { flex-wrap: wrap; }
  .field-grid, .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
  .stat-grid { grid-template-columns: 1fr 1fr !important; }
  .page-header { flex-wrap: wrap; gap: 10px; }
}
