:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f4f7fb;
  font-synthesis: none;
  --ink: #172033;
  --muted: #667085;
  --soft: #98a2b3;
  --line: #e4e9f1;
  --panel: #ffffff;
  --surface: #f7f9fc;
  --navy: #172033;
  --navy-2: #25324a;
  --green: #12b76a;
  --blue: #2e67d1;
  --amber: #d78b09;
  --purple: #7a56c2;
  --orange: #e66e22;
  --danger: #d92d20;
  --sidebar-width: 272px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f4f7fb;
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

/* =========================
   LOGIN
   ========================= */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(78, 116, 181, 0.12), transparent 38%),
    linear-gradient(180deg, #eef3fb 0%, #f8fafc 100%);
}

.login-card {
  width: min(100%, 850px);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(218, 225, 235, 0.9);
  border-radius: 30px;
  padding: 48px 54px;
  box-shadow: 0 22px 70px rgba(23, 32, 51, 0.10);
  text-align: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  background: var(--navy);
  color: #fff;
  font-weight: 850;
  letter-spacing: 0.08em;
  user-select: none;
}

.brand-mark-large {
  width: 90px;
  height: 90px;
  margin: 0 auto 28px;
  border-radius: 25px;
  font-size: 1.15rem;
}

.brand-mark-small {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  font-size: 0.74rem;
  flex: 0 0 auto;
}

.eyebrow,
.section-kicker,
.topbar-kicker {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.105em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-card h1 {
  margin: 18px 0 0;
  font-size: clamp(2.15rem, 5vw, 3.8rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.version {
  margin: 18px 0 0;
  font-weight: 800;
  color: #475467;
}

.lead {
  margin: 26px auto 0;
  max-width: 56ch;
  color: var(--muted);
  line-height: 1.72;
  font-size: 1.03rem;
}

.status {
  margin: 34px auto 0;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  color: #475467;
  font-size: 0.95rem;
}

.status-dot,
.access-chip-dot,
.session-mini-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  flex: 0 0 auto;
  box-shadow: 0 0 0 4px rgba(18, 183, 106, 0.10);
}

.status-dot-waiting {
  background: #f79009;
}

.status-dot-error {
  background: var(--danger);
}

.primary-button,
.secondary-button,
.secondary-action {
  border-radius: 14px;
  padding: 15px 18px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.primary-button {
  width: 100%;
  margin-top: 24px;
  border: 0;
  background: var(--navy);
  color: #fff;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(23, 32, 51, 0.18);
}

.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hint {
  margin: 12px 0 0;
  font-size: 0.84rem;
  color: var(--soft);
}

/* =========================
   APP SHELL
   ========================= */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: #f4f7fb;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  height: 100vh;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 22px 16px 18px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 22px;
  border-bottom: 1px solid #edf0f5;
}

.sidebar-brand strong {
  display: block;
  font-size: 1rem;
  line-height: 1.2;
}

.sidebar-brand span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

.nav-list {
  display: grid;
  gap: 5px;
  margin-top: 20px;
  overflow-y: auto;
  padding-right: 2px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #536076;
  font-weight: 670;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: #f5f7fb;
  color: var(--ink);
}

.nav-item.active {
  background: #edf2fa;
  color: var(--ink);
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #f1f4f8;
  color: #56657c;
  font-size: 0.73rem;
  font-weight: 850;
  flex: 0 0 auto;
}

.nav-item.active .nav-icon {
  background: var(--navy);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 6px 0;
  border-top: 1px solid #edf0f5;
}

.session-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 12px;
}

.session-mini strong,
.session-mini span {
  display: block;
}

.session-mini strong {
  font-size: 0.79rem;
}

.session-mini span {
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--muted);
}

.session-mini-dot {
  width: 8px;
  height: 8px;
}

.logout-link {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  background: #fff;
  color: #475467;
  font-weight: 700;
  cursor: pointer;
}

.logout-link:hover {
  background: #f8fafc;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  border: 0;
  background: rgba(23, 32, 51, 0.35);
}

.app-main {
  grid-column: 2;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  min-height: 82px;
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 32px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar h2 {
  margin: 4px 0 0;
  font-size: 1.22rem;
  letter-spacing: -0.015em;
}

.topbar-kicker {
  font-size: 0.66rem;
}

.menu-button {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  padding: 10px;
}

.menu-button span {
  display: block;
  height: 2px;
  margin: 4px 0;
  border-radius: 999px;
  background: var(--ink);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}

.topbar-user-copy {
  min-width: 0;
}

.topbar-user-copy strong,
.topbar-user-copy span {
  display: block;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-user-copy strong {
  font-size: 0.85rem;
}

.topbar-user-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.content-area {
  width: min(100%, 1500px);
  margin: 0 auto;
  padding: 30px 32px 48px;
}

/* =========================
   DASHBOARD
   ========================= */
.welcome-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
}

.welcome-row h3,
.section-heading h3,
.module-placeholder h3 {
  margin: 7px 0 0;
  color: var(--ink);
  letter-spacing: -0.025em;
}

.welcome-row h3 {
  font-size: clamp(1.7rem, 3vw, 2.35rem);
}

.welcome-row > div:first-child > p:last-child {
  margin: 9px 0 0;
  color: var(--muted);
}

.access-chip {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 210px;
  padding: 13px 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: 0 5px 18px rgba(23, 32, 51, 0.04);
}

.access-chip small,
.access-chip strong {
  display: block;
}

.access-chip small {
  color: var(--muted);
  font-size: 0.71rem;
}

.access-chip strong {
  margin-top: 3px;
  font-size: 0.82rem;
}

.notice-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 16px 18px;
  margin-bottom: 28px;
  background: #eef4fc;
  border: 1px solid #dae7f8;
  border-radius: 16px;
  color: #344054;
}

