:root {
  --ink: #17211d;
  --muted: #64736d;
  --line: rgba(36, 91, 116, 0.14);
  --paper: rgba(255, 255, 255, 0.9);
  --teal: #10a893;
  --teal-dark: #0a766e;
  --blue: #2f80ed;
  --blue-dark: #1d5fbf;
  --green: #28a745;
  --red: #d94b4b;
  --amber: #c88719;
  --cyan: #18a8c7;
  --shadow: 0 18px 55px rgba(22, 35, 31, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Inter", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.user-shell {
  position: relative;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, #03020a 0%, #050611 20%, #07101d 48%, #0a1825 73%, #142b33 100%);
}

.user-shell::before,
.user-shell::after {
  display: none;
}

.night-sky-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
}

.admin-shell {
  background: #f5f7f6;
}

.app-frame,
.admin-frame {
  width: min(1180px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 20px 0 32px;
}

.app-frame {
  position: relative;
  z-index: 1;
}

.login-layout {
  min-height: calc(100vh - 52px);
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  align-items: stretch;
}

.brand-panel {
  min-height: 520px;
  padding: 34px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  color: white;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(rgba(6, 27, 24, 0.28), rgba(6, 27, 24, 0.74)),
    url("https://images.unsplash.com/photo-1519681393784-d120267933ba?auto=format&fit=crop&w=1500&q=80") center/cover;
  box-shadow: var(--shadow);
}

.user-shell .brand-panel {
  border-color: rgba(185, 224, 255, 0.22);
  background: transparent;
  box-shadow:
    0 24px 70px rgba(0, 5, 24, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 0 34px rgba(114, 190, 255, 0.08);
  backdrop-filter: blur(18px);
}

.brand-panel::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 180px;
  background: linear-gradient(transparent, rgba(5, 18, 16, 0.55));
}

.user-shell .brand-panel::after {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .night-sky-canvas {
    opacity: 0.72;
  }
}

.brand-panel > * {
  position: relative;
  z-index: 1;
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(14px);
  font-size: 25px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.brand-panel .eyebrow {
  color: rgba(255, 255, 255, 0.82);
}

.brand-panel h1,
.topbar h1,
.admin-topbar h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: 0;
}

.brand-copy {
  max-width: 420px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 16px;
}

.topbar-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-topbar .topbar-note {
  color: var(--muted);
}

.auth-panel,
.admin-auth,
.control-panel,
.chart-panel,
.screen-panel,
.log-panel,
.license-form,
.license-table-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.user-shell .topbar h1,
.user-shell .topbar .eyebrow {
  color: rgba(255, 255, 255, 0.96);
}

.user-shell .topbar-note {
  color: rgba(224, 242, 254, 0.82);
}

.user-shell .control-panel,
.user-shell .chart-panel,
.user-shell .screen-panel,
.user-shell .log-panel,
.user-shell .status-pill,
.user-shell .metric,
.user-shell .auth-panel {
  border-color: rgba(188, 226, 255, 0.32);
  background: transparent;
  box-shadow:
    0 18px 48px rgba(0, 5, 20, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 0 30px rgba(117, 194, 255, 0.07);
  backdrop-filter: blur(8px);
}

.user-shell .status-pill,
.user-shell .metric {
  border-color: rgba(202, 235, 255, 0.34);
  background: rgba(2, 8, 22, 0.08);
  box-shadow:
    0 14px 36px rgba(0, 5, 18, 0.27),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 0 24px rgba(115, 207, 255, 0.08);
}

.user-shell .screen-panel,
.user-shell .chart-panel {
  background: transparent;
  box-shadow:
    0 20px 54px rgba(0, 5, 22, 0.31),
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    inset 0 0 34px rgba(88, 219, 224, 0.07);
}

.user-shell .log-panel,
.user-shell .control-panel {
  background: transparent;
  box-shadow:
    0 20px 54px rgba(0, 5, 22, 0.31),
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    inset 0 0 34px rgba(145, 190, 255, 0.07);
}

.user-shell .section-title h2,
.user-shell .metric strong,
.user-shell .status-pill,
.user-shell .panel-kicker,
.user-shell .auth-panel h2 {
  color: rgba(244, 250, 255, 0.96);
}

.user-shell .metric span,
.user-shell .section-title span,
.user-shell .field span,
.user-shell .panel-note {
  color: rgba(223, 240, 255, 0.82);
}

.auth-panel {
  padding: 28px;
  align-self: center;
  display: grid;
  gap: 18px;
}

.auth-panel h2,
.admin-auth h1,
.section-title h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

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

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
}

.field input:focus,
.field select:focus {
  border-color: rgba(15, 159, 143, 0.65);
  box-shadow: 0 0 0 4px rgba(15, 159, 143, 0.12);
}

.primary-action,
.run-button,
.stop-button,
.icon-text-button,
.ghost-button,
.icon-button,
.table-action {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-action,
.run-button {
  background: linear-gradient(135deg, #16b28f, #38c172);
  color: white;
  box-shadow: 0 12px 26px rgba(16, 168, 147, 0.24);
}

.secondary-action {
  color: var(--teal-dark);
  background: rgba(15, 159, 143, 0.1);
  border: 1px solid rgba(15, 159, 143, 0.24);
  box-shadow: none;
}

.primary-action:disabled,
.secondary-action:disabled,
.run-button:disabled,
.stop-button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  transform: none;
}

.stop-button {
  background: linear-gradient(135deg, #ef5350, #ff8a65);
  color: white;
  box-shadow: 0 12px 26px rgba(217, 75, 75, 0.22);
}

.primary-action:hover,
.run-button:hover,
.stop-button:hover,
.icon-text-button:hover,
.ghost-button:hover,
.icon-button:hover,
.table-action:hover {
  transform: translateY(-1px);
}

.run-button:active {
  background: linear-gradient(135deg, #087c68, #18a058);
  box-shadow: 0 6px 14px rgba(16, 168, 147, 0.28);
  transform: translateY(1px) scale(0.98);
}

.stop-button:active {
  background: linear-gradient(135deg, #b32626, #e85c45);
  box-shadow: 0 6px 14px rgba(217, 75, 75, 0.28);
  transform: translateY(1px) scale(0.98);
}

.icon-text-button:active,
.ghost-button:active,
.icon-button:active,
.mini-icon-button:active,
.table-action:active {
  background: rgba(47, 128, 237, 0.12);
  transform: translateY(1px) scale(0.98);
}

.form-error {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.panel-note {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.topbar,
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 8px 0 18px;
}

.topbar h1,
.admin-topbar h1 {
  font-size: clamp(26px, 5vw, 42px);
}

.ghost-button,
.icon-button,
.icon-text-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

.ghost-button,
.icon-button {
  width: 46px;
  padding: 0;
}

.icon-text-button {
  padding: 0 14px;
}

.icon-text-button.subtle {
  color: var(--muted);
}

.icon-text-button.active {
  color: var(--teal-dark);
  background: rgba(15, 159, 143, 0.1);
  border-color: rgba(15, 159, 143, 0.28);
}

.status-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr 0.85fr 1.2fr;
  gap: 12px;
  margin-bottom: 14px;
}

.status-pill,
.metric {
  min-height: 78px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 10px 24px rgba(24, 36, 32, 0.08);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 22px;
  font-weight: 900;
}

.pulse-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 7px rgba(217, 75, 75, 0.13);
}

.status-pill.running .pulse-dot {
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(40, 167, 69, 0.13);
}

.metric {
  display: grid;
  align-content: center;
  gap: 5px;
}

.metric span,
.section-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  font-size: clamp(20px, 4.4vw, 30px);
  line-height: 1;
}

.metric .type-badge {
  width: fit-content;
  font-size: 13px;
}

.metric span i {
  color: #16a085;
}

.license-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.license-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-icon-button {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(47, 128, 237, 0.18);
  border-radius: 10px;
  color: var(--blue-dark);
  background: rgba(47, 128, 237, 0.08);
}

.control-grid,
.media-log-grid,
.primary-work-grid,
.media-stat-grid,
.admin-content {
  display: grid;
  gap: 14px;
}

.control-grid,
.primary-work-grid {
  grid-template-columns: 1fr;
  margin-bottom: 14px;
}

.media-log-grid,
.media-stat-grid {
  grid-template-columns: 1fr;
}

.control-panel,
.chart-panel,
.screen-panel,
.log-panel,
.license-form,
.license-table-panel {
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.table-toolbar {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.license-search {
  position: relative;
  width: min(260px, 32vw);
  min-width: 190px;
}

.license-search > i {
  position: absolute;
  top: 50%;
  left: 11px;
  z-index: 1;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.license-search input {
  width: 100%;
  min-height: 36px;
  padding: 0 38px 0 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.license-search input:focus {
  border-color: #0e8379;
  outline: 2px solid rgba(14, 131, 121, 0.12);
}

.license-search .icon-button {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 28px;
  width: 28px;
  min-height: 28px;
  height: 28px;
  border: 0;
}

.log-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.capture-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

#controlHint.error {
  color: #ff9b9b;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.run-button,
.stop-button {
  min-height: 58px;
  font-size: 17px;
}

.chart-box {
  height: 210px;
}

.screen-window {
  min-height: 320px;
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(23, 33, 29, 0.16);
  border-radius: 14px;
  background: #111a17;
}

.screen-window img {
  width: 100%;
  height: 100%;
  display: none;
  object-fit: contain;
  background: #0e1513;
}

.screen-window.has-image img {
  display: block;
}

.screen-window.has-image .screen-empty {
  display: none;
}

.screen-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.screen-empty i {
  font-size: 30px;
}

@media (min-width: 901px) {
  .primary-work-grid {
    grid-template-columns: minmax(280px, 0.72fr) minmax(520px, 1.28fr);
    align-items: stretch;
  }

  .media-stat-grid {
    grid-template-columns: 1fr;
  }
}

.log-output {
  height: 320px;
  padding: 14px;
  overflow: auto;
  border: 1px solid rgba(16, 168, 147, 0.2);
  border-radius: 14px;
  background: #dff7e9;
  color: #10231c;
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.total-harvest {
  min-height: 42px;
  margin: -4px 0 12px;
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(47, 128, 237, 0.16);
  border-radius: 12px;
  color: var(--blue-dark);
  background: linear-gradient(135deg, rgba(47, 128, 237, 0.1), rgba(16, 168, 147, 0.08));
  font-size: 15px;
  font-weight: 900;
}

.admin-frame {
  width: min(1360px, calc(100vw - 36px));
  padding-top: 24px;
}

.admin-login {
  min-height: calc(100vh - 52px);
  display: grid;
  place-items: center;
}

.admin-auth {
  width: min(420px, 100%);
  padding: 28px;
  display: grid;
  gap: 16px;
}

.admin-dashboard {
  min-height: calc(100vh - 52px);
}

.admin-topbar {
  padding: 18px 22px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 30px rgba(22, 35, 31, 0.08);
}

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

.admin-stat {
  min-height: 108px;
  padding: 18px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 13px;
  row-gap: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 10px 28px rgba(22, 35, 31, 0.07);
}

.admin-stat i {
  width: 42px;
  height: 42px;
  grid-row: span 2;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--teal-dark);
  background: rgba(15, 159, 143, 0.11);
}

.admin-stat span {
  align-self: end;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-stat strong {
  align-self: start;
  font-size: 30px;
  line-height: 1;
}

.admin-content {
  grid-template-columns: 1fr;
  align-items: start;
  gap: 16px;
}

.license-form {
  align-self: start;
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(150px, 0.7fr) minmax(260px, 1fr) auto;
  align-items: end;
  gap: 15px;
}

.license-form .section-title,
.license-form .form-error {
  grid-column: 1 / -1;
}

.license-form .primary-action {
  min-width: 138px;
}

.license-table-panel {
  min-height: 540px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.license-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  background: white;
}

.license-table th,
.license-table td {
  padding: 15px 16px;
  border-bottom: 1px solid rgba(23, 33, 29, 0.09);
  text-align: center;
  vertical-align: middle;
  font-size: 14px;
}

.license-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  background: #f6faf8;
}

.license-table tr:last-child td {
  border-bottom: 0;
}

.note-cell {
  max-width: 220px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-badge.active,
.status-badge.running {
  color: #09694e;
  background: rgba(40, 167, 69, 0.12);
}

.status-badge.unactivated {
  color: #836016;
  background: rgba(200, 135, 25, 0.14);
}

.status-badge.frozen {
  color: #8b3b33;
  background: rgba(217, 75, 75, 0.12);
}

.status-badge.expired {
  color: #836016;
  background: rgba(200, 135, 25, 0.14);
}

.type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 54px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.type-badge.day {
  color: #1d5fbf;
  background: rgba(47, 128, 237, 0.12);
}

.type-badge.week {
  color: #087c68;
  background: rgba(16, 168, 147, 0.13);
}

.type-badge.month {
  color: #836016;
  background: rgba(200, 135, 25, 0.14);
}

.type-badge.permanent {
  color: #8b3b33;
  background: rgba(217, 75, 75, 0.12);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.table-action {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.table-action.danger {
  color: var(--red);
}

.empty-table {
  display: none;
  padding: 32px;
  color: var(--muted);
  text-align: center;
  background: white;
}

.empty-table.visible {
  display: block;
}

.expiry-dialog {
  width: min(430px, calc(100vw - 26px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.expiry-dialog::backdrop {
  background: rgba(12, 19, 17, 0.42);
}

.expiry-dialog form {
  padding: 20px;
  display: grid;
  gap: 15px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dialog-actions .ghost-button {
  width: auto;
  min-width: 156px;
  padding: 0 16px;
  white-space: nowrap;
}

.dialog-actions .primary-action {
  min-width: 122px;
  white-space: nowrap;
}

.user-shell .brand-panel,
.user-shell .auth-panel,
.user-shell .control-panel,
.user-shell .chart-panel,
.user-shell .screen-panel,
.user-shell .log-panel,
.user-shell .status-pill,
.user-shell .metric {
  background-color: transparent;
  background-image: none;
}

.user-shell .brand-panel,
.user-shell .auth-panel,
.user-shell .control-panel,
.user-shell .chart-panel,
.user-shell .screen-panel,
.user-shell .log-panel {
  border-color: rgba(196, 231, 255, 0.34);
  box-shadow:
    0 20px 54px rgba(0, 5, 22, 0.32),
    0 0 0 1px rgba(105, 190, 255, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 0 34px rgba(105, 190, 255, 0.08);
}

.user-shell .status-pill,
.user-shell .metric {
  border-color: rgba(206, 237, 255, 0.36);
  box-shadow:
    0 14px 34px rgba(0, 5, 18, 0.28),
    0 0 0 1px rgba(134, 213, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 0 26px rgba(124, 208, 255, 0.08);
}

.user-shell .section-title h2,
.user-shell .metric strong,
.user-shell .status-pill,
.user-shell .auth-panel h2 {
  color: #f7fbff;
  text-shadow: 0 0 18px rgba(121, 206, 255, 0.22);
}

.user-shell .panel-kicker,
.user-shell .metric span i {
  color: #8feaff;
  text-shadow: 0 0 14px rgba(143, 234, 255, 0.28);
}

.user-shell .topbar-note,
.user-shell .panel-note,
.user-shell .section-title span,
.user-shell .metric span,
.user-shell .field span {
  color: rgba(226, 243, 255, 0.84);
}

.user-shell .screen-window {
  border-color: rgba(180, 228, 255, 0.28);
  background: transparent;
  box-shadow:
    inset 0 0 28px rgba(88, 185, 255, 0.08),
    0 12px 32px rgba(0, 5, 20, 0.22);
}

.user-shell .screen-window img {
  background: transparent;
}

.user-shell .screen-empty {
  color: rgba(238, 248, 255, 0.78);
  text-shadow: 0 0 16px rgba(120, 210, 255, 0.22);
}

.user-shell .log-output {
  border-color: rgba(157, 235, 198, 0.36);
  background: transparent;
  color: #eafff3;
  box-shadow:
    inset 0 0 28px rgba(103, 255, 180, 0.08),
    0 12px 32px rgba(0, 5, 20, 0.2);
  text-shadow: 0 0 10px rgba(103, 255, 180, 0.12);
}

.user-shell .total-harvest,
.user-shell .mini-icon-button,
.user-shell .ghost-button,
.user-shell .icon-button,
.user-shell .icon-text-button {
  border-color: rgba(185, 228, 255, 0.28);
  background: transparent;
  color: #eaf8ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.user-shell .total-harvest {
  color: #c8f7ff;
  text-shadow: 0 0 14px rgba(143, 234, 255, 0.26);
}

.user-shell .field input,
.user-shell .field select {
  border-color: rgba(190, 229, 255, 0.32);
  background: transparent;
  color: #f7fbff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 18px rgba(120, 210, 255, 0.05);
}

.user-shell .field input::placeholder {
  color: rgba(222, 240, 255, 0.58);
}

.user-shell .field input:focus,
.user-shell .field select:focus {
  border-color: rgba(143, 234, 255, 0.68);
  box-shadow:
    0 0 0 4px rgba(143, 234, 255, 0.08),
    inset 0 0 18px rgba(120, 210, 255, 0.08);
}

@media (max-width: 900px) {
  .login-layout,
  .control-grid,
  .media-log-grid,
  .primary-work-grid,
  .media-stat-grid,
  .admin-content {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: 360px;
  }

  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 560px) {
  .app-frame,
  .admin-frame {
    width: 100%;
    padding: 8px 8px 18px;
  }

  .brand-panel,
  .auth-panel,
  .control-panel,
  .chart-panel,
  .screen-panel,
  .log-panel,
  .admin-auth,
  .license-form,
  .license-table-panel {
    border-radius: 14px;
    padding: 15px;
  }

  .dashboard-layout {
    display: grid;
    gap: 10px;
  }

  .topbar {
    padding: 10px 0 6px;
  }

  .topbar .eyebrow {
    margin-bottom: 5px;
    font-size: 11px;
  }

  .topbar h1 {
    font-size: 25px;
  }

  .ghost-button,
  .icon-button {
    width: 42px;
    min-height: 42px;
    border-radius: 11px;
  }

  .brand-panel {
    min-height: 300px;
  }

  .brand-panel h1 {
    font-size: 34px;
  }

  .status-strip {
    grid-template-columns: 0.9fr 1.1fr;
    gap: 8px;
    margin-bottom: 0;
  }

  .status-pill,
  .metric {
    min-height: 58px;
    padding: 12px 13px;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(24, 36, 32, 0.07);
  }

  .status-pill {
    gap: 9px;
    font-size: 19px;
  }

  .pulse-dot {
    width: 11px;
    height: 11px;
    box-shadow: 0 0 0 6px rgba(217, 75, 75, 0.13);
  }

  .status-pill.running .pulse-dot {
    box-shadow: 0 0 0 6px rgba(40, 167, 69, 0.13);
  }

  .metric {
    gap: 3px;
  }

  .metric span,
  .section-title span {
    font-size: 11px;
  }

  .metric strong {
    font-size: 20px;
  }

  .metric:nth-child(3) {
    grid-column: 1 / -1;
  }

  .control-grid,
  .media-log-grid,
  .primary-work-grid,
  .media-stat-grid {
    gap: 10px;
    margin-bottom: 0;
  }

  .control-panel,
  .chart-panel,
  .screen-panel,
  .log-panel {
    padding: 14px;
    border-radius: 15px;
    box-shadow: 0 10px 28px rgba(22, 35, 31, 0.11);
  }

  .section-title {
    align-items: center;
    flex-direction: row;
    margin-bottom: 11px;
  }

  .section-title h2 {
    font-size: 20px;
  }

  .action-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .run-button,
  .stop-button {
    min-height: 50px;
    border-radius: 12px;
    font-size: 15px;
  }

  .chart-box {
    height: 168px;
  }

  .screen-window {
    min-height: 0;
    border-radius: 12px;
  }

  .log-output {
    height: 230px;
    padding: 12px;
    border-radius: 12px;
    font-size: 11px;
    line-height: 1.5;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }

  .admin-topbar {
    border-radius: 14px;
    padding: 15px;
  }

  .section-title .icon-text-button,
  .section-title .icon-button {
    align-self: center;
    flex: 0 0 auto;
  }

  .icon-text-button {
    min-height: 40px;
    padding: 0 12px;
    border-radius: 11px;
    font-size: 13px;
  }

  .capture-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .capture-actions .icon-text-button {
    width: 100%;
    justify-content: center;
  }

  .user-shell .brand-panel,
  .user-shell .auth-panel,
  .user-shell .control-panel,
  .user-shell .chart-panel,
  .user-shell .screen-panel,
  .user-shell .log-panel,
  .user-shell .status-pill,
  .user-shell .metric {
    background-color: transparent;
    background-image: none;
  }

  .user-shell .control-panel,
  .user-shell .chart-panel,
  .user-shell .screen-panel,
  .user-shell .log-panel {
    box-shadow:
      0 16px 38px rgba(0, 5, 22, 0.3),
      0 0 0 1px rgba(105, 190, 255, 0.06),
      inset 0 1px 0 rgba(255, 255, 255, 0.14),
      inset 0 0 26px rgba(105, 190, 255, 0.08);
  }

  .user-shell .status-pill,
  .user-shell .metric {
    box-shadow:
      0 10px 28px rgba(0, 5, 18, 0.27),
      0 0 0 1px rgba(134, 213, 255, 0.05),
      inset 0 1px 0 rgba(255, 255, 255, 0.16),
      inset 0 0 22px rgba(124, 208, 255, 0.08);
  }
}

/* Global base: full-screen deep-space background for the user page only. */
body.user-shell {
  min-height: 100vh;
  background: transparent;
  isolation: isolate;
}

.user-shell::before {
  content: "";
  display: block;
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background: linear-gradient(180deg, #03020a 0%, #050611 20%, #07101d 48%, #0a1825 73%, #142b33 100%);
}

.user-shell::after {
  display: none;
}

/* Starfield canvas: all animated sky rendering stays behind every control. */
.user-shell .night-sky-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  filter: saturate(0.88) contrast(1.03);
  transform: translateZ(0);
}

.user-shell .app-frame {
  position: relative;
  z-index: 0;
}

/* Card shell: keep the floating outlines while leaving panel padding transparent. */
.user-shell .brand-panel,
.user-shell .auth-panel,
.user-shell .control-panel,
.user-shell .chart-panel,
.user-shell .screen-panel,
.user-shell .log-panel,
.user-shell .status-pill,
.user-shell .metric {
  background: transparent;
  background-image: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Inner content layer: only real content receives a soft dark backing for readability. */
.user-shell .brand-panel .brand-mark,
.user-shell .brand-panel .eyebrow,
.user-shell .brand-panel h1,
.user-shell .brand-copy,
.user-shell .auth-panel > div,
.user-shell .auth-panel > .field,
.user-shell .auth-panel > .form-error,
.user-shell .control-panel > .section-title,
.user-shell .control-panel > .panel-note,
.user-shell .control-panel > .action-row,
.user-shell .log-panel > .section-title,
.user-shell .screen-panel > .section-title,
.user-shell .chart-panel > .section-title,
.user-shell .status-pill > span:not(.pulse-dot),
.user-shell .metric > span,
.user-shell .metric > strong,
.user-shell .metric > .license-row,
.user-shell .screen-window,
.user-shell .log-output,
.user-shell .total-harvest,
.user-shell .chart-box {
  border-radius: 12px;
  background: rgba(3, 8, 25, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 18px rgba(115, 188, 255, 0.05);
}

.user-shell .brand-panel .eyebrow,
.user-shell .brand-panel h1,
.user-shell .brand-copy,
.user-shell .auth-panel > div,
.user-shell .auth-panel > .field,
.user-shell .auth-panel > .form-error,
.user-shell .control-panel > .section-title,
.user-shell .control-panel > .panel-note,
.user-shell .control-panel > .action-row,
.user-shell .log-panel > .section-title,
.user-shell .screen-panel > .section-title,
.user-shell .chart-panel > .section-title,
.user-shell .chart-box {
  padding: 10px 12px;
}

.user-shell .status-pill > span:not(.pulse-dot),
.user-shell .metric > span,
.user-shell .metric > strong,
.user-shell .metric > .license-row,
.user-shell .total-harvest {
  padding: 7px 10px;
  width: fit-content;
  max-width: 100%;
}

.user-shell .metric > strong,
.user-shell .license-row {
  color: #f7fbff;
}

.user-shell .screen-window,
.user-shell .log-output {
  background: rgba(3, 8, 25, 0.48);
}

.user-shell .screen-empty {
  color: rgba(243, 250, 255, 0.82);
}

.user-shell .field input,
.user-shell .field select,
.user-shell .mini-icon-button,
.user-shell .ghost-button,
.user-shell .icon-button,
.user-shell .icon-text-button {
  background: rgba(3, 8, 25, 0.28);
}

/* Admin workspace */
.admin-shell {
  background: #f3f6f7;
}

.admin-shell .admin-frame {
  width: min(1360px, calc(100vw - 40px));
  padding: 22px 0 36px;
}

.admin-shell .admin-topbar {
  margin-bottom: 14px;
  padding: 8px 2px 18px;
  border: 0;
  border-bottom: 1px solid #dce3e5;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.admin-shell .admin-topbar h1 {
  margin: 2px 0 0;
  font-size: 30px;
  line-height: 1.15;
}

.admin-shell .admin-topbar .eyebrow {
  color: #0a766e;
}

.admin-shell .admin-topbar .ghost-button,
.admin-shell .icon-button,
.admin-shell .icon-text-button {
  border-radius: 6px;
  background: #fff;
}

.admin-shell .admin-stats {
  gap: 10px;
  margin-bottom: 14px;
}

.admin-shell .admin-stat {
  --stat-color: #2f6fbb;
  --stat-tint: #eaf2fb;
  min-height: 88px;
  padding: 14px 16px;
  column-gap: 12px;
  border-color: #dfe6e8;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(29, 44, 48, 0.05);
}

.admin-shell .admin-stat:nth-child(2) {
  --stat-color: #16815f;
  --stat-tint: #e8f6f0;
}

.admin-shell .admin-stat:nth-child(3) {
  --stat-color: #b04b54;
  --stat-tint: #fbecee;
}

.admin-shell .admin-stat:nth-child(4) {
  --stat-color: #a56d17;
  --stat-tint: #fbf2df;
}

.admin-shell .admin-stat i {
  width: 38px;
  height: 38px;
  border-radius: 7px;
  color: var(--stat-color);
  background: var(--stat-tint);
}

.admin-shell .admin-stat strong {
  font-size: 25px;
}

.admin-shell .admin-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

.admin-shell .license-form,
.admin-shell .license-table-panel,
.admin-shell .admin-auth {
  min-width: 0;
  border-color: #dfe6e8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(29, 44, 48, 0.06);
  backdrop-filter: none;
}

.admin-shell .license-form {
  display: block;
  padding: 20px;
}

.admin-shell .license-form .section-title {
  margin-bottom: 16px;
}

.admin-shell .license-form .section-title h2 {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
}

.admin-shell .license-form .section-title h2 i {
  color: #0a766e;
  font-size: 15px;
}

.license-form-fields {
  display: grid;
  grid-template-columns: minmax(220px, 1.15fr) minmax(230px, 1fr) minmax(180px, 0.75fr) minmax(220px, 1fr);
  align-items: end;
  gap: 16px;
}

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

.control-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.segmented-control {
  min-height: 48px;
  padding: 3px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  border: 1px solid #dce3e5;
  border-radius: 7px;
  background: #edf1f2;
}

.segmented-control label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  height: 100%;
  min-width: 0;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 5px;
  color: #66747a;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.segmented-control input:checked + span {
  color: #075f59;
  background: #fff;
  box-shadow: 0 1px 4px rgba(30, 48, 53, 0.14);
}

.segmented-control input:focus-visible + span {
  outline: 2px solid rgba(15, 159, 143, 0.55);
  outline-offset: 1px;
}

.admin-shell .field input,
.admin-shell .field select {
  min-height: 48px;
  border-color: #d6dfe1;
  border-radius: 6px;
  background: #fff;
}

.admin-shell .field input:hover,
.admin-shell .field select:hover {
  border-color: #aab9bd;
}

.license-form-actions {
  margin-top: 16px;
  padding-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid #e6ebec;
}

.license-form-actions .form-error {
  flex: 1;
}

.admin-shell .license-form-actions .primary-action {
  min-width: 148px;
  min-height: 46px;
  border-radius: 6px;
  background: #0e8379;
  box-shadow: 0 7px 16px rgba(14, 131, 121, 0.18);
}

.admin-shell .license-form-actions .primary-action:hover {
  background: #096e67;
}

.admin-shell .license-table-panel {
  min-height: 480px;
  padding: 20px;
}

.admin-shell .license-table-panel .section-title {
  margin-bottom: 14px;
}

.admin-shell .license-table-panel .section-title h2 {
  font-size: 17px;
}

.license-summary {
  color: #64736d;
  font-size: 13px;
  font-weight: 700;
}

.admin-shell .table-wrap {
  border-color: #dfe6e8;
  border-radius: 6px;
}

.admin-shell .license-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #526168;
  background: #f5f7f8;
}

.admin-shell .license-table th,
.admin-shell .license-table td {
  padding: 13px 15px;
}

.admin-shell .license-table th:first-child,
.admin-shell .license-table td:first-child,
.admin-shell .license-table th:nth-child(5),
.admin-shell .license-table td:nth-child(5) {
  text-align: left;
}

.admin-shell .license-table tbody tr:hover {
  background: #f8fbfa;
}

.type-badge.custom {
  color: #7048a0;
  background: #f1eafa;
}

.admin-shell .table-action {
  border-radius: 6px;
}

@media (max-width: 1080px) {
  .license-form-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .license-note-field {
    grid-column: span 2;
  }
}

@media (max-width: 700px) {
  .admin-shell .admin-frame {
    width: 100%;
    padding: 10px 10px 24px;
  }

  .admin-shell .admin-topbar {
    padding: 8px 2px 14px;
  }

  .admin-shell .admin-topbar h1 {
    font-size: 25px;
  }

  .admin-shell .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-shell .admin-stat {
    min-height: 80px;
    padding: 12px;
  }

  .admin-shell .license-form,
  .admin-shell .license-table-panel {
    padding: 15px;
    border-radius: 8px;
  }

  .license-form-fields {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .license-note-field {
    grid-column: auto;
  }

  .license-form-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .admin-shell .license-form-actions .primary-action {
    width: 100%;
  }

  .admin-shell .license-table-panel .section-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .admin-shell .license-table-panel .section-title h2 {
    white-space: nowrap;
  }

  .admin-shell .table-wrap {
    overflow: visible;
    border: 0;
  }

  .admin-shell .license-table {
    min-width: 0;
    background: transparent;
  }

  .admin-shell .license-table thead {
    display: none;
  }

  .admin-shell .license-table tbody {
    display: grid;
    gap: 10px;
  }

  .admin-shell .license-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid #dfe6e8;
    border-radius: 6px;
    background: #fff;
  }

  .admin-shell .license-table tbody td {
    min-width: 0;
    padding: 12px !important;
    display: grid;
    justify-items: start;
    gap: 6px;
    border: 0;
    text-align: left !important;
  }

  .admin-shell .license-table tbody td::before {
    content: attr(data-label);
    color: #64736d;
    font-size: 11px;
    font-weight: 800;
  }

  .admin-shell .license-table tbody td:first-child,
  .admin-shell .license-table tbody td:nth-child(5),
  .admin-shell .license-table tbody td:last-child {
    grid-column: 1 / -1;
  }

  .admin-shell .license-table tbody td:first-child {
    overflow-wrap: anywhere;
  }

  .admin-shell .license-table .note-cell {
    max-width: none;
    white-space: normal;
  }

  .admin-shell .license-table .table-actions {
    justify-content: flex-start;
  }

  .admin-shell .table-toolbar {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .license-search {
    width: 100%;
  }

  .license-summary {
    width: 100%;
    text-align: right;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .dialog-actions .ghost-button,
  .dialog-actions .primary-action {
    width: 100%;
  }
}

/* Keep the live-view heading stable while capture controls adapt to the viewport. */
.user-shell .screen-panel > .section-title {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
}

.user-shell .screen-panel > .section-title h2 {
  white-space: nowrap;
}

.user-shell .screen-panel .capture-actions {
  min-width: 0;
}

@media (max-width: 560px) {
  .user-shell .screen-panel > .section-title {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
  }

  .user-shell .screen-panel .capture-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* User dashboard summary: status, gem task, and license information. */
.dashboard-summary-grid {
  display: grid;
  grid-template-columns: minmax(190px, 0.72fr) minmax(420px, 1.55fr) minmax(270px, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.user-shell .summary-panel,
.user-shell .control-panel,
.user-shell .screen-panel,
.user-shell .chart-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(190, 226, 255, 0.34);
  border-radius: 16px;
  background: rgba(2, 7, 24, 0.14);
  box-shadow:
    0 24px 52px rgba(0, 3, 18, 0.42),
    0 7px 16px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -18px 36px rgba(31, 64, 132, 0.08);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.user-shell .summary-panel::before,
.user-shell .control-panel::before,
.user-shell .screen-panel::before,
.user-shell .chart-panel::before {
  content: "";
  position: absolute;
  inset: 0 18px auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(229, 247, 255, 0.62), transparent);
  pointer-events: none;
}

.summary-panel {
  min-height: 248px;
  padding: 18px;
}

.summary-heading {
  display: flex;
  align-items: center;
  gap: 11px;
}

.summary-heading h2 {
  margin: 2px 0 0;
  color: #f7fbff;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
}

.summary-label {
  display: block;
  color: rgba(205, 230, 255, 0.7);
  font-size: 11px;
  font-weight: 800;
}

.summary-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(122, 218, 255, 0.28);
  border-radius: 8px;
  color: #85eaff;
  background: rgba(24, 129, 180, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.summary-icon.gem-icon {
  color: #7af3d7;
  border-color: rgba(103, 240, 208, 0.28);
  background: rgba(18, 154, 126, 0.14);
}

.summary-icon.license-icon {
  color: #ffd989;
  border-color: rgba(255, 209, 112, 0.26);
  background: rgba(177, 122, 27, 0.13);
}

.status-summary {
  display: flex;
  flex-direction: column;
}

.script-state {
  min-height: 76px;
  margin-top: 30px;
  display: flex;
  align-items: center;
  gap: 13px;
}

.script-state strong {
  color: #f7fbff;
  font-size: 25px;
  font-weight: 850;
  line-height: 1.15;
}

.script-state .pulse-dot {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  background: #ff7c8b;
  box-shadow:
    0 0 0 7px rgba(255, 96, 117, 0.12),
    0 0 18px rgba(255, 96, 117, 0.58);
}

.script-state.running .pulse-dot {
  background: #67efbf;
  box-shadow:
    0 0 0 7px rgba(83, 230, 178, 0.12),
    0 0 19px rgba(83, 230, 178, 0.68);
}

.script-state.offline strong {
  color: rgba(235, 242, 255, 0.72);
}

.status-caption {
  margin: auto 0 0;
  color: rgba(196, 219, 245, 0.62);
  font-size: 12px;
  font-weight: 650;
}

.gem-task-panel {
  display: grid;
  grid-template-rows: auto 1fr;
}

.gem-task-content {
  min-width: 0;
  display: grid;
  grid-template-columns: 174px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.gem-ring-wrap {
  width: 164px;
  height: 164px;
  position: relative;
  isolation: isolate;
}

.gem-ring-wrap::before {
  content: "";
  position: absolute;
  inset: 15px 12px 5px;
  z-index: -1;
  border-radius: 50%;
  background: rgba(2, 5, 20, 0.58);
  box-shadow:
    0 13px 0 rgba(0, 2, 13, 0.42),
    0 19px 25px rgba(0, 0, 0, 0.4),
    inset 0 -10px 18px rgba(104, 227, 224, 0.08);
}

#gemTaskChart {
  position: relative;
  z-index: 1;
  width: 164px !important;
  height: 164px !important;
  filter: drop-shadow(0 9px 7px rgba(0, 0, 0, 0.34));
}

.gem-ring-center {
  position: absolute;
  inset: 47px;
  z-index: 2;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}

.gem-ring-center span {
  color: rgba(213, 237, 255, 0.72);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.gem-ring-center strong {
  margin-top: 3px;
  color: #f8fcff;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.gem-task-data {
  min-width: 0;
  display: grid;
  gap: 22px;
}

.gem-legend {
  display: grid;
  gap: 10px;
}

.gem-legend > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 9px minmax(58px, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: rgba(216, 236, 255, 0.76);
  font-size: 12px;
  font-weight: 700;
}

.gem-legend strong {
  color: #f7fbff;
  font-size: 16px;
  font-weight: 850;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.collected {
  background: #68ecd2;
  box-shadow: 0 0 10px rgba(104, 236, 210, 0.58);
}

.legend-dot.remaining {
  border: 1px solid rgba(104, 236, 210, 0.34);
  background: rgba(104, 236, 210, 0.18);
}

.gem-progress-row {
  display: grid;
  grid-template-columns: auto minmax(72px, 1fr) 38px;
  align-items: center;
  gap: 8px;
}

.progress-label,
#gemProgressPercent {
  color: rgba(226, 242, 255, 0.88);
  font-size: 12px;
  font-weight: 800;
}

#gemProgressPercent {
  text-align: right;
}

.gem-progress-track {
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(177, 210, 244, 0.2);
  border-radius: 5px;
  background: rgba(2, 7, 24, 0.58);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.34),
    0 1px 0 rgba(255, 255, 255, 0.08);
}

.gem-progress-track span {
  width: 0;
  height: 100%;
  display: block;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(223, 255, 248, 0.38), transparent 42%), #68ecd2;
  box-shadow: 0 0 12px rgba(104, 236, 210, 0.56);
  transition: width 360ms ease;
}

.license-summary-panel {
  display: grid;
  grid-template-rows: auto 1fr;
}

.license-details {
  min-width: 0;
  margin: 20px 0 0;
  display: grid;
  align-content: center;
}

.license-detail {
  min-width: 0;
  padding: 10px 0;
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(183, 218, 250, 0.14);
}

.license-detail:last-child {
  border-bottom: 0;
}

.license-detail dt {
  color: rgba(200, 225, 249, 0.64);
  font-size: 11px;
  font-weight: 750;
}

.license-detail dd {
  min-width: 0;
  margin: 0;
  color: #f7fbff;
  font-size: 13px;
  font-weight: 800;
}

.license-detail dd > strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.license-detail .license-row {
  justify-content: space-between;
}

.license-detail .type-badge {
  width: fit-content;
  padding: 5px 9px;
  border: 1px solid rgba(111, 232, 205, 0.22);
  border-radius: 6px;
  color: #8af1d7;
  background: rgba(38, 150, 129, 0.12);
  font-size: 12px;
}

.license-detail .mini-icon-button {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  border-radius: 7px;
  color: #cbeeff;
}

@media (max-width: 900px) {
  .dashboard-summary-grid {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  }

  .status-summary {
    grid-column: 1;
    grid-row: 1;
  }

  .license-summary-panel {
    grid-column: 2;
    grid-row: 1;
  }

  .gem-task-panel {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 620px) {
  .dashboard-summary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .status-summary,
  .gem-task-panel,
  .license-summary-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .summary-panel {
    min-height: 0;
    padding: 16px;
  }

  .script-state {
    min-height: 62px;
    margin-top: 18px;
  }

  .script-state strong {
    font-size: 22px;
  }

  .status-caption {
    margin-top: 8px;
  }

  .gem-task-content {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 10px;
  }

  .gem-task-heading {
    justify-self: stretch;
  }

  .gem-task-data {
    width: 100%;
    gap: 16px;
  }

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

  .gem-legend > div {
    grid-template-columns: 9px minmax(0, 1fr);
  }

  .gem-legend strong {
    grid-column: 2;
  }

  .license-details {
    margin-top: 12px;
  }
}

@media (max-width: 420px) {
  .user-shell .topbar > div {
    min-width: 0;
  }

  .user-shell .topbar-note {
    max-width: 100%;
    overflow-wrap: anywhere;
    line-height: 1.55;
  }

  .gem-legend {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }

  .gem-legend > div {
    grid-template-columns: 9px minmax(0, 1fr) auto;
  }

  .gem-legend strong {
    grid-column: auto;
  }
}

@media (max-width: 380px) {
  .gem-progress-row {
    grid-template-columns: auto minmax(56px, 1fr) 36px;
    gap: 6px;
  }

  .license-detail {
    grid-template-columns: 62px minmax(0, 1fr);
  }
}

/* Transparent bubble dashboard. Keep this block last so legacy glass rules cannot win. */
.user-shell .dashboard-summary-grid {
  grid-template-columns: minmax(150px, 0.48fr) minmax(0, 1.52fr);
  align-items: stretch;
  gap: 12px;
}

.user-shell .status-summary {
  grid-column: 1;
  grid-row: 1;
}

.user-shell .gem-task-panel {
  grid-column: 2;
  grid-row: 1;
}

.user-shell .license-summary-panel {
  grid-column: 1 / -1;
  grid-row: 2;
}

.user-shell .summary-panel,
.user-shell .control-panel,
.user-shell .screen-panel,
.user-shell .chart-panel {
  min-width: 0;
  border: 1px solid rgba(190, 230, 255, 0.48);
  border-radius: 16px;
  background: transparent;
  background-image: none;
  box-shadow:
    0 0 0 1px rgba(111, 196, 255, 0.06),
    0 0 24px rgba(86, 176, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 0 18px rgba(118, 205, 255, 0.035);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.user-shell .summary-panel::before,
.user-shell .control-panel::before,
.user-shell .screen-panel::before,
.user-shell .chart-panel::before {
  inset: 0 22px auto;
  background: linear-gradient(90deg, transparent, rgba(235, 250, 255, 0.82), transparent);
}

.user-shell .summary-panel {
  min-height: 0;
  padding: 15px;
}

.user-shell .status-summary,
.user-shell .gem-task-panel {
  height: 222px;
}

.user-shell .summary-heading {
  min-width: 0;
  gap: 8px;
}

.user-shell .summary-heading h2,
.user-shell .section-title h2 {
  min-width: 0;
  margin: 0;
  color: #f7fbff;
  letter-spacing: 0;
}

.user-shell .summary-heading h2 {
  font-size: 16px;
  white-space: nowrap;
}

.user-shell .summary-icon {
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 16px;
  filter: drop-shadow(0 0 8px currentColor);
}

.user-shell .status-summary {
  display: flex;
  flex-direction: column;
}

.user-shell .script-state {
  min-height: 54px;
  margin-top: 22px;
  gap: 10px;
}

.user-shell .script-state strong {
  font-size: 22px;
  white-space: nowrap;
}

.user-shell .script-state .pulse-dot {
  width: 11px;
  height: 11px;
  flex-basis: 11px;
}

.user-shell .status-caption {
  margin-top: auto;
  font-size: 11px;
}

.user-shell .gem-task-content {
  grid-template-columns: 160px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: start;
  gap: 4px 12px;
}

.user-shell .gem-ring-wrap,
.user-shell #gemTaskChart {
  width: 140px !important;
  height: 140px !important;
}

.user-shell .gem-ring-wrap {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  transform: translate(6px, 2px);
}

.user-shell .gem-ring-wrap::before {
  inset: 0;
  z-index: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 300deg,
    rgba(104, 236, 210, 0.14) 0 320deg,
    transparent 320deg 360deg
  );
  -webkit-mask: radial-gradient(circle at center, transparent 0 49%, rgba(0, 0, 0, 0.72) 50%, #000 52% 98%, transparent 100%);
  mask: radial-gradient(circle at center, transparent 0 49%, rgba(0, 0, 0, 0.72) 50%, #000 52% 98%, transparent 100%);
  transform: translateY(5px) scale(0.985);
  filter:
    drop-shadow(0 2px 0 rgba(27, 45, 79, 0.58))
    drop-shadow(0 4px 5px rgba(0, 0, 0, 0.28));
  box-shadow: none;
}

.user-shell .gem-ring-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(
    from 300deg,
    rgba(165, 255, 236, 0.2) 0 68deg,
    transparent 68deg 232deg,
    rgba(104, 236, 210, 0.07) 232deg 320deg,
    transparent 320deg 360deg
  );
  -webkit-mask: radial-gradient(circle at center, transparent 0 50.5%, #000 52% 59%, transparent 61% 100%);
  mask: radial-gradient(circle at center, transparent 0 50.5%, #000 52% 59%, transparent 61% 100%);
  transform: translateY(-1px);
  filter:
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.2))
    drop-shadow(0 2px 2px rgba(0, 0, 0, 0.14));
}

.user-shell #gemTaskChart {
  --gem-progress-angle: 0deg;
  --gem-cap-opacity: 0;
  border-radius: 50%;
  background:
    conic-gradient(
      from 300deg,
      rgba(190, 255, 241, 0.18) 0 64deg,
      transparent 64deg 230deg,
      rgba(104, 236, 210, 0.06) 230deg 320deg,
      transparent 320deg 360deg
    ),
    conic-gradient(
      from 300deg,
      rgba(104, 236, 210, 0.88) 0 var(--gem-progress-angle),
      rgba(104, 236, 210, 0.14) var(--gem-progress-angle) 320deg,
      transparent 320deg 360deg
    );
  -webkit-mask: radial-gradient(circle at center, transparent 0 49%, rgba(0, 0, 0, 0.74) 50%, #000 52% 98%, transparent 100%);
  mask: radial-gradient(circle at center, transparent 0 49%, rgba(0, 0, 0, 0.74) 50%, #000 52% 98%, transparent 100%);
  filter:
    drop-shadow(0 1px 0 rgba(190, 255, 241, 0.24))
    drop-shadow(0 0 8px rgba(104, 236, 210, 0.13))
    drop-shadow(0 5px 5px rgba(0, 0, 0, 0.3));
  pointer-events: none;
  cursor: default;
}

.user-shell #gemTaskChart::before,
.user-shell #gemTaskChart::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 12.5%,
    rgba(225, 255, 249, 0.72) 0 2.5%,
    rgba(104, 236, 210, 0.96) 3% 10.5%,
    rgba(104, 236, 210, 0.34) 11%,
    transparent 13%
  );
  filter: drop-shadow(0 0 5px rgba(104, 236, 210, 0.42));
  pointer-events: none;
}

.user-shell #gemTaskChart::before {
  transform: rotate(300deg);
}

.user-shell #gemTaskChart::after {
  opacity: var(--gem-cap-opacity);
  transform: rotate(calc(300deg + var(--gem-progress-angle)));
  transition: transform 360ms ease, opacity 180ms ease;
}

.user-shell .gem-ring-center {
  inset: 38px;
}

.user-shell .gem-ring-center span {
  font-size: 10px;
}

.user-shell .gem-ring-center strong {
  font-size: 19px;
}

.user-shell .gem-task-data {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  padding: 15px 0 0 38px;
  gap: 8px;
}

.user-shell .gem-legend {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.user-shell .gem-legend > div {
  grid-template-columns: 8px auto auto;
  justify-content: start;
  gap: 6px;
  font-size: 11px;
}

.user-shell .gem-legend strong {
  font-size: 14px;
}

.user-shell .gem-progress-track {
  height: 13px;
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(153, 210, 250, 0.05);
}

.user-shell .gem-progress-row {
  width: 100%;
  grid-column: 1 / -1;
  grid-row: 2;
  align-self: end;
}

.user-shell .license-summary-panel {
  padding-block: 13px;
}

.user-shell .license-details {
  margin-top: 10px;
  grid-template-columns: 1.25fr 0.72fr 1fr;
  align-items: stretch;
}

.user-shell .license-detail {
  min-height: 42px;
  padding: 5px 14px;
  grid-template-columns: 64px minmax(0, 1fr);
  border-right: 1px solid rgba(183, 218, 250, 0.16);
  border-bottom: 0;
}

.user-shell .license-detail:last-child {
  border-right: 0;
}

.user-shell .license-detail dd {
  min-height: 30px;
  display: flex;
  align-items: center;
}

.user-shell .license-detail dd > strong {
  line-height: 1.2;
}

.user-shell .license-detail .type-badge {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  background: transparent;
  line-height: 1;
}

.user-shell .primary-work-grid {
  grid-template-columns: minmax(0, 1fr);
}

.user-shell .control-panel,
.user-shell .screen-panel,
.user-shell .chart-panel {
  padding: 17px;
}

.user-shell .control-panel > .section-title,
.user-shell .control-panel > .panel-note,
.user-shell .control-panel > .action-row,
.user-shell .screen-panel > .section-title,
.user-shell .chart-panel > .section-title,
.user-shell .chart-panel > .total-harvest,
.user-shell .chart-panel > .chart-box {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.user-shell .section-title h2 {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 19px;
}

.user-shell .section-title h2 i {
  width: 22px;
  color: #82e8ff;
  text-align: center;
  filter: drop-shadow(0 0 7px rgba(130, 232, 255, 0.68));
}

.user-shell .control-panel > .panel-note {
  margin-bottom: 14px;
}

.user-shell .action-row {
  max-width: 560px;
}

.user-shell .run-button,
.user-shell .stop-button,
.user-shell .icon-text-button {
  background-image: none !important;
}

.user-shell .run-button {
  border-color: rgba(103, 239, 191, 0.68);
  color: #f7fffb;
  background: linear-gradient(135deg, #16b989, #38cf75) !important;
  box-shadow: 0 10px 24px rgba(27, 197, 125, 0.2) !important;
}

.user-shell .stop-button {
  border-color: rgba(255, 124, 139, 0.68);
  color: #fff9fa;
  background: linear-gradient(135deg, #ed5261, #ff806b) !important;
  box-shadow: 0 10px 24px rgba(241, 81, 96, 0.2) !important;
}

.user-shell .icon-text-button {
  border-color: rgba(125, 210, 255, 0.42);
  color: #e7f8ff;
  background: rgba(31, 103, 164, 0.28) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

.user-shell .run-button:hover,
.user-shell .stop-button:hover,
.user-shell .icon-text-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.14);
}

.user-shell .screen-panel > .section-title {
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.user-shell .total-harvest {
  width: fit-content;
  margin-bottom: 8px;
  background: transparent;
  box-shadow: none;
}

.user-shell .chart-box {
  height: 210px;
  background: transparent;
}

@media (max-width: 620px) {
  .user-shell .dashboard-summary-grid {
    grid-template-columns: minmax(104px, 0.7fr) minmax(0, 1.3fr);
    gap: 8px;
  }

  .user-shell .status-summary {
    grid-column: 1;
    grid-row: 1;
  }

  .user-shell .gem-task-panel {
    grid-column: 2;
    grid-row: 1;
  }

  .user-shell .license-summary-panel {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .user-shell .summary-panel {
    padding: 10px;
  }

  .user-shell .status-summary,
  .user-shell .gem-task-panel {
    height: 188px;
  }

  .user-shell .summary-heading {
    gap: 5px;
  }

  .user-shell .summary-heading h2 {
    font-size: 13px;
  }

  .user-shell .summary-icon {
    width: 23px;
    height: 23px;
    flex-basis: 23px;
    font-size: 13px;
  }

  .user-shell .script-state {
    min-height: 46px;
    margin-top: 20px;
    gap: 7px;
  }

  .user-shell .script-state strong {
    font-size: 14px;
  }

  .user-shell .script-state .pulse-dot {
    width: 9px;
    height: 9px;
    flex-basis: 9px;
    box-shadow: 0 0 0 5px rgba(255, 96, 117, 0.12), 0 0 12px rgba(255, 96, 117, 0.5);
  }

  .user-shell .status-caption {
    font-size: 9px;
    line-height: 1.35;
  }

  .user-shell .gem-task-content {
    grid-template-columns: 118px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    justify-items: stretch;
    gap: 4px 6px;
  }

  .user-shell .gem-ring-wrap,
  .user-shell #gemTaskChart {
    width: 114px !important;
    height: 114px !important;
  }

  .user-shell .gem-ring-wrap {
    transform: translate(4px, 7px);
  }

  .user-shell .gem-ring-center {
    inset: 32px;
  }

  .user-shell .gem-ring-center span {
    font-size: 7px;
  }

  .user-shell .gem-ring-center strong {
    font-size: 13px;
  }

  .user-shell .gem-task-data {
    width: auto;
    padding: 9px 0 0 20px;
    gap: 5px;
  }

  .user-shell .gem-legend {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }

  .user-shell .gem-legend > div {
    grid-template-columns: 6px auto auto;
    justify-content: start;
    gap: 2px;
    font-size: 9px;
    white-space: nowrap;
  }

  .user-shell .gem-legend strong {
    grid-column: auto;
    font-size: 10px;
  }

  .user-shell .gem-progress-row {
    grid-template-columns: auto minmax(22px, 1fr) 28px;
    gap: 4px;
  }

  .user-shell .progress-label,
  .user-shell #gemProgressPercent {
    font-size: 8px;
  }

  .user-shell .gem-progress-track {
    height: 10px;
  }

  .user-shell .license-details {
    grid-template-columns: minmax(0, 1fr);
  }

  .user-shell .license-detail {
    min-height: 40px;
    padding: 5px 2px;
    grid-template-columns: 62px minmax(0, 1fr);
    border-right: 0;
    border-bottom: 1px solid rgba(183, 218, 250, 0.14);
  }

  .user-shell .license-detail:last-child {
    border-bottom: 0;
  }

  .user-shell .control-panel,
  .user-shell .screen-panel,
  .user-shell .chart-panel {
    padding: 14px;
  }

  .user-shell .section-title h2 {
    font-size: 18px;
  }

  .user-shell .chart-box {
    height: 168px;
  }
}

@media (max-width: 380px) {
  .user-shell .dashboard-summary-grid {
    grid-template-columns: minmax(100px, 0.7fr) minmax(0, 1.3fr);
  }

  .user-shell .summary-panel {
    padding: 9px;
  }

  .user-shell .gem-task-content {
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 4px;
  }

  .user-shell .gem-ring-wrap,
  .user-shell #gemTaskChart {
    width: 104px !important;
    height: 104px !important;
  }

  .user-shell .gem-ring-wrap {
    transform: translate(3px, 6px);
  }

  .user-shell .gem-ring-center {
    inset: 29px;
  }

  .user-shell .gem-task-data {
    padding-left: 10px;
  }
}
