﻿:root {
  --bg: #f7f4ef;
  --surface: #ffffff;
  --text: #1a1b1f;
  --muted: #5a606b;
  --border: #e3e1dc;
  --primary: #1f5eff;
  --primary-contrast: #ffffff;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;

  --font-sans: "Space Grotesk", "Segoe UI", sans-serif;
  --font-display: "Fraunces", "Times New Roman", serif;

  --fs-1: 32px;
  --fs-2: 22px;
  --fs-3: 16px;
  --fs-4: 14px;

  --sp-1: 8px;
  --sp-2: 12px;
  --sp-3: 16px;
  --sp-4: 24px;
  --sp-5: 32px;
  --sp-6: 48px;

  --tap: 48px;
  --r-1: 10px;
  --r-2: 16px;

  --sh-1: 0 8px 20px rgba(20, 22, 30, 0.06);
  --sh-2: 0 16px 40px rgba(20, 22, 30, 0.1);

  --container: 1120px;
  --topbar-height: 84px;
  --topbar-offset: 0px;
  --page-pad-top: var(--sp-5);
  --page-pad-bottom: var(--sp-6);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, #e4ecff 0%, transparent 60%),
    radial-gradient(900px 500px at 90% 0%, #ffe8d6 0%, transparent 55%),
    var(--bg);
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

.container {
  width: min(100% - 32px, var(--container));
  margin: 0 auto;
}

.stack {
  display: grid;
  gap: var(--sp-3);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

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

.page {
  padding: var(--page-pad-top) 0 var(--page-pad-bottom);
  display: grid;
  gap: var(--sp-4);
}

.has-topbar {
  margin-top: calc(var(--topbar-height) + var(--topbar-offset));
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  padding: var(--sp-4);
  box-shadow: var(--sh-1);
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 36px);
  margin: 0;
}

.section-title {
  font-size: var(--fs-2);
  margin: 0;
}

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

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.header-badge {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(31, 94, 255, 0.18), rgba(31, 94, 255, 0.04));
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid rgba(31, 94, 255, 0.2);
}

.account-avatar {
  display: grid;
  place-items: center;
}

.account-avatar-btn {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  border: 1px solid rgba(31, 94, 255, 0.2);
  background: linear-gradient(135deg, rgba(31, 94, 255, 0.12), rgba(31, 94, 255, 0.02));
  color: var(--primary);
  font-weight: 700;
  font-size: 16px;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.account-avatar-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(31, 94, 255, 0.18);
}

.avatar-initials {
  letter-spacing: 0.06em;
}

.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.text-small {
  font-size: 13px;
}

.link {
  text-decoration: none;
  color: var(--primary);
  font-size: 13px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
  font-family: var(--font-sans);
  min-height: var(--tap);
}

.btn.primary {
  background: var(--primary);
  color: var(--primary-contrast);
  box-shadow: none;
}

.btn.secondary {
  background: #f0f2f6;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.ghost {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text);
}

.btn.small {
  padding: 8px 14px;
  font-size: 13px;
  min-height: 36px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible,
input:focus-visible,
a:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(31, 94, 255, 0.35);
  outline-offset: 2px;
}

.input {
  display: grid;
  gap: 6px;
}

.input label {
  font-size: 13px;
  color: var(--muted);
}

.input input,
.input select {
  height: var(--tap);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 0 14px;
  font-size: 14px;
  font-family: var(--font-sans);
  background: #fbfbfb;
}

.input select {
  background-color: #fbfbfb;
}

.input .hint {
  font-size: 12px;
  color: var(--muted);
}

.input.error input {
  border-color: rgba(220, 38, 38, 0.5);
  background: #fff5f5;
}

.input.error .hint {
  color: var(--danger);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.avatar-upload {
  display: grid;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-3);
  border-radius: 16px;
  border: 1px dashed var(--border);
  background: #f9fafc;
}

.avatar-preview {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: #f1f4fa;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 600;
  overflow: hidden;
}

.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-title {
  margin: 0 0 4px;
  font-weight: 600;
}

.avatar-meta {
  display: grid;
  gap: 6px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 14px var(--sp-3);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  z-index: 10;
  box-shadow: 0 6px 18px rgba(20, 22, 30, 0.05);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

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

.topbar-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.topbar-title {
  font-weight: 600;
  font-size: 18px;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  flex: 1;
  justify-content: flex-end;
}

.nav-link {
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.nav-link:hover {
  transform: translateY(-1px);
}

.nav-link.is-active {
  background: var(--primary);
  color: var(--primary-contrast);
  border-color: transparent;
  box-shadow: 0 10px 20px rgba(31, 94, 255, 0.25);
}

.nav-link.is-quiet {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
}

.topbar-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  min-height: 36px;
  flex: 1 1 240px;
  max-width: 320px;
}

.topbar-search .search-icon {
  width: 16px;
  height: 16px;
}

.topbar-search .search-input {
  font-size: 13px;
}

.avatar {
  position: relative;
}

.avatar-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
  position: relative;
  overflow: hidden;
}

.avatar-btn:hover {
  transform: translateY(-1px);
}

.avatar-btn:focus-visible {
  outline: 3px solid rgba(31, 94, 255, 0.35);
  outline-offset: 2px;
}

.avatar-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 190px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--sh-1);
  display: none;
}

.avatar.is-open .avatar-menu {
  display: grid;
  gap: 4px;
}

.avatar-menu a {
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 10px;
}

.avatar-menu a:hover {
  background: #f4f6fb;
}

.logo-mark.small {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 14px;
}

.search {
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  color: var(--muted);
  background: #fff;
}

.search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.search-input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--text);
  background: transparent;
}

.panel.compact {
  padding: var(--sp-3);
}

