@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Noto+Sans+SC:wght@400;500;700&display=swap');

:root {
  --bg: #f6f9fc;
  --ink: #14213d;
  --muted: #5f6c7b;
  --card: rgba(255, 255, 255, 0.88);
  --line: rgba(20, 33, 61, 0.12);
  --accent: #1f8a70;
  --accent-strong: #176856;
  --warn: #d9480f;
  --ok: #2b8a3e;
  --shadow: 0 10px 30px rgba(20, 33, 61, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(120deg, #f0f7f5 0%, #f6f9fc 38%, #ecf3ff 100%);
  color: var(--ink);
  font-family: "Manrope", "Noto Sans SC", sans-serif;
  min-height: 100vh;
}

.bg-shape {
  position: fixed;
  z-index: -1;
  filter: blur(4px);
  opacity: 0.4;
}

.bg-shape-a {
  width: 36rem;
  height: 36rem;
  background: radial-gradient(circle, #8dd3bb 0%, transparent 65%);
  top: -14rem;
  left: -6rem;
}

.bg-shape-b {
  width: 32rem;
  height: 32rem;
  background: radial-gradient(circle, #bee3f8 0%, transparent 60%);
  bottom: -12rem;
  right: -4rem;
}

nav {
  display: flex;
  gap: 0.9rem;
}

a {
  color: var(--ink);
  text-decoration: none;
}

nav a {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
}

nav a:hover {
  background: rgba(31, 138, 112, 0.12);
}

.userbox {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  font-size: 0.9rem;
}

.card-header h1 {
  margin: 0;
  font-size: 1.25rem;
}

.card-header p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

form {
  margin-top: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  background: #fff;
}

button {
  border: none;
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: all .16s ease;
}

button:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

button.ghost,
.btn-link {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.danger {
  background: var(--warn);
}

button.danger:hover {
  background: #b64010;
}

#batch-submit-btn.submit-btn-in {
  background: #1f8a70;
}

#batch-submit-btn.submit-btn-in:hover {
  background: #176856;
}

#batch-submit-btn.submit-btn-out {
  background: #d9480f;
}

#batch-submit-btn.submit-btn-out:hover {
  background: #b64010;
}

.table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-top: 0.8rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0.6rem;
  text-align: left;
  font-size: 0.88rem;
}

.qty {
  font-weight: 700;
}

.pos {
  color: var(--ok);
}

.neg {
  color: var(--warn);
}

.flash-stack {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.8rem;
}

.flash-success {
  background: #eafaf1;
  color: #1f6f3c;
  border: 1px solid #9ad9b1;
}

.flash-error {
  background: #fff1f0;
  color: #982929;
  border: 1px solid #f0b7b7;
}

.flash-info {
  background: #eef4ff;
  color: #1f4f8f;
  border: 1px solid #bdd0f2;
}

.actions,
.toolbar,
.inline-actions,
.filter-grid,
.form-grid {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  align-items: end;
}

.inline-actions form {
  margin: 0;
}

.warning-panel {
  margin-top: 0.8rem;
  border: 1px solid rgba(217, 72, 15, 0.35);
  border-radius: 12px;
  background: rgba(255, 241, 240, 0.8);
  padding: 0.65rem;
}

.warning-panel h2 {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  color: #962f0b;
}

.warning-chips {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.warning-chip {
  display: inline-flex;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(217, 72, 15, 0.28);
  background: #fff;
  font-size: 0.78rem;
  color: #8b2a09;
}

.row-low-stock td {
  background: rgba(255, 241, 240, 0.55);
}

.inline-form {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin: 0;
}

.stack-form {
  display: grid;
  gap: 0.4rem;
  margin: 0;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 0.4rem;
}

.form-grid > label,
.filter-grid > label {
  min-width: 160px;
  flex: 1;
}

.filter-wide > label {
  min-width: 140px;
}

.toolbar {
  margin-bottom: 0.8rem;
}

.toolbar-operator {
  align-items: center;
  gap: 0.9rem;
}

.toolbar-operator label {
  min-width: 180px;
}

.label-title {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.direction-box {
  min-width: 250px;
}

.direction-switch {
  display: inline-flex;
  gap: 0.3rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  min-width: 250px;
}

.dir-btn {
  flex: 1;
  font-weight: 700;
  padding: 0.62rem 0.9rem;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
}

.dir-btn:hover {
  transform: none;
}

.dir-in.is-active {
  background: #dff7ee;
  border-color: #9ad9b1;
  color: #135f45;
}

.dir-out.is-active {
  background: #ffe9e6;
  border-color: #f3b8b0;
  color: #9b2f1b;
}

.scan-hint {
  margin: 0.35rem 0 0.6rem;
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  align-items: center;
}

.scan-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.42rem 0.75rem;
  background: #fff;
  cursor: pointer;
}

.scan-toggle input {
  width: auto;
}

.scanner-code {
  font-size: 1.02rem;
}

.undo-form {
  margin-top: 0.55rem;
}

.undo-banner {
  margin-top: 0;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  background: rgba(31, 138, 112, 0.08);
  font-size: 0.86rem;
}

.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.admin-shell {
  display: grid;
  gap: 0.9rem;
}

.admin-v2 {
  display: grid;
  gap: 0.9rem;
}

.admin-top-grid {
  display: grid;
  grid-template-columns: 1fr 1.45fr;
  gap: 0.8rem;
  margin-top: 0.85rem;
}

.admin-create-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem;
  margin: 0;
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  gap: 0.7rem;
}

.admin-create-card h2 {
  margin: 0;
  font-size: 1rem;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

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

.span-3 {
  grid-column: span 3;
}

.admin-main-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.4fr;
  gap: 0.9rem;
}

.admin-main-v2 {
  grid-template-columns: 1fr;
  align-items: start;
}

