/* ============================================================================
   QHRM Super Admin — component styles (app shell, primitives, dashboard).
   Global stylesheet so tokens/classes are shared across all components.
   ========================================================================== */

/* ---------- App shell v2 (ported from QHRM Super Admin.dc.html) ---------- */
.q-rail { width: 240px; flex-shrink: 0; transition: width .14s ease; }
.q-aside { width: 240px; flex-shrink: 0; transition: width .14s ease; }
.q-collapsed .q-rail { width: 64px; }
.q-collapsed .q-aside { width: 64px; }
.q-collapsed .q-collapsible { display: none !important; }
.q-collapsed .qn-item { justify-content: center; padding: 0; }
.q-collapsed .qn-item__label { display: none; }
.q-collapsed .qn-head { display: none; }

.qn-head {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); padding: 14px 12px 6px;
}
.qn-item {
  display: flex; align-items: center; gap: 11px; width: 100%; height: 37px;
  padding: 0 12px; justify-content: flex-start; border-radius: 8px;
  font-size: 13px; font-weight: 500; margin-bottom: 2px;
  background: transparent; color: var(--text-2); text-decoration: none;
  transition: background .12s, color .12s;
}
.qn-item:hover { background: var(--surface-2); color: var(--text); }
.qn-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.qn-item__icon { display: flex; flex-shrink: 0; }
.qn-item__label { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* generic hover helper for inline-styled buttons that need a surface hover */
.q-hov:hover { background: var(--surface-2) !important; color: var(--text) !important; }
.q-hov-accent:hover { border-color: var(--accent) !important; color: var(--accent) !important; }

/* Solid accent-filled buttons (ported inline-styled, `background:var(--accent)`)
   must DARKEN on hover and keep their light text. Without this, the generic
   hover helpers above flip the text to accent/surface colour — which matches the
   accent fill and makes the label vanish. The [style*=] match is intentionally
   scoped to accent-filled buttons, so outline buttons using these helpers keep
   their accent-text hover. */
.q-hov-accent[style*="background:var(--accent);"]:hover,
.q-hov[style*="background:var(--accent);"]:hover {
  background: var(--accent-2) !important;
  color: var(--accent-on) !important;
  border-color: transparent !important;
}

/* ---------- App shell (legacy v1 — unused, kept harmless) ---------- */
.q-shell { display: flex; min-height: 100vh; }

.q-sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.q-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 18px;
}
.q-logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-on);
  display: grid; place-items: center;
  font-weight: 800; font-size: 16px;
  flex-shrink: 0;
}
.q-logo__text { font-weight: 700; font-size: 14px; letter-spacing: -.01em; line-height: 1.1; }
.q-logo__sub { display: block; font-size: 11px; font-weight: 600; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; }

.q-nav { display: flex; flex-direction: column; gap: 2px; }
.q-nav__section {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); padding: 16px 10px 6px;
}
.q-nav__item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--r-control);
  color: var(--text-2); font-size: 13px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.q-nav__item:hover { background: var(--surface-2); color: var(--text); }
.q-nav__item.active {
  background: var(--accent-soft); color: var(--accent);
  font-weight: 600;
}
.q-nav__item.active .q-nav__icon { color: var(--accent); }
.q-nav__icon { display: inline-flex; color: var(--text-3); }
.q-nav__item:hover .q-nav__icon { color: var(--text-2); }
.q-nav__label { flex: 1; }
.q-nav__item.is-disabled { opacity: .55; cursor: default; }
.q-nav__item.is-disabled:hover { background: transparent; color: var(--text-2); }
.q-nav__soon {
  font-size: 9.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3); background: var(--surface-2);
  padding: 2px 6px; border-radius: var(--r-pill);
}

.q-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.q-topbar {
  display: flex; align-items: center; gap: 14px;
  height: 64px; padding: 0 24px;
  background: var(--topbar);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.q-search { position: relative; flex: 1; max-width: 420px; }
.q-search__icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.q-search__input {
  width: 100%; height: 38px; padding: 0 12px 0 36px;
  border-radius: var(--r-control); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px; outline: none;
}
.q-search__input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.q-search__input::placeholder { color: var(--text-3); }
.q-topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.q-content { padding: 28px 32px 56px; flex: 1; }

/* ---------- Profile menu ---------- */
.q-profile { position: relative; }
.q-profile__btn {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 9px 5px 5px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface);
}
.q-profile__btn:hover { background: var(--surface-2); }
.q-profile__avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.q-profile__meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.q-profile__name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.q-profile__role { font-size: 11px; color: var(--text-3); }
.q-profile__chev { color: var(--text-3); display: inline-flex; }
.q-profile__pop {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 230px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow-lg); padding: 8px; z-index: 40;
}
.q-profile__head { padding: 8px 10px; }
.q-profile__email { font-size: 11.5px; }
.q-profile__divider { height: 1px; background: var(--border); margin: 6px 0; }
.q-profile__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: var(--r-control);
  color: var(--text); font-size: 13px; font-weight: 500; background: none; border: 0;
}
.q-profile__item:hover { background: var(--surface-2); }

