:root {
  --bg: #eef2ff;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-strong: #ffffff;
  --ink: #2d2d2d;
  --muted: #474747;
  --line: rgba(48, 79, 255, 0.12);
  --brand: #304fff;
  --brand-soft: #e3e9ff;
  --accent: #6c7dff;
  --danger: #d93025;
  --success: #1f8f58;
  --warning: #bf7b00;
  --shadow: 0 24px 70px rgba(48, 79, 255, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 20px;
  --space-5: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Nunito Sans", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background:
    radial-gradient(circle at top left, rgba(48, 79, 255, 0.18), transparent 26%),
    radial-gradient(circle at bottom right, rgba(108, 125, 255, 0.16), transparent 30%),
    var(--bg);
  color: var(--ink);
}

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

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 290px 1fr;
}

.sidebar {
  padding: 14px 18px 20px;
  background: linear-gradient(180deg, rgba(48, 79, 255, 0.97), rgba(32, 58, 199, 0.98));
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border-radius: 0;
  margin-bottom: 2px;
}

.brand-wrap h1,
.topbar h2,
.panel h3,
.login-card h2,
.login-hero h1 {
  margin: 0;
}

.brand-logo-wrap {
  width: 220px;
  height: 92px;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin: 0;
  background: transparent;
}

.brand-logo {
  width: 176px;
  height: auto;
  display: block;
  object-fit: contain;
  background: transparent;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
  color: var(--muted);
}

.sidebar .eyebrow {
  color: rgba(255, 255, 255, 0.76);
}

.sidebar-nav {
  display: grid;
  gap: 6px;
  flex: 1 1 auto;
  align-content: start;
}

.nav-item {
  padding: 11px 14px;
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  line-height: 1.35;
  transition: 180ms ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  transform: translateX(2px);
}

.main-content {
  padding: var(--space-5);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-3);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-icon-link {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--brand);
  position: relative;
}

.header-icon-link.active {
  background: #e8edff;
}

.header-icon-glyph {
  font-size: 17px;
  line-height: 1;
}

.header-icon-button {
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.header-avatar {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #304fff 0%, #5d73ff 100%);
  box-shadow: var(--shadow);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.header-icon-button:hover,
.header-avatar:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(46, 62, 124, 0.14);
}

.subtle {
  color: var(--muted);
  font-size: 12px;
}

.header-notification-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  position: absolute;
  top: -5px;
  right: -5px;
  box-shadow: 0 0 0 3px #eef1ff;
}

.notice {
  background: #edf2ff;
  border: 1px solid #cddbff;
  color: #233fc4;
  padding: 11px 14px;
  border-radius: 16px;
  margin-bottom: var(--space-3);
  font-size: 14px;
}

.notice.error {
  background: #fff1ef;
  border-color: #ffd0c8;
  color: #8c2f24;
}

.stats-grid,
.dashboard-grid,
.quick-grid,
.detail-grid {
  display: grid;
  gap: var(--space-3);
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: var(--space-3);
}

.stat-card,
.panel,
.detail-card,
.quick-card,
.login-card,
.login-hero {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.stat-card {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
}

.stat-card p,
.stat-card span {
  margin: 0;
  color: var(--muted);
}

.stat-card h3 {
  font-size: 30px;
  line-height: 1.05;
  margin: 8px 0 6px;
}

.dashboard-grid {
  grid-template-columns: 1.2fr 0.8fr;
}

.panel {
  padding: var(--space-4);
  border-radius: var(--radius-xl);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-3);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.action-row,
.form-actions,
.inline-form,
.logout-form {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  background: #e8edff;
  color: #2440c9;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}

.badge-success {
  background: #dff5e9;
  color: var(--success);
}

.badge-warning {
  background: #fff0d6;
  color: var(--warning);
}

.primary-button,
.inline-button,
.danger-button,
.ghost-button {
  border: none;
  cursor: pointer;
  border-radius: 12px;
  padding: 10px 13px;
  font-size: 14px;
  line-height: 1.2;
  transition: 180ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--brand), #6c7dff);
  color: #f5fbf9;
  font-weight: 700;
}

.primary-button.compact {
  padding: 10px 14px;
}

.inline-button {
  background: #e8edff;
  color: #2440c9;
}

.danger-button {
  background: #ffe6e2;
  color: var(--danger);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.primary-button:hover,
.inline-button:hover,
.danger-button:hover,
.ghost-button:hover,
.quick-card:hover,
.secondary-link:hover {
  transform: translateY(-1px);
}

.secondary-link {
  color: var(--brand);
  font-weight: 700;
}

.quick-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.quick-card {
  border-radius: 20px;
  padding: var(--space-3);
  min-height: 108px;
  display: flex;
  align-items: end;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(227, 233, 255, 0.96)),
    var(--panel-strong);
}

.map-panel {
  overflow: hidden;
}

.active-guards-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr);
  gap: 16px;
}