.admin-stack-v3 {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(760px, 1.5fr);
  grid-template-areas:
    "room user"
    "audit audit";
  gap: 0.9rem;
  align-items: start;
}

.admin-room-card {
  grid-area: room;
}

.admin-user-card {
  grid-area: user;
}

.admin-audit-card {
  grid-area: audit;
}

.threshold-window {
  border-color: rgba(42, 124, 212, 0.28);
}

.threshold-table {
  min-width: 520px;
}

.stat-grid {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 0.6rem;
}

.stat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  background: #fff;
  display: grid;
  gap: 0.2rem;
}

.stat-card .label {
  color: var(--muted);
  font-size: 0.82rem;
}

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

.review-stat-grid {
  margin-top: 0.9rem;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.review-section {
  margin-top: 0.9rem;
}

.review-grid {
  margin-top: 0.9rem;
  grid-template-columns: 1fr 1fr;
}

.exception-grid {
  margin-top: 0.9rem;
  grid-template-columns: 1fr 1.05fr;
  align-items: start;
}

.exception-risk-section {
  margin-top: 0.9rem;
}

.exception-risk-table {
  min-width: 1180px;
}

.backup-grid {
  margin-top: 0.8rem;
  grid-template-columns: 1fr 1fr;
}

.risk-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 0.2rem 0.48rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.risk-high {
  color: #8f2505;
  background: #ffe8e6;
  border-color: #f4b5ae;
}

.risk-medium {
  color: #8c5c00;
  background: #fff4d9;
  border-color: #f1d08b;
}

.risk-low {
  color: #2d5d95;
  background: #e9f2ff;
  border-color: #b8d0f2;
}

.insight-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 0.65rem;
}

.insight-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.75rem;
}

.insight-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
}

.insight-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.action-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 0.65rem;
}

.review-progress {
  margin-top: 0.78rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.review-progress span {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
  color: var(--muted);
  background: #fff;
}

.action-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.75rem;
  display: grid;
  gap: 0.52rem;
}

.action-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.action-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.action-head h3 {
  margin: 0;
  font-size: 1rem;
}

.action-priority {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 0.12rem 0.5rem;
  font-size: 0.78rem;
  white-space: nowrap;
  color: var(--muted);
  background: #fff;
}

.action-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.action-note {
  font-size: 0.8rem;
}

.action-state {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 0.12rem 0.48rem;
  font-size: 0.76rem;
  white-space: nowrap;
}

.action-open {
  color: #8c5c00;
  background: #fff4d9;
  border-color: #f1d08b;
}

.action-done {
  color: #1f6f3c;
  background: #eafaf1;
  border-color: #9ad9b1;
}

.action-overdue {
  color: #8f2505;
  background: #ffe8e6;
  border-color: #f4b5ae;
}

.action-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.action-foot form {
  margin: 0;
}

.action-link {
  justify-self: start;
}

.insight-high {
  border-color: rgba(217, 72, 15, 0.45);
  background: rgba(255, 241, 240, 0.7);
}

.insight-medium {
  border-color: rgba(238, 153, 0, 0.45);
  background: rgba(255, 248, 234, 0.78);
}

.insight-info {
  border-color: rgba(42, 124, 212, 0.35);
  background: rgba(238, 244, 255, 0.8);
}

.insight-ok {
  border-color: rgba(43, 138, 62, 0.45);
  background: rgba(234, 250, 241, 0.78);
}

.admin-filter-grid {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
  gap: 0.55rem;
  align-items: end;
}

.admin-filter-grid > label {
  min-width: 0;
}

.admin-filter-grid .inline-actions {
  align-self: end;
}

.bulk-actions {
  margin-top: 0.7rem;
  margin-bottom: 0.65rem;
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(31, 138, 112, 0.04);
}

.bulk-actions input {
  min-width: 220px;
}

.user-table-wrap {
  max-height: 560px;
  overflow: auto;
}

.admin-user-table-v2 {
  min-width: 1320px;
  table-layout: fixed;
}

.admin-user-table-v2 td {
  vertical-align: middle;
}

.admin-user-table-v2 th:nth-child(1),
.admin-user-table-v2 td:nth-child(1) {
  width: 42px;
}

.admin-user-table-v2 th:nth-child(2),
.admin-user-table-v2 td:nth-child(2) {
  width: 220px;
}

.admin-user-table-v2 th:nth-child(3),
.admin-user-table-v2 td:nth-child(3) {
  width: 170px;
}

.admin-user-table-v2 th:nth-child(4),
.admin-user-table-v2 td:nth-child(4) {
  width: 130px;
}

.admin-user-table-v2 th:nth-child(5),
.admin-user-table-v2 td:nth-child(5) {
  width: 210px;
}

.admin-user-table-v2 th:nth-child(6),
.admin-user-table-v2 td:nth-child(6) {
  width: 250px;
}

.admin-user-table-v2 th:nth-child(7),
.admin-user-table-v2 td:nth-child(7) {
  width: 130px;
}

.admin-user-table-v2 th:nth-child(8),
.admin-user-table-v2 td:nth-child(8) {
  width: 240px;
}

.check-col {
  width: 42px;
  text-align: center;
}