/* ---------- Toaster ---------- */
.q-toaster {
  position: fixed; bottom: 22px; right: 22px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; max-width: 360px;
}
.q-toast {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 14px; border-radius: var(--r-card);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); animation: q-toast-in .18s ease;
}
@keyframes q-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.q-toast__icon { display: inline-flex; flex-shrink: 0; margin-top: 1px; }
.q-toast--success .q-toast__icon { color: var(--success); }
.q-toast--error .q-toast__icon { color: var(--danger); }
.q-toast--warning .q-toast__icon { color: var(--warning); }
.q-toast--info .q-toast__icon { color: var(--info); }
.q-toast__body { flex: 1; min-width: 0; }
.q-toast__title { font-size: 13px; font-weight: 600; }
.q-toast__msg { font-size: 12.5px; color: var(--text-2); }
.q-toast__close { color: var(--text-3); background: none; border: 0; padding: 2px; }
.q-toast__close:hover { color: var(--text); }

/* ---------- Overlay + modal ---------- */
.q-overlay {
  position: fixed; inset: 0; z-index: 150;
  background: var(--overlay); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 20px;
}
.q-modal {
  width: 420px; max-width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow-lg); padding: 24px;
  text-align: center;
}
.q-modal__icon {
  width: 46px; height: 46px; border-radius: 12px; margin: 0 auto 14px;
  display: grid; place-items: center;
}
.q-modal__icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.q-modal__icon.is-accent { background: var(--accent-soft); color: var(--accent); }
.q-modal__title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.q-modal__msg { font-size: 13px; color: var(--text-2); margin: 0 0 20px; }
.q-modal__actions { display: flex; gap: 10px; justify-content: center; }
.q-btn--danger-solid { background: var(--danger); color: #fff; }
.q-btn--danger-solid:hover { background: var(--danger); filter: brightness(.92); }

/* ---------- States ---------- */
.q-state { text-align: center; padding: 56px 24px; }
.q-state__icon {
  width: 54px; height: 54px; border-radius: 14px; margin: 0 auto 16px;
  display: grid; place-items: center; background: var(--surface-2); color: var(--text-3);
}
.q-state__title { font-size: 15px; font-weight: 600; }
.q-state__hint { font-size: 13px; color: var(--text-2); margin-top: 5px; }
.q-state__action { margin-top: 18px; }

.q-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--r-card); border: 1px solid var(--border);
}
.q-banner--danger { background: var(--danger-soft); border-color: transparent; }
.q-banner__icon { color: var(--danger); display: inline-flex; flex-shrink: 0; }
.q-banner__body { flex: 1; min-width: 0; }
.q-banner__title { font-size: 13px; font-weight: 600; color: var(--danger-text); }
.q-banner__msg { font-size: 12.5px; color: var(--text-2); }

.q-skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: q-shimmer 1.3s ease infinite;
}
@keyframes q-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---------- Page header ---------- */
.q-pagehead { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.q-pagehead__titles { flex: 1; min-width: 0; }
.q-pagehead__sub { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.q-pagehead__actions { display: flex; gap: 10px; }

/* ---------- Dashboard ---------- */
.q-kpis {
  display: grid; gap: 16px; margin-bottom: 22px;
  grid-template-columns: repeat(5, 1fr);
}
@media (max-width: 1280px) { .q-kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px)  { .q-kpis { grid-template-columns: 1fr; } }

.q-kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.q-kpi__top { display: flex; align-items: center; justify-content: space-between; }
.q-kpi__icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.q-kpi__delta { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; }
.q-kpi__delta.is-up { color: var(--success-text); }
.q-kpi__delta.is-down { color: var(--danger-text); }
.q-kpi__delta.is-down .q-svg { transform: scaleY(-1); }
.q-kpi__value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; font-family: var(--font-mono); }
.q-kpi__label { font-size: 12.5px; color: var(--text-2); }
.q-kpi__spark { margin-top: 8px; }

.q-area { display: block; }
.q-area__axis { display: flex; justify-content: space-between; margin-top: 8px; font-size: 10.5px; color: var(--text-3); font-family: var(--font-mono); }

.q-grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; margin-bottom: 22px; }
@media (max-width: 1100px) { .q-grid-2 { grid-template-columns: 1fr; } }

