:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f7f7f7;
  color: #111;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f6f7fb 0%, #f3f5f9 100%);
}

.page-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 14px 16px 32px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.login-panel {
  width: min(100%, 420px);
  background: #ffffff;
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.login-panel h1 {
  margin: 0 0 18px;
  font-size: 1.6rem;
}

.login-panel .form-group {
  margin-bottom: 12px;
}

.login-panel button {
  width: 100%;
}

.login-status {
  min-height: 22px;
  margin: 12px 0 0;
  color: #dc2626;
  font-size: 0.95rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 18px 16px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.page-header h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
}

.page-header p {
  margin: 0;
  color: #4b5563;
}

.logo {
  min-width: 52px;
  min-height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #e2e8f0;
  font-size: 1.6rem;
}

.panel {
  margin-top: 16px;
  background: #ffffff;
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-heading h2 {
  margin: 0;
}

.panel-status {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 0.92rem;
}

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

.section-heading h2 {
  margin-bottom: 0;
}

.section-toggle {
  min-height: 38px;
  padding: 0 12px;
}

.panel-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
}

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

.panel-box {
  padding: 0;
}

h2 {
  margin: 0 0 12px;
  font-size: 1rem;
}

h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.collapsible-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#productFormPanel {
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

input[type="text"],
input[type="password"] {
  flex: 1 1 220px;
  min-height: 48px;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  padding: 0 14px;
  font-size: 1rem;
  background: #fafbff;
}

button,
.small-button {
  border: none;
  border-radius: 14px;
  background: #2563eb;
  color: #fff;
  min-height: 48px;
  padding: 0 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.action-button--secondary {
  background: #e2e8f0;
  color: #111827;
}

button:hover,
.small-button:hover,
.action-button--secondary:hover {
  background-color: #1d4ed8;
  transform: translateY(-1px);
}

.action-button--secondary:hover {
  background-color: #cbd5e1;
}

.hidden {
  display: none !important;
}

.store-list,
.product-list,
.filter-list,
.store-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.store-selector {
  margin-bottom: 16px;
}

.filter-list.collapsed {
  display: none;
}

.store-card,
.product-card,
.filter-pill {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px;
}

.store-card input[type="text"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 1rem;
  background: #fff;
}

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

.store-card .store-meta,
.product-card .product-meta {
  display: flex;
  flex-direction: column;
}

.product-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.product-title {
  font-weight: 600;
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

.product-title.bought {
  text-decoration: line-through;
  color: #6b7280;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.badge {
  background: #eef2ff;
  color: #3730a3;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.84rem;
  max-width: 100%;
  overflow-wrap: anywhere;
}

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

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.action-button {
  background: #e2e8f0;
  color: #111827;
  min-height: 42px;
  padding: 0 12px;
}

.action-button:hover {
  background: #cbd5e1;
}

.input-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.store-selector label {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
}

.store-selector input {
  accent-color: #2563eb;
}

.filter-list {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
}

.filter-pill.active {
  background: #2563eb;
  color: #ffffff;
  border-color: transparent;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 90%;
  background: rgba(15, 23, 42, 0.95);
  color: white;
  padding: 12px 16px;
  border-radius: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.toast.show {
  opacity: 1;
}

@media (max-width: 720px) {
  .page-shell {
    padding: 12px 12px 24px;
  }

  .page-header,
  .panel {
    border-radius: 18px;
    padding: 16px;
  }

  .page-header h1 {
    font-size: 1.45rem;
  }

  .page-header p {
    display: none;
  }

  .logo {
    min-width: 48px;
    min-height: 48px;
  }

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

  .panel-header,
  .panel-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-heading > .action-row,
  .panel-heading .small-button {
    width: 100%;
  }

  .section-heading > .action-row .small-button,
  .panel-heading .small-button,
  .form-group button {
    width: 100%;
  }

  .store-card,
  .product-card {
    align-items: stretch;
    gap: 14px;
  }

  .store-card {
    flex-direction: column;
  }

  .product-card {
    display: flex;
    flex-direction: column;
  }

  .product-card .action-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: stretch;
  }

  .product-card .action-button {
    min-width: 0;
    width: 100%;
    padding: 0 8px;
  }

  .store-card .action-row {
    justify-content: stretch;
  }

  .store-card .action-button {
    flex: 1 1 0;
  }

  .badges {
    margin-top: 10px;
  }

  .badge {
    border-radius: 12px;
  }
}
