:root {
  --sidebar-bg: #1b2330;
  --sidebar-active: #2a3648;
  --accent: #2e86de;
  --bg: #f4f6f9;
}

body {
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --- App shell ------------------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 230px;
  background: var(--sidebar-bg);
  color: #cfd8e3;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 16px 18px;
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
}
.sidebar-brand i { margin-right: 8px; color: var(--accent); }
.sidebar-logo { height: 32px; width: auto; margin-right: 10px; flex-shrink: 0; }

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 10px 0;
  flex: 1;
}
.sidebar-nav li a {
  display: block;
  padding: 11px 20px;
  color: #cfd8e3;
  text-decoration: none;
  font-size: 0.92rem;
}
.sidebar-nav li a i { width: 20px; margin-right: 10px; }
.sidebar-nav li a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav li.active a { background: var(--sidebar-active); color: #fff; border-left: 3px solid var(--accent); }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); }

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

.app-header {
  background: #fff;
  border-bottom: 1px solid #e3e7ed;
  padding: 16px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.app-header h1 { font-size: 1.25rem; margin: 0; }

.app-content { padding: 24px 28px; flex: 1; }

/* --- Cards ------------------------------------------------------------- */
.card { border: 1px solid #e3e7ed; box-shadow: 0 1px 2px rgba(0,0,0,0.03); margin-bottom: 20px; }
.card-header { background: #fff; font-weight: 600; border-bottom: 1px solid #e3e7ed; }

/* --- Stat grid ----------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border: 1px solid #e3e7ed;
  border-radius: 6px;
  padding: 18px;
  text-align: center;
}
.stat-value { font-size: 1.9rem; font-weight: 700; }
.stat-label { color: #6c757d; font-size: 0.85rem; text-transform: uppercase; letter-spacing: .03em; }
.stat-open .stat-value { color: #2e86de; }
.stat-pending .stat-value { color: #e1b12c; }
.stat-closed .stat-value { color: #6c757d; }
.stat-urgent .stat-value { color: #e74c3c; }

/* --- Badges -------------------------------------------------------------- */
.badge-status-new { background: #6c757d; }
.badge-status-open { background: #2e86de; }
.badge-status-pending { background: #e1b12c; color: #222; }
.badge-status-closed { background: #16a34a; }

.badge-priority-P1 { background: #e74c3c; }
.badge-priority-P2 { background: #e67e22; }
.badge-priority-P3 { background: #2e86de; }
.badge-priority-P4 { background: #7f9cb5; }
.badge-priority-P5 { background: #9aa5b1; }

.badge, .role-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  color: #fff;
  text-transform: capitalize;
}
.role-badge.role-admin { background: #8e44ad; }
.role-badge.role-user { background: #2e86de; }
.role-badge.role-viewer { background: #6c757d; }
.role-badge.role-hr { background: #16a085; }
.role-badge.role-dtr-approver { background: #d35400; }

/* --- Comments -------------------------------------------------------- */
.comment { padding: 10px 0; border-bottom: 1px solid #eee; }
.comment:last-child { border-bottom: none; }
.comment-internal { background: #fff8e6; padding: 10px; border-radius: 4px; }
.comment-meta { margin-bottom: 4px; }

/* --- Login / landing page ---------------------------------------------
   A two-panel page: a dark branded hero on the left (the marketing half)
   and the sign-in card on the right. The palette is sampled straight out
   of public/images/logo.png — navy #1d2c3c from the wordmark, blue
   #3d77ab–#528abe from the puzzle piece, grey #a3aab1 from its twin —
   plus #5fb0d2, the accent greyareasolutions.com.ph itself uses. Below
   992px the two panels stack and the hero collapses to a compact banner.
------------------------------------------------------------------------ */
.login-page {
  --navy: #1d2c3c;
  --navy-deep: #111923;
  --blue: #3d77ab;
  --blue-bright: #528abe;
  --cyan: #5fb0d2;
  --steel: #a3aab1;

  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  background: #fff;
}

/* --- Left: brand hero --------------------------------------------------- */
.login-hero {
  position: relative;
  overflow: hidden;
  color: #eaf1f8;
  background:
    linear-gradient(152deg, var(--navy-deep) 0%, var(--navy) 42%, #274866 78%, #325c85 100%);
  display: flex;
}

.login-hero-bg { position: absolute; inset: 0; pointer-events: none; }

/* Soft brand-coloured light sources, and a fine dot grid over the top. */
.login-hero-bg .glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
}
.login-hero-bg .glow-a {
  width: 460px; height: 460px;
  top: -160px; left: -120px;
  background: rgba(95, 176, 210, 0.30);
}
.login-hero-bg .glow-b {
  width: 420px; height: 420px;
  right: -140px; bottom: -150px;
  background: rgba(82, 138, 190, 0.34);
}
.login-hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.13) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.4;
  mask-image: radial-gradient(ellipse at 30% 20%, #000 10%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 20%, #000 10%, transparent 72%);
}

/* The interlocking puzzle motif from the logo, blown up as line art. */
.login-hero-bg .puzzle {
  position: absolute;
  color: rgba(255, 255, 255, 0.07);
}
.login-hero-bg .puzzle-a { width: 400px; right: -90px; bottom: 40px; }
.login-hero-bg .puzzle-b { width: 400px; right: 130px; bottom: 210px; color: rgba(95, 176, 210, 0.10); }

.login-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding: 52px 56px;
  width: 100%;
  max-width: 660px;
  margin-left: auto;
}

/* The logo is navy-on-white artwork, so it sits on a white plate rather
   than fighting the dark panel behind it. */
.login-logo-plate {
  align-self: flex-start;
  background: #fff;
  border-radius: 14px;
  padding: 8px 14px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}
.login-logo-plate img { display: block; height: 76px; width: auto; }

.login-hero-mid { flex: 1; display: flex; flex-direction: column; justify-content: center; }

.login-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #cfe8f4;
  background: rgba(95, 176, 210, 0.16);
  border: 1px solid rgba(95, 176, 210, 0.34);
}
.login-eyebrow i { font-size: 0.8rem; }

.login-hero-mid h1 {
  margin: 20px 0 0;
  font-size: clamp(1.7rem, 2.5vw, 2.35rem);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.015em;
  max-width: 24ch;
  color: #fff;
}
.login-lede {
  margin: 16px 0 0;
  font-size: 1rem;
  line-height: 1.6;
  max-width: 50ch;
  color: rgba(234, 241, 248, 0.74);
}

.login-features { list-style: none; margin: 34px 0 0; padding: 0; display: grid; gap: 16px; }
.login-features li { display: flex; gap: 14px; align-items: flex-start; }
.login-features .lf-icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 0.98rem;
  color: #dff0f8;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.login-features strong { display: block; font-size: 0.94rem; font-weight: 600; color: #fff; }
.login-features small { display: block; margin-top: 2px; font-size: 0.83rem; line-height: 1.5; color: rgba(234, 241, 248, 0.6); }

.login-hero-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: center;
  justify-content: space-between;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.82rem;
  color: rgba(234, 241, 248, 0.62);
}
.login-hero-foot i { margin-right: 6px; }
.login-hero-foot a { color: #9fd3e8; text-decoration: none; }
.login-hero-foot a:hover { color: #fff; text-decoration: underline; }
.login-hero-foot a i { margin: 0 0 0 4px; font-size: 0.72rem; }

/* --- Right: sign-in panel ----------------------------------------------- */
.login-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 40px 72px;
  background: #fff;
}

.login-card { width: 100%; max-width: 396px; }

/* Shown only when the hero panel is hidden (phones/tablets). */
.login-card-logo { display: none; height: 46px; width: auto; margin: 0 auto 22px; }

.login-card-head { margin-bottom: 26px; }
.login-card-head h2 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--navy);
}
.login-card-head p { margin: 7px 0 0; font-size: 0.93rem; color: #6b7785; }

.login-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.875rem;
  line-height: 1.45;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.login-alert i { margin-top: 2px; }
.login-alert-ok  { background: #e9f7ef; border-color: #b7e4c7; color: #14663c; }
.login-alert-bad { background: #fdecec; border-color: #f5c2c2; color: #a02020; }

.login-field { margin-bottom: 17px; }
.login-field > label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.83rem;
  font-weight: 600;
  color: #3d4855;
}

.login-input { position: relative; display: flex; align-items: center; }
.login-input > i {
  position: absolute;
  left: 15px;
  font-size: 0.93rem;
  color: #97a2af;
  pointer-events: none;
  transition: color 0.15s ease;
}
.login-input input {
  width: 100%;
  height: 50px;
  padding: 0 15px 0 43px;
  font-size: 0.95rem;
  color: var(--navy);
  background: #f7f9fb;
  border: 1px solid #dde3ea;
  border-radius: 11px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.login-input input::placeholder { color: #a9b3bf; }
.login-input input:hover { border-color: #c8d2dd; }
.login-input input:focus {
  background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(61, 119, 171, 0.14);
}
.login-input input:focus ~ i,
.login-input input:focus + i { color: var(--blue); }
.login-input:focus-within > i { color: var(--blue); }

/* Password reveal toggle. */
.login-eye {
  position: absolute;
  right: 6px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #97a2af;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.login-eye:hover { color: var(--blue); background: rgba(61, 119, 171, 0.09); }
.login-eye:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.login-caps {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  font-size: 0.79rem;
  color: #a4700d;
}

.login-submit {
  position: relative;
  width: 100%;
  height: 50px;
  margin-top: 6px;
  border: 0;
  border-radius: 11px;
  font-size: 0.97rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-bright) 55%, var(--cyan) 140%);
  box-shadow: 0 8px 20px rgba(61, 119, 171, 0.30);
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}
.login-submit:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(61, 119, 171, 0.38); filter: saturate(1.06); }
.login-submit:active { transform: translateY(0); box-shadow: 0 6px 14px rgba(61, 119, 171, 0.30); }
.login-submit:focus-visible { outline: 3px solid rgba(61, 119, 171, 0.45); outline-offset: 2px; }
.login-submit i { margin-left: 7px; transition: transform 0.16s ease; }
.login-submit:hover i { transform: translateX(3px); }

.login-submit-spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 19px; height: 19px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: none;
}
.login-submit.is-loading { pointer-events: none; }
.login-submit.is-loading .login-submit-label { visibility: hidden; }
.login-submit.is-loading .login-submit-spinner { display: block; animation: login-spin 0.7s linear infinite; }
@keyframes login-spin { to { transform: rotate(360deg); } }

.login-help {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 22px 0 0;
  padding-top: 20px;
  border-top: 1px solid #edf1f5;
  font-size: 0.84rem;
  line-height: 1.5;
  color: #77828f;
}
.login-help i { margin-top: 2px; color: var(--steel); }

/* Pinned to the foot of the panel so the card itself stays optically
   centred in the full height rather than being pushed up by it. */
.login-foot {
  position: absolute;
  left: 0; right: 0; bottom: 26px;
  font-size: 0.78rem;
  color: #9aa4b0;
  text-align: center;
  padding: 0 24px;
}

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 1200px) {
  .login-hero-inner { padding: 44px 40px; }
  .login-hero-bg .puzzle-b { display: none; }
}

@media (max-width: 991.98px) {
  .login-page { grid-template-columns: 1fr; min-height: 0; }

  /* The hero becomes a compact banner: keep the logo and the promise,
     drop the feature list so the form stays above the fold. */
  .login-hero { min-height: 0; }
  .login-hero-inner {
    max-width: none;
    margin: 0;
    gap: 22px;
    padding: 30px 28px 34px;
    text-align: center;
    align-items: center;
  }
  .login-logo-plate { align-self: center; padding: 6px 12px; }
  .login-logo-plate img { height: 60px; }
  .login-eyebrow { align-self: center; }
  .login-hero-mid { align-items: center; }
  .login-hero-mid h1 { font-size: 1.45rem; max-width: 22ch; }
  .login-lede { font-size: 0.93rem; max-width: 52ch; }
  .login-features, .login-hero-foot { display: none; }
  .login-hero-bg .puzzle-a { width: 300px; right: -110px; bottom: -70px; }

  /* Stacked: the panel is only as tall as its content, so the footer goes
     back into normal flow instead of being pinned over it. */
  .login-panel { padding: 36px 24px 34px; }
  .login-card-head { text-align: center; }
  .login-foot { position: static; margin-top: 26px; padding: 0; }
}

@media (max-width: 575.98px) {
  .login-hero-inner { padding: 26px 20px 30px; }
  .login-hero-mid h1 { font-size: 1.3rem; }
  .login-lede { display: none; }
  .login-panel { padding: 30px 20px 36px; gap: 20px; }
  .login-card-head h2 { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: reduce) {
  .login-submit, .login-submit i { transition: none; }
  .login-submit:hover { transform: none; }
  .login-submit.is-loading .login-submit-spinner { animation-duration: 1.6s; }
}

/* --- Chat --------------------------------------------------------------- */
/* .app-content has 24px vertical padding and .app-header is ~65px tall
   (16px*2 padding + ~1 line of text), so this heuristic keeps the whole
   two-pane layout filling the viewport without an outer page scrollbar. */
.chat-wrapper {
  display: flex;
  height: calc(100vh - 170px);
  min-height: 420px;
  border: 1px solid #e3e7ed;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.chat-sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid #e3e7ed;
  background: #f8f9fb;
  overflow-y: auto;
  padding: 12px 0;
}

.chat-sidebar-section { margin-bottom: 18px; }
.chat-sidebar-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 16px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6c757d;
}
.chat-add-btn {
  border: none;
  background: transparent;
  color: #6c757d;
  font-size: 1rem;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}
.chat-add-btn:hover { color: var(--accent); }

.chat-list { list-style: none; margin: 0; padding: 0; }
.chat-list li a {
  display: block;
  padding: 7px 16px;
  color: #333;
  text-decoration: none;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-list li a i { width: 16px; margin-right: 8px; color: #8a94a3; }
.chat-list li a:hover { background: #eef1f5; }
.chat-list li.active a { background: var(--sidebar-active); color: #fff; }
.chat-list li.active a i { color: #fff; }
.chat-dm-picker li a { display: flex; align-items: center; gap: 6px; }

.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-header { padding: 12px 20px; border-bottom: 1px solid #e3e7ed; }
.chat-header h2 { font-size: 1.05rem; margin: 0; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.chat-empty { text-align: center; margin-top: 20px; }

.chat-message { display: flex; gap: 12px; margin-bottom: 14px; }
.chat-message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}
.chat-message-body { min-width: 0; }
.chat-message-meta { font-size: 0.85rem; margin-bottom: 2px; }
.chat-message-meta span { font-size: 0.75rem; margin-left: 4px; }
.chat-message-text { font-size: 0.92rem; white-space: pre-wrap; word-break: break-word; }

.chat-input-row {
  display: flex;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid #e3e7ed;
}
.chat-input-row input { flex: 1; }

/* --- DTR ------------------------------------------------------------ */
.dtr-badge-draft { background: #6c757d; }
.dtr-badge-submitted { background: #e1b12c; color: #222; }
.dtr-badge-approved { background: #16a34a; }
.dtr-badge-rejected { background: #e74c3c; }

.dtr-table th, .dtr-table td { vertical-align: middle; font-size: 0.85rem; }
.dtr-table input.form-control-sm { min-width: 90px; }
.dtr-table td:last-child { min-width: unset; }

.comment-approved { border-left: 3px solid #16a34a; padding-left: 10px; }
.comment-rejected { border-left: 3px solid #e74c3c; padding-left: 10px; }
