/* ===================================================================
   common/_shell.css — shared admin-shell design system
   Loaded by org/platform/_layout.html after common/_tokens.css (the
   single source for values shared with the customer app too) and each
   role's own small _layout.css (role tokens + role-specific rules).
   Every rule here is written against generic tokens (--accent,
   --accent-deep, --sidebar-bg, ...) so each role's own token file can
   swap the theme without touching this file.
   =================================================================== */

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

:root {
  /* Admin dashboards' own design language — tighter radius scale and
     Inter-only display font, distinct from the customer app's. ink/
     white/border/text-tertiary/font-body come from common/_tokens.css.
     --navy aliases straight to --ink (Primary Navy) rather than its own
     hex — the brand sheet's own "Navigation bar" example uses Primary
     Navy itself for dark nav backgrounds, not a separate darker shade. */
  --navy:           var(--ink);
  --paper:          #F5F7F9;
  --mist:           #E6EEF2;
  --text-secondary: #6E7B87;
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
  --shadow-card:    0 1px 3px color-mix(in srgb, var(--ink) 6%, transparent), 0 4px 12px color-mix(in srgb, var(--ink) 6%, transparent);
  --font-display:   "Inter", system-ui, -apple-system, sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===================================================================
   Flash messages
   =================================================================== */
.flash-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.flash {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  word-break: break-word;
  opacity: 1;
  transition: opacity 250ms, transform 250ms;
}
.flash--dismissing { opacity: 0; transform: translateX(12px); }
.flash--success  { background: var(--success); color: #fff; }
.flash--danger   { background: var(--danger); color: #fff; }
.flash--warning  { background: var(--warning); color: #fff; }
.flash--info     { background: var(--accent-deep); color: #fff; }

.flash-text { flex: 1; }
.flash-close {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(255,255,255,0.18);
  color: inherit;
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}
.flash-close:hover { opacity: 1; background: rgba(255,255,255,0.3); }

/* ===================================================================
   Admin shell — sidebar + main
   =================================================================== */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 16px;
}

.admin-brand .brand-mark {
  width: 22px;
  height: 26px;
  color: var(--accent);
  flex-shrink: 0;
}

.admin-brand .brand-word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.2px;
}
.admin-brand .brand-word b { font-weight: 800; color: var(--accent); }
.admin-brand .brand-logo {
  /* Uploaded logos keep their real colors on a light chip — the old
     brightness(0) invert(1) flattened every logo to a white silhouette,
     which turned detailed/colored marks into an illegible blob on the
     dark sidebar. */
  max-height: 52px;
  max-width: 172px; /* sidebar 220px − 2×20px brand padding, a hair inside */
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
}

.admin-brand-badge {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 70%, transparent);
  margin-top: 1px;
}

.admin-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
  overflow-y: auto;
  min-height: 0;
}

.admin-nav-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  padding: 14px 12px 6px;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}
.admin-nav-link .ti { font-size: 17px; }
.admin-nav-link:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.9); }
.admin-nav-link--active {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}

.admin-logout-wrap {
  padding: 16px 10px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 16px;
}

.admin-logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: rgba(255,255,255,0.45);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 120ms ease, color 120ms ease;
}
.admin-logout-btn .ti { font-size: 17px; }
.admin-logout-btn:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.75); }

/* ===================================================================
   Main content area
   =================================================================== */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

.admin-content {
  padding: 40px 32px;
}

/* ===================================================================
   Page title/subtitle — the .page-header wrapper layout itself is
   role-specific (some pages stack title+sub, some put an action button
   alongside), so it stays in each role's own _layout.css.
   =================================================================== */
.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  margin: 0 0 4px;
}

.page-sub {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0;
}

/* ===================================================================
   Shared card
   =================================================================== */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  margin: 0 0 4px;
}

.card-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 20px;
  line-height: 1.5;
}

