:root {
  --navy: #10233f;
  --blue: #1769e0;
  --blue-dark: #0d4fb5;
  --green: #1f9d75;
  --cyan: #14a8c4;
  --violet: #7357d8;
  --ink: #172033;
  --muted: #687386;
  --line: #dfe5ed;
  --surface: #ffffff;
  --background: #f4f7fb;
  --danger: #c63f4e;
  --warning: #b06b00;
  --shadow: 0 10px 35px rgba(24, 42, 72, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}
html {
  min-height: 100%;
  background: var(--background);
}
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
button,
input,
select {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
a {
  color: inherit;
}
[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: 250px;
  padding: 28px 18px 18px;
  color: #fff;
  background: linear-gradient(165deg, #10233f 0%, #15345a 70%, #125d72 130%);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 30px;
  text-decoration: none;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #fff;
  background: linear-gradient(145deg, var(--blue), #31b67f);
  border-radius: 11px;
  font-size: 19px;
  font-weight: 800;
  box-shadow: 0 7px 18px rgba(23, 105, 224, 0.35);
}
.brand-mark.large {
  width: 54px;
  height: 54px;
  margin-bottom: 12px;
  border-radius: 15px;
  font-size: 26px;
}
.brand strong,
.brand small {
  display: block;
}
.brand strong {
  font-size: 18px;
  letter-spacing: 0.2px;
}
.brand small {
  color: #aebdd1;
  font-size: 11px;
  letter-spacing: 1.3px;
  text-transform: uppercase;
}
.sidebar nav {
  display: grid;
  gap: 5px;
}
.sidebar nav a {
  padding: 11px 13px;
  color: #c8d3e2;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  transition: 0.18s ease;
}
.sidebar nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}
.sidebar nav a.active {
  color: #fff;
  background: rgba(55, 153, 229, 0.2);
  box-shadow: inset 3px 0 #50b9ea;
}
.nav-label {
  margin: 23px 13px 6px;
  color: #8296b2;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.sidebar-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 14px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.avatar,
.person > span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  color: #fff;
  background: #2b7daf;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}
.user-summary {
  min-width: 0;
}
.user-summary strong,
.user-summary small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-summary strong {
  font-size: 12px;
}
.user-summary small {
  color: #97abc5;
  font-size: 11px;
}
.icon-button {
  padding: 7px;
  color: #b8c5d6;
  background: none;
  border: 0;
  cursor: pointer;
}
.mobile-header {
  display: none;
}
.main-content {
  grid-column: 2;
  width: 100%;
  max-width: 1500px;
  min-height: 100vh;
  padding: 42px 4vw 60px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}
h1,
h2,
p {
  margin-top: 0;
}
h1 {
  margin-bottom: 5px;
  font-size: clamp(29px, 3vw, 39px);
  line-height: 1.12;
  letter-spacing: -0.9px;
}
h2 {
  margin-bottom: 5px;
  font-size: 19px;
  letter-spacing: -0.25px;
}
.page-header p:last-child,
.panel-heading p,
.entity-card p,
.feature-grid p {
  margin-bottom: 0;
  color: var(--muted);
}
.eyebrow {
  margin-bottom: 5px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.35px;
  text-transform: uppercase;
}
.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}
.button:hover {
  transform: translateY(-1px);
}
.button.primary {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 7px 16px rgba(23, 105, 224, 0.18);
}
.button.primary:hover {
  background: var(--blue-dark);
}
.button.secondary {
  color: var(--blue-dark);
  background: #edf4ff;
  border-color: #cbdfff;
}
.button.ghost {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}
.button.wide {
  width: 100%;
}

.panel {
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid rgba(212, 221, 232, 0.85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}
.panel-heading h2:last-child {
  margin-bottom: 0;
}
.table-panel {
  overflow: hidden;
}
.table-wrap {
  width: 100%;
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 15px 18px;
  border-bottom: 1px solid #e8edf3;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
th {
  color: #718096;
  background: #f9fbfd;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover td {
  background: #fbfcfe;
}
td small,
label small {
  display: block;
  color: var(--muted);
}
.empty {
  padding: 35px;
  color: var(--muted);
  text-align: center;
}
.person {
  display: flex;
  align-items: center;
  gap: 10px;
}
.person strong,
.person small {
  display: block;
}
.status {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  color: #526174;
  background: #eef2f6;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  text-transform: capitalize;
}
.status.active {
  color: #137153;
  background: #e4f7ef;
}
.status.inactive,
.status.locked {
  color: #9a3944;
  background: #fae9eb;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  padding: 23px;
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat-card::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  right: -35px;
  bottom: -55px;
  border: 18px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}
.stat-card span,
.stat-card strong {
  display: block;
  position: relative;
  z-index: 1;
}
.stat-card span {
  opacity: 0.85;
  font-weight: 650;
}
.stat-card strong {
  margin-top: 12px;
  font-size: 34px;
}
.stat-card.blue {
  background: linear-gradient(135deg, #1769e0, #3989ed);
}
.stat-card.cyan {
  background: linear-gradient(135deg, #138fae, #25b8c9);
}
.stat-card.green {
  background: linear-gradient(135deg, #168768, #35ac7f);
}
.stat-card.violet {
  background: linear-gradient(135deg, #654bd0, #8973e2);
}
.attention-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  padding: 24px;
  border-left: 5px solid #eaa43b;
}
.attention-panel p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
}
.feature-grid > div {
  padding: 23px;
  background: #fff;
}
.feature-grid p {
  margin: 6px 0 0;
}

.form-panel {
  padding-bottom: 22px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
  padding: 22px 24px 0;
}
label {
  display: grid;
  align-content: start;
  gap: 6px;
  color: #354158;
  font-size: 12px;
  font-weight: 750;
}
input,
select {
  width: 100%;
  min-height: 43px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfd8e4;
  border-radius: 9px;
  outline: 0;
}
input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.12);
}
.form-actions {
  display: flex;
  align-items: end;
  gap: 8px;
  grid-column: 1 / -1;
}
.action-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 20px;
}
.action-tabs button {
  padding: 7px 12px;
  color: #42536b;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.entity-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 17px;
  padding: 21px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.entity-card h2 {
  margin: 2px 0 4px;
}
.entity-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  color: #1769e0;
  background: #edf4ff;
  border-radius: 13px;
  font-weight: 850;
}
.meta {
  color: var(--muted);
  font-size: 11px;
}
.entity-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}
.link-button {
  padding: 4px 7px;
  color: var(--blue-dark);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 750;
  cursor: pointer;
}
.link-button:hover {
  background: #edf4ff;
}
.inline-form {
  display: flex;
  align-items: center;
  gap: 5px;
}
.inline-form select {
  min-width: 105px;
  min-height: 34px;
  padding: 4px 7px;
}
.history {
  overflow: hidden;
}
.history summary {
  display: flex;
  justify-content: space-between;
  padding: 19px 23px;
  font-weight: 750;
  cursor: pointer;
}
.history summary span {
  color: var(--muted);
}
.history[open] summary {
  border-bottom: 1px solid var(--line);
}
code {
  padding: 3px 6px;
  color: #314760;
  background: #eef2f7;
  border-radius: 5px;
  font-size: 12px;
}

.flash {
  margin-bottom: 20px;
  padding: 13px 16px;
  border: 1px solid;
  border-radius: 10px;
  font-weight: 650;
}
.flash-success {
  color: #126449;
  background: #e9f8f1;
  border-color: #bfead8;
}
.flash-error {
  color: #94323d;
  background: #fff0f1;
  border-color: #f2c5ca;
}
.flash-warning {
  color: #7a5200;
  background: #fff7df;
  border-color: #efd993;
}

.auth-shell {
  display: grid;
  place-items: center;
  padding: 30px;
  background:
    radial-gradient(
      circle at 70% 20%,
      rgba(30, 157, 117, 0.13),
      transparent 27%
    ),
    radial-gradient(
      circle at 20% 80%,
      rgba(23, 105, 224, 0.17),
      transparent 30%
    ),
    #eef3fa;
}
.auth-content {
  width: min(880px, 100%);
}
.login-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  min-height: 470px;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(22, 45, 79, 0.16);
}
.login-intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(35px, 6vw, 65px);
  color: #fff;
  background: linear-gradient(145deg, #10233f, #16537a);
}
.login-intro .eyebrow {
  color: #72d6c0;
}
.login-intro h1 {
  font-size: 42px;
}
.login-intro p:last-child {
  color: #c1d4e6;
}
.login-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 19px;
  padding: clamp(35px, 6vw, 65px);
}
.error-card {
  max-width: 600px;
  margin: 80px auto;
  padding: 45px;
  text-align: center;
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.error-card .button {
  margin-top: 10px;
}

@media (max-width: 1050px) {
  .stat-grid,
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .app-shell {
    display: block;
  }
  .sidebar {
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.18);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 58px;
    padding: 0 18px;
    color: #fff;
    background: var(--navy);
  }
  .menu-toggle {
    padding: 7px 10px;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 7px;
  }
  .main-content {
    padding: 25px 16px 45px;
  }
  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .header-actions {
    justify-content: flex-start;
  }
  .stat-grid,
  .card-grid,
  .feature-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid {
    padding-inline: 17px;
  }
  .panel-heading {
    padding-inline: 17px;
  }
  .attention-panel {
    align-items: flex-start;
    flex-direction: column;
  }
  .login-card {
    grid-template-columns: 1fr;
  }
  .login-intro {
    min-height: 260px;
  }
  .login-form {
    min-height: 300px;
  }
  .auth-shell {
    padding: 15px;
  }
  .entity-card {
    grid-template-columns: auto 1fr;
  }
  .entity-card > .status {
    grid-column: 2;
    justify-self: start;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
