:root {
  --bg: #070b17;
  --bg-soft: #0c1224;
  --panel: rgba(18, 27, 51, 0.82);
  --panel-solid: #111a31;
  --panel-light: #18233f;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f6f8ff;
  --muted: #98a3bd;
  --primary: #7b61ff;
  --primary-2: #34d5ff;
  --success: #36d399;
  --warning: #ffbf69;
  --danger: #ff637d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 20px;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(72, 87, 220, 0.20), transparent 34%),
    radial-gradient(circle at 100% 30%, rgba(28, 197, 226, 0.13), transparent 30%),
    var(--bg);
}

button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: .2;
  pointer-events: none;
}
.ambient-one { top: -180px; left: -100px; background: #725cff; }
.ambient-two { right: -180px; bottom: -150px; background: #15b8d3; }

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-shell {
  width: min(1040px, 100%);
  min-height: 620px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(10, 16, 31, 0.77);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(123, 97, 255, .30), rgba(52, 213, 255, .06)),
    #0d152c;
}
.brand-panel::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -160px;
  width: 410px;
  height: 410px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 50%;
  box-shadow: 0 0 0 45px rgba(255,255,255,.025), 0 0 0 90px rgba(255,255,255,.018);
}

.brand-mark {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin-bottom: 34px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 24px;
  font-size: 42px;
  background: linear-gradient(145deg, rgba(123,97,255,.45), rgba(52,213,255,.18));
  box-shadow: 0 15px 45px rgba(52, 105, 255, .2);
}
.brand-mark.small {
  width: 45px;
  height: 45px;
  margin: 0;
  border-radius: 14px;
  font-size: 25px;
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: #8e9ab8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .15em;
}

.brand-panel h1 {
  margin: 0;
  font-size: clamp(44px, 7vw, 72px);
  letter-spacing: -.055em;
}
.brand-panel > p {
  max-width: 470px;
  margin: 20px 0 34px;
  color: #b3bdd2;
  font-size: 18px;
  line-height: 1.7;
}
.feature-list { display: grid; gap: 14px; color: #d9deea; }
.feature-list div { display: flex; align-items: center; gap: 12px; }
.feature-list span {
  width: 25px;
  height: 25px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #052719;
  background: var(--success);
  font-weight: 900;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px;
}
.login-panel h2 { margin: 0 0 8px; font-size: 34px; letter-spacing: -.035em; }
.muted { color: var(--muted); }
.mobile-brand { display: none; }

form { display: grid; gap: 18px; }
.login-panel form { margin-top: 32px; }

label {
  display: grid;
  gap: 9px;
  color: #dfe4ef;
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  color: var(--text);
  background: rgba(255,255,255,.045);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:focus {
  border-color: rgba(123,97,255,.8);
  background: rgba(255,255,255,.065);
  box-shadow: 0 0 0 4px rgba(123,97,255,.12);
}

.input-wrap { position: relative; }
.input-wrap input { padding-left: 44px; padding-right: 45px; }
.input-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 15px;
  color: #7f8ca8;
  transform: translateY(-50%);
}
.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  color: #94a0b8;
  background: transparent;
  transform: translateY(-50%);
}

