@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --orange: #ff5a00;
  --orange-dark: #e84f00;
  --orange-soft: #fff1e8;
  --ink: #17191c;
  --muted: #6f737b;
  --line: #e7e8eb;
  --body: #f7f7f8;
  --green: #21a366;
  --red: #ef4962;
  --blue: #4267b2;
  --shadow: 0 8px 26px rgba(32, 35, 40, .07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; overflow-x: hidden; color: var(--ink); background: var(--body); font-family: "Inter", sans-serif; font-size: 14px; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { border: 0; cursor: pointer; }
.container { width: min(1216px, calc(100% - 40px)); margin-inline: auto; }

.site-header { position: sticky; z-index: 20; top: 0; background: white; box-shadow: 0 1px 0 var(--line); }
.header-row { min-height: 74px; display: grid; grid-template-columns: 160px minmax(280px, 540px) 1fr; align-items: center; gap: 32px; }
.logo img { width: 104px; height: 54px; object-fit: contain; display: block; }
.header-search { min-width: 0; height: 44px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: #f8f8f9; transition: .2s; }
.header-search:focus-within { border-color: var(--orange); background: white; box-shadow: 0 0 0 3px var(--orange-soft); }
.header-search > span { margin-left: 14px; color: var(--muted); font-size: 25px; line-height: 1; transform: rotate(-15deg); }
.header-search input { min-width: 0; width: 100%; height: 100%; padding: 0 12px; border: 0; outline: 0; color: var(--ink); background: transparent; }
.header-search kbd { margin-right: 10px; padding: 3px 7px; border: 1px solid #dddfe3; border-radius: 5px; color: #92959b; background: white; font-size: 10px; box-shadow: 0 1px 0 #d7d8da; }
.header-account { justify-self: end; display: flex; align-items: center; gap: 22px; font-weight: 600; }
.header-account > a:first-child:hover { color: var(--orange); }
.register-button { padding: 10px 19px; border-radius: 9px; color: white; background: var(--orange); box-shadow: 0 6px 15px rgba(255, 90, 0, .22); }
.register-button:hover { background: var(--orange-dark); }
.nav-line { border-top: 1px solid #f1f1f2; }
.nav-row { min-height: 48px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.nav-row nav, .nav-tools { display: flex; align-items: center; gap: 28px; }
.nav-row a { color: #4e5259; font-size: 13px; font-weight: 500; }
.nav-row a:hover, .nav-row a.active { color: var(--orange); }
.nav-tools { gap: 18px; }
.nav-tools::before { content: "Tool"; color: var(--orange); font-size: 11px; font-weight: 800; text-transform: uppercase; }

.breadcrumb { min-height: 64px; display: flex; align-items: center; gap: 9px; color: #858990; font-size: 13px; }
.breadcrumb a:hover { color: var(--orange); }
.breadcrumb strong { color: var(--ink); }
.shop-layout { padding-bottom: 60px; display: grid; grid-template-columns: 248px minmax(0, 1fr); align-items: start; gap: 28px; }

.sidebar { position: sticky; top: 142px; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 5px 18px rgba(30, 34, 40, .035); }
.sidebar-title { padding: 18px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.sidebar-title > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; color: var(--orange); background: var(--orange-soft); font-size: 19px; }
.sidebar-title div { display: flex; flex-direction: column; }
.sidebar-title small { color: var(--orange); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.sidebar-title strong { font-size: 16px; }
#sidebarCategories { padding: 8px; }
.sidebar-link { width: 100%; min-height: 48px; padding: 8px 9px; display: grid; grid-template-columns: 32px minmax(0,1fr) auto; align-items: center; gap: 8px; border-radius: 8px; color: #50545b; background: transparent; text-align: left; }
.sidebar-link:hover { background: #fafafa; }
.sidebar-link.active { color: var(--orange); background: var(--orange-soft); font-weight: 700; }
.sidebar-link > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-link b { min-width: 24px; padding: 2px 6px; border-radius: 10px; color: #8c9096; background: #f1f2f4; font-size: 10px; text-align: center; }
.category-icon { width: 28px; height: 28px; display: grid; place-items: center; overflow: hidden; border-radius: 7px; color: white; background: var(--blue); font-weight: 800; }
.category-icon img, .card-category img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-support { margin: 10px; padding: 18px; border-radius: 10px; background: #17191c; color: white; text-align: center; }
.sidebar-support > span { width: 34px; height: 34px; margin: 0 auto 8px; display: grid; place-items: center; border-radius: 50%; color: #17191c; background: white; font-weight: 800; }
.sidebar-support strong { display: block; }
.sidebar-support p { margin: 6px 0 13px; color: #aeb1b6; font-size: 11px; }
.sidebar-support a { display: block; padding: 8px; border-radius: 7px; background: var(--orange); font-size: 12px; font-weight: 700; }

.shop-content { min-width: 0; width: 100%; max-width: 100%; overflow: hidden; }
.shop-hero { min-height: 154px; padding: 28px 34px; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; border-radius: 14px; color: white; background: linear-gradient(120deg, #15171b 0%, #292c31 70%, #363940 100%); }
.shop-hero::after { content: ""; position: absolute; right: 90px; bottom: -90px; width: 260px; height: 260px; border: 55px solid rgba(255,255,255,.035); border-radius: 50%; }
.rating { margin-bottom: 4px; color: #d7d9dd; font-size: 12px; }
.rating > span { color: #ffc02d; }
.rating small { color: #aeb1b6; }
.shop-hero h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); line-height: 1.12; }
.shop-hero p { margin: 7px 0 0; color: #c9cbd0; }
.hero-mark { position: relative; z-index: 1; width: 70px; height: 70px; display: grid; place-items: center; border-radius: 18px; color: white; background: var(--blue); font-size: 48px; font-weight: 800; box-shadow: 0 14px 25px rgba(0,0,0,.22); }

.toolbar { min-height: 66px; display: flex; align-items: center; gap: 18px; }
.result-count { margin-right: auto; color: var(--muted); }
.result-count strong { color: var(--ink); }
.sync-status { display: flex; align-items: center; gap: 7px; color: #84888e; font-size: 11px; }
.sync-status i { width: 7px; height: 7px; border-radius: 50%; background: #e8ae35; box-shadow: 0 0 0 3px #fff0cf; }
.sync-status[data-status="success"] i { background: var(--green); box-shadow: 0 0 0 3px #dff5e9; }
.sync-status[data-status="error"] i { background: var(--red); box-shadow: 0 0 0 3px #fde3e7; }
#refreshButton { padding: 7px 11px; border: 1px solid var(--line); border-radius: 7px; color: #696d73; background: white; font-size: 12px; }
#refreshButton:hover { color: var(--orange); border-color: #ffc5a5; }
.mobile-categories { width: 100%; max-width: 100%; display: none; }

.product-grid { min-width: 0; width: 100%; max-width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.product-card { min-width: 0; width: 100%; max-width: 100%; min-height: 300px; padding: 18px; overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 4px 15px rgba(30, 34, 40, .035); transition: transform .2s, box-shadow .2s, border-color .2s; }
.product-card:hover { border-color: #ffb68e; box-shadow: var(--shadow); transform: translateY(-3px); }
.card-badges { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stock-badge, .type-badge { padding: 4px 8px; border-radius: 6px; font-size: 10px; font-weight: 700; }
.stock-badge.available { color: #168651; background: #e4f7ed; }
.stock-badge.sold-out { color: #d83952; background: #fde7ea; }
.type-badge { color: #d63e55; background: #ffedf0; }
.card-category { min-width: 0; margin-top: 20px; display: flex; align-items: center; gap: 8px; color: #797d84; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.card-category > img, .card-category > span:first-child { width: 25px; height: 25px; display: grid; place-items: center; overflow: hidden; border-radius: 6px; color: white; background: var(--blue); font-size: 15px; font-weight: 800; }
.card-category > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-card h2 { margin: 12px 0 8px; display: -webkit-box; overflow: hidden; overflow-wrap: anywhere; color: #202328; font-size: 15px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.product-card h2 a:hover { color: var(--orange); }
.product-card > p { margin: 0 0 14px; display: -webkit-box; overflow: hidden; color: #74787f; font-size: 11px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.card-meta { margin-top: auto; padding: 12px 0; display: flex; flex-direction: column; gap: 5px; border-top: 1px dashed var(--line); color: #858990; font-size: 10px; }
.card-meta i { width: 16px; height: 16px; display: inline-grid; place-items: center; border-radius: 50%; color: var(--green); background: #e6f6ee; font-style: normal; }
.card-bottom { min-width: 0; width: 100%; max-width: 100%; padding-top: 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-bottom > div { min-width: 0; display: flex; flex-direction: column; }
.card-bottom small { color: #90939a; font-size: 9px; text-transform: uppercase; }
.card-bottom strong { overflow: hidden; color: #202328; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.buy-button { flex: 0 0 auto; padding: 9px 16px; border-radius: 8px; color: white; background: var(--orange); font-size: 11px; font-weight: 700; box-shadow: 0 5px 12px rgba(255,90,0,.2); }
.buy-button:hover { background: var(--orange-dark); }
.buy-button.disabled { background: #90939a; box-shadow: none; }

.skeleton-card { height: 300px; border-radius: 12px; background: linear-gradient(90deg, #eee 25%, #fafafa 50%, #eee 75%); background-size: 200% 100%; animation: skeleton 1.3s infinite; }
@keyframes skeleton { to { background-position: -200% 0; } }
.empty-state, .load-error { grid-column: 1 / -1; padding: 60px 20px; border: 1px dashed #d8dade; border-radius: 12px; background: white; text-align: center; }
.empty-state > span { color: var(--orange); font-size: 35px; }
.empty-state h2 { margin: 8px 0 2px; font-size: 20px; }
.empty-state p, .load-error { color: var(--muted); }
.about-section { margin-top: 24px; padding: 24px; display: flex; gap: 15px; border: 1px solid #ffd2ba; border-radius: 12px; background: var(--orange-soft); }
.about-icon { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--orange); font-weight: 800; }
.about-section h2 { margin: 0 0 4px; font-size: 16px; }
.about-section p { margin: 0; color: #6f625b; font-size: 12px; }

footer { padding-top: 42px; border-top: 1px solid var(--line); background: white; }
.footer-grid { padding-bottom: 38px; display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 80px; }
.footer-about img { width: 120px; height: 75px; object-fit: contain; }
.footer-about p { max-width: 390px; color: var(--muted); font-size: 12px; }
.footer-grid > div:not(.footer-about) { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.footer-grid h2 { margin: 5px 0 7px; font-size: 15px; }
.footer-grid a { color: var(--muted); font-size: 12px; }
.footer-grid a:hover { color: var(--orange); }
.copyright { padding: 16px 20px; border-top: 1px solid var(--line); color: #888c92; text-align: center; font-size: 11px; }

.wordmark { display: inline-flex; align-items: center; gap: 10px; }
.wordmark > span { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 12px; color: white; background: linear-gradient(145deg, var(--orange), #ff8a00); font-size: 23px; font-weight: 800; box-shadow: 0 7px 17px rgba(255,90,0,.22); }
.wordmark strong { display: flex; flex-direction: column; font-size: 17px; line-height: .9; letter-spacing: .08em; }
.wordmark small { margin-top: 5px; color: var(--orange); font-size: 8px; letter-spacing: .28em; }
.login-text { border: 0; color: var(--ink); background: transparent; font-weight: 600; }
.login-text:hover { color: var(--orange); }
.header-account button { white-space: nowrap; }
.footer-about .wordmark { margin-bottom: 12px; }
.footer-about .wordmark > span { width: 36px; height: 36px; border-radius: 9px; font-size: 19px; }

.modal { width: min(480px, calc(100% - 24px)); max-height: min(780px, calc(100vh - 30px)); padding: 0; overflow: auto; border: 0; border-radius: 15px; color: var(--ink); background: white; box-shadow: 0 25px 80px rgba(0,0,0,.26); }
.modal::backdrop { background: rgba(18,20,24,.68); backdrop-filter: blur(4px); }
.account-modal { width: min(720px, calc(100% - 24px)); }
.modal-head { position: sticky; z-index: 2; top: 0; padding: 19px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: white; }
.modal-head small { color: var(--orange); font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.modal-head h2 { margin: 2px 0 0; font-size: 20px; }
.modal-head > button { width: 34px; height: 34px; border-radius: 50%; color: #74777d; background: #f2f3f4; font-size: 22px; }
.auth-tabs, .account-tabs { margin: 18px 22px 0; padding: 4px; display: grid; grid-template-columns: repeat(2,1fr); border-radius: 9px; background: #f3f4f5; }
.auth-tabs button, .account-tabs button { padding: 9px; border-radius: 7px; color: #767a80; background: transparent; font-weight: 600; }
.auth-tabs button.active, .account-tabs button.active { color: var(--orange); background: white; box-shadow: 0 2px 8px rgba(0,0,0,.07); }
.account-tabs { grid-template-columns: repeat(4,1fr); }
.stack-form { padding: 18px 22px 22px; display: grid; gap: 14px; }
.stack-form label { display: grid; gap: 6px; color: #555960; font-size: 12px; font-weight: 600; }
.stack-form input, .stack-form select { width: 100%; height: 43px; padding: 0 12px; border: 1px solid #dadce0; border-radius: 8px; outline: 0; color: var(--ink); background: white; }
.stack-form input:focus, .stack-form select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.stack-form label small { color: #96999e; font-weight: 400; }
.primary-action { min-height: 43px; border-radius: 8px; color: white; background: var(--orange); font-weight: 700; box-shadow: 0 7px 16px rgba(255,90,0,.18); }
.primary-action:hover { background: var(--orange-dark); }
.primary-action:disabled { cursor: not-allowed; background: #a5a8ad; box-shadow: none; }
.form-message { min-height: 20px; margin: -8px 22px 19px; color: #d93f55; font-size: 12px; text-align: center; }
.balance-card { margin: 20px 22px 0; padding: 19px 21px; display: grid; border-radius: 12px; color: white; background: linear-gradient(120deg,#17191d,#31343a); }
.balance-card span { color: #b7bac0; font-size: 11px; }
.balance-card strong { margin: 2px 0; font-size: 27px; }
.balance-card small { color: #d2d4d7; }
.account-panel { padding: 18px 22px 4px; }
.payment-info { padding: 14px; border: 1px solid #ffd3bb; border-radius: 9px; background: var(--orange-soft); }
.payment-info strong { display: block; margin-bottom: 3px; }
.payment-info p { margin: 5px 0; color: #6f625a; font-size: 12px; }
.payment-info code { overflow-wrap: anywhere; color: #3c3e42; }
.payment-info small { color: #8a766a; }
.compact-form { padding-inline: 0; }
.history-list { display: grid; gap: 9px; padding-bottom: 16px; }
.history-item { padding: 12px 13px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 9px; }
.history-item > div:first-child { min-width: 0; display: grid; gap: 2px; }
.history-item strong, .history-item small, .history-item p { overflow-wrap: anywhere; }
.history-item small { color: #85898f; font-size: 10px; }
.history-item p { margin: 5px 0 0; color: #676b72; font-size: 11px; }
.status { flex: 0 0 auto; padding: 4px 8px; border-radius: 6px; font-size: 10px; font-weight: 700; }
.status.pending { color: #9b6900; background: #fff2ce; }
.status.approved, .status.completed { color: #168651; background: #e4f7ed; }
.status.rejected, .status.refunded { color: #d83952; background: #fde7ea; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.empty-row { padding: 25px; color: #8b8e94; text-align: center; }
.review-actions { display: flex; gap: 6px; }
.review-actions button { padding: 6px 9px; border-radius: 6px; color: white; background: var(--green); font-size: 10px; }
.review-actions button:last-child { background: var(--red); }
.logout-button { margin: 7px 22px 22px; padding: 9px 13px; border-radius: 7px; color: #d74056; background: #fff0f2; font-weight: 600; }
.buy-summary { margin: 20px 22px 0; padding: 15px; display: flex; justify-content: space-between; border-radius: 9px; background: #f5f6f7; }
.buy-summary strong { color: var(--orange); font-size: 18px; }
.toast { position: fixed; z-index: 50; right: 20px; bottom: 20px; max-width: 330px; padding: 12px 16px; border-radius: 9px; color: white; background: #1e9e66; box-shadow: 0 12px 35px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transform: translateY(12px); transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #d94459; }

@media (max-width: 1040px) {
  .header-row { grid-template-columns: 120px minmax(240px, 1fr) auto; }
  .nav-tools { display: none; }
  .product-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .container { width: min(100% - 24px, 1216px); }
  .site-header { position: relative; }
  .header-row { min-height: 64px; grid-template-columns: 70px minmax(0,1fr) auto; gap: 9px; }
  .wordmark { gap: 5px; }
  .wordmark > span { width: 38px; height: 38px; border-radius: 9px; font-size: 19px; }
  .wordmark strong { display: none; }
  .header-search { height: 40px; }
  .header-search kbd { display: none; }
  .header-account > a:first-child { display: none; }
  .register-button { padding: 8px 10px; font-size: 11px; }
  .nav-row { min-height: 42px; overflow-x: auto; scrollbar-width: none; }
  .nav-row nav { gap: 21px; white-space: nowrap; }
  .breadcrumb { min-height: 52px; }
  .shop-layout { grid-template-columns: 1fr; gap: 0; }
  .sidebar { display: none; }
  .shop-hero { min-height: 132px; padding: 22px; }
  .shop-hero p { max-width: 240px; font-size: 12px; }
  .hero-mark { width: 54px; height: 54px; font-size: 36px; }
  .toolbar { flex-wrap: wrap; gap: 10px; padding: 12px 0 8px; }
  .result-count { width: 100%; }
  .sync-status { margin-right: auto; }
  .mobile-categories { padding: 4px 0 14px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
  .mobile-categories button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; color: #5f6369; background: white; font-size: 11px; white-space: nowrap; }
  .mobile-categories button.active { color: white; border-color: var(--orange); background: var(--orange); }
  .product-grid { grid-template-columns: 1fr; gap: 12px; }
  .product-card { min-height: 276px; }
  .footer-grid { grid-template-columns: 1fr; gap: 25px; }
  .account-tabs { grid-template-columns: repeat(2,1fr); }
  .history-item { align-items: flex-start; }
}