.q-panel { padding: 18px 20px; }
.q-panel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.q-panel__title { font-size: 14px; font-weight: 700; }
.q-panel__caption { font-size: 12px; color: var(--text-3); }

.q-list { display: flex; flex-direction: column; }
.q-list__row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.q-list__row:first-child { border-top: 0; }
.q-list__icon {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: var(--surface-2); color: var(--text-2); display: grid; place-items: center;
}
.q-list__main { flex: 1; min-width: 0; }
.q-list__text { font-size: 13px; }
.q-list__meta { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }

.q-health { display: flex; flex-wrap: wrap; gap: 10px; }
.q-health__chip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--r-pill);
  background: var(--surface-2); font-size: 12.5px; font-weight: 500;
}
.q-health__dot { width: 8px; height: 8px; border-radius: 50%; }
.q-health__dot.is-operational { background: var(--success); }
.q-health__dot.is-degraded { background: var(--warning); }
.q-health__dot.is-down { background: var(--danger); }

.q-quick { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Auth / login ---------- */
.q-auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; }
.q-auth__card { width: 400px; max-width: 100%; padding: 30px 32px; box-shadow: var(--shadow-lg); }
.q-auth__brand { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.q-auth__title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.q-auth__subtitle { font-size: 12.5px; }
.q-auth__hint { font-size: 12px; margin: 18px 0 0; text-align: center; }
.q-auth__foot { font-size: 11.5px; }

.q-form { display: flex; flex-direction: column; }
.q-form__label { font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }

/* ---------- Login (split brand + form) ---------- */
.q-login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--bg); }

.q-login__brand {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px 52px;
  border-right: 1px solid var(--border);
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(125, 123, 255, .20), transparent 55%),
    radial-gradient(100% 80% at 100% 100%, rgba(125, 123, 255, .10), transparent 50%),
    var(--surface);
}
.q-login__brand-top { display: flex; align-items: center; gap: 12px; }
.q-login__brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.q-login__brand-tag { font-size: 11px; font-weight: 600; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; }
.q-login__hero { max-width: 440px; }
.q-login__hero-h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.18; margin: 0 0 12px; }
.q-login__hero-sub { font-size: 14px; color: var(--text-2); line-height: 1.6; margin: 0; }
.q-login__features { list-style: none; margin: 30px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.q-login__feature { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-2); }
.q-login__feature-ic { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.q-login__brand-foot { font-size: 11.5px; color: var(--text-3); letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }

.q-login__panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.q-login__form-wrap { width: 100%; max-width: 380px; }
.q-login__head { margin-bottom: 24px; }
.q-login__h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 6px; }
.q-login__lede { font-size: 13px; color: var(--text-3); margin: 0; }

.q-field { display: flex; flex-direction: column; margin-bottom: 15px; }
.q-input-wrap { position: relative; display: flex; align-items: center; }
.q-input-wrap .q-input { width: 100%; padding-left: 38px; }
.q-input-wrap--reveal .q-input { padding-right: 40px; }
.q-input-wrap__ic { position: absolute; left: 12px; color: var(--text-3); display: inline-flex; pointer-events: none; }
.q-input-wrap__btn { position: absolute; right: 7px; height: 28px; width: 28px; border: none; background: transparent; color: var(--text-3); border-radius: 6px; display: grid; place-items: center; cursor: pointer; }
.q-input-wrap__btn:hover { color: var(--text-2); background: var(--surface-2); }

.q-login__row { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 18px; }
.q-check { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: pointer; user-select: none; }
.q-check input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.q-link { font-size: 12.5px; color: var(--accent); text-decoration: none; font-weight: 500; }
.q-link:hover { text-decoration: underline; }

.q-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.q-divider::before, .q-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.q-login__seed { margin-top: 22px; padding: 11px 13px; border: 1px dashed var(--border-2); border-radius: var(--r-control); font-size: 11.5px; color: var(--text-3); text-align: center; line-height: 1.7; }
.q-login__seed code { color: var(--text-2); font-family: var(--font-mono); }

@media (max-width: 880px) {
  .q-login { grid-template-columns: 1fr; }
  .q-login__brand { display: none; }
}

/* ---------- Responsive shell (spec §11: ≤1024px collapse sidebar to icons) ---------- */
@media (max-width: 1024px) {
  .q-sidebar { width: 64px; padding: 16px 8px; }
  .q-logo__text, .q-nav__section, .q-nav__label, .q-nav__soon { display: none; }
  .q-nav__item { justify-content: center; }
  .q-content { padding: 20px 16px 48px; }
  .q-profile__meta { display: none; }
}
