* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; background: #f5f5f5; color: #1a1a1a; }
.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }
.app-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 4px; }
h1 { font-size: 20px; font-weight: 600; }
.subtitle { color: #666; font-size: 13px; margin-bottom: 20px; }
.controls { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
#search { flex: 1; min-width: 200px; padding: 7px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; outline: none; }
#search:focus { border-color: #0078d4; box-shadow: 0 0 0 2px rgba(0,120,212,.15); }
select { padding: 7px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; background: #fff; cursor: pointer; }
.count { font-size: 13px; color: #666; margin-left: auto; white-space: nowrap; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
thead { background: #f0f0f0; }
th { padding: 10px 14px; text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #555; border-bottom: 1px solid #e0e0e0; cursor: pointer; user-select: none; white-space: nowrap; }
th:hover { background: #e8e8e8; }
th .arrow { margin-left: 4px; opacity: .4; font-style: normal; }
th.sorted .arrow { opacity: 1; }
td { padding: 9px 14px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }
td.num { width: 80px; font-family: monospace; font-size: 13px; color: #555; }
td.name a { color: #0078d4; text-decoration: none; }
td.name a:hover { text-decoration: underline; }
td.loc { width: 300px; font-size: 12px; color: #777; font-family: monospace; }
.hidden { display: none; }
.no-results { padding: 40px; text-align: center; color: #999; font-size: 14px; background: #fff; border-radius: 8px; }
.logout-btn { font-size: 13px; color: #666; text-decoration: none; padding: 6px 12px; border: 1px solid #ddd; border-radius: 6px; background: #fff; white-space: nowrap; }
.logout-btn:hover { border-color: #999; color: #333; }

/* ── Attachment column & drawer ── */
.files-cell { width: 44px; text-align: center; }
.attach-btn { background: none; border: none; cursor: pointer; color: #aaa; padding: 4px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; }
.attach-btn:hover { color: #0078d4; background: #f0f6ff; }

.attach-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 100; }
.attach-overlay.open { display: block; }

.attach-drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 380px; max-width: 100vw; background: #fff; border-left: 1px solid #e0e0e0; box-shadow: -4px 0 24px rgba(0,0,0,.10); z-index: 101; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .22s ease; }
.attach-drawer.open { transform: translateX(0); }

.attach-drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid #f0f0f0; gap: 12px; }
.attach-drawer-title { font-size: 13px; font-weight: 600; color: #1a1a1a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-close-btn { background: none; border: none; cursor: pointer; color: #888; padding: 4px; border-radius: 4px; display: flex; flex-shrink: 0; }
.attach-close-btn:hover { background: #f5f5f5; color: #333; }

.attach-drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }

.attach-dropzone { border: 2px dashed #d0d0d0; border-radius: 8px; padding: 28px 16px; text-align: center; color: #888; cursor: pointer; transition: border-color .15s, background .15s; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.attach-dropzone:hover, .attach-dropzone.dragover { border-color: #0078d4; background: #f0f6ff; color: #0078d4; }
.attach-dropzone p { font-size: 13px; margin: 0; }
.attach-browse-link { color: #0078d4; cursor: pointer; text-decoration: underline; }

.attach-upload-status { font-size: 12px; padding: 8px 10px; border-radius: 6px; background: #f5f5f5; color: #555; }
.attach-upload-status.hidden { display: none; }
.attach-upload-ok { background: #f0fdf4; color: #166534; }
.attach-upload-error { background: #fef2f2; color: #991b1b; }

.attach-file-list { display: flex; flex-direction: column; gap: 4px; }
.attach-file-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; background: #f9f9f9; font-size: 13px; }
.attach-file-row:hover { background: #f0f0f0; }
.attach-file-icon { flex-shrink: 0; color: #888; }
.attach-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #1a1a1a; }
.attach-file-size { font-size: 11px; color: #aaa; white-space: nowrap; }
.attach-action { background: none; border: none; cursor: pointer; color: #aaa; padding: 3px; border-radius: 4px; display: inline-flex; text-decoration: none; }
.attach-action:hover { color: #0078d4; background: #e8f0fe; }
.attach-delete:hover { color: #dc2626; background: #fef2f2; }
.attach-loading, .attach-empty, .attach-error { font-size: 13px; color: #888; text-align: center; padding: 20px 0; }
.attach-error { color: #dc2626; }

/* ── Login card (matches sales-space / estimating-space style) ── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f8fafc;
  margin: 0;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.login-container { width: 100%; max-width: 400px; padding: 24px; }
.login-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 36px; }
.login-brand { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 4px; }
.login-subtitle { font-size: 14px; color: #64748b; margin-bottom: 28px; }
.login-btn-microsoft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 500;
  background: #fff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
  text-decoration: none;
  box-sizing: border-box;
}
.login-btn-microsoft:hover { background: #f8fafc; border-color: #cbd5e1; }
.alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
}
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }

/* ──────────────────────────────────────────────────────────────────
   Auth pages — Clearspace Design System
   ────────────────────────────────────────────────────────────────── */

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

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

.auth-brand {
  grid-column: 1;
  grid-row: 1 / -1;
  display: grid;
  grid-template-rows: subgrid;
  background: var(--cs-dark-blue, #323D4C);
  color: #FFFFFF;
  padding: 64px 72px;
  overflow: hidden;
}
.auth-brand-top { grid-row: 1; align-self: start; }
.auth-brand-top img { height: 26px; display: block; width: auto; }
.auth-brand-content { grid-row: 2; align-self: start; }

.auth-headline {
  font-family: inherit;
  font-weight: 300;
  font-size: 88px;
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  color: #FFFFFF;
  text-wrap: balance;
  max-width: 9ch;
  margin: 0;
}
.auth-em { color: var(--cs-light-blue, #3BABFF); }

.auth-form {
  grid-column: 2;
  grid-row: 1 / -1;
  display: grid;
  grid-template-rows: subgrid;
  background: #FFFFFF;
  padding: 64px 80px;
}
.auth-form-top { grid-row: 1; align-self: start; height: 26px; }
.auth-form-middle {
  grid-row: 2;
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.auth-product {
  font-family: inherit;
  font-weight: 300;
  font-size: 72px;
  line-height: 1.0;
  letter-spacing: -0.03em;
  color: var(--cs-charcoal, #16191A);
  margin: 0;
}
.auth-blurb {
  font-family: inherit;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.45;
  color: var(--cs-n-500, #6B7280);
  margin: 20px 0 0;
  max-width: 38ch;
}

.auth-ms-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding: 16px 26px;
  border: 1px solid var(--cs-n-300, #D1D5DB);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--cs-charcoal, #16191A);
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-ms-btn:hover {
  border-color: var(--cs-n-500, #6B7280);
  box-shadow: 0 1px 6px rgba(22, 25, 26, 0.07);
}
.auth-ms-btn:focus-visible {
  outline: none;
  border-color: var(--cs-light-blue, #3BABFF);
  box-shadow: 0 0 0 3px rgba(59, 171, 255, 0.10);
}
.auth-ms-logo { width: 18px; height: 18px; flex-shrink: 0; }

.auth-sso-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-family: inherit;
  font-size: 13px;
  color: var(--cs-n-500, #6B7280);
}
.auth-sso-note svg { width: 14px; height: 14px; stroke: var(--cs-n-400, #9CA3AF); flex-shrink: 0; }

.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); }

.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; }

.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; }

@media (max-width: 880px) {
  .auth-split {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
  }
  .auth-brand, .auth-form {
    grid-column: 1;
    grid-row: auto;
    grid-template-rows: none;
    display: block;
  }
  .auth-brand { padding: 40px 32px; }
  .auth-headline { font-size: 56px; max-width: 14ch; }
  .auth-form { padding: 48px 32px; }
  .auth-form-top { display: none; }
  .auth-product { font-size: 48px; }
}
