:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --soft: #eef4f5;
  --ink: #172129;
  --muted: #60717c;
  --line: #d7e2e5;
  --brand: #d91f2f;
  --brand-dark: #a71320;
  --blue: #177a9c;
  --green: #20845f;
  --yellow: #f2c84b;
  --shadow: 0 18px 50px rgba(23, 33, 41, .1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

body.admin-dashboard {
  --bg: #10171b;
  --surface: #ffffff;
  --soft: #eef4f5;
  --ink: #172129;
  --muted: #647681;
  --line: #d6e1e5;
  background:
    linear-gradient(180deg, #10171b 0, #142026 330px, #f4f7f8 331px),
    #f4f7f8;
}

a {
  color: inherit;
  text-decoration: none;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 44px);
  background: rgba(16, 23, 27, .92);
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  color: #f7fbfc;
  backdrop-filter: blur(18px);
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.admin-brand strong,
.admin-brand small {
  display: block;
}

.admin-brand small {
  color: rgba(247, 251, 252, .66);
  margin-top: 3px;
}

.admin-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}

.admin-topbar nav {
  display: flex;
  gap: 10px;
}

.admin-topbar nav a,
.actions a,
button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--surface);
  cursor: pointer;
}

.admin-topbar nav a {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .07);
  color: #f7fbfc;
  font-weight: 800;
}

.admin-topbar nav a:hover {
  border-color: rgba(255, 255, 255, .32);
  background: rgba(255, 255, 255, .13);
}

button {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

button:hover {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
}

.ghost-action {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
}

.admin-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px clamp(16px, 4vw, 44px) 60px;
}

.admin-hero {
  margin-bottom: 22px;
}

.admin-hero p {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 5vw, 4rem);
}

.admin-hero span {
  color: var(--muted);
}

.dashboard-shell {
  width: min(1460px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 44px) 70px;
}

.dashboard-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  min-height: 280px;
  margin-bottom: 18px;
  padding: clamp(24px, 4vw, 40px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  background:
    linear-gradient(110deg, rgba(217, 31, 47, .42), transparent 34%),
    linear-gradient(22deg, rgba(23, 122, 156, .42), transparent 50%),
    linear-gradient(180deg, #1b2a31, #10171b);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .24);
  color: #f7fbfc;
}

.dashboard-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .22;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .16) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px);
  background-size: 38px 38px;
}

.dashboard-hero::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -90px;
  width: 520px;
  height: 520px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 24deg, rgba(255, 255, 255, .09) 0 12deg, transparent 12deg 24deg);
  animation: dashboardRadar 24s linear infinite;
}

.dashboard-hero > * {
  position: relative;
  z-index: 1;
}

.dashboard-hero h1 {
  max-width: 780px;
  margin: 0 0 10px;
  font-size: clamp(2.4rem, 6vw, 5.4rem);
  line-height: .95;
  letter-spacing: 0;
}

.dashboard-hero span {
  display: block;
  max-width: 680px;
  color: rgba(247, 251, 252, .76);
  line-height: 1.5;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.dashboard-actions .ghost-action {
  border-color: rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .1);
  color: #f7fbfc;
}

.dashboard-actions button {
  min-height: 46px;
  box-shadow: 0 16px 32px rgba(217, 31, 47, .28);
}

.kicker {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.dashboard-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 46px rgba(23, 33, 41, .1);
}

.metric-icon {
  display: block;
  width: 12px;
  height: 12px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 8px rgba(23, 122, 156, .12);
}

.metric-card.is-good .metric-icon {
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(32, 132, 95, .14);
}

.metric-card.is-warning .metric-icon {
  background: var(--yellow);
  box-shadow: 0 0 0 8px rgba(242, 200, 75, .18);
}

.metric-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.45rem;
}

