:root {
  --workspace-bg: #f6f9fc;
  --workspace-shell-bg: rgba(255, 255, 255, 0.94);
  --workspace-shell-border: rgba(10, 37, 64, 0.12);
  --workspace-shell-shadow: 0 18px 44px rgba(10, 37, 64, 0.1);
  --sidebar-bg: rgba(249, 251, 253, 0.96);
  --sidebar-line: rgba(10, 37, 64, 0.12);
  --panel-bg: rgba(255, 255, 255, 0.94);
  --panel-soft-bg: #f4f8fb;
  --line: rgba(10, 37, 64, 0.12);
  --line-strong: rgba(10, 37, 64, 0.22);
  --ink-900: #0a2540;
  --ink-800: #253f56;
  --ink-700: #425466;
  --muted: #587086;
  --accent: #1769aa;
  --accent-strong: #0b4f87;
  --accent-soft: rgba(23, 105, 170, 0.1);
  --accent-wash: rgba(23, 105, 170, 0.08);
  --copper: #7d8da1;
  --copper-soft: rgba(125, 141, 161, 0.14);
  --ok: #0f8a5f;
  --danger: #c24e3d;
  --shadow-soft: 0 2px 5px rgba(50, 50, 93, 0.045), 0 10px 24px rgba(10, 37, 64, 0.04);
  --shadow-card: 0 2px 5px rgba(50, 50, 93, 0.045), 0 10px 24px rgba(10, 37, 64, 0.04);
  --radius-shell: 16px;
  --radius-card: 12px;
  --radius-soft: 10px;
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "PingFang SC", "Microsoft YaHei UI", "Noto Sans CJK SC", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "PingFang SC", "Microsoft YaHei UI", "Noto Sans CJK SC", sans-serif;

  /* Typography & Colors */
  --ui-label-font-size: 13px;
  --ui-label-font-weight: 600;
  --ui-label-color: #587086;
  --ui-control-color: #0a2540;
  --ui-control-bg: #ffffff;
  --ui-control-border: #d8e2eb;
  --ui-control-focus-border: #1769aa;
  --ui-control-focus-shadow: 0 0 0 3px rgba(23, 105, 170, 0.12);

  /* Spacing Gaps */
  --ui-label-control-gap-y: 6px;    /* Vertical label-to-control distance */
  --ui-label-control-gap-x: 8px;    /* Horizontal label-to-control distance */
  --ui-form-group-gap: 14px;        /* Spacing between different fields in a grid/form */

  /* Control Dimensions */
  --ui-control-radius: 8px;         /* Uniform border-radius */
  --ui-control-height: 36px;        /* Standard height */
  --ui-control-height-sm: 28px;     /* Compact / small height */
}

/* Standardized UI Components */
.ui-label, 
.field-block label,
.filter-block > label,
.register-form-label, 
.profile-field-label, 
.form-label,
.range-date-label {
  font-size: var(--ui-label-font-size) !important;
  font-weight: var(--ui-label-font-weight) !important;
  color: var(--ui-label-color) !important;
  margin: 0 0 var(--ui-label-control-gap-y) 0 !important;
  padding: 0 !important;
  line-height: 1.4 !important;
  display: inline-block;
}

/* Horizontal controls shouldn't have margin-bottom on label */
.filter-block.is-horizontal > label,
.range-date-label {
  margin-bottom: 0 !important;
}

.ui-form-group, 
.field-block,
.register-form-grid > div,
.profile-form-grid > div,
.password-reset-field {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: var(--ui-label-control-gap-y) !important;
}

/* Clean label margins inside form group container */
.ui-form-group > label, 
.field-block > label,
.register-form-grid > div > label,
.profile-form-grid > div > label,
.password-reset-field > label {
  margin: 0 !important;
}