.admin-user-table-v2 td .muted {
  font-size: 0.8rem;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-table-v2 select {
  min-width: 0;
  width: 100%;
}

.admin-user-table-v2 input[type="text"] {
  min-width: 0;
  width: 100%;
}

.admin-user-table-v2 .ghost {
  white-space: nowrap;
}

.row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.row-actions button {
  white-space: nowrap;
  padding: 0.45rem 0.65rem;
}

.row-actions .danger {
  color: var(--warn);
  background: transparent;
  border: 1px solid rgba(217, 72, 15, 0.35);
}

.row-actions .danger:hover {
  color: #fff;
  background: var(--warn);
  border-color: var(--warn);
}

.inline-reset-form {
  display: none;
  margin: 0;
}

.pager-row {
  margin-top: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.audit-section {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.audit-panel-card .audit-section {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.audit-table {
  min-width: 1060px;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

.audit-log-wrap {
  max-height: 420px;
  overflow: auto;
  position: relative;
}

.audit-table thead th {
  position: static;
  z-index: auto;
  background: #e7efee;
  white-space: nowrap;
}

.audit-table tbody td {
  background: #fff;
}

.admin-room-grid {
  min-width: 760px;
  table-layout: fixed;
}

.admin-room-grid th:nth-child(1),
.admin-room-grid td:nth-child(1) {
  width: 60px;
}

.admin-room-grid th:nth-child(2),
.admin-room-grid td:nth-child(2) {
  width: 220px;
}

.admin-room-grid th:nth-child(4),
.admin-room-grid td:nth-child(4) {
  width: 110px;
}

.admin-room-grid td input {
  width: 100%;
}

.admin-room-grid td:last-child form {
  margin: 0;
}

.admin-room-grid button {
  white-space: nowrap;
  width: 100%;
  min-width: 0;
}

.audit-table th:nth-child(1),
.audit-table td:nth-child(1) {
  width: 220px;
}

.audit-table th:nth-child(2),
.audit-table td:nth-child(2) {
  width: 120px;
}

.audit-table th:nth-child(3),
.audit-table td:nth-child(3) {
  width: 138px;
}

.audit-table th:nth-child(4),
.audit-table td:nth-child(4) {
  width: 170px;
}

.nowrap-cell {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audit-time {
  display: inline-block;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ellipsis-cell {
  display: inline-block;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audit-table td:nth-child(5) .ellipsis-cell {
  white-space: normal;
  word-break: break-word;
}

.code-cell,
.mono-cell,
.datetime-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
}

.code-cell,
.datetime-cell {
  white-space: nowrap;
}

.inventory-page-card,
.ledger-page-card {
  display: grid;
  gap: 0.7rem;
}

.inventory-stat-grid,
.ledger-stat-grid {
  margin-top: 0.2rem;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.inventory-filter-grid,
.ledger-filter-grid {
  margin-top: 0.1rem;
}

.inventory-search-focus {
  margin-top: 0.2rem;
  padding: 0.78rem 0.82rem;
  border: 1px solid rgba(24, 62, 66, 0.16);
  border-radius: 14px;
  background: rgba(245, 252, 251, 0.88);
}

.inventory-search-head h2 {
  margin: 0;
  font-size: 1.04rem;
}

.inventory-search-head p {
  margin: 0.28rem 0 0.55rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.inventory-filter-focus {
  margin-top: 0;
  display: grid;
  gap: 0.55rem;
}

.inventory-filter-fields {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(420px, 2fr);
  gap: 0.65rem;
  align-items: end;
}

.inventory-search-submit {
  display: flex;
  justify-content: flex-end;
}

.inventory-search-submit > button {
  min-width: 180px;
  min-height: 44px;
  font-size: 0.95rem;
}

.inventory-code-search {
  min-width: 420px !important;
  flex: 2 !important;
}

.inventory-code-search input {
  min-height: 44px;
  font-size: 1rem;
}

.inventory-search-result {
  margin-top: 0.5rem;
  color: rgba(17, 41, 43, 0.72);
  font-size: 0.84rem;
}

.inventory-search-result strong {
  color: #0f7f73;
}

.inventory-table-wrap,
.ledger-table-wrap,
.user-table-wrap {
  max-height: 66vh;
}

.dense-table {
  min-width: 1200px;
  table-layout: fixed;
}

.dense-table th,
.dense-table td {
  padding: 0.56rem 0.62rem;
  font-size: 0.86rem;
  line-height: 1.3;
  vertical-align: middle;
}

.inventory-table th:nth-child(1),
.inventory-table td:nth-child(1) {
  width: 230px;
}

.inventory-table th:nth-child(2),
.inventory-table td:nth-child(2) {
  width: 190px;
}

.inventory-table th:nth-child(3),
.inventory-table td:nth-child(3) {
  width: 220px;
}

.inventory-table th:nth-child(4),
.inventory-table td:nth-child(4) {
  width: 105px;
}

.inventory-table th:nth-child(5),
.inventory-table td:nth-child(5) {
  width: 185px;
}

.inventory-table th:nth-child(6),
.inventory-table td:nth-child(6) {
  width: 220px;
}

.ledger-table th:nth-child(1),
.ledger-table td:nth-child(1) {
  width: 70px;
}

.ledger-table th:nth-child(2),
.ledger-table td:nth-child(2) {
  width: 172px;
}

.ledger-table th:nth-child(3),
.ledger-table td:nth-child(3) {
  width: 108px;
}

.ledger-table th:nth-child(4),
.ledger-table td:nth-child(4) {
  width: 170px;
}

.ledger-table th:nth-child(5),
.ledger-table td:nth-child(5) {
  width: 100px;
}

.ledger-table th:nth-child(6),
.ledger-table td:nth-child(6),
.ledger-table th:nth-child(7),
.ledger-table td:nth-child(7),
.ledger-table th:nth-child(8),
.ledger-table td:nth-child(8) {
  width: 84px;
}

.ledger-table th:nth-child(9),
.ledger-table td:nth-child(9) {
  width: 126px;
}

.ledger-table th:nth-child(10),
.ledger-table td:nth-child(10) {
  width: 190px;
}

.ledger-table th:nth-child(11),
.ledger-table td:nth-child(11) {
  width: 220px;
}

.ledger-table th:nth-child(12),
.ledger-table td:nth-child(12) {
  width: 220px;
}

.ledger-table th:nth-child(13),
.ledger-table td:nth-child(13) {
  width: 108px;
}

.pager-actions .btn-link.is-active {
  background: rgba(31, 138, 112, 0.16);
  border-color: rgba(31, 138, 112, 0.35);
  font-weight: 700;
}

.room-list {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.55rem;
}

.room-row {
  display: grid;
  grid-template-columns: 70px 1fr 1fr 90px;
  gap: 0.55rem;
  align-items: end;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.room-row label span,
.user-reset-form label span {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.28rem;
  color: var(--muted);
}

.room-id {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--muted);
  align-self: center;
}

.user-card-list {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.75rem;
}

.user-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem;
  background: #fff;
  display: grid;
  gap: 0.65rem;
}

.user-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-card-head strong {
  font-size: 1rem;
}

.user-card-head .muted {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
}

.user-config-form,
.user-reset-form {
  margin: 0;
  display: grid;
  gap: 0.55rem;
}

.user-config-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 0.5rem;
}

.user-config-form > button,
.user-reset-form > button {
  justify-self: start;
}

.user-reset-form {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.user-reset-form label {
  margin: 0;
}

.user-reset-form input {
  min-width: 220px;
}

.user-reset-form button {
  white-space: nowrap;
}

.login-card {
  max-width: 460px;
  margin: 7vh auto 0;
}

.subtitle,
.muted,
.empty {
  color: var(--muted);
}

.hint-block {
  margin-top: 0.8rem;
  padding: 0.75rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 0.88rem;
}

.hint-block p {
  margin: 0.18rem 0;
}

.compact table {
  min-width: 320px;
}

@media (max-width: 980px) {
  .split-grid {
    grid-template-columns: 1fr;
  }

  .admin-top-grid,
  .admin-main-grid {
    grid-template-columns: 1fr;
  }

  .admin-stack-v3 {
    grid-template-columns: 1fr;
    grid-template-areas:
      "room"
      "user"
      "audit";
  }

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

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

  .stat-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .inventory-stat-grid,
  .ledger-stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .review-stat-grid,
  .insight-grid,
  .action-grid,
  .review-grid,
  .exception-grid,
  .backup-grid {
    grid-template-columns: 1fr;
  }

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

  .dense-table {
    min-width: 980px;
  }

  .span-3 {
    grid-column: auto;
  }

  .room-row {
    grid-template-columns: 1fr;
  }

  .room-id {
    align-self: start;
  }

  .user-config-grid {
    grid-template-columns: 1fr;
  }

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

  .user-reset-form input {
    min-width: 0;
  }

  .row-actions {
    flex-wrap: wrap;
  }

  .bulk-actions input {
    min-width: 0;
    width: 100%;
  }

  .userbox {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ===== Premium UI Refresh ===== */
:root {
  --bg: #f2f6f6;
  --ink: #11292b;
  --muted: #5e7073;
  --card: rgba(255, 255, 255, 0.84);
  --line: rgba(24, 62, 66, 0.14);
  --accent: #0f7f73;
  --accent-strong: #0a665d;
  --accent-alt: #2aa38f;
  --warn: #d65a3c;
  --ok: #2d9c58;
  --shadow: 0 16px 45px rgba(22, 52, 56, 0.11);
}

body {
  background:
    radial-gradient(52rem 34rem at -10% -20%, rgba(42, 163, 143, 0.18), transparent 66%),
    radial-gradient(42rem 28rem at 100% -10%, rgba(127, 197, 185, 0.2), transparent 60%),
    linear-gradient(140deg, #eff4f4 0%, #f5f8f8 45%, #edf5f4 100%);
  letter-spacing: 0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(16, 55, 59, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 55, 59, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at 50% 40%, #000 30%, transparent 100%);
  pointer-events: none;
}

.bg-shape {
  filter: blur(0);
  opacity: 0.55;
  animation: floatBlob 11s ease-in-out infinite;
}

.bg-shape-a {
  width: 34rem;
  height: 34rem;
  top: -13rem;
  left: -4rem;
  background: radial-gradient(circle, rgba(41, 162, 144, 0.3) 0%, transparent 68%);
}

.bg-shape-b {
  width: 30rem;
  height: 30rem;
  right: -5rem;
  bottom: -11rem;
  background: radial-gradient(circle, rgba(120, 190, 178, 0.32) 0%, transparent 66%);
  animation-delay: -4s;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  z-index: 20;
  width: min(1480px, calc(100% - 1.6rem));
  margin: 0.8rem auto 0;
  padding: 0.85rem 1.2rem;
  border: 1px solid rgba(24, 62, 66, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px rgba(16, 45, 49, 0.08);
  top: 0.55rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.66rem;
  min-width: 248px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  filter: drop-shadow(0 5px 10px rgba(16, 45, 49, 0.2));
  object-fit: contain;
}

.brand-mark.is-raster {
  width: 56px;
  height: 44px;
  object-position: center;
  filter: drop-shadow(0 4px 8px rgba(16, 45, 49, 0.16));
}

.brand-lockup {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.05;
  gap: 0.18rem;
}

.brand-cn {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #0b6f63;
}

.brand-en {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(16, 45, 49, 0.56);
}

nav {
  gap: 0.5rem;
}

nav a {
  position: relative;
  padding: 0.46rem 0.84rem;
  border: 1px solid transparent;
  font-weight: 700;
  color: rgba(16, 45, 49, 0.78);
  transition: all 0.2s ease;
}

nav a:hover {
  background: rgba(42, 163, 143, 0.12);
  border-color: rgba(42, 163, 143, 0.28);
}

nav a.is-active {
  color: #fff;
  background: linear-gradient(120deg, #0f7f73 0%, #2aa38f 100%);
  box-shadow: 0 10px 22px rgba(29, 122, 108, 0.28);
}

.userbox {
  gap: 0.5rem;
}

.userbox > span,
.userbox > a {
  border-radius: 999px;
  padding: 0.34rem 0.62rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #2cb67d;
  display: inline-block;
  box-shadow: 0 0 0 4px rgba(44, 182, 125, 0.14);
}

.operator-room-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  font-weight: 700;
  color: #0d6f64;
  border: 1px solid rgba(42, 163, 143, 0.36);
  background: rgba(236, 247, 245, 0.92);
}

.entry-operator-header {
  margin: 0.7rem 0 0.8rem;
  display: flex;
  gap: 0.7rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.entry-room-status {
  display: inline-flex;
  align-items: center;
  gap: 0.56rem;
  border-radius: 12px;
  border: 1px solid rgba(42, 163, 143, 0.3);
  background: rgba(238, 250, 247, 0.9);
  padding: 0.56rem 0.68rem;
}

.entry-room-status-copy {
  display: grid;
  gap: 0.1rem;
}

.entry-room-status-copy strong {
  font-size: 0.92rem;
  line-height: 1.2;
}

.entry-room-status-copy span {
  font-size: 0.8rem;
  color: rgba(17, 41, 43, 0.7);
}

.undo-banner button {
  border-color: rgba(214, 90, 60, 0.48);
  color: #ad3718;
  background: rgba(255, 243, 240, 0.95);
}

.undo-banner button:hover {
  color: #fff;
  background: linear-gradient(120deg, #ea5c2e 0%, #ce3f16 100%);
  border-color: #ce3f16;
}

.container {
  max-width: 1480px;
  margin: 1.05rem auto 2.3rem;
  padding: 0 1rem;
}

.card {
  position: relative;
  border-radius: 18px;
  border: 1px solid rgba(24, 62, 66, 0.12);
  background:
    linear-gradient(170deg, rgba(255, 255, 255, 0.97) 0%, rgba(247, 251, 250, 0.86) 100%);
  box-shadow: var(--shadow);
  padding: 1.2rem;
  overflow: clip;
}

.card::after {
  content: "";
  position: absolute;
  inset: auto -10% 100% -10%;
  height: 120%;
  background: linear-gradient(125deg, transparent 35%, rgba(42, 163, 143, 0.08) 52%, transparent 68%);
  transform: translateY(0);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(22, 52, 56, 0.15);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card-header h1 {
  font-size: clamp(1.26rem, 1.5vw, 1.68rem);
  letter-spacing: 0.01em;
}

.card-header p {
  color: rgba(17, 41, 43, 0.62);
  font-weight: 500;
}

input,
select {
  border: 1px solid rgba(24, 62, 66, 0.18);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.85);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(42, 163, 143, 0.58);
  box-shadow: 0 0 0 3px rgba(42, 163, 143, 0.14);
  background: #fff;
}

button {
  border-radius: 11px;
  font-weight: 700;
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-alt) 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(23, 113, 100, 0.24);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

button:hover {
  background: linear-gradient(120deg, #0a665d 0%, #218f7e 100%);
  transform: translateY(-1px);
  filter: saturate(1.03);
}

button:active {
  transform: translateY(0);
}

button.ghost,
.btn-link {
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  border: 1px solid rgba(24, 62, 66, 0.2);
  box-shadow: none;
}

button.ghost:hover,
.btn-link:hover {
  background: rgba(236, 247, 245, 0.92);
  border-color: rgba(42, 163, 143, 0.32);
}

button.danger {
  background: linear-gradient(120deg, #ea5c2e 0%, #ce3f16 100%);
  box-shadow: 0 10px 24px rgba(217, 79, 36, 0.24);
}

button.danger:hover {
  background: linear-gradient(120deg, #d95228 0%, #be360f 100%);
}

.pill {
  background: linear-gradient(120deg, rgba(15, 127, 115, 0.14), rgba(42, 163, 143, 0.1));
  border-color: rgba(42, 163, 143, 0.25);
  font-weight: 600;
}

.direction-switch {
  padding: 0.22rem;
  border-radius: 14px;
  border-color: rgba(24, 62, 66, 0.17);
}

.dir-btn {
  border-radius: 10px;
}

.dir-in.is-active {
  background: linear-gradient(120deg, rgba(47, 146, 102, 0.2), rgba(113, 183, 148, 0.16));
  border-color: rgba(47, 146, 102, 0.35);
  color: #0a6258;
}

.dir-out.is-active {
  background: linear-gradient(120deg, rgba(233, 95, 58, 0.2), rgba(234, 155, 56, 0.16));
  border-color: rgba(217, 79, 36, 0.35);
  color: #9b3215;
}

.table-wrap {
  margin-top: 0.82rem;
  border: 1px solid rgba(24, 62, 66, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
}

table {
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid rgba(24, 62, 66, 0.1);
}

th {
  background: linear-gradient(180deg, rgba(15, 127, 115, 0.14), rgba(42, 163, 143, 0.08));
  color: rgba(17, 41, 43, 0.92);
  font-weight: 800;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr {
  transition: background-color 0.18s ease;
}

tbody tr:hover td {
  background: rgba(15, 127, 115, 0.05);
}

.flash {
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  border-left: 4px solid transparent;
  box-shadow: 0 8px 20px rgba(22, 52, 56, 0.08);
}

.flash-success {
  border-left-color: #26a269;
}

.flash-error {
  border-left-color: #d94f24;
}

.flash-info {
  border-left-color: #2aa38f;
}

body.login-page {
  background: #f8f9f8;
  color: #2c4a3e;
  letter-spacing: 0.02em;
}

body.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(520px 280px at 8% 8%, rgba(141, 169, 148, 0.2) 0%, rgba(141, 169, 148, 0) 72%),
    radial-gradient(580px 320px at 94% 92%, rgba(44, 74, 62, 0.1) 0%, rgba(44, 74, 62, 0) 76%);
}

.login-page .bg-shape {
  display: none;
}

.login-page .container {
  position: relative;
  z-index: 1;
  max-width: 1600px;
  margin: 0 auto;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(16px, 2.2vw, 32px);
}

.login-stage {
  width: 100%;
  display: grid;
  place-items: center;
}

.login-bento-grid {
  width: min(1240px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 1.5rem;
}

.login-bento-card {
  border-radius: 32px;
  border: 1px solid #e5ece7;
  box-shadow: 0 10px 26px rgba(44, 74, 62, 0.08);
  background: rgba(255, 255, 255, 0.96);
  padding: 1.7rem;
  transition: transform 0.3s ease;
}

.login-bento-card:hover {
  transform: translateY(-4px);
}

.login-bento-hero {
  background: linear-gradient(160deg, rgba(240, 245, 242, 0.94) 0%, rgba(255, 255, 255, 0.98) 100%);
}

.login-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.72rem;
  padding: 0.6rem 0.78rem;
  border-radius: 22px;
  background: #f0f2f0;
}

.login-brand-pill-mark {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}

.login-brand-pill-mark.is-raster {
  width: 56px;
  height: 44px;
}

.login-brand-pill-lockup {
  display: inline-flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.1;
}

.login-brand-pill-lockup strong {
  font-size: 1.04rem;
  letter-spacing: 0.09em;
}

.login-brand-pill-lockup span {
  font-size: 0.7rem;
  color: rgba(44, 74, 62, 0.68);
  letter-spacing: 0.08em;
}

.login-bento-title {
  margin: 1rem 0 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.12;
}

.login-bento-subtitle {
  margin: 0.72rem 0 0;
  color: rgba(44, 74, 62, 0.76);
  font-size: 1rem;
  line-height: 1.6;
}

.login-bento-form h2 {
  margin: 0;
  font-size: 1.7rem;
}

.login-bento-form .form-subtitle {
  margin: 0.4rem 0 1rem;
  color: rgba(44, 74, 62, 0.7);
  font-size: 0.92rem;
}

.login-panel-form {
  margin: 0;
  max-width: none;
  gap: 0.75rem;
}

.login-panel-form input {
  height: 52px;
  border-radius: 18px;
  border: none;
  background: #f0f2f0;
  color: #2c4a3e;
  padding: 0.7rem 0.86rem;
}

.login-panel-form input:focus {
  outline: none;
  background: #e4eae5;
}

.login-panel-form button[type="submit"] {
  height: 52px;
  margin-top: 0.2rem;
  border-radius: 18px;
  background: #8da994;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.login-panel-form button[type="submit"]:hover {
  background: #7e9985;
}

.login-panel-tips {
  margin-top: 1rem;
  padding: 0.82rem 0.9rem;
  border-radius: 20px;
  border: 1px solid #e5ece7;
  background: #f4f7f4;
}

.login-panel-tips p {
  margin: 0;
  font-size: 0.86rem;
  color: rgba(44, 74, 62, 0.78);
  line-height: 1.5;
}

.login-panel-tips p + p {
  margin-top: 0.32rem;
}

.login-card {
  max-width: none;
  margin: 0;
  padding: 1.4rem;
  border-radius: 22px;
}

.login-card h2 {
  margin: 0;
  font-size: clamp(1.42rem, 2vw, 1.8rem);
}

.login-card .subtitle {
  font-size: 1.02rem;
  line-height: 1.55;
}

.login-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.72rem;
  align-items: stretch;
  max-width: 440px;
}

.login-form-grid > label {
  min-width: 0;
}

.login-card button[type="submit"] {
  width: 100%;
  min-height: 44px;
  margin-top: 0.1rem;
}

.hint-block {
  margin-top: 1rem;
  background: rgba(237, 248, 246, 0.86);
  border-style: solid;
  border-color: rgba(42, 163, 143, 0.2);
}

.stat-card {
  border-radius: 14px;
  border-color: rgba(24, 62, 66, 0.14);
  background: rgba(255, 255, 255, 0.92);
}

.stat-card strong {
  font-weight: 800;
}

.warning-panel,
.bulk-actions,
.action-card,
.insight-card {
  border-radius: 14px;
}

.warning-panel {
  border-color: rgba(42, 163, 143, 0.3);
  background: rgba(236, 248, 246, 0.84);
}

.warning-panel h2 {
  color: #0c6d61;
}

.warning-chip {
  border-color: rgba(42, 163, 143, 0.32);
  color: #0f6559;
}

.row-low-stock td {
  background: rgba(236, 248, 246, 0.58);
}

.inventory-admin-tools {
  margin-top: 0.15rem;
}

.data-reset-banner {
  margin-top: 0.2rem;
  border: 1px dashed rgba(214, 90, 60, 0.38);
  border-radius: 12px;
  background: rgba(255, 244, 241, 0.9);
  padding: 0.62rem 0.68rem;
  display: grid;
  gap: 0.45rem;
}

.data-reset-copy {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

.data-reset-copy strong {
  color: #a33b23;
  font-size: 0.9rem;
}

.data-reset-form {
  margin: 0;
  gap: 0.45rem;
}

.data-reset-form input[name="confirm_text"] {
  width: 120px;
  min-width: 0;
}

.admin-maintenance-card {
  border-style: dashed;
}

.admin-maintenance-grid {
  display: grid;
  grid-template-columns: minmax(260px, 420px) auto;
  gap: 0.8rem;
  align-items: end;
}

.admin-maintenance-actions {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
}

.admin-stack-v3 {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "user"
    "room"
    "audit";
}

.admin-create-user-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr)) auto;
  gap: 0.55rem;
  align-items: end;
}

.admin-create-user-grid label {
  min-width: 0;
}

.admin-create-room-grid {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(220px, 340px) auto;
  gap: 0.55rem;
  align-items: end;
}

.admin-create-room-grid label {
  min-width: 0;
}

.user-table-wrap {
  max-height: 68vh;
}

.admin-user-table-v2 {
  min-width: 1260px;
  table-layout: auto;
}

.admin-user-table-v2 th:nth-child(2),
.admin-user-table-v2 td:nth-child(2) {
  width: 210px;
}

.admin-user-table-v2 th:nth-child(3),
.admin-user-table-v2 td:nth-child(3) {
  width: 190px;
}

.admin-user-table-v2 th:nth-child(4),
.admin-user-table-v2 td:nth-child(4) {
  width: 120px;
}

.admin-user-table-v2 th:nth-child(5),
.admin-user-table-v2 td:nth-child(5) {
  width: 180px;
}

.admin-user-table-v2 th:nth-child(6),
.admin-user-table-v2 td:nth-child(6) {
  width: 220px;
}

.admin-user-table-v2 th:nth-child(7),
.admin-user-table-v2 td:nth-child(7) {
  width: 120px;
}

.admin-user-table-v2 th:nth-child(8),
.admin-user-table-v2 td:nth-child(8) {
  width: 240px;
}

.audit-table {
  min-width: 980px;
}

.danger-zone-card {
  border-color: rgba(214, 90, 60, 0.28);
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 242, 238, 0.9) 100%);
}

.danger-zone-form {
  display: grid;
  grid-template-columns: minmax(240px, 360px) auto;
  gap: 0.8rem;
  align-items: end;
}

.danger-zone-form .danger {
  width: fit-content;
}

.reveal-on-scroll {
  opacity: 0;
  transform: translateY(20px) scale(0.985);
  transition:
    opacity 0.45s ease,
    transform 0.45s ease;
}

.reveal-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@keyframes floatBlob {
  0%, 100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -12px, 0);
  }
}

@media (max-width: 980px) {
  .topbar {
    width: calc(100% - 1rem);
    margin-top: 0.5rem;
    border-radius: 14px;
    gap: 0.55rem;
    flex-wrap: wrap;
  }

  .container {
    margin-top: 0.9rem;
    padding: 0 0.55rem;
  }

  .card {
    padding: 0.9rem;
    border-radius: 14px;
  }

  .login-card {
    margin-top: 0;
    max-width: 100%;
  }

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

  .login-page .container {
    min-height: 100dvh;
    padding: 0.9rem 0.7rem;
  }

  .login-bento-grid {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .login-bento-card {
    border-radius: 24px;
    padding: 1rem;
  }

  .login-bento-title {
    font-size: 1.7rem;
  }

  .brand {
    min-width: 0;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-mark.is-raster {
    width: 46px;
    height: 36px;
  }

  .brand-cn {
    font-size: 0.92rem;
    letter-spacing: 0.1em;
  }

  .brand-en {
    font-size: 0.62rem;
  }

  .operator-room-chip {
    width: 100%;
    justify-content: center;
  }

  .entry-operator-header {
    flex-direction: column;
    align-items: stretch;
  }

  .inventory-code-search {
    min-width: 0 !important;
  }

  .inventory-filter-fields {
    grid-template-columns: 1fr;
  }

  .inventory-search-submit > button {
    width: 100%;
    min-width: 0;
  }

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

  .admin-maintenance-grid,
  .admin-create-user-grid,
  .admin-create-room-grid {
    grid-template-columns: 1fr;
  }

  .data-reset-form {
    flex-wrap: wrap;
  }

  .data-reset-form input[name="confirm_text"] {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ===== Admin Bento Refresh (JadeTiger-Minimal) ===== */
#admin-page {
  --jt-bg: #f8f9f8;
  --jt-ink: #2c4a3e;
  --jt-muted: #6e8378;
  --jt-accent: #2c4a3e;
  --jt-accent-soft: #8da994;
  --jt-card: #ffffff;
  --jt-surface: #eef3ef;
  --jt-dark: #24332d;
  --jt-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  letter-spacing: 0.01em;
}

#admin-page .card {
  border: 0;
  border-radius: 18px;
  box-shadow: var(--jt-shadow);
  background: var(--jt-card);
}

#admin-page .card::after {
  display: none;
}

#admin-page .card:hover {
  transform: none;
  box-shadow: var(--jt-shadow);
}

#admin-page .card-header h1 {
  color: var(--jt-ink);
  letter-spacing: 0.02em;
}

#admin-page .card-header p {
  color: var(--jt-muted);
}

#admin-page .admin-kpi-board {
  background: linear-gradient(145deg, #ffffff 0%, #f4f7f5 100%);
}

#admin-page .kpi-bento {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(260px, 1fr);
  gap: 0.7rem;
}

#admin-page .kpi-primary,
#admin-page .kpi-mini {
  border-radius: 16px;
  background: var(--jt-surface);
  padding: 0.85rem 0.9rem;
}

#admin-page .kpi-primary {
  display: grid;
  gap: 0.18rem;
  align-content: center;
}

#admin-page .kpi-primary p {
  margin: 0.1rem 0 0;
  color: var(--jt-muted);
  font-size: 0.84rem;
}

#admin-page .kpi-label {
  color: var(--jt-muted);
  font-size: 0.86rem;
}

#admin-page .kpi-main-value {
  font-size: clamp(2rem, 3.6vw, 2.8rem);
  line-height: 1;
  color: var(--jt-ink);
}

#admin-page .kpi-side-stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 0.7rem;
}

#admin-page .kpi-mini {
  display: grid;
  gap: 0.22rem;
  align-content: center;
}

#admin-page .kpi-mini span {
  color: var(--jt-muted);
  font-size: 0.82rem;
}

#admin-page .kpi-mini strong {
  font-size: 1.6rem;
  line-height: 1.05;
  color: var(--jt-ink);
}