.metric-card small {
  color: var(--muted);
  line-height: 1.45;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 285px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.dashboard-side {
  position: sticky;
  top: 94px;
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  background: #152127;
  color: #f7fbfc;
  box-shadow: 0 20px 54px rgba(0, 0, 0, .18);
}

.dashboard-side strong {
  margin-bottom: 6px;
}

.dashboard-side a {
  display: flex;
  min-height: 40px;
  align-items: center;
  border-radius: 8px;
  padding: 0 12px;
  color: rgba(247, 251, 252, .72);
  font-weight: 800;
}

.dashboard-side a:hover {
  background: rgba(255, 255, 255, .1);
  color: #f7fbfc;
}

.side-note {
  margin-top: 10px;
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
}

.side-note span {
  color: var(--brand);
  font-weight: 900;
}

.side-note p {
  margin: 8px 0 0;
  color: rgba(247, 251, 252, .65);
  line-height: 1.45;
}

.dashboard-content {
  min-width: 0;
}

.command-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.command-panel a {
  display: grid;
  min-height: 112px;
  align-content: space-between;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.command-panel span {
  color: var(--brand);
  font-size: .82rem;
  font-weight: 900;
}

.command-panel strong {
  font-size: 1.2rem;
}

.command-panel small {
  color: var(--muted);
}

.panel,
.login-card,
.login-intro {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
  margin-bottom: 18px;
}

.panel h2 {
  margin: 0;
}

.panel h3 {
  margin: 0;
  font-size: 1.35rem;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head span {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border-radius: 8px;
  padding: 0 10px;
  background: var(--soft);
  color: var(--muted);
  font-size: .88rem;
  font-weight: 800;
}

.panel-head.compact {
  margin-bottom: 16px;
  padding-bottom: 14px;
}

.form-grid,
.card-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--soft);
  color: var(--ink);
  font: inherit;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

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

fieldset {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.card-editor {
  margin-top: 16px;
}

legend {
  padding: 0 8px;
  font-weight: 900;
}

fieldset label {
  margin-top: 10px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check input {
  width: auto;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.notice {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-weight: 800;
}

.notice.success {
  background: #dff3e9;
  color: #176043;
}

.notice.error {
  background: #ffe2e2;
  color: #9d1720;
}

.user-zone {
  margin-top: 24px;
  padding-top: 8px;
}

.user-zone-head {
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.user-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 18px;
}

.user-panel {
  margin-bottom: 18px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 86px;
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 8px;
  background: var(--soft);
}

.avatar {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 900;
}

.profile-card strong,
.profile-card small {
  display: block;
}

.profile-card small {
  margin-top: 4px;
  color: var(--muted);
}

.locked-box {
  padding: 16px;
  border-radius: 8px;
  background: var(--soft);
}

.locked-box p {
  margin: 8px 0 0;
  color: var(--muted);
}

.user-list-panel {
  overflow: hidden;
}

.user-table {
  display: grid;
  gap: 8px;
}

.user-row {
  display: grid;
  grid-template-columns: 1.2fr 1.1fr .9fr .9fr;
  gap: 12px;
  align-items: center;
  min-height: 62px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--soft);
}

.user-row-head {
  min-height: 42px;
  background: var(--ink);
  color: var(--surface);
  font-size: .85rem;
  font-weight: 900;
  text-transform: uppercase;
}

.user-row strong,
.user-row small {
  display: block;
}

.user-row small {
  margin-top: 4px;
  color: var(--muted);
}

.user-row-head small {
  color: inherit;
}

.role-pill {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--ink);
  font-style: normal;
  font-weight: 900;
}

.mini-role-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 6px;
}

.mini-role-form select {
  min-height: 36px;
  padding: 7px 9px;
}

.mini-role-form button {
  min-height: 36px;
  padding: 0 8px;
}

.role-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.role-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.role-card span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 900;
}

.role-card h3 {
  margin: 0 0 10px;
}

.role-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.role-card.tone-danger span { background: var(--brand); }
.role-card.tone-blue span { background: var(--blue); }
.role-card.tone-green span { background: var(--green); }
.role-card.tone-yellow span { background: var(--yellow); color: var(--ink); }
.role-card.tone-dark span { background: var(--ink); }
.role-card.tone-muted span { background: var(--muted); }

.admin-login {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
  overflow: hidden;
  background:
    linear-gradient(115deg, rgba(217, 31, 47, .34), transparent 34%),
    linear-gradient(28deg, rgba(23, 122, 156, .42), transparent 54%),
    linear-gradient(180deg, #10171b, #17252c 58%, #10171b);
}

.admin-login::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .24;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .16) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, .12) 1px, transparent 1px),
    repeating-linear-gradient(112deg, transparent 0 20px, rgba(255, 255, 255, .08) 20px 22px, transparent 22px 44px);
  background-size: 42px 42px, 42px 42px, auto;
}

.admin-login::after {
  content: "";
  position: absolute;
  right: 8vw;
  top: 9vh;
  width: min(48vw, 620px);
  height: min(48vw, 620px);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .18);
  background:
    repeating-conic-gradient(from 15deg, rgba(255, 255, 255, .10) 0 10deg, transparent 10deg 24deg);
  animation: dashboardRadar 26s linear infinite;
}

.login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 22px;
  width: min(1040px, 100%);
  align-items: stretch;
}

.login-intro {
  position: relative;
  min-height: 520px;
  padding: clamp(26px, 5vw, 48px);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .95), rgba(238, 244, 245, .88));
  overflow: hidden;
}

.login-intro::after {
  content: "";
  position: absolute;
  right: 32px;
  bottom: 36px;
  width: 78px;
  height: 128px;
  clip-path: polygon(42% 0, 82% 0, 58% 38%, 88% 38%, 26% 100%, 43% 52%, 16% 52%);
  background: #f2c84b;
  filter: drop-shadow(0 0 22px rgba(242, 200, 75, .48));
}

.login-intro h1 {
  margin: 64px 0 16px;
  font-size: clamp(3rem, 8vw, 6.6rem);
  line-height: .92;
}

.login-intro p {
  max-width: 560px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.login-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.login-status span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}

.login-status i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
}

.login-card {
  align-self: center;
  width: 100%;
  padding: 26px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(16px);
}

.login-card h2 {
  margin: 0 0 14px;
  font-size: 2rem;
}

.login-card form {
  display: grid;
  gap: 14px;
}

.login-card button {
  min-height: 48px;
  box-shadow: 0 16px 32px rgba(217, 31, 47, .24);
}

.login-eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: .8rem;
  font-weight: 900;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .dashboard-hero,
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

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

  .command-panel,
  .user-grid,
  .role-board {
    grid-template-columns: 1fr;
  }

  .user-row,
  .user-row-head {
    grid-template-columns: 1fr;
  }

  .user-row-head {
    display: none;
  }

  .dashboard-side {
    position: relative;
    top: auto;
  }

  .dashboard-actions {
    justify-content: flex-start;
  }

  .panel-head {
    display: grid;
  }

  .admin-topbar,
  .admin-topbar nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-topbar nav {
    width: 100%;
  }

  .admin-topbar nav a {
    width: 100%;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .admin-login::after {
    right: -90px;
    top: 16vh;
    width: 360px;
    height: 360px;
  }

  .login-intro {
    min-height: auto;
  }

  .login-intro h1 {
    margin-top: 42px;
    font-size: clamp(3rem, 16vw, 4.4rem);
  }

  .form-grid,
  .card-editor {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 761px) and (max-width: 1120px) {
  .dashboard-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-layout {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .command-panel,
  .role-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-grid,
  .user-row {
    grid-template-columns: 1fr;
  }
}

@keyframes dashboardRadar {
  to {
    transform: rotate(1turn);
  }
}