.active-guards-map {
  min-height: 560px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.active-guards-list {
  display: grid;
  gap: 12px;
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}

.guard-map-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  gap: 6px;
}

.guard-map-card h4,
.guard-map-card p,
.guard-map-card span,
.guard-map-card code {
  margin: 0;
}

.guard-map-card h4 {
  font-size: 16px;
}

.guard-map-card p,
.guard-map-card span {
  color: var(--muted);
  font-size: 13px;
}

.guard-map-card code {
  color: var(--brand);
  font-size: 12px;
  word-break: break-word;
}

.feed-list {
  display: grid;
  gap: 12px;
}

.feed-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.feed-item h4,
.feed-item p {
  margin: 0;
}

.feed-item p {
  margin-top: 6px;
  color: var(--muted);
}

.detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.detail-card {
  border-radius: 20px;
  padding: var(--space-3);
}

.detail-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

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

.card-form label,
.permissions-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.security-hint {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(48, 79, 255, 0.06);
}

.security-hint span {
  color: var(--muted);
}

.card-form input,
.card-form select,
.card-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 13px;
  background: rgba(255, 255, 255, 0.7);
}

.full-span {
  grid-column: 1 / -1;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.checkbox-row {
  flex-direction: row;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
  font-size: 14px;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.full-width {
  width: 100%;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  display: grid;
  gap: 10px;
}

.sidebar-version {
  margin: 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  text-align: left;
}

.empty-state {
  padding: var(--space-4);
  text-align: center;
  color: var(--muted);
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-4);
}

.login-grid {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-4);
}

.login-hero,
.login-card {
  border-radius: 30px;
  padding: 30px;
}

.login-hero {
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.2), transparent 30%),
    linear-gradient(180deg, rgba(48, 79, 255, 0.96), rgba(28, 50, 186, 0.98));
  color: #ffffff;
}

.login-hero .eyebrow {
  color: rgba(255, 255, 255, 0.68);
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.login-field {
  display: grid;
  gap: 8px;
}

.login-field > span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.login-input-wrap {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid rgba(48, 79, 255, 0.14);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(247, 249, 255, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 12px 28px rgba(48, 79, 255, 0.08);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.login-input-wrap:focus-within {
  border-color: rgba(48, 79, 255, 0.52);
  box-shadow: 0 0 0 4px rgba(48, 79, 255, 0.12), 0 16px 34px rgba(48, 79, 255, 0.12);
  transform: translateY(-1px);
}

.login-input-icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
}

.login-input-wrap input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
}

.login-input-wrap input::placeholder {
  color: rgba(71, 71, 71, 0.58);
  font-weight: 500;
}

.login-form .primary-button {
  width: 100%;
  min-height: 54px;
  margin-top: 2px;
  justify-content: center;
  border-radius: 18px;
  font-size: 15px;
}

.hero-copy,
.hero-list {
  color: rgba(255, 255, 255, 0.78);
}

.hero-list {
  padding-left: 18px;
  margin-top: var(--space-4);
}

.hero-logo {
  width: 198px;
  height: auto;
  display: block;
  object-fit: contain;
  margin-bottom: 18px;
  background: transparent;
}

.demo-credentials {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

@media (max-width: 980px) {
  .app-shell,
  .dashboard-grid,
  .login-grid,
  .active-guards-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

@media (max-width: 640px) {
  .main-content,
  .sidebar,
  .login-hero,
  .login-card {
    padding: var(--space-4);
  }

  .topbar,
  .panel-head {
    flex-direction: column;
    align-items: start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