#admin-page .kpi-mini.emphasis {
  background: linear-gradient(140deg, #e4ece7 0%, #d7e6dd 100%);
}

#admin-page .admin-bento-top {
  display: grid;
  grid-template-columns: minmax(340px, 0.75fr) minmax(520px, 1.25fr);
  gap: 0.9rem;
  align-items: stretch;
}

#admin-page .admin-dark-maintenance {
  background: radial-gradient(circle at top right, #33473f 0%, #24332d 58%, #1f2c27 100%);
  color: #f5fbf8;
}

#admin-page .admin-dark-maintenance .card-header h1 {
  color: #f5fbf8;
}

#admin-page .admin-dark-maintenance .card-header p {
  color: rgba(245, 251, 248, 0.74);
}

#admin-page .danger-zone-form {
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

#admin-page .danger-zone-form label {
  color: rgba(245, 251, 248, 0.85);
}

#admin-page .danger-zone-form input {
  border: 0;
  background: rgba(255, 255, 255, 0.92);
}

#admin-page .danger-zone-form .danger {
  width: 100%;
  justify-content: center;
  background: linear-gradient(120deg, #ea5c2e 0%, #ce3f16 100%);
}

#admin-page .admin-maintenance-actions .btn-link {
  border: 0;
  color: #f5fbf8;
  background: rgba(255, 255, 255, 0.08);
}