.form-control,
.form-select,
.range-date-input,
.filter-multi,
.filter-multi-group {
  font-size: 13px !important;
  color: var(--ui-control-color) !important;
  background-color: var(--ui-control-bg) !important;
  border: 1px solid var(--ui-control-border) !important;
  border-radius: var(--ui-control-radius) !important;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus,
.form-select:focus,
.range-date-input:focus {
  border-color: var(--ui-control-focus-border) !important;
  box-shadow: var(--ui-control-focus-shadow) !important;
  outline: none !important;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink-900);
  background:
    radial-gradient(circle at 12% 2%, rgba(255, 255, 255, 0.98), transparent 30%),
    radial-gradient(circle at 84% 2%, rgba(68, 151, 191, 0.08), transparent 24%),
    linear-gradient(180deg, #fbfdff 0%, #f6f9fc 42%, #f3f7fa 100%);
  background-color: var(--workspace-bg);
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  pointer-events: none;
  z-index: 1000;
  background: linear-gradient(90deg, #24abc3 0%, #1769aa 48%, #75b5d6 100%);
}

.workspace-shell {
  position: relative;
  width: min(calc(100vw - 32px), 1880px);
  max-width: none;
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  border: 1px solid var(--workspace-shell-border);
  border-radius: var(--radius-shell);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 18%),
    var(--workspace-shell-bg);
  box-shadow: var(--workspace-shell-shadow);
  overflow: hidden;
  display: grid;
  grid-template-columns: clamp(380px, 24vw, 480px) minmax(0, 1fr);
}

.workspace-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at top right, rgba(164, 191, 218, 0.16), transparent 22%),
    radial-gradient(circle at bottom left, rgba(212, 219, 227, 0.16), transparent 24%);
}

.sidebar {
  position: relative;
  z-index: 1;
  padding: 26px 20px 18px;
  background: var(--sidebar-bg);
  color: rgba(19, 53, 94, 0.94);
  border-right: 1px solid rgba(126, 171, 220, 0.3);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 10%, rgba(255, 255, 255, 0.85), transparent 24%),
    radial-gradient(circle at 85% 14%, rgba(120, 190, 255, 0.24), transparent 28%),
    linear-gradient(140deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 46%);
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(135deg, rgba(23, 84, 145, 0.08) 0, rgba(23, 84, 145, 0.08) 1px, transparent 1px, transparent 16px);
  background-size: 18px 18px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 92%);
}

.brand {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 4px 8px 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--sidebar-line);
}

.brand img {
  display: block;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  object-fit: cover;
  object-position: center center;
  background: rgba(255, 255, 255, 0.94);
  padding: 5px;
  border: 1px solid rgba(117, 169, 221, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 12px 24px rgba(69, 124, 180, 0.18);
}

.brand-text {
  line-height: 1.15;
  min-width: 0;
}

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #15426f;
}

.brand-subtitle {
  margin: 4px 0 0;
  color: rgba(54, 94, 138, 0.82);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sidebar-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(117, 169, 221, 0.24);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: #15426f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.sidebar-mobile-toggle i {
  font-size: 18px;
  line-height: 1;
}

.sidebar-menu {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 4px 8px;
}

.sidebar-qr-panel {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  padding: 10px 8px 4px;
  border-top: 1px solid rgba(117, 169, 221, 0.2);
}

.sidebar-qr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sidebar-qr-card {
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(117, 169, 221, 0.16);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(240, 248, 255, 0.72) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 12px 22px rgba(69, 124, 180, 0.08);
}

.sidebar-qr-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
}

.menu-title {
  margin: 18px 8px 10px;
  color: rgba(70, 106, 147, 0.78);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.menu-link {
  width: 100%;
  border: 1px solid rgba(117, 169, 221, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(245, 251, 255, 0.24) 100%);
  border-radius: 18px;
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  color: rgba(20, 56, 98, 0.92);
  margin-bottom: 6px;
  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease;
}

.menu-link i {
  width: 20px;
  margin-top: 2px;
  font-size: 15px;
  color: rgba(19, 99, 187, 0.9);
  flex: 0 0 20px;
}

.menu-copy {
  display: block;
  min-width: 0;
}

.menu-text {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
}

.menu-link:hover,
.menu-link.active {
  transform: translateX(2px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, rgba(233, 245, 255, 0.74) 100%);
  border-color: rgba(92, 153, 214, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 12px 24px rgba(69, 124, 180, 0.16);
  color: #103a66;
}

.menu-link.active {
  position: relative;
}

.menu-link.active::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #5fa8f4 0%, #0e63bc 100%);
}

.main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 92px;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74) 0%, rgba(242, 246, 250, 0.9) 100%);
  backdrop-filter: blur(14px);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.desk-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(132, 154, 181, 0.24);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.76) 0%, rgba(240, 245, 249, 0.92) 100%);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.desk-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(180deg, #8ca0b8 0%, #5e7998 100%);
  box-shadow: 0 0 0 4px rgba(148, 164, 182, 0.16);
}