.account-panel .section-title {
  font-family: var(--font-display);
  font-weight: 600;
}

.account-form {
  gap: var(--sp-4);
}

.form-grid {
  display: grid;
  gap: var(--sp-3);
}

.form-grid .span-2 {
  grid-column: span 2;
}

.form-actions {
  justify-content: space-between;
  gap: var(--sp-3);
  align-items: center;
  flex-wrap: wrap;
}

.form-feedback {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: #f4f6fb;
  color: var(--muted);
}

.form-feedback.is-success {
  border-color: rgba(22, 163, 74, 0.2);
  background: rgba(22, 163, 74, 0.08);
  color: #166534;
}

.form-feedback.is-error {
  border-color: rgba(220, 38, 38, 0.2);
  background: rgba(220, 38, 38, 0.08);
  color: #991b1b;
}

.product-grid {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: 1fr;
}

.product-card {
  border-radius: 14px;
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent, var(--primary));
  padding: 16px;
  display: grid;
  gap: 14px;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.product-card-body {
  display: grid;
  gap: 6px;
}

.product-title {
  font-weight: 600;
  margin: 0;
}

.product-desc {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.product-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
}

.product-action {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
}

.recent {
  display: grid;
  gap: var(--sp-2);
}

.chip {
  border: 1px solid var(--border);
  background: #f8f8f6;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  min-height: var(--tap);
}

.toast {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--sp-2);
  align-items: center;
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 14px;
  background: #f9fbff;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
}

.dot.success {
  background: var(--success);
}

.toast-title {
  font-weight: 600;
  margin: 0;
}

.toast-body {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.empty {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 16px;
  display: grid;
  gap: 8px;
}

.empty-title {
  font-weight: 600;
}

.empty-body {
  color: var(--muted);
  font-size: 13px;
}

.skeleton {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ececec 0%, #f5f5f5 50%, #ececec 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--sp-5) var(--sp-3);
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-2);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--sh-2);
}

.logo-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.auth-footer {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.support-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.support-card {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 16px;
  display: grid;
  gap: 6px;
}

.offline {
  display: grid;
  gap: 12px;
  font-size: 14px;
}

@keyframes shimmer {
  0% {
    background-position: 0% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@media (max-width: 520px) {
  :root {
    --topbar-height: 120px;
    --topbar-offset: 0px;
    --page-pad-top: var(--sp-4);
    --page-pad-bottom: var(--sp-5);
  }
  .container {
    width: min(100% - 24px, var(--container));
  }

  .page {
    gap: var(--sp-3);
  }

  .panel {
    padding: var(--sp-3);
    border-radius: var(--r-1);
  }

  .page-title {
    font-size: clamp(22px, 7vw, 30px);
  }

  .auth {
    padding: var(--sp-4) var(--sp-2);
  }

  .auth-card {
    padding: var(--sp-3);
    border-radius: var(--r-1);
  }

  .auth-card .btn {
    width: 100%;
  }

  .topbar {
    padding: 12px var(--sp-2);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  .topbar-actions {
    display: contents;
  }

  .topbar-search {
    grid-column: 2;
    justify-self: end;
    position: relative;
    width: 40px;
    max-width: 220px;
    min-height: 38px;
    padding: 6px 12px;
    border-radius: 999px;
    flex: 0 0 auto;
    overflow: hidden;
    cursor: text;
    transition: width 0.2s ease, box-shadow 0.2s ease;
  }

  .topbar-search .search-icon {
    position: relative;
    z-index: 1;
    width: 16px;
    height: 16px;
    pointer-events: none;
  }

  .topbar-search .search-input {
    position: absolute;
    inset: 0;
    width: 100%;
    padding-left: 36px;
    opacity: 0;
    pointer-events: auto;
    z-index: 2;
  }

  .topbar-search:focus-within {
    width: min(100%, 220px);
    box-shadow: 0 6px 16px rgba(20, 22, 30, 0.08);
  }

  .topbar-search:focus-within .search-input {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar-kicker {
    display: none;
  }

  .topbar.is-searching .topbar-title {
    opacity: 0;
    transform: translateX(-8px);
    max-width: 0;
    transition: opacity 0.2s ease, transform 0.2s ease, max-width 0.2s ease;
  }

  .topbar.is-searching .topbar-search {
    width: min(100%, 260px);
  }

  .avatar-btn {
    width: 34px;
    height: 34px;
    font-size: 12px;
  }

  .avatar {
    grid-column: 3;
    justify-self: end;
  }

  .topbar-title {
    max-width: 100%;
  }

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

  .account-avatar-btn {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    font-size: 14px;
  }
}

@media (min-width: 480px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  :root {
    --page-pad-top: var(--sp-6);
    --page-pad-bottom: 72px;
  }
  .page {
  }

  .panel {
    padding: var(--sp-5);
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .avatar-upload {
    grid-template-columns: auto 1fr;
  }

  .topbar-search {
    position: relative;
    width: 44px;
    max-width: 320px;
    flex: 0 0 auto;
    overflow: hidden;
    cursor: text;
    transition: width 0.2s ease, box-shadow 0.2s ease;
  }

  .topbar-search .search-icon {
    pointer-events: none;
  }

  .topbar-search .search-input {
    position: absolute;
    inset: 0;
    width: 100%;
    padding-left: 36px;
    opacity: 0;
    pointer-events: auto;
  }

  .topbar-search:focus-within {
    width: 320px;
    box-shadow: 0 6px 16px rgba(20, 22, 30, 0.08);
  }

  .topbar-search:focus-within .search-input {
    opacity: 1;
  }
}

@media (min-width: 1024px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .account-panel {
    max-width: 860px;
    margin: 0 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