.primary-button, .secondary-button, .danger-button, .ghost-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  font-weight: 800;
  transition: transform .2s, filter .2s, background .2s;
}
.primary-button {
  color: white;
  background: linear-gradient(120deg, var(--primary), #5b86ff);
  box-shadow: 0 12px 28px rgba(100, 94, 255, .25);
}
.primary-button:hover, .danger-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.secondary-button { border: 1px solid var(--line); color: #e4e8f2; background: rgba(255,255,255,.055); }
.danger-button { color: white; background: linear-gradient(120deg, #ed4a67, #ff6b78); }
.ghost-button { border: 1px solid var(--line); color: #cfd6e6; background: transparent; }
.full { width: 100%; }
button:disabled { opacity: .6; cursor: wait; transform: none !important; }

.security-note {
  margin: 22px 0 0;
  color: #7f8aa2;
  font-size: 12px;
  text-align: center;
}
.form-message {
  padding: 11px 13px;
  border: 1px solid rgba(255, 99, 125, .22);
  border-radius: 11px;
  color: #ffadba;
  background: rgba(255, 99, 125, .08);
  font-size: 13px;
  line-height: 1.45;
}
.form-message.success {
  border-color: rgba(54, 211, 153, .22);
  color: #8ff0c8;
  background: rgba(54, 211, 153, .08);
}

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

.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  width: 270px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(8, 13, 28, .91);
  backdrop-filter: blur(22px);
}

.sidebar-brand {
  height: 86px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}
.sidebar-brand strong { display: block; font-size: 18px; letter-spacing: -.02em; }
.sidebar-brand span { color: #78859e; font-size: 11px; }
.sidebar-close { display: none; margin-left: auto; }

.menu-list {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 18px 12px;
  overflow-y: auto;
}
.menu-item {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #9da8bf;
  background: transparent;
  text-align: left;
  font-weight: 700;
}
.menu-item:hover { color: white; background: rgba(255,255,255,.045); }
.menu-item.active {
  border-color: rgba(123, 97, 255, .25);
  color: white;
  background: linear-gradient(100deg, rgba(123,97,255,.20), rgba(52,213,255,.05));
}
.menu-icon { width: 24px; font-size: 18px; text-align: center; }

.sidebar-footer { padding: 14px; border-top: 1px solid var(--line); }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 12px;
  padding: 10px;
}
.avatar {
  width: 40px;
  height: 40px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 13px;
  color: white;
  background: linear-gradient(145deg, #735cff, #397cd7);
  font-weight: 900;
}
.user-copy { min-width: 0; }
.user-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.user-copy span { color: #78859e; font-size: 11px; }

.workspace { min-height: 100vh; margin-left: 270px; }
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 23, .76);
  backdrop-filter: blur(18px);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar h2 { margin: 0; font-size: 23px; letter-spacing: -.035em; }
.topbar .eyebrow { margin: 0 0 4px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.menu-button { display: none; }

.icon-button {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #c8cfdd;
  background: rgba(255,255,255,.04);
  font-size: 20px;
}
.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid rgba(54,211,153,.18);
  border-radius: 999px;
  color: #a5eacf;
  background: rgba(54,211,153,.07);
  font-size: 12px;
  font-weight: 800;
}
.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(54,211,153,.1);
}
.account-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: white;
  background: rgba(255,255,255,.04);
}
.account-button .avatar { width: 36px; height: 36px; border-radius: 10px; }

.page-content { padding: 30px; }

.hero-card {
  position: relative;
  min-height: 230px;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 38px;
  border: 1px solid rgba(123,97,255,.22);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 90% 20%, rgba(52,213,255,.17), transparent 26%),
    linear-gradient(135deg, rgba(123,97,255,.18), rgba(15,25,48,.75));
  box-shadow: 0 18px 65px rgba(0,0,0,.18);
}
.hero-card::after {
  content: "◐";
  position: absolute;
  right: 60px;
  color: rgba(255,255,255,.09);
  font-size: 150px;
  transform: rotate(-20deg);
}
.hero-content { position: relative; z-index: 1; max-width: 690px; }
.hero-content h1 { margin: 0 0 12px; font-size: clamp(30px, 5vw, 48px); letter-spacing: -.055em; }
.hero-content p { margin: 0; color: #b4bed1; line-height: 1.7; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 18px;
}
.stat-card, .content-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(16, 24, 46, .72);
  box-shadow: 0 14px 40px rgba(0,0,0,.14);
}
.stat-card { padding: 20px; }
.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-icon {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.04);
  font-size: 20px;
}
.stat-card strong { display: block; margin-top: 18px; font-size: 28px; letter-spacing: -.04em; }
.stat-card > span { color: var(--muted); font-size: 12px; }

.section-block { margin-top: 28px; }
.section-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.section-title-row h3 { margin: 0; font-size: 20px; }
.section-title-row p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.quick-card {
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: white;
  background: rgba(16,24,46,.72);
  text-align: left;
  transition: transform .2s, border-color .2s, background .2s;
}
.quick-card:hover {
  border-color: rgba(123,97,255,.4);
  background: rgba(25,35,65,.9);
  transform: translateY(-3px);
}
.quick-card .quick-icon { font-size: 24px; }
.quick-card strong { display: block; font-size: 15px; }
.quick-card span { color: var(--muted); font-size: 12px; }

.module-shell {
  min-height: 540px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(15, 23, 44, .72);
}
.module-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.module-big-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(123,97,255,.25);
  border-radius: 18px;
  background: rgba(123,97,255,.12);
  font-size: 29px;
}
.module-head h3 { margin: 0 0 7px; font-size: 25px; }
.module-head p { margin: 0; color: var(--muted); }
.empty-state {
  min-height: 370px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}
.empty-state > div { max-width: 480px; }
.empty-state .empty-icon { font-size: 54px; opacity: .65; }
.empty-state h4 { margin: 15px 0 8px; color: white; font-size: 20px; }
.empty-state p { margin: 0; line-height: 1.65; }

