:root {
  --bg: #071426;
  --surface: #0d1c32;
  --surface-2: #112548;
  --line: #28426e;
  --text: #eef5ff;
  --muted: #a9bddf;
  --accent: #f3c766;
  --accent-2: #68d9bd;
  --danger: #e46a6a;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  width: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background:
    radial-gradient(circle at 50% -10%, rgba(85, 128, 211, .24), transparent 36%),
    linear-gradient(180deg, #081325 0%, #0a1a30 34%, #10254a 100%),
    url("data:image/svg+xml,%3Csvg width='1200' height='720' viewBox='0 0 1200 720' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='1200' height='720' fill='%23121f33'/%3E%3Cg stroke='%23375575' stroke-width='1' opacity='.38'%3E%3Cpath d='M0 600C200 520 380 640 600 540S960 420 1200 500' fill='none'/%3E%3Cpath d='M0 420C220 360 430 470 650 370S980 260 1200 330' fill='none'/%3E%3Cpath d='M0 240C230 190 410 300 620 220S970 130 1200 190' fill='none'/%3E%3C/g%3E%3Cg fill='%23f0b84d' opacity='.34'%3E%3Ccircle cx='180' cy='160' r='8'/%3E%3Ccircle cx='420' cy='220' r='6'/%3E%3Ccircle cx='730' cy='120' r='7'/%3E%3Ccircle cx='980' cy='280' r='5'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  background-attachment: fixed;
  color: var(--text);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
  max-width: 100%;
}

button {
  border: 0;
  border-radius: var(--radius);
  padding: 11px 14px;
  background: #234a83;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:hover,
a:hover {
  filter: brightness(1.08);
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0b1628;
  color: var(--text);
  padding: 10px 12px;
}

label {
  display: block;
  margin: 14px 0 7px;
  color: var(--muted);
  font-size: .9rem;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: #ffe2a5;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px clamp(12px, 4vw, 32px);
  background: rgba(8, 15, 28, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  padding-left: max(clamp(12px, 4vw, 32px), env(safe-area-inset-left));
  padding-right: max(clamp(12px, 4vw, 32px), env(safe-area-inset-right));
}

.brandmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  min-width: 0;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #142033;
}

.topnav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topnav a {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: var(--radius);
}

.topnav a:hover {
  background: rgba(255, 255, 255, .08);
  color: var(--text);
}

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px clamp(12px, 4vw, 32px) 44px;
  padding-left: max(clamp(12px, 4vw, 32px), env(safe-area-inset-left));
  padding-right: max(clamp(12px, 4vw, 32px), env(safe-area-inset-right));
  overflow-x: clip;
}

.auth-shell {
  min-height: calc(100vh - 60px);
  display: grid;
  place-items: center;
  padding: 24px 12px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
}

.hero,
.page-head,
.auth-panel,
.panel,
.route-card {
  background: linear-gradient(180deg, rgba(17, 37, 72, .82), rgba(8, 20, 38, .9));
  border: 1px solid rgba(93, 132, 199, .22);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .04);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr);
  gap: 18px;
  align-items: stretch;
  padding: clamp(18px, 4vw, 36px);
}

.hero h1,
.page-head h1,
.auth-panel h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 4.4rem);
  line-height: 1.05;
}

.page-head h1,
.auth-panel h1 {
  font-size: clamp(1.7rem, 5vw, 3rem);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.lead {
  margin: 14px 0 0;
  color: #dce8f8;
  line-height: 1.75;
  max-width: 760px;
  overflow-wrap: anywhere;
}

.small-lead {
  max-width: 460px;
}

.status-panel {
  display: grid;
  align-content: center;
  gap: 10px;
  background: rgba(5, 12, 22, .42);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius);
  padding: 16px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  color: var(--muted);
}

.status-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.status-row strong {
  color: var(--text);
  text-align: right;
}

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

.route-card {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  text-decoration: none;
}

.route-card strong {
  font-size: 1.25rem;
}

.route-card span:last-child,
.muted {
  color: var(--muted);
  line-height: 1.6;
}

