.hidden { display: none !important; }
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef4fb 100%);
}
.login-card {
  width: min(420px, 100%);
  background: #ffffff;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}
.login-brand {
  color: #2563eb;
  font-weight: 700;
  margin-bottom: 12px;
}
.login-form {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}
.login-form input, .login-form button { width: 100%; height: 40px; }
.login-notice {
  margin-top: 14px;
  min-height: 22px;
  color: #64748b;
  font-size: 13px;
}
.login-notice.error { color: #b91c1c; }
.login-notice.ok { color: #15803d; }
.portal-label {
  margin: -12px 8px 18px;
  color: #64748b;
  font-size: 13px;
}
:root {
  color: #172033;
  background: #f5f7fb;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }

#app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}

.sidebar {
  background: #ffffff;
  border-right: 1px solid #d9e2ef;
  padding: 20px 14px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  margin: 4px 8px 22px;
}

.nav {
  width: 100%;
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.nav.active, .nav:hover {
  background: #e8f0ff;
  color: #1d4ed8;
}

.side-note {
  margin: 18px 8px 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.main {
  padding: 24px;
  overflow: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}

h1, h2, p { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
p { color: #64748b; margin-top: 6px; }

.login, .form-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.login { justify-content: flex-end; }
.form-grid { margin-top: 12px; }
.product-form input, .product-form select { min-width: 130px; }
.ledger-form { margin-bottom: 12px; }

input, select {
  height: 36px;
  border: 1px solid #d9e2ef;
  border-radius: 6px;
  padding: 0 10px;
  min-width: 150px;
  background: #ffffff;
  color: #172033;
}

input:focus, select:focus {
  outline: 2px solid #bfdbfe;
  border-color: #2563eb;
}

button {
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: #2563eb;
  color: #ffffff;
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
}

button:hover { background: #1d4ed8; }
button:disabled { background: #94a3b8; cursor: not-allowed; }
button.ghost {
  background: #eef2f7;
  color: #334155;
}
button.ghost:hover { background: #e2e8f0; }
button.danger { background: #b91c1c; }
button.danger:hover { background: #991b1b; }
button.small { height: 30px; padding: 0 10px; font-size: 13px; }

.notice {
  min-height: 40px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
}
.notice.ok { border-color: #bbf7d0; color: #15803d; background: #f0fdf4; }
.notice.error { border-color: #fecaca; color: #b91c1c; background: #fef2f2; }

.view { display: none; }
.view.active { display: block; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metrics div, .panel {
  background: #ffffff;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
}

.metrics div { padding: 16px; }
.metrics span { display: block; font-size: 24px; font-weight: 700; }
.metrics label { display: block; color: #64748b; margin-top: 6px; }

.panel {
  padding: 16px;
  margin-bottom: 16px;
}

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

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid.two-one { grid-template-columns: 1.2fr 1fr; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { border-bottom: 1px solid #e5edf6; padding: 10px 8px; text-align: left; white-space: nowrap; vertical-align: middle; }
th { color: #64748b; font-weight: 600; }
td.id { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef2f7;
  color: #334155;
}
.badge.success { background: #dcfce7; color: #15803d; }
.badge.warning { background: #fef3c7; color: #b45309; }
.badge.danger { background: #fee2e2; color: #b91c1c; }
.badge.info { background: #dbeafe; color: #1d4ed8; }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.account-card {
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid #d9e2ef;
  border-radius: 6px;
  color: #475569;
  background: #f8fafc;
}
.check { display: inline-flex; align-items: center; gap: 6px; height: 36px; color: #475569; }
.check input { min-width: 0; height: auto; }

@media (max-width: 920px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid #d9e2ef; }
  .metrics, .grid, .grid.two-one { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; }
  .login { justify-content: flex-start; }
}

.security-panel { display: none; }
.security-panel.active { display: block; }



.storefront-screen {
  min-height: 100vh;
  background: #f5f7fb;
}
.storefront-header {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(280px, 420px);
  gap: 20px;
  align-items: start;
  padding: 24px;
  background: #ffffff;
  border-bottom: 1px solid #d9e2ef;
}
.storefront-header h1 { font-size: 26px; }
.store-login, .profile-card {
  background: #f8fafc;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  padding: 14px;
}
.store-login {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 10px;
  align-items: center;
}
.store-login input { min-width: 0; width: 100%; }
.store-notice {
  grid-column: 1 / -1;
  min-height: 20px;
  color: #64748b;
  font-size: 13px;
}
.store-notice.error { color: #b91c1c; }
.store-notice.ok { color: #15803d; }
.profile-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.profile-card span {
  display: block;
  font-weight: 700;
}
.profile-card small {
  display: block;
  margin-top: 4px;
  color: #64748b;
}
.storefront-main {
  padding: 24px;
}
.store-section, .user-center {
  margin-top: 18px;
}
.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.product-card {
  display: flex;
  flex-direction: column;
  min-height: 330px;
  background: #ffffff;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  overflow: hidden;
}
.product-media {
  height: 132px;
  background: #eef2f7;
  border-bottom: 1px solid #d9e2ef;
}
.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.product-placeholder {
  height: 100%;
  display: grid;
  place-items: center;
  color: #1d4ed8;
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, #eef6ff 0%, #f8fafc 100%);
}
.product-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}
.product-meta, .product-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.product-meta {
  color: #64748b;
  font-size: 12px;
}
.product-card h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}
.product-card p {
  flex: 1;
  margin: 0;
  line-height: 1.5;
}
.product-foot strong {
  color: #172033;
  font-size: 18px;
}
.empty-card {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: #64748b;
  background: #ffffff;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
}
.user-metrics { margin-bottom: 16px; }

@media (max-width: 920px) {
  .storefront-header { grid-template-columns: 1fr; }
  .store-login { grid-template-columns: 1fr; }
  .section-title { flex-direction: column; }
}

.message-list {
  min-height: 220px;
  max-height: 360px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  margin-top: 12px;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  background: #f8fafc;
}
.message {
  max-width: 82%;
  padding: 10px 12px;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  background: #ffffff;
}
.message.mine {
  justify-self: end;
  border-color: #bfdbfe;
  background: #eff6ff;
}
.message span {
  display: block;
  color: #64748b;
  font-size: 12px;
  margin-bottom: 4px;
}
.message p {
  margin: 0;
  color: #172033;
  overflow-wrap: anywhere;
}
.empty-message {
  color: #64748b;
  align-self: center;
  justify-self: center;
}
.support-form input {
  flex: 1 1 240px;
}
.support-panel {
  grid-column: 1 / -1;
}