#admin-page .admin-maintenance-actions .btn-link:hover {
  background: rgba(255, 255, 255, 0.16);
  border: 0;
}

#admin-page .threshold-cards-window {
  background: linear-gradient(145deg, #ffffff 0%, #f4f8f5 100%);
}

#admin-page .threshold-card-grid {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.62rem;
}

#admin-page .threshold-mini-form {
  margin-top: 0;
}

#admin-page .threshold-mini-card {
  border-radius: 14px;
  background: var(--jt-surface);
  padding: 0.68rem 0.72rem;
  display: grid;
  gap: 0.65rem;
}

#admin-page .threshold-room-head {
  display: flex;
  align-items: center;
  gap: 0.56rem;
}

#admin-page .room-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.84rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, #4f6d60 0%, #2c4a3e 100%);
}

#admin-page .room-meta {
  display: grid;
  gap: 0.05rem;
}

#admin-page .room-meta strong {
  color: var(--jt-ink);
  font-size: 0.9rem;
}

#admin-page .room-meta span {
  color: var(--jt-muted);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}

#admin-page .threshold-stepper {
  display: grid;
  grid-template-columns: 34px 1fr 34px 38px;
  gap: 0.42rem;
}

#admin-page .step-btn,
#admin-page .icon-save-btn {
  margin: 0;
  border: 0;
  border-radius: 12px;
  min-height: 34px;
  padding: 0;
}