.topbar-right {
  color: var(--ink-800);
  font-size: 14px;
}

.topbar-right .text-secondary {
  color: var(--muted) !important;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(29, 78, 137, 0.16);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-900);
  box-shadow: 0 8px 16px rgba(20, 32, 51, 0.05);
  font-weight: 700;
}

.top-link {
  text-decoration: none;
  color: var(--ink-800);
  border: 1px solid rgba(36, 54, 80, 0.12);
  border-radius: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.68);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    background-color 0.18s ease;
}

.top-link:hover {
  transform: translateY(-1px);
  border-color: rgba(29, 78, 137, 0.24);
  color: var(--accent);
  background: rgba(255, 255, 255, 0.92);
}

.content-wrap {
  padding: 24px 28px 28px;
  display: grid;
  gap: 18px;
  min-width: 0;
}

.section-head {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 24px 26px;
  border: 1px solid rgba(29, 78, 137, 0.12);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(171, 196, 223, 0.22), transparent 24%),
    radial-gradient(circle at left bottom, rgba(226, 232, 239, 0.5), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(241, 246, 250, 0.96) 100%);
  box-shadow: var(--shadow-soft);
}

.section-head::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -90px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(29, 78, 137, 0.1), transparent 68%);
  pointer-events: none;
}

.section-head > div:first-child {
  position: relative;
  z-index: 1;
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink-900);
}

.section-subtitle {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.range-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(140, 160, 183, 0.24);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, rgba(241, 245, 249, 0.88) 100%);
  color: var(--accent-strong);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 12px 24px rgba(18, 31, 53, 0.06);
}

.range-pill::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(180deg, #8ea3ba 0%, #6580a1 100%);
  box-shadow: 0 0 0 4px rgba(148, 164, 182, 0.16);
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.function-panel {
  display: none;
  animation: fadeInUp 0.28s ease;
}

.function-panel.active {
  display: block;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .workspace-shell {
    grid-template-columns: 380px minmax(0, 1fr);
  }

  .section-title {
    font-size: 19px;
  }
}

@media (max-width: 1040px) {
  .workspace-shell {
    width: calc(100vw - 28px);
    grid-template-columns: 1fr;
    margin: 14px;
    min-height: calc(100vh - 28px);
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-menu {
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding-bottom: 4px;
  }

  .sidebar-qr-panel {
    margin-top: 10px;
    padding-top: 8px;
  }

  .menu-link {
    display: inline-flex;
    width: min(280px, 100%);
    margin-right: 8px;
    white-space: normal;
  }

  .topbar {
    padding: 18px 22px;
  }

  .content-wrap {
    padding: 22px;
  }
}

@media (max-width: 760px) {
  .topbar,
  .topbar-right {
    align-items: flex-start;
  }

  .sidebar-qr-panel {
    display: none;
  }

  .section-head {
    padding: 20px 18px;
  }

  .section-title {
    font-size: 17px;
  }
}

@media (max-width: 640px) {
  .workspace-shell {
    width: calc(100vw - 20px);
    margin: 10px;
    border-radius: 22px;
  }

  .sidebar {
    padding: 18px 14px 14px;
  }

  .sidebar-qr-panel {
    padding-left: 4px;
    padding-right: 4px;
  }

  .sidebar-qr-grid {
    gap: 8px;
  }

  .topbar {
    padding: 16px;
  }

  .content-wrap {
    padding: 16px;
  }

  .section-title {
    font-size: 16px;
  }

  .panel {
    padding: 16px;
    border-radius: 18px;
  }
}