/* ===================================================================
   Buttons
   =================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 18px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, opacity 120ms ease;
  white-space: nowrap;
}
.btn .ti { font-size: 16px; }

.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: var(--accent-deep); }

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn-outline:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }

.btn-ghost {
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid var(--mist);
}
.btn-ghost:hover { background: var(--mist); }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: var(--danger-deep); }

.btn-sm { height: 32px; padding: 0 14px; font-size: 12.5px; }

/* ===================================================================
   Status + priority pills — shared across appointments, customers, dashboard
   =================================================================== */
.appt-status {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: capitalize;
  white-space: nowrap;
}
.appt-status--submitted           { background: color-mix(in srgb, var(--secondary-blue) 12%, transparent);  color: var(--secondary-blue); }
.appt-status--seeking_quotes      { background: color-mix(in srgb, var(--teal) 12%, transparent);  color: #1A8C96; }
.appt-status--pending_approval    { background: color-mix(in srgb, var(--teal) 12%, transparent);  color: #1A8C96; }
.appt-status--pending_reapproval  { background: color-mix(in srgb, var(--warning) 14%, transparent);  color: #B87A00; }
.appt-status--approved            { background: color-mix(in srgb, var(--success) 12%, transparent);   color: var(--success); }
.appt-status--scheduled           { background: color-mix(in srgb, var(--warning) 14%, transparent);  color: #B87A00; }
.appt-status--in_progress         { background: color-mix(in srgb, var(--navy) 10%, transparent);     color: var(--navy); }
.appt-status--awaiting_parts      { background: color-mix(in srgb, var(--warning) 18%, transparent);  color: #B87A00; }
.appt-status--completed           { background: color-mix(in srgb, var(--success) 12%, transparent);   color: var(--success); }
.appt-status--invoiced            { background: color-mix(in srgb, var(--navy) 10%, transparent);     color: var(--navy); }
.appt-status--paid                { background: color-mix(in srgb, var(--success) 12%, transparent);   color: var(--success); }
.appt-status--cancelled           { background: color-mix(in srgb, var(--text-secondary) 10%, transparent);  color: #6B7F8C; }

.appt-priority {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 1px 6px;
  border-radius: 20px;
}
.appt-priority--urgent    { background: color-mix(in srgb, var(--warning) 14%, transparent); color: #B87A00; }
.appt-priority--emergency { background: color-mix(in srgb, var(--danger) 12%, transparent);  color: var(--danger); }

/* ===================================================================
   Shared form elements
   =================================================================== */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.form-control {
  display: block;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--white);
  border: 1.5px solid var(--mist);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 150ms ease;
}
.form-control:focus { border-color: var(--accent); }
.form-control::placeholder { color: var(--text-secondary); }

.form-hint {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.form-hint code {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11.5px;
  font-family: ui-monospace, monospace;
}

/* Select */
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%236B7F8C' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Checkbox row */
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.form-check label {
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
}

/* ===================================================================
   Password field — toggle-eye + strength meter
   Shared by every login/signup/reset-password page across roles.
   =================================================================== */
.password-field, .pw-wrap { position: relative; }
.password-field .form-control, .pw-wrap .form-control { padding-right: 42px; }
.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.toggle-password:hover { color: var(--ink); }

.strength-bar { height: 4px; border-radius: 2px; background: #e8e8e8; margin-top: 8px; overflow: hidden; }
.strength-fill { height: 100%; width: 0%; border-radius: 2px; background: #f0a000; transition: width 200ms ease, background 200ms ease; }
.strength-fill.weak   { width: 25%;  background: #D9534F; }
.strength-fill.fair   { width: 50%;  background: #f0a000; }
.strength-fill.good   { width: 75%;  background: #5BA3D9; }
.strength-fill.strong { width: 100%; background: #2e7d32; }
.strength-text { display: block; margin-top: 5px; font-size: 11.5px; color: #888; }
.strength-text.weak   { color: #D9534F; }
.strength-text.fair   { color: #f0a000; }
.strength-text.good   { color: #4A90C2; }
.strength-text.strong { color: #2e7d32; }
.match-text { display: block; margin-top: 6px; font-size: 11.5px; }
.match-text.match    { color: #2e7d32; }
.match-text.no-match { color: #D9534F; }
