:root {
  --bg: #f3f8fa;
  --panel: #ffffff;
  --ink: #242529;
  --muted: #65727a;
  --line: #d8e7ec;
  --green: #43bed0;
  --green-2: #60c9c5;
  --blue: #3f829c;
  --navy: #2f6f89;
  --amber: #b45309;
  --red: #b91c1c;
  --radius: 8px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 12%, rgba(67, 190, 208, .18), transparent 28%),
    linear-gradient(135deg, #f7fbfc 0%, var(--bg) 48%, #eef7f8 100%);
}
a { color: inherit; text-decoration: none; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  background: #242529;
  color: #f5fbfc;
  display: flex;
  flex-direction: column;
  padding: 22px;
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; }
.brand.center { justify-content: center; color: var(--ink); }
.brand-logo,
.home-logo,
.login-logo,
.sidebar-logo {
  display: block;
  object-fit: contain;
}
.home-logo {
  width: 170px;
  max-height: 150px;
}
.login-logo {
  width: min(250px, 78%);
  max-height: 170px;
  margin: 0 auto;
}
.sidebar-logo {
  width: 46px;
  height: 46px;
  padding: 4px;
  border-radius: 8px;
  background: #fff;
}
.mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: white;
  font-weight: 800;
}
.brand small, .profile small, table small { display: block; color: var(--muted); margin-top: 3px; }
.sidebar .brand small, .sidebar .profile small { color: #a9cbd3; }
nav { display: grid; gap: 6px; }
nav a {
  padding: 11px 12px;
  border-radius: 8px;
  color: #dceff3;
}
nav a:hover { background: rgba(255,255,255,.08); }
.profile { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding-top: 18px; }
.profile a { display: inline-block; margin-top: 10px; color: #72d7e2; }
.main { margin-left: 260px; padding: 28px; }
.auth-main { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.portal-shell {
  min-height: calc(100vh - 48px);
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 520px;
  gap: 34px;
  align-items: center;
}
.logo-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
.logo-lockup strong {
  display: block;
  font-size: 24px;
  font-weight: 900;
}
.logo-lockup small {
  color: var(--muted);
  font-size: 15px;
}
.logo-cube {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, #3f829c, #43bed0 58%, #60c9c5);
  box-shadow: 0 18px 42px rgba(63, 130, 156, .24);
  font-weight: 900;
}
.portal-copy .eyebrow {
  display: inline-block;
  color: var(--green);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 12px;
  margin-bottom: 14px;
}
.portal-copy h1 {
  font-size: 46px;
  line-height: 1.04;
  max-width: 780px;
}
.portal-copy p {
  color: var(--muted);
  font-size: 18px;
  max-width: 700px;
}
.portal-grid { display: grid; gap: 16px; }
.portal-grid.single {
  align-self: center;
}
.portal-card {
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-shadow: 0 20px 60px rgba(36, 37, 41, .08);
  transition: transform .18s ease, box-shadow .18s ease;
}
.portal-grid.single .portal-card {
  min-height: 190px;
}
.portal-card:hover { transform: translateY(-3px); box-shadow: 0 26px 70px rgba(36, 37, 41, .13); }
.portal-card span { color: var(--muted); font-weight: 900; text-transform: uppercase; font-size: 12px; }
.portal-card strong { font-size: 28px; margin: 8px 0; }
.portal-card small { color: var(--muted); line-height: 1.5; font-size: 14px; }
.portal-card.staff { border-top: 5px solid var(--green); }
.portal-card.client { border-top: 5px solid var(--blue); }
.login-card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(17, 24, 39, .06);
}
.login-card {
  width: min(500px, 100%);
  padding: 38px 34px 34px;
  position: relative;
  overflow: hidden;
}
.login-card:before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--green-2));
}
.login-card h1 {
  text-align: center;
  margin-bottom: 22px;
}
.login-logo-wrap {
  display: grid;
  place-items: center;
  min-height: 126px;
  margin-bottom: 12px;
}
.login-heading {
  display: grid;
  gap: 4px;
  text-align: center;
  margin-bottom: 18px;
}
.login-heading strong {
  font-size: 20px;
}
.login-heading small {
  color: var(--muted);
}
.login-card .button {
  width: 100%;
  margin-top: 12px;
}
.login-card form {
  margin-top: 10px;
  gap: 16px;
}
.staff-login { box-shadow: 0 30px 90px rgba(63, 130, 156, .18); }
.client-login { box-shadow: 0 30px 90px rgba(67, 190, 208, .18); }
.panel { padding: 20px; }
.narrow { max-width: 860px; }
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 30px; }
h2 { font-size: 18px; margin-bottom: 16px; }
p { line-height: 1.55; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}
.page-head p { margin: 6px 0 0; color: var(--muted); }
.button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
}
.button.primary { background: #242529; border-color: #242529; color: white; }
.button.danger { border-color: #fecaca; color: var(--red); background: #fff5f5; }
.button:hover { filter: brightness(.97); }
.button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.ops-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.ops-strip article {
  background: #102219;
  color: #f4fbf6;
  border-radius: 8px;
  padding: 18px;
}
.ops-strip span, .ops-strip small { display: block; color: #bad2c4; }
.ops-strip strong { display: block; font-size: 30px; margin: 7px 0; }
.kpis article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.kpis span { display: block; color: var(--muted); font-size: 13px; }
.kpis strong { display: block; font-size: 28px; margin-top: 6px; }
.kpis .danger strong { color: var(--red); }
.panel-title { display: flex; justify-content: space-between; align-items: center; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px;
}
td { border-bottom: 1px solid var(--line); padding: 12px 10px; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.inactive-row { opacity: .58; }
.code { font-weight: 800; color: var(--blue); }
.badge, .priority {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 800;
  background: #eef2f0;
  color: #33423a;
}
.status-rejected, .status-cancelled, .priority.critical { background: #fee2e2; color: var(--red); }
.status-closed, .status-accepted { background: #dff8fa; color: #267386; }
.status-client_validation, .priority.high { background: #dbeafe; color: var(--blue); }
.status-scope_pending, .priority.medium { background: #fef3c7; color: var(--amber); }
.priority.low { background: #ecfdf5; color: #047857; }
.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px 170px auto;
  gap: 10px;
  margin-bottom: 16px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: white;
}
textarea { resize: vertical; min-height: 96px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.data-form { display: grid; gap: 14px; }
.two, .split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}
.description { white-space: normal; }
.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.meta-grid span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
}
.meta-grid strong { display: block; color: var(--ink); margin-top: 4px; }
.actions { position: sticky; top: 18px; }
.inline-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.user-directory {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.client-directory {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}
.directory-toolbar {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px 160px 140px;
  gap: 12px;
  align-items: end;
  box-shadow: 0 14px 38px rgba(36, 37, 41, .05);
}
.directory-count {
  border-left: 1px solid var(--line);
  padding-left: 14px;
}
.fixed-org-filter {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: #f8fbfc;
}
.fixed-org-filter span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.fixed-org-filter strong {
  display: block;
  margin-top: 2px;
}
.directory-count strong {
  display: block;
  font-size: 24px;
}
.directory-count small {
  color: var(--muted);
}
.user-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 14px;
  box-shadow: 0 14px 38px rgba(36, 37, 41, .06);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  cursor: pointer;
}
.client-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  padding: 0 16px 16px;
  display: grid;
  gap: 14px;
  box-shadow: 0 14px 38px rgba(36, 37, 41, .06);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  cursor: pointer;
}
.client-card:hover {
  transform: translateY(-2px);
  border-color: #bcdbe4;
  box-shadow: 0 20px 52px rgba(36, 37, 41, .09);
}
.client-card.is-hidden { display: none; }
.brand-line {
  height: 6px;
  margin: 0 -16px;
  background: var(--client-color, var(--green));
}
.client-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-top: 14px;
}
.client-head strong {
  display: block;
  font-size: 18px;
}
.client-head small { color: var(--muted); }
.client-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.client-metrics span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
}
.client-metrics strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
  margin-top: 4px;
}
.user-card:hover {
  transform: translateY(-2px);
  border-color: #bcdbe4;
  box-shadow: 0 20px 52px rgba(36, 37, 41, .09);
}
.user-card.is-hidden { display: none; }
.user-main {
  display: flex;
  gap: 12px;
  align-items: center;
}
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--green));
  font-weight: 900;
}
.user-main strong { display: block; }
.user-main small,
.user-meta small,
.muted-text {
  color: var(--muted);
}
.user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.status-dot {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 800;
}
.status-dot.ok { background: #dff8fa; color: #267386; }
.status-dot.off { background: #f3f4f6; color: #6b7280; }
.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.user-actions form { margin: 0; }
.pagination-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}
.pagination-bar span {
  color: var(--muted);
  font-weight: 800;
}
.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 50;
}
.modal.open { display: block; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(36, 37, 41, .54);
}
.modal-panel {
  position: relative;
  width: min(560px, calc(100% - 32px));
  margin: 7vh auto;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 24px;
  box-shadow: 0 30px 90px rgba(36, 37, 41, .22);
}
.modal-panel.wide {
  width: min(920px, calc(100% - 32px));
}
.modal-brand-line {
  height: 7px;
  border-radius: 8px 8px 0 0;
  margin: -24px -24px 18px;
  background: var(--green);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.local-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin: 18px 0;
}
.local-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 11px 12px;
  font-weight: 900;
  cursor: pointer;
}
.local-tabs button.active {
  color: var(--blue);
  border-bottom: 3px solid var(--green);
}
.local-tab { display: none; }
.local-tab.active { display: block; }
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.info-grid span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
}
.info-grid strong {
  display: block;
  color: var(--ink);
  margin-top: 5px;
}
.kpis.compact {
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  margin-bottom: 0;
}
.clients-toolbar {
  grid-template-columns: minmax(280px, 1fr) 190px 170px 150px;
}
.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin: 20px 0 14px;
}
.tabs button {
  border: 0;
  background: transparent;
  padding: 12px 14px;
  font-weight: 800;
  cursor: pointer;
  color: var(--muted);
}
.tabs button.active { color: var(--green); border-bottom: 3px solid var(--green); }
.tab { display: none; }
.tab.active { display: block; }
.timeline { display: grid; gap: 12px; margin-bottom: 18px; }
.timeline article {
  border-left: 3px solid var(--green-2);
  background: #f8fbf9;
  border-radius: 0 8px 8px 0;
  padding: 12px 14px;
}
.timeline small { display: block; color: var(--muted); margin-top: 3px; }
.timeline p { margin-bottom: 0; }
.empty { color: var(--muted); text-align: center; padding: 24px; }
.alert {
  color: var(--red);
  background: #fee2e2;
  border: 1px solid #fecaca;
  padding: 10px 12px;
  border-radius: 8px;
}
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 4px; margin-right: 8px; vertical-align: -2px; }
.client-logo {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-right: 10px;
  vertical-align: middle;
  background: #fff;
  overflow: hidden;
}
.client-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.check { display: flex; grid-template-columns: auto 1fr; flex-direction: row; align-items: center; gap: 8px; }
.check input { width: auto; }
@media print {
  .sidebar, .filters, .button { display: none !important; }
  .main { margin: 0; padding: 0; }
  body { background: white; }
  .panel { box-shadow: none; border: 0; }
}
@media (max-width: 980px) {
  .sidebar { position: static; width: auto; }
  .main { margin: 0; padding: 18px; }
  .kpis, .split, .ticket-layout, .filters, .portal-shell, .ops-strip, .directory-toolbar { grid-template-columns: 1fr; }
  .portal-copy h1 { font-size: 34px; }
  .page-head { flex-direction: column; }
  .meta-grid { grid-template-columns: 1fr; }
  .actions { position: static; }
}