.route-kicker {
  color: var(--accent-2);
  font-weight: 800;
}

.static-card {
  pointer-events: none;
}

.auth-panel {
  width: min(520px, 100%);
  padding: 24px;
}

.login-form {
  margin-top: 18px;
}

.login-form button,
.primary-action {
  width: 100%;
  margin-top: 14px;
  background: var(--accent);
  color: #132033;
}

.notice-box {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius);
  color: #dbe8f7;
  background: rgba(10, 20, 35, .72);
  line-height: 1.6;
}

.notice-box.warning {
  border-color: rgba(240, 184, 77, .5);
  background: rgba(74, 52, 15, .55);
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
}

.badge,
.state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(73, 182, 166, .16);
  color: #bdf5ec;
  font-weight: 800;
  white-space: nowrap;
}

.state.test {
  background: rgba(240, 184, 77, .16);
  color: #ffe0a0;
}

.dashboard-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-layout {
  grid-template-columns: minmax(240px, .58fr) minmax(0, 2.42fr);
}

.panel {
  padding: 18px;
}

.panel.wide {
  grid-column: span 2;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.list-controls {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 10px;
}

.compact-field {
  display: grid;
  grid-template-columns: auto minmax(120px, 160px);
  gap: 8px;
  align-items: center;
  margin: 0;
}

.compact-field span {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}

.compact-field select {
  min-height: 34px;
  padding: 5px 28px 5px 9px;
  font-size: .85rem;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
  white-space: nowrap;
}

.pager .mini {
  min-width: 54px;
  margin: 0;
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.number-row,
.chip-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.number-row span,
.chip-list span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d7ebff, #3b74e9 72%);
  font-weight: 800;
  color: #eef5ff;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, .42), 0 8px 18px rgba(0, 0, 0, .22);
}

.muted-numbers span {
  background: radial-gradient(circle at 35% 30%, #d7ebff, #3b74e9 72%);
  color: #eef5ff;
}

.chip-list.hot span {
  background: radial-gradient(circle at 35% 30%, #ffe6b1, #dc8f11 72%);
}

.chip-list.cold span {
  background: radial-gradient(circle at 35% 30%, #d7ebff, #3b74e9 72%);
}

.ticket-list {
  margin: 0;
  padding-left: 22px;
  line-height: 2;
}

.metric-main {
  margin: 0 0 8px;
  font-size: 1.6rem;
  font-weight: 800;
}

.caution {
  border-color: rgba(240, 184, 77, .35);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius);
  max-width: 100%;
}

table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 8px 9px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
  font-size: .9rem;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: rgba(8, 16, 30, .7);
  font-size: .78rem;
  white-space: nowrap;
}

th:nth-child(1) {
  width: 210px;
}

th:nth-child(2) {
  width: 82px;
}

th:nth-child(3) {
  width: 180px;
}

th:nth-child(4),
th:nth-child(5) {
  width: 132px;
}

th:nth-child(6) {
  width: 150px;
}

th:nth-child(7) {
  width: 220px;
}

.mini {
  min-height: 28px;
  padding: 5px 8px;
  margin: 4px 0 0 6px;
  background: #223a60;
  font-size: .76rem;
  line-height: 1.15;
  white-space: nowrap;
}

.action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.action-stack .mini {
  min-height: 26px;
  padding: 4px 7px;
  margin: 0;
  font-size: .72rem;
  font-weight: 700;
}

@media (max-width: 920px) {
  .hero,
  .page-head,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .page-head {
    display: grid;
  }

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

@media (max-width: 560px) {
  body {
    background-attachment: scroll;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

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

  .topnav a {
    padding: 8px 9px;
  }

  .shell {
    padding-top: 16px;
    padding-bottom: 28px;
  }

  .auth-shell {
    min-height: calc(100svh - 74px);
    align-items: start;
    padding-top: 18px;
  }

  .auth-panel,
  .panel,
  .page-head,
  .route-card {
    padding: 16px;
  }

  .hero h1,
  .page-head h1,
  .auth-panel h1 {
    font-size: 1.7rem;
    line-height: 1.16;
  }

  .lead {
    font-size: .95rem;
    line-height: 1.65;
  }

  .route-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .panel.wide {
    grid-column: span 1;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 18px;
  }

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

  .list-controls {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .compact-field {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .pager {
    justify-content: space-between;
  }

  .number-row span,
  .chip-list span {
    width: 38px;
    height: 38px;
  }

  .ticket-list {
    padding-left: 20px;
  }
}

@media (max-width: 720px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-layout .panel.wide {
    grid-column: span 1;
  }

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

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
  }

  table {
    min-width: 0;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tr {
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: var(--radius);
    background: rgba(8, 16, 30, .46);
    overflow: hidden;
  }

  td {
    display: grid;
    grid-template-columns: minmax(86px, .36fr) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
  }

  td::before {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 800;
  }

  td:nth-of-type(1)::before {
    content: "キー";
  }

  td:nth-of-type(2)::before {
    content: "状態";
  }

  td:nth-of-type(3)::before {
    content: "メモ";
  }

  td:nth-of-type(4)::before {
    content: "初回認証";
  }

  td:nth-of-type(5)::before {
    content: "最終ログイン";
  }

  td:nth-of-type(6)::before {
    content: "端末ID";
  }

  td:nth-of-type(7)::before {
    content: "操作";
  }

  td:nth-of-type(1) code,
  td:nth-of-type(1) .mini {
    grid-column: 2;
  }

  td:nth-of-type(1) {
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 6px;
  }

  td:nth-of-type(1)::before {
    grid-column: 1;
  }

  td:nth-of-type(1) code {
    grid-column: 2;
    font-size: .82rem;
    white-space: nowrap;
  }

  td:nth-of-type(1) .mini {
    grid-column: 3;
    min-width: 48px;
    margin: 0;
  }

  td:nth-of-type(2) {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  td:nth-of-type(2) .state {
    width: fit-content;
    min-width: 104px;
    min-height: 28px;
    padding: 4px 12px;
  }

  td.action-stack {
    display: flex;
    align-items: center;
    gap: 3px;
    overflow-x: auto;
    padding-top: 6px;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  td.action-stack::before {
    flex: 0 0 58px;
  }

  td.action-stack::-webkit-scrollbar {
    display: none;
  }

  td.action-stack .mini {
    flex: 0 0 auto;
    width: auto;
    min-width: 38px;
    margin: 0;
    min-height: 26px;
    padding: 3px 5px;
    font-size: .62rem;
    white-space: nowrap;
  }

  td.action-stack .mini:nth-child(2) {
    min-width: 76px;
  }
}

.number-row .number-ball,
.chip-list .number-ball,
.buyer-ticket-balls .number-ball {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #eef5ff;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(7, 14, 27, .4);
  box-shadow: inset 0 1px 4px rgba(255, 255, 255, .55), 0 9px 20px rgba(0, 0, 0, .24);
}

.number-ball.green {
  background: radial-gradient(circle at 35% 30%, #92f0cf, #078b63 72%);
}

.number-ball.orange {
  background: radial-gradient(circle at 35% 30%, #ffe6b1, #dc8f11 72%);
}

.number-ball.red {
  background: radial-gradient(circle at 35% 30%, #ffc2c2, #cf304b 72%);
}

.number-ball.blue {
  background: radial-gradient(circle at 35% 30%, #d7ebff, #3b74e9 72%);
}

.number-ball.purple {
  background: radial-gradient(circle at 35% 30%, #e7d7ff, #7d4de0 72%);
}

.loto6-buyer-theme {
  background:
    radial-gradient(circle at 50% -8%, rgba(134, 157, 215, .34), transparent 34%),
    linear-gradient(180deg, #071426 0%, #0a1a30 36%, #10254a 100%);
}

.buyer-wrap {
  width: min(680px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(34px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.buyer-hero,
.buyer-card {
  border: 1px solid rgba(92, 127, 193, .26);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(17, 37, 72, .78), rgba(8, 20, 38, .88));
  box-shadow: 0 18px 44px rgba(1, 8, 21, .28), inset 0 1px 0 rgba(255, 255, 255, .05);
}

.buyer-hero {
  padding: 22px 18px;
  margin-bottom: 14px;
}

.buyer-kicker,
.buyer-label,
.buyer-subhead {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.buyer-kicker {
  color: #b8c9ec;
  font-size: .82rem;
}

.buyer-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}

.buyer-title-row h1 {
  margin: 0;
  font-size: clamp(2rem, 10vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.buyer-catch {
  margin: 12px 0 0;
  color: #fff;
  font-size: clamp(1.08rem, 4.8vw, 1.6rem);
  font-weight: 900;
  line-height: 1.45;
}

.buyer-copy,
.buyer-muted {
  color: #b9c7e2;
  line-height: 1.7;
}

.buyer-copy {
  margin: 12px 0 0;
}

.buyer-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.buyer-chip-row span {
  padding: 8px 12px;
  border-radius: 999px;
  color: #dbe8ff;
  background: rgba(78, 112, 180, .34);
  border: 1px solid rgba(255, 255, 255, .08);
  font-size: .82rem;
  font-weight: 800;
}

.admin-preview-link {
  display: inline-block;
  margin-top: 14px;
  color: #ffe2a5;
  font-weight: 800;
}

.buyer-card {
  padding: 18px;
  margin-top: 14px;
}

.buyer-card h2 {
  margin: 6px 0 0;
  font-size: clamp(1.35rem, 6vw, 2rem);
  line-height: 1.2;
}

.buyer-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.buyer-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
  margin-bottom: 16px;
}

.buyer-control-grid label {
  margin: 0;
}

.buyer-control-grid label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}

.buyer-control-grid select,
.buyer-control-grid input {
  min-height: 40px;
  border-color: rgba(92, 127, 193, .42);
  border-radius: 14px;
  background: rgba(8, 20, 38, .68);
}

.buyer-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.buyer-action-row button {
  flex: 1 1 150px;
  min-height: 42px;
}

.buyer-action-row .secondary {
  background: rgba(30, 55, 95, .78);
}

.buyer-control-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.5;
}

.buyer-main-numbers,
.buyer-core-list,
.buyer-ticket-balls {
  margin-top: 10px;
}

.buyer-main-numbers {
  gap: 7px;
}

.buyer-main-numbers .number-ball {
  width: 38px;
  height: 38px;
  font-size: .86rem;
}

.buyer-core-list {
  gap: 7px;
}

.buyer-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.buyer-split .chip-list {
  margin-top: 8px;
  gap: 7px;
}

.loto6-buyer-theme .chip-list .number-ball {
  width: 36px;
  height: 36px;
  font-size: .82rem;
}

.buyer-ticket-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 12px 0 0;
  list-style: none;
  line-height: 1;
}

.buyer-ticket-card {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(92, 127, 193, .18);
  background: rgba(8, 20, 38, .48);
}

.buyer-ticket-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}

.buyer-ticket-balls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.buyer-ticket-balls .number-ball {
  width: 34px;
  height: 34px;
  font-size: .78rem;
}

.inline-balls {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.inline-balls .number-ball {
  width: 30px;
  height: 30px;
  font-size: .72rem;
}

.inline-balls.small-balls .number-ball {
  width: 26px;
  height: 26px;
  font-size: .68rem;
}

.analysis-table td {
  vertical-align: top;
}

.buyer-score-card h2 {
  color: #fff;
}

.buyer-updated {
  margin-bottom: 0;
  font-size: .86rem;
}

.buyer-footer {
  margin-top: 16px;
  padding: 16px 4px 2px;
  color: rgba(201, 214, 238, .82);
  font-size: .78rem;
}

.buyer-legal {
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.buyer-legal p {
  margin: 0;
  line-height: 1.65;
}

.buyer-legal p + p {
  margin-top: 6px;
}

.buyer-footer-line {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  color: rgba(184, 201, 236, .82);
  letter-spacing: 0;
}

.buyer-footer-line a {
  color: #d8e5ff;
  font-weight: 800;
  text-decoration: none;
}

.admin-analysis-shell .panel h2 {
  margin-bottom: 8px;
}

.admin-analysis-shell {
  padding-top: clamp(12px, 3vw, 24px);
  scroll-margin-top: 160px;
}

.admin-analysis-shell .page-head {
  margin-bottom: 18px;
}

.admin-analysis-shell .page-head h1 {
  font-size: clamp(1.95rem, 7vw, 3.2rem);
  line-height: 1.12;
}

.admin-analysis-page .topbar {
  padding-top: 9px;
  padding-bottom: 9px;
}

.admin-analysis-shell .page-head,
.admin-analysis-shell .panel {
  padding: 14px;
}

.admin-analysis-shell .lead {
  margin-top: 8px;
  line-height: 1.45;
}

.admin-analysis-shell .dashboard-grid {
  gap: 12px;
}

.analysis-menu-grid {
  align-items: start;
}

.analysis-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.analysis-mini-metric {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(92, 127, 193, .18);
  border-radius: 14px;
  background: rgba(8, 20, 38, .42);
}

.analysis-mini-metric span {
  display: block;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
  line-height: 1.35;
}

.analysis-mini-metric strong {
  display: block;
  margin-top: 3px;
  color: #f8fbff;
  font-size: .98rem;
  line-height: 1.35;
  word-break: keep-all;
}

.analysis-latest-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.analysis-latest-card {
  padding: 12px;
  border: 1px solid rgba(92, 127, 193, .18);
  border-radius: 16px;
  background: rgba(8, 20, 38, .38);
}

.analysis-latest-card h3 {
  margin: 4px 0;
  font-size: 1.2rem;
}

.analysis-ball-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.analysis-ball-row.bonus {
  margin-top: 0;
}

.analysis-bonus-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 800;
}

.compact {
  margin-top: 8px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 12px;
  background: #284a7e;
  color: #fff;
  font-size: .86rem;
  font-weight: 800;
  text-decoration: none;
}

.button-link.compact {
  margin-top: 0;
  white-space: nowrap;
}

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

.compact-analysis-table {
  min-width: 760px;
}

.compact-analysis-table th,
.compact-analysis-table td {
  padding: 10px 12px;
  vertical-align: middle;
}

.analysis-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.analysis-inline-pair,
.analysis-inline-hit {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.analysis-inline-pair span {
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.analysis-inline-hit strong,
.analysis-inline-pair strong {
  white-space: nowrap;
}

.analysis-num-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid rgba(118, 153, 220, .28);
  border-radius: 999px;
  background: rgba(34, 58, 96, .55);
  color: #ecf4ff;
  font-size: .76rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.nowrap {
  white-space: nowrap;
  word-break: keep-all;
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.manual-grid label {
  margin: 0;
}

.manual-grid .manual-reason {
  grid-column: 1 / -1;
}

.manual-grid input {
  min-height: 40px;
}

@media (max-width: 560px) {
  .buyer-wrap {
    padding-top: max(14px, env(safe-area-inset-top));
  }

  .buyer-hero,
  .buyer-card {
    border-radius: 18px;
    padding: 16px;
  }

  .buyer-title-row {
    flex-direction: column;
  }

  .buyer-title-row .badge {
    align-self: flex-start;
  }

  .buyer-split {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .buyer-control-grid {
    grid-template-columns: 1fr;
  }

  .buyer-main-numbers .number-ball,
  .number-row .number-ball,
  .chip-list .number-ball {
    width: 34px;
    height: 34px;
    font-size: .78rem;
  }

  .loto6-buyer-theme .chip-list .number-ball,
  .loto6-buyer-theme .buyer-main-numbers .number-ball {
    width: 32px;
    height: 32px;
    font-size: .74rem;
  }

  .buyer-ticket-balls .number-ball {
    width: 32px;
    height: 32px;
    font-size: .74rem;
  }

  .buyer-ticket-balls {
    gap: 5px;
    margin-top: 8px;
  }

  .buyer-ticket-card {
    padding: 9px 10px;
  }
}

@media (max-width: 920px) {
  .analysis-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analysis-latest-grid,
  .manual-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .admin-analysis-page .topbar {
    gap: 6px;
    padding: 8px 12px;
  }

  .admin-analysis-page .brandmark {
    gap: 8px;
    font-size: .94rem;
    line-height: 1.1;
  }

  .admin-analysis-page .brand-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
  }

  .admin-analysis-page .topnav {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .admin-analysis-page .topnav::-webkit-scrollbar {
    display: none;
  }

  .admin-analysis-page .topnav a {
    flex: 0 0 auto;
    padding: 5px 2px;
    font-size: .82rem;
    line-height: 1.2;
    white-space: nowrap;
  }
}

@media (max-width: 720px) {
  .admin-analysis-shell .compact-analysis-table,
  .admin-analysis-shell .compact-analysis-table thead,
  .admin-analysis-shell .compact-analysis-table tbody,
  .admin-analysis-shell .compact-analysis-table tr,
  .admin-analysis-shell .compact-analysis-table th,
  .admin-analysis-shell .compact-analysis-table td {
    display: block;
    width: 100%;
  }

  .admin-analysis-shell .compact-analysis-table {
    min-width: 0;
  }

  .admin-analysis-shell .compact-analysis-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

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

  .admin-analysis-shell .compact-analysis-table tr {
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 14px;
    background: rgba(8, 16, 30, .46);
    overflow: hidden;
  }

  .admin-analysis-shell .compact-analysis-table td {
    display: grid;
    grid-template-columns: minmax(64px, .24fr) minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
  }

  .admin-analysis-shell .compact-analysis-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
  }

  .admin-analysis-shell .compact-analysis-table td:nth-of-type(1)::before,
  .admin-analysis-shell .compact-analysis-table td:nth-of-type(2)::before,
  .admin-analysis-shell .compact-analysis-table td:nth-of-type(3)::before,
  .admin-analysis-shell .compact-analysis-table td:nth-of-type(4)::before,
  .admin-analysis-shell .compact-analysis-table td:nth-of-type(5)::before,
  .admin-analysis-shell .compact-analysis-table td:nth-of-type(6)::before,
  .admin-analysis-shell .compact-analysis-table td:nth-of-type(7)::before {
    content: attr(data-label);
  }
}

@media (max-width: 560px) {
  .admin-analysis-shell {
    padding-top: 8px;
  }

  .admin-analysis-shell .page-head {
    padding: 12px;
    margin-bottom: 10px;
  }

  .admin-analysis-shell .page-head h1 {
    font-size: 1.45rem;
  }

  .admin-analysis-shell .lead {
    margin-top: 6px;
    font-size: .88rem;
    line-height: 1.45;
  }

  .admin-analysis-shell .dashboard-grid {
    gap: 10px;
  }

  .admin-analysis-shell .panel {
    padding: 12px;
  }

  .admin-analysis-shell .panel h2 {
    margin-bottom: 6px;
    font-size: 1rem;
  }

  .analysis-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

  .analysis-mini-metric {
    padding: 8px 9px;
  }

  .analysis-mini-metric span {
    font-size: .72rem;
  }

  .analysis-mini-metric strong {
    font-size: .9rem;
    line-height: 1.25;
  }

  .analysis-latest-card {
    padding: 10px;
  }

  .analysis-latest-card h3 {
    font-size: 1.08rem;
  }

  .analysis-latest-card .muted {
    margin: 6px 0;
    line-height: 1.4;
  }

  .analysis-ball-row .number-ball {
    width: 36px;
    height: 36px;
    font-size: .82rem;
  }

  .metric-main {
    margin-bottom: 6px;
    font-size: 1.35rem;
    line-height: 1.15;
  }

  .panel .muted {
    line-height: 1.5;
  }

  .analysis-bonus-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .analysis-num-chip {
    min-width: 26px;
    min-height: 23px;
    padding: 3px 6px;
    font-size: .72rem;
  }

  .button-link.compact {
    width: 100%;
  }
}