.notice-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: #fff;
  font-weight: 850;
  flex: 0 0 auto;
}

.notice-card strong {
  font-size: 0.88rem;
}

.notice-card p {
  margin: 4px 0 0;
  color: #667085;
  font-size: 0.82rem;
  line-height: 1.55;
}

.metric-section {
  margin-bottom: 28px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.section-heading.compact {
  align-items: flex-start;
}

.section-heading h3 {
  font-size: 1.14rem;
}

.data-state,
.online-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 750;
}

.data-state {
  padding: 6px 10px;
  background: #f2f4f7;
  color: #667085;
  border: 1px solid #e4e7ec;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  min-width: 0;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: 0 6px 22px rgba(23, 32, 51, 0.035);
}

.metric-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 11px;
  font-size: 0.76rem;
  font-weight: 850;
}

.metric-icon-blue { background: #edf4ff; color: var(--blue); }
.metric-icon-amber { background: #fff7e8; color: var(--amber); }
.metric-icon-purple { background: #f3effc; color: var(--purple); }
.metric-icon-orange { background: #fff1e8; color: var(--orange); }
.metric-icon-green { background: #ecfdf3; color: #087c4c; }

.metric-card p {
  margin: 0;
  color: #475467;
  font-size: 0.83rem;
  font-weight: 700;
}

.metric-card > strong {
  display: block;
  margin-top: 9px;
  font-size: 1.9rem;
  line-height: 1;
}

.metric-card > span {
  display: block;
  margin-top: 10px;
  color: var(--soft);
  font-size: 0.72rem;
  line-height: 1.45;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 21px;
  box-shadow: 0 6px 22px rgba(23, 32, 51, 0.035);
}

.workflow-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.workflow-list li {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
}

.workflow-list li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 44px;
  bottom: -4px;
  width: 2px;
  background: #edf0f4;
}

.workflow-list li > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #edf2fa;
  color: #344054;
  font-size: 0.75rem;
  font-weight: 850;
  z-index: 1;
}

.workflow-list strong,
.workflow-list small {
  display: block;
}

.workflow-list strong {
  padding-top: 1px;
  font-size: 0.84rem;
}

.workflow-list small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.48;
  font-size: 0.75rem;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-action {
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border 0.15s ease;
}

.quick-action:hover {
  transform: translateY(-1px);
  border-color: #ccd5e2;
  box-shadow: 0 8px 20px rgba(23, 32, 51, 0.06);
}

.quick-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 9px;
  background: var(--navy);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 850;
}

.quick-action strong,
.quick-action small {
  display: block;
}

.quick-action strong {
  font-size: 0.8rem;
}

.quick-action small {
  margin-top: 5px;
  color: var(--soft);
  font-size: 0.68rem;
}

.system-card {
  margin-top: 16px;
  padding: 16px;
  border-radius: 15px;
  background: #f7f9fc;
  border: 1px solid #edf0f4;
}

.system-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.system-card-head strong {
  font-size: 0.82rem;
}

.online-badge {
  padding: 5px 8px;
  background: #ecfdf3;
  color: #087c4c;
}

.system-card dl {
  margin: 14px 0 0;
}

.system-card dl > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-top: 1px solid #e9edf3;
}

.system-card dt {
  color: var(--muted);
  font-size: 0.72rem;
}

.system-card dd {
  margin: 0;
  text-align: right;
  font-size: 0.73rem;
  font-weight: 750;
  color: #344054;
}

/* =========================
   PLACEHOLDER MODULES
   ========================= */
.module-placeholder {
  min-height: calc(100vh - 190px);
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 50px 24px;
}

.placeholder-icon {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 20px;
  background: var(--navy);
  color: #fff;
  font-weight: 850;
  font-size: 0.8rem;
}

.module-placeholder h3 {
  font-size: 1.7rem;
}

.module-placeholder > p:last-of-type {
  max-width: 530px;
  margin: 11px auto 0;
  color: var(--muted);
  line-height: 1.65;
}

.secondary-action {
  margin-top: 24px;
  padding-inline: 22px;
  border: 1px solid #d0d5dd;
  background: #fff;
  color: #344054;
}

.secondary-action:hover {
  background: #f8fafc;
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .quick-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 12px 0 32px rgba(23, 32, 51, 0.12);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app-main {
    min-height: 100vh;
  }

  .menu-button {
    display: block;
  }

  .topbar {
    padding: 12px 20px;
  }

  .content-area {
    padding: 24px 20px 40px;
  }

  .welcome-row {
    flex-direction: column;
  }

  .access-chip {
    min-width: 0;
  }

  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .login-shell {
    padding: 0;
    align-items: stretch;
  }

  .login-card {
    min-height: 100vh;
    width: 100%;
    border-radius: 0;
    border: 0;
    padding: 44px 22px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .brand-mark-large {
    width: 76px;
    height: 76px;
    border-radius: 21px;
  }

  .login-card h1 {
    font-size: clamp(2rem, 10vw, 2.8rem);
  }

  .topbar-user-copy {
    display: none;
  }

  .topbar-kicker {
    display: none;
  }

  .topbar h2 {
    margin-top: 0;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-card:last-child {
    grid-column: 1 / -1;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }
}

@media (max-width: 460px) {
  .content-area {
    padding: 20px 14px 34px;
  }

  .topbar {
    padding-inline: 14px;
  }

  .metric-grid,
  .quick-grid {
    grid-template-columns: 1fr;
  }

  .metric-card:last-child {
    grid-column: auto;
  }

  .panel {
    padding: 17px;
  }
}