.user-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.user-toolbar h3 { margin: 0 0 6px; }
.user-toolbar p { margin: 0; color: var(--muted); font-size: 13px; }
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
}
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 16px; border-bottom: 1px solid var(--line); text-align: left; }
th {
  color: #8995ad;
  background: rgba(255,255,255,.025);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
td { color: #dbe0eb; font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.018); }
.table-user { display: flex; align-items: center; gap: 11px; }
.table-user .avatar { width: 36px; height: 36px; border-radius: 11px; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}
.badge.master { color: #cfc7ff; background: rgba(123,97,255,.14); }
.badge.active { color: #99e8c9; background: rgba(54,211,153,.1); }
.badge.inactive { color: #ffb1bd; background: rgba(255,99,125,.1); }
.permission-chips { display: flex; flex-wrap: wrap; gap: 5px; max-width: 340px; }
.permission-chip {
  padding: 4px 7px;
  border-radius: 7px;
  color: #acb6ca;
  background: rgba(255,255,255,.05);
  font-size: 10px;
}
.row-actions { display: flex; gap: 7px; }
.table-action {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #cbd2df;
  background: rgba(255,255,255,.035);
}
.table-action.danger { color: #ff91a3; }

.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(2,5,12,.72);
  backdrop-filter: blur(10px);
}
.modal-card {
  width: min(500px, 100%);
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #10182d;
  box-shadow: var(--shadow);
}
.modal-card.wide { width: min(760px, 100%); }
.modal-card.compact { width: min(410px, 100%); text-align: center; }
.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.modal-header h3 { margin: 0; font-size: 23px; letter-spacing: -.03em; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}
.switch-row strong { display: block; font-size: 13px; }
.switch-row span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.switch { position: relative; display: inline-block; width: 48px; height: 27px; }
.switch input { width: 0; height: 0; opacity: 0; }
.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #303950;
  transition: .2s;
}
.slider::before {
  content: "";
  position: absolute;
  width: 21px;
  height: 21px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: white;
  transition: .2s;
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider::before { transform: translateX(21px); }

.permission-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.section-heading strong, .section-heading span { display: block; }
.section-heading span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.permission-actions { display: flex; gap: 10px; }
.text-button { padding: 0; border: 0; color: #9da8ff; background: none; font-size: 11px; font-weight: 800; }
.permission-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.permission-option {
  display: flex;
  grid-template: none;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,.025);
}
.permission-option input { width: 17px; min-height: 17px; accent-color: var(--primary); }
.permission-option .p-icon { width: 22px; text-align: center; }
.permission-option strong { font-size: 12px; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 5px; }
.modal-actions.centered { justify-content: center; margin-top: 20px; }
.confirm-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 50%;
  color: #ffb4c0;
  background: rgba(255,99,125,.11);
  font-size: 25px;
  font-weight: 900;
}

.toast-container {
  position: fixed;
  z-index: 200;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
}
.toast {
  min-width: 290px;
  max-width: 390px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: #e7ebf4;
  background: #17213a;
  box-shadow: 0 18px 45px rgba(0,0,0,.35);
  animation: toastIn .25s ease both;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

.loading-block {
  min-height: 300px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.spinner {
  width: 35px;
  height: 35px;
  margin: 0 auto 12px;
  border: 3px solid rgba(255,255,255,.09);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sidebar-backdrop {
  position: fixed;
  z-index: 25;
  inset: 0;
  background: rgba(0,0,0,.55);
}

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .login-view { padding: 18px; }
  .login-shell { grid-template-columns: 1fr; min-height: auto; }
  .brand-panel { display: none; }
  .login-panel { padding: 38px 28px; }
  .mobile-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 38px; }

  .sidebar { transform: translateX(-100%); transition: transform .24s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close, .menu-button { display: inline-grid; }
  .workspace { margin-left: 0; }
  .topbar { padding: 0 18px; }
  .page-content { padding: 20px 16px; }
  .status-pill { display: none; }
  .hero-card { padding: 28px; }
  .hero-card::after { right: 20px; opacity: .6; }
}

@media (max-width: 580px) {
  .topbar { height: 76px; }
  .topbar h2 { font-size: 19px; }
  .topbar-actions .account-button span:not(.avatar) { display: none; }
  .page-content { padding-top: 16px; }
  .stats-grid, .quick-grid { grid-template-columns: 1fr; }
  .hero-card { min-height: 240px; }
  .hero-card::after { display: none; }
  .form-grid, .permission-grid { grid-template-columns: 1fr; }
  .section-heading, .user-toolbar { align-items: stretch; flex-direction: column; }
  .permission-actions { justify-content: flex-start; }
  .user-toolbar .primary-button { width: 100%; }
  .modal-card { padding: 20px; }
}