#admin-page .step-btn {
  color: var(--jt-ink);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(44, 74, 62, 0.14);
}

#admin-page .step-btn:hover {
  background: #f3f8f4;
}

#admin-page .threshold-value-input {
  min-height: 34px;
  text-align: center;
  font-weight: 700;
  border: 0;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(44, 74, 62, 0.16);
}

#admin-page .icon-save-btn {
  display: grid;
  place-items: center;
  width: 38px;
  color: #fff;
  background: linear-gradient(140deg, #345648 0%, #2c4a3e 100%);
  box-shadow: none;
  transform: translateZ(0);
}

#admin-page .icon-save-btn svg {
  width: 17px;
  height: 17px;
}

#admin-page .icon-save-btn:hover {
  background: linear-gradient(140deg, #2f4e41 0%, #243d34 100%);
}

#admin-page .icon-save-btn.is-saving {
  animation: adminSavePulse 0.9s ease;
}

#admin-page .bulk-actions,
#admin-page .table-wrap,
#admin-page .warning-panel,
#admin-page .admin-create-card,
#admin-page .action-card,
#admin-page .insight-card {
  border: 0;
  background: var(--jt-surface);
  box-shadow: none;
}

#admin-page .table-wrap {
  border-radius: 14px;
}

#admin-page .btn-link,
#admin-page button.ghost {
  border: 0;
  background: #ffffff;
}

#admin-page .admin-user-table-v2 th,
#admin-page .admin-room-grid th,
#admin-page .audit-table th {
  background: #e9f0eb;
}

#admin-page .admin-user-table-v2 td,
#admin-page .admin-room-grid td,
#admin-page .audit-table td {
  background: #fdfefd;
}

#admin-page .row-actions .danger {
  border: 0;
  background: rgba(214, 90, 60, 0.12);
  color: #a13e24;
}

#admin-page .row-actions .danger:hover {
  background: #d65a3c;
  color: #fff;
}

@keyframes adminSavePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(44, 74, 62, 0.28);
  }
  40% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(44, 74, 62, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(44, 74, 62, 0);
  }
}

@media (max-width: 1200px) {
  #admin-page .admin-bento-top {
    grid-template-columns: 1fr;
  }

  #admin-page .kpi-side-stack {
    grid-template-columns: repeat(3, minmax(100px, 1fr));
  }
}

@media (max-width: 980px) {
  #admin-page .kpi-bento {
    grid-template-columns: 1fr;
  }

  #admin-page .kpi-side-stack {
    grid-template-columns: 1fr 1fr;
  }

  #admin-page .threshold-card-grid {
    grid-template-columns: 1fr;
  }
}
