* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at 20% 20%, #f0f9ff 0%, #f8fafc 45%, #eef2ff 100%);
  color: #0f172a;
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

.app-sidebar {
  width: 250px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px 12px;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  overflow-y: auto;
  transition: width 0.2s ease, padding 0.2s ease, transform 0.2s ease;
}

.sidebar-brand {
  font-size: 20px;
  font-weight: 700;
  padding: 10px 12px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  margin-bottom: 10px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background 0.2s ease;
}

.sidebar-link:hover {
  background: rgba(56, 189, 248, 0.15);
}

.sidebar-link.active {
  background: rgba(14, 165, 233, 0.3);
  color: #fff;
}

.sidebar-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
}

.sidebar-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.app-main {
  margin-left: 250px;
  width: calc(100% - 250px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.2s ease, width 0.2s ease;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.icon-btn {
  display: inline-flex;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  background: #fff;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}

.icon-btn span {
  width: 18px;
  height: 2px;
  background: #0f172a;
}

.user-menu-wrap {
  position: relative;
}

.user-menu-wrap.right-align {
  margin-left: auto;
}

.user-menu-btn {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  cursor: pointer;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f766e, #0ea5e9);
  color: #fff;
  font-weight: 700;
}

.user-name {
  font-weight: 600;
  color: #0f172a;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: 46px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  min-width: 180px;
  display: none;
  overflow: hidden;
}

.user-dropdown.show {
  display: block;
}

.user-dropdown a {
  display: block;
  padding: 10px 12px;
  color: #0f172a;
  text-decoration: none;
}

.user-dropdown a:hover {
  background: #f1f5f9;
}

.content-wrap {
  flex: 1;
}

.app-footer {
  padding: 14px 20px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font-size: 14px;
}

.app-footer a {
  color: #0284c7;
  text-decoration: none;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 15;
}

.sidebar-backdrop.show {
  display: block;
}

.app-shell.sidebar-collapsed .app-sidebar {
  width: 76px;
  padding-left: 8px;
  padding-right: 8px;
}

.app-shell.sidebar-collapsed .sidebar-brand {
  text-align: center;
  font-size: 14px;
  padding-left: 0;
  padding-right: 0;
}

.app-shell.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}

.app-shell.sidebar-collapsed .sidebar-link span:last-child {
  display: none;
}

.app-shell.sidebar-collapsed .app-main {
  margin-left: 76px;
  width: calc(100% - 76px);
}

.wrap {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 20px;
}

.card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.stat-label {
  color: #64748b;
  font-size: 13px;
  margin-bottom: 4px;
}

.stat-value {
  color: #0f172a;
  font-weight: 700;
  font-size: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

h1, h2, h3 {
  margin: 0 0 12px;
}

.sub {
  color: #475569;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.field {
  margin-bottom: 14px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #334155;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea,
input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  outline: none;
  background: #fff;
}

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

.btn {
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #0f766e, #0ea5e9);
  color: #fff;
  font-weight: 700;
  padding: 10px 16px;
  cursor: pointer;
}

.btn.secondary {
  background: #0f172a;
}

.btn.link {
  text-decoration: none;
  display: inline-block;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.alert {
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-weight: 600;
}

.alert.success {
  background: #dcfce7;
  color: #166534;
}

.alert.error {
  background: #fee2e2;
  color: #991b1b;
}

.group-list {
  max-height: 260px;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
}

.group-tools {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.group-tools input[type="text"] {
  flex: 1;
  min-width: 240px;
}

.group-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed #cbd5e1;
}

.group-item:last-child {
  border-bottom: 0;
}

.data-table-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: auto;
  background: #fff;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
}

.badge.success {
  background: #dcfce7;
  color: #166534;
}

.badge.partial {
  background: #fef3c7;
  color: #92400e;
}

.badge.failed {
  background: #fee2e2;
  color: #991b1b;
}

.qr-box {
  text-align: center;
  padding: 12px;
  border: 1px dashed #94a3b8;
  border-radius: 12px;
  background: #ffffff;
}

.qr-box img {
  max-width: 260px;
  width: 100%;
}

.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loader-box {
  background: #fff;
  border-radius: 14px;
  padding: 18px 22px;
  min-width: 220px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
  border: 1px solid #e2e8f0;
}

.loader-spinner {
  width: 34px;
  height: 34px;
  border: 4px solid #cbd5e1;
  border-top-color: #0ea5e9;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

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

  .app-main {
    margin-left: 0;
    width: 100%;
  }

  .app-shell.sidebar-collapsed .app-main {
    margin-left: 0;
    width: 100%;
  }

  .user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.public-body {
  font-family: "Manrope", "Segoe UI", Tahoma, sans-serif;
  background: linear-gradient(140deg, #f5f7ff 0%, #e8f8f4 48%, #eef4ff 100%);
  color: #0f172a;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.public-bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(8px);
  z-index: 0;
  pointer-events: none;
}

.public-bg-shape-a {
  width: 380px;
  height: 380px;
  right: -90px;
  top: -90px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.26), rgba(14, 165, 233, 0));
}

.public-bg-shape-b {
  width: 360px;
  height: 360px;
  left: -110px;
  bottom: -100px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.24), rgba(16, 185, 129, 0));
}

.public-header,
.public-main {
  position: relative;
  z-index: 2;
}

.public-header {
  padding: 18px 18px 4px;
}

.public-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 14px;
  padding: 10px 12px;
}

.public-brand {
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #0f172a;
}

.public-main {
  max-width: 1120px;
  margin: 10px auto 32px;
  padding: 0 18px;
}

.public-hero {
  background: linear-gradient(130deg, #0f172a, #0a4a5f 60%, #0f766e);
  color: #fff;
  border-radius: 20px;
  padding: 38px 28px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.25);
  margin-bottom: 18px;
}

.public-kicker {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}

.public-hero h1 {
  font-size: clamp(26px, 5vw, 44px);
  line-height: 1.1;
  margin-bottom: 12px;
}

.public-hero p {
  margin: 0 0 16px;
  color: rgba(255, 255, 255, 0.9);
  max-width: 760px;
}

.public-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

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

.public-feature-card,
.public-panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.09);
}

.public-feature-card h3,
.public-panel h2 {
  margin-bottom: 8px;
}

.public-feature-card p,
.public-panel p {
  color: #334155;
  margin: 0;
}

.public-list,
.public-list-numbered {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
  color: #1e293b;
}

.manual-hero {
  background: linear-gradient(125deg, #0f172a, #0f766e);
  color: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.22);
  margin-bottom: 12px;
}

.manual-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.manual-card {
  background: #fff;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.07);
}

.manual-card h3 {
  margin-bottom: 8px;
}

.manual-card ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
  color: #1e293b;
}

@media (max-width: 900px) {
  .public-grid-3,
  .public-grid-2,
  .manual-grid {
    grid-template-columns: 1fr;
  }

  .public-hero {
    padding: 24px 18px;
  }

  .public-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
