:root {
  --ink: #102235;
  --muted: #5d7284;
  --line: #cde8fb;
  --brand: #3b9ee8;
  --brand-dark: #2678b8;
  --danger: #dc2626;
  --surface: #fff;
  --page: #f8fcff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.hidden {
  display: none !important;
}

.login-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  grid-column: 1 / -1;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 18%, rgba(59, 158, 232, 0.14), transparent 32%),
    linear-gradient(135deg, #f8fcff 0%, #eef7ff 48%, #f8fcff 100%);
}

.beian-footer {
  margin-top: 30px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.beian-footer a {
  color: inherit;
  text-decoration: none;
}

.beian-footer a:hover {
  color: var(--brand-dark);
}

.login-beian {
  align-self: end;
  margin-top: 18px;
}

.login-shell {
  width: min(920px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  overflow: hidden;
  border: 1px solid rgba(185, 223, 248, 0.92);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 24px 70px rgba(31, 96, 150, 0.12);
}

.login-intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px;
  background: linear-gradient(160deg, #eaf7ff 0%, #f8fcff 100%);
  border-right: 1px solid var(--line);
}

.login-logo {
  width: 54px;
  height: 54px;
  margin-bottom: 24px;
  border-radius: 18px;
  background: linear-gradient(135deg, #8ed5ff, #3b9ee8);
  color: #fff;
  line-height: 54px;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(59, 158, 232, 0.22);
}

.login-intro h1 {
  font-size: 30px;
  line-height: 1.2;
}

.login-intro p {
  max-width: 360px;
  margin-top: 14px;
  font-size: 15px;
}

.login-metrics {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 34px;
}

.login-metrics span {
  padding: 7px 12px;
  border: 1px solid #b9dff8;
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
}

.login-card {
  align-self: center;
  justify-self: center;
  width: min(360px, calc(100% - 48px));
  display: grid;
  gap: 16px;
  padding: 34px;
  border: 1px solid #d8ecfb;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(31, 96, 150, 0.08);
}

.login-card h2 {
  font-size: 24px;
  margin-bottom: 4px;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: #374151;
  font-weight: 700;
}

.login-card label span {
  font-size: 13px;
}

.login-card button,
.login-card input {
  width: 100%;
}

.login-card input {
  height: 44px;
}

.login-card button {
  height: 44px;
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  box-shadow: 8px 0 28px rgba(31, 96, 150, 0.04);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 26px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #8ed5ff, #3b9ee8);
  color: #fff;
  line-height: 42px;
  text-align: center;
  font-weight: 700;
}

h1 {
  font-size: 18px;
  margin: 0;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  width: 100%;
  height: 42px;
  margin-bottom: 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #374151;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.nav:hover {
  background: #f3f9ff;
  color: var(--brand-dark);
}

.nav.active {
  background: #eef8ff;
  color: var(--brand-dark);
  font-weight: 700;
}

main {
  padding: 28px;
  min-width: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

h2 {
  margin: 0;
  font-size: 24px;
}

p {
  margin: 4px 0 0;
  color: var(--muted);
}

button {
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
}

button:hover:not(:disabled) {
  background: #2f8fd3;
}

button.secondary {
  border: 1px solid #b9dff8;
  background: #eef8ff;
  color: var(--brand-dark);
}

button.secondary:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  background: #e2f3ff;
}

button.danger {
  border: 1px solid #fecaca;
  background: #fff5f5;
  color: var(--danger);
}

button.danger:hover:not(:disabled) {
  background: #ffecec;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.store-edit-row input {
  width: min(180px, 100%);
  height: 34px;
  padding: 0 8px;
}

.store-edit-row td {
  background: #f5fbff;
}

.muted {
  color: var(--muted);
}

.password-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 112px;
}

.password-text {
  min-width: 54px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.icon-button {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #b9dff8;
  border-radius: 8px;
  background: #eef8ff;
  padding: 0;
  color: var(--brand-dark);
}

.eye-icon {
  position: relative;
  width: 16px;
  height: 10px;
  display: block;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.eye-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.eye-icon:not(.eye-icon-open)::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -4px;
  width: 2px;
  height: 17px;
  border-radius: 2px;
  background: currentColor;
  transform: translateX(-50%) rotate(45deg);
}

.toolbar,
.form,
.stall-form,
.printer-form {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.toolbar {
  grid-template-columns: 180px 1fr 160px 160px 96px;
}

.form {
  grid-template-columns: 1fr 1.1fr 130px 150px 140px 120px 150px 110px;
}

.printer-form {
  grid-template-columns: 220px 1fr 1.1fr 110px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(31, 96, 150, 0.05);
}

.stall-form {
  grid-template-columns: 220px 1fr 1fr 1.1fr 110px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(31, 96, 150, 0.05);
}

.stall-edit-row input,
.stall-edit-row select {
  width: min(180px, 100%);
  height: 34px;
  padding: 0 8px;
}

.stall-edit-row td {
  background: #f5fbff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

input,
select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus {
  border-color: #8ed5ff;
  box-shadow: 0 0 0 3px rgba(59, 158, 232, 0.12);
  outline: 0;
}

.table-card,
.empty {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(31, 96, 150, 0.06);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #e4f1fb;
  padding: 14px 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #f3f9ff;
}

tbody tr:hover td {
  background: #f7fbff;
}

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

.notice {
  margin: 12px 0;
  color: var(--danger);
}

.notice-success {
  color: var(--brand-dark);
}

.empty {
  padding: 28px;
  color: var(--muted);
}

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

  .login-panel {
    padding: 16px;
  }

  .login-shell {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .login-intro {
    padding: 30px 26px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .login-intro h1 {
    font-size: 24px;
  }

  .login-card {
    width: 100%;
    padding: 26px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .sidebar {
    display: flex;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
  }

  .brand {
    margin: 0 12px 0 0;
    flex-shrink: 0;
  }

  .nav {
    width: auto;
    margin: 0;
    flex-shrink: 0;
  }

  main {
    padding: 18px;
  }

  header,
  .toolbar,
  .form,
  .stall-form,
  .printer-form {
    grid-template-columns: 1fr;
    display: grid;
    gap: 10px;
  }

  .table-card {
    overflow-x: auto;
  }
}

@media (max-width: 640px) {
  body {
    display: block;
    min-width: 0;
    background: #f8fcff;
  }

  .login-panel {
    min-height: 100vh;
    padding: 12px;
    align-content: center;
  }

  .login-shell {
    width: 100%;
    border-radius: 18px;
  }

  .login-intro {
    padding: 24px 20px;
  }

  .login-logo {
    width: 48px;
    height: 48px;
    margin-bottom: 18px;
    line-height: 48px;
  }

  .login-intro h1 {
    margin: 0;
    font-size: 22px;
  }

  .login-intro p {
    font-size: 14px;
  }

  .login-metrics {
    margin-top: 20px;
  }

  .login-card {
    padding: 22px 20px 24px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 24px rgba(31, 96, 150, 0.08);
    background: rgba(255, 255, 255, 0.96);
  }

  .brand {
    min-width: 128px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    line-height: 36px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .brand p {
    display: none;
  }

  .nav {
    height: 38px;
    padding: 0 12px;
    white-space: nowrap;
  }

  main {
    padding: 14px 12px 24px;
  }

  header {
    align-items: stretch;
  }

  h2 {
    font-size: 22px;
  }

  header > button,
  .toolbar button,
  .form button,
  .stall-form button,
  .printer-form button {
    width: 100%;
  }

  .toolbar,
  .form,
  .stall-form,
  .printer-form {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(31, 96, 150, 0.05);
  }

  .toolbar input,
  .toolbar select,
  .form input,
  .stall-form input,
  .stall-form select,
  .printer-form input {
    width: 100%;
    min-width: 0;
  }

  .table-card {
    border-radius: 14px;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 760px;
  }

  #storeRows {
    font-size: 13px;
  }

  th,
  td {
    padding: 12px 10px;
    white-space: nowrap;
  }

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

  .row-actions button,
  td button {
    height: 34px;
    padding: 0 10px;
    white-space: nowrap;
  }

  .beian-footer {
    margin-top: 22px;
    padding-bottom: 8px;
  }
}
