.crm-body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(245, 138, 0, 0.07), transparent 42%),
    #f5f3ef;
}
.crm-shell {
  min-height: 100vh;
}
.crm-login {
  width: min(900px, calc(100% - 32px));
  margin: 4vh auto;
  display: grid;
  grid-template-columns: minmax(290px, 1fr) minmax(320px, 0.88fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}
.crm-login.hidden { display: none; }
.crm-login-visual {
  min-height: 500px;
  display: flex;
  align-items: end;
  padding: 28px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(32, 32, 32, 0.02) 0%, rgba(32, 32, 32, 0.12) 34%, #232323 62%, #1b1b1b 100%),
    url("../images/secure-login-office.png") top center / 100% auto no-repeat,
    #1b1b1b;
}
.crm-login-visual h1 { font-size: 40px; }
.crm-login-visual .eyebrow { color: #d7a84d; }
.crm-login-visual p { max-width: 430px; }
.crm-login-content { padding: 26px 28px; }
.login-tabs {
  display: flex;
  gap: 8px;
  margin: 20px 0 14px;
}
.crm-login-form, .staff-create-form {
  display: grid;
  gap: 10px;
}
.show-password {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.show-password input { width: auto; }
.back-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--brand);
  font-weight: 800;
}
.crm-dashboard {
  padding: 24px clamp(16px, 4vw, 56px) 56px;
  animation: dashboard-enter 420ms ease both;
}
.crm-header {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 300px auto;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(100deg, rgba(28, 28, 28, 0.98), rgba(52, 52, 52, 0.92)),
    url("../images/secure-login-office.png") center 42% / cover;
  box-shadow: var(--shadow);
}
.crm-header h1 {
  font-size: clamp(30px, 5vw, 54px);
  margin-bottom: 6px;
}
.crm-header .eyebrow { color: var(--gold); }
.crm-header-copy { margin: 0; color: #d8e5df; }
.crm-motion {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 210px;
}
.crm-logo-core {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: rgba(255,255,255,.94);
  box-shadow: 0 18px 38px rgba(0,0,0,.28);
  animation: crm-core-float 3.6s ease-in-out infinite;
}
.crm-logo-core img { width: 92px; height: 70px; object-fit: contain; mix-blend-mode: multiply; }
.crm-orbit {
  position: absolute;
  border: 1px solid rgba(245,138,0,.48);
  border-radius: 50%;
  animation: crm-orbit-spin 10s linear infinite;
}
.crm-orbit-one { width: 190px; height: 190px; }
.crm-orbit-two { width: 150px; height: 150px; animation-direction: reverse; animation-duration: 7s; }
.crm-orbit i { position: absolute; top: 16px; left: 28px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 7px rgba(245,138,0,.13); }
.crm-signal {
  position: absolute;
  z-index: 3;
  padding: 6px 9px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  color: #fff;
  background: rgba(22,22,22,.76);
  font-size: 11px;
  animation: crm-signal-float 3s ease-in-out infinite;
}
.signal-one { top: 10px; right: 14px; }
.signal-two { bottom: 20px; left: 10px; animation-delay: 600ms; }
.signal-three { right: 0; bottom: 24px; animation-delay: 1.1s; }
.crm-user {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}
.crm-user span {
  display: block;
  color: #d8e5df;
  font-size: 12px;
}
.crm-muted {
  color: var(--muted);
}
.crm-user-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--ink);
  background: var(--gold);
  font-weight: 900;
}
.crm-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.due-shortlist {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(45,45,45,.07);
}
.due-shortlist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.due-shortlist-head h2 { margin: 0; font-size: 24px; }
.due-shortlist-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.due-card {
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: #fff8ed;
}
.due-card.overdue { border-left-color: var(--danger); background: #fff1ef; }
.due-card strong, .due-card small { display: block; }
.due-card small { margin-top: 4px; color: var(--muted); }
.due-card b { display: inline-block; margin-top: 8px; color: #b95f00; font-size: 13px; }
.due-card.overdue b { color: var(--danger); }
.kpi-card {
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 94px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(18, 58, 86, 0.06);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  animation: card-enter 440ms ease both;
}
.kpi-card.active {
  border-color: var(--brand);
  box-shadow: 0 14px 28px rgba(245, 138, 0, 0.18);
}
.kpi-card.active .kpi-icon {
  background: var(--gold);
  color: var(--ink);
}
.kpi-card:nth-child(2) { animation-delay: 60ms; }
.kpi-card:nth-child(3) { animation-delay: 120ms; }
.kpi-card:nth-child(4) { animation-delay: 180ms; }
.kpi-card:hover {
  transform: translateY(-4px);
  border-color: rgba(245, 138, 0, 0.42);
  box-shadow: 0 16px 30px rgba(45, 45, 45, 0.12);
}
.kpi-card small { display: block; color: var(--muted); font-weight: 800; }
.kpi-card strong { display: block; color: var(--brand-2); font-size: 28px; }
.kpi-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-2), #4b4b4b);
  font-weight: 900;
}
.crm-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  padding: 6px;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}
.nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: 6px;
  border-radius: 999px;
  color: #fff;
  background: var(--brand);
  font-size: 12px;
}
.tab-button.active .nav-badge { background: var(--gold); color: var(--ink); }
.crm-view {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: #fff;
  box-shadow: var(--shadow);
}
.crm-view-animated:not(.hidden) { animation: view-enter 260ms ease both; }
.crm-view .admin-toolbar {
  margin-top: 0;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.crm-view table tbody tr {
  transition: background-color 160ms ease, transform 160ms ease;
}
.crm-view table tbody tr:hover {
  background: #fff8ed;
}
.crm-view th {
  color: var(--brand-2);
  background: #f6f2eb;
}
.crm-two-column {
  display: grid;
  grid-template-columns: minmax(280px, 0.7fr) minmax(320px, 1.3fr);
  gap: 28px;
}
.staff-list, .activity-list {
  display: grid;
  gap: 10px;
}
.staff-card, .activity-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.staff-card:hover, .activity-card:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 138, 0, 0.35);
  box-shadow: 0 10px 22px rgba(18, 58, 86, 0.08);
}
.staff-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.staff-status {
  border-radius: 999px;
  padding: 3px 8px;
  color: #fff;
  background: var(--brand);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.staff-status.suspended { background: #b7791f; }
.staff-status.locked { background: #a13c3c; }
.staff-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.staff-actions .button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}
.activity-card time {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.reminder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.reminder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.reminder-list {
  display: grid;
  gap: 12px;
}
.reminder-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--soft);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.reminder-card:hover {
  transform: translateY(-2px);
  border-color: rgba(245, 138, 0, 0.35);
  box-shadow: 0 10px 24px rgba(18, 58, 86, 0.08);
}
.reminder-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.reminder-card-top span {
  border-radius: 999px;
  padding: 3px 8px;
  color: #fff;
  background: var(--brand-2);
  font-size: 12px;
  font-weight: 900;
}
.reminder-card textarea {
  min-height: 94px;
  margin-top: 10px;
  resize: vertical;
  background: #fff;
}
.reminder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.activity-button {
  border: 0;
  color: var(--brand);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}
.activity-button:hover, .doc-item a:hover {
  text-decoration: underline;
}
.document-view-button {
  border: 0;
  padding: 0;
  color: var(--brand);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}
.document-view-button:hover { text-decoration: underline; }
.document-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 35, 31, 0.72);
  backdrop-filter: blur(6px);
}
.document-modal.hidden { display: none; }
.document-modal-panel {
  width: min(1100px, 100%);
  height: min(86vh, 820px);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.3);
}
.document-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.document-modal-header h2 { margin: 0; font-size: 20px; }
.document-security-note {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 700;
}
.modal-close {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}
.modal-close:hover { border-color: var(--brand); color: var(--brand); }
#document-frame { width: 100%; height: 100%; border: 0; background: #f3f8f5; }
@media print {
  body.staff-secure-view * {
    display: none !important;
  }
}
@keyframes dashboard-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes card-enter {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes view-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes crm-orbit-spin { to { transform: rotate(360deg); } }
@keyframes crm-core-float { 50% { transform: translateY(-8px); } }
@keyframes crm-signal-float { 50% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
@media (max-width: 800px) {
  .crm-header { grid-template-columns: 1fr; }
  .crm-user { align-items: flex-start; flex-direction: column; }
  .crm-motion { min-height: 230px; }
  .crm-two-column { grid-template-columns: 1fr; }
  .crm-login { grid-template-columns: 1fr; }
  .crm-login-visual { min-height: 260px; }
  .crm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reminder-grid { grid-template-columns: 1fr; }
  .due-shortlist-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .crm-kpis { grid-template-columns: 1fr; }
  .crm-nav { width: 100%; overflow-x: auto; }
  .due-shortlist-head { align-items: flex-start; flex-direction: column; }
  .due-shortlist-grid { grid-template-columns: 1fr; }
}
