*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg-app: #f4f7fe;
  --surface: #ffffff;
  --surface-soft: #f9fbff;
  --border-subtle: #e2e8f0;
  --primary: #16a34a;
  --primary-soft: #bbf7d0;
  --primary-strong: #15803d;
  --accent: #22c55e;
  --danger: #ef4444;
  --text-main: #0f172a;
  --text-muted: #6b7280;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.12);
  --radius-lg: 18px;
  --radius-pill: 999px;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top left, #e0f2fe, #f4f7fe 45%, #eef2ff);
  color: var(--text-main);
}

body {
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  backdrop-filter: blur(16px);
  background: linear-gradient(
      to bottom,
      rgba(244, 247, 254, 0.9),
      rgba(244, 247, 254, 0.8)
    );
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

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

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 14px;
  background: radial-gradient(circle at 20% 20%, #bbf7d0, #16a34a 60%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #ecfdf5;
  box-shadow: 0 12px 25px rgba(22, 163, 74, 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-tagline {
  font-size: 11px;
  color: var(--text-muted);
}

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

.icon-button {
  border: none;
  background: #e5f5ff;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
  box-shadow: 0 8px 18px rgba(148, 163, 184, 0.45);
}

.icon-button:hover {
  background: #dbeafe;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.user-chip.hidden {
  display: none;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 12px;
  font-weight: 600;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* Main layout */

.app-main {
  flex: 1;
  padding: 18px 16px 22px;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}

.view {
  display: none;
}

.view-active {
  display: block;
}

.view-header {
  margin-bottom: 20px;
}

.view-header h1 {
  margin: 0 0 6px;
  font-size: 26px;
}

.view-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* Cards / surfaces */

.role-card,
.auth-card,
.info-card,
.summary-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px 18px 20px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.role-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.role-card p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 14px;
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.highlight-card {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  box-shadow: 0 18px 40px rgba(22, 163, 74, 0.25);
  margin-bottom: 16px;
}

.highlight-card h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.highlight-card p {
  margin: 0;
  font-size: 14px;
  color: #14532d;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.info-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.info-card p {
  margin: 2px 0;
  font-size: 14px;
}

/* Buttons */

.btn-primary,
.btn-secondary {
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease,
    background 0.12s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #ecfdf5;
  box-shadow: 0 14px 30px rgba(22, 163, 74, 0.55);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(22, 163, 74, 0.7);
}

.btn-secondary {
  background: #e5f5ff;
  color: #0f172a;
  box-shadow: 0 10px 24px rgba(148, 163, 184, 0.45);
}

.btn-secondary:hover {
  background: #dbeafe;
}

.full-width {
  width: 100%;
}

.link-button,
.link-button-small {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  font-size: 14px;
  cursor: pointer;
  color: #16a34a;
  text-decoration: underline;
}

.link-button-small {
  font-size: 13px;
}

.back-link {
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
}

/* Auth */

.auth-card {
  max-width: 640px;
  margin: 0 auto;
}

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 6px;
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 22px;
}

.auth-card p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 14px;
}

.auth-tabs {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: #f1f5f9;
  margin-top: 4px;
  margin-bottom: 16px;
}

.auth-tab {
  border-radius: 999px;
  border: none;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
}

.auth-tab-active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 8px 18px rgba(148, 163, 184, 0.35);
}

.form {
  display: none;
}

.form-visible {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-field label {
  font-size: 13px;
  font-weight: 500;
}

.form-field input {
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  padding: 9px 10px;
  font-size: 14px;
  background: #f9fafb;
}

.form-field input:focus {
  outline: 2px solid rgba(34, 197, 94, 0.3);
  border-color: var(--primary);
  background: #ffffff;
}

.input-group {
  display: flex;
  align-items: stretch;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #f9fafb;
}

.input-prefix {
  padding: 9px 10px;
  font-size: 13px;
  color: var(--text-muted);
  border-right: 1px solid var(--border-subtle);
  background: #f1f5f9;
}

.input-group input {
  border: none;
  background: transparent;
}

.field-helper {
  font-size: 11px;
  color: var(--text-muted);
}

.field-error {
  font-size: 11px;
  min-height: 14px;
  color: var(--danger);
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 13px;
  margin: 10px 0 2px;
}

.checkbox-field input {
  margin-top: 3px;
}

.checkbox-field a {
  color: #16a34a;
}

.form-footer-text {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Toggles */

.toggle-group {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: #f1f5f9;
}

.toggle-option {
  border-radius: 999px;
  border: none;
  padding: 5px 16px;
  font-size: 13px;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
}

.toggle-option-active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 8px 18px rgba(148, 163, 184, 0.3);
}

/* Search + pills */

.search-wrapper {
  margin-top: 14px;
  margin-bottom: 10px;
}

.search-input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  padding: 9px 14px;
  font-size: 14px;
  background: #f9fafb;
}

.search-input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.28);
  border-color: #2563eb;
  background: #ffffff;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.pill {
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: var(--text-muted);
  cursor: pointer;
}

.pill-active {
  background: #e0f2fe;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

/* Products */

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.product-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 14px 14px 14px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(226, 232, 240, 0.9);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.product-title h3 {
  margin: 0;
  font-size: 16px;
}

.product-meta {
  margin: 2px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.badge {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
}

.badge-gold {
  background: #fef3c7;
  color: #92400e;
}

.badge-green {
  background: #dcfce7;
  color: #166534;
}

.badge-blue {
  background: #e0f2fe;
  color: #1d4ed8;
}

.product-footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-price {
  font-size: 14px;
  font-weight: 600;
}

.product-stock {
  font-size: 12px;
  color: var(--text-muted);
}

.product-card .btn-primary {
  margin-top: 6px;
}

/* View footer */

.view-footer {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.view-footer .muted-text {
  font-size: 13px;
}

/* Summary */

.summary-card {
  margin-top: 14px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 4px;
}

.summary-row-strong {
  font-weight: 600;
}

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

/* Panel layouts */

.panel-header-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header-row .info-card.grow {
  flex: 1;
}

/* Cart items */

.cart-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed #e5e7eb;
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-main {
  flex: 1;
}

.cart-main h3 {
  margin: 0 0 3px;
  font-size: 15px;
}

.cart-meta {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.cart-qty {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cart-qty button {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: #e5f5ff;
  font-size: 16px;
}

.cart-qty span {
  min-width: 32px;
  text-align: center;
  font-size: 14px;
}

.cart-price {
  font-size: 14px;
  font-weight: 600;
}

.cart-remove {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: #9ca3af;
}

/* Status pills */

.status-pill {
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-active {
  background: #e0f2fe;
  color: #1d4ed8;
}

.status-completed {
  background: #dcfce7;
  color: #166534;
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.94);
  color: #f9fafb;
  font-size: 13px;
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* Responsive */

@media (max-width: 640px) {
  .app-main {
    padding-inline: 12px;
  }

  .view-header h1 {
    font-size: 22px;
  }

  .products-grid {
    grid-template-columns: 1fr;
  }

  .panel-header-row {
    flex-direction: column;
  }

  .role-card,
  .auth-card,
  .info-card,
  .summary-card {
    padding: 16px 14px 18px;
  }
}
