/* Evotor Portal — strict Apple-inspired design system */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.12);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --danger: #d70015;
  --ok: #1d7d3f;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.45;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
button, input, select { font: inherit; }

.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(180deg, #3a3a3c 0%, #1d1d1f 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  position: relative; margin: 0 auto 16px;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 12px; border-radius: 6px;
  border: 2px solid rgba(255,255,255,.85);
}
.brand-mark.sm { width: 28px; height: 28px; border-radius: 8px; margin: 0; }
.brand-mark.sm::after { inset: 7px; border-radius: 4px; border-width: 1.5px; }

/* —— Login —— */
.page-login {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 32px 16px 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #fff 0%, var(--bg) 55%);
}
.login-shell { width: 100%; max-width: 380px; }
.login-card {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); padding: 36px 32px 32px; border: 1px solid var(--line);
}
.brand { text-align: center; margin-bottom: 28px; }
.brand h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.brand-sub { margin-top: 6px; color: var(--text-3); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.compact { gap: 4px; }
.field span { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field input, .field select, .filter-input {
  appearance: none; border: 1px solid var(--line-strong); background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 12px 14px; color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field.compact select { padding: 8px 10px; }
.field input:focus, .field select:focus, .filter-input:focus {
  outline: none; border-color: var(--accent); background: #fff;
  box-shadow: 0 0 0 4px rgba(0,113,227,.15);
}
.btn-primary {
  appearance: none; border: 0; border-radius: 980px; background: var(--accent); color: #fff;
  font-weight: 500; padding: 12px 18px; cursor: pointer; margin-top: 6px;
  transition: background .15s ease, transform .1s ease;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost {
  appearance: none; border: 1px solid var(--line-strong); background: rgba(255,255,255,.8);
  color: var(--text); border-radius: 980px; font-weight: 500; padding: 8px 14px; cursor: pointer;
  transition: background .15s ease;
}
.btn-ghost:hover { background: #fff; }
.btn-ghost.sm { padding: 5px 10px; font-size: 12px; color: var(--text-2); }
.form-error {
  margin: 0; color: var(--danger); font-size: 13px;
  background: rgba(215,0,21,.06); border-radius: var(--radius-sm); padding: 10px 12px;
}
.login-foot { margin-top: 20px; text-align: center; color: var(--text-3); font-size: 12px; }

/* —— Chrome —— */
.topbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  background: rgba(245,245,247,.78); border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 20px;
}
.brand-inline { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.brand-title { font-weight: 600; letter-spacing: -0.01em; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  padding: 8px 14px; border-radius: 980px; color: var(--text-2); font-weight: 500; font-size: 14px;
}
.tab:hover { background: rgba(0,0,0,.04); color: var(--text); }
.tab.active { background: rgba(0,113,227,.12); color: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip {
  color: var(--text-2); font-size: 13px; padding: 6px 12px;
  border-radius: 980px; background: rgba(0,0,0,.04);
}
.inline-form { margin: 0; }

.page-wrap { max-width: 1200px; margin: 0 auto; padding: 28px 24px 48px; }
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.page-header h1, .catalog-header h1 {
  font-size: 28px; font-weight: 600; letter-spacing: -0.025em;
}
.eyebrow {
  color: var(--text-3); font-size: 12px; letter-spacing: .04em;
  text-transform: uppercase; margin-bottom: 4px;
}
.page-header-side, .catalog-meta { color: var(--text-3); font-size: 13px; font-variant-numeric: tabular-nums; }

/* —— Stats —— */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 18px 18px 16px; box-shadow: var(--shadow-card); min-height: 96px;
}
.stat-card .label { color: var(--text-3); font-size: 12px; margin-bottom: 8px; }
.stat-card .value {
  font-size: 28px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.stat-card .hint { margin-top: 6px; color: var(--text-3); font-size: 12px; }
.skeleton-block {
  background: linear-gradient(90deg,#eee 25%,#f7f7f7 50%,#eee 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

.dash-cols { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); overflow: hidden;
}
.panel-head {
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .04em;
}
.rank-list, .type-list { list-style: none; margin: 0; padding: 8px; }
.rank-list li, .type-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
}
.rank-list li:hover, .type-list li:hover { background: rgba(0,0,0,.03); }
.rank-list .name, .type-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .count, .type-list .count {
  color: var(--text-3); font-size: 13px; font-variant-numeric: tabular-nums;
}

/* —— Catalog layout —— */
.catalog-layout {
  max-width: 1200px; margin: 0 auto; padding: 28px 24px 48px;
  display: grid; grid-template-columns: 260px 1fr; gap: 28px; align-items: start;
}
.catalog-sidebar {
  position: sticky; top: 76px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); overflow: hidden;
}
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 10px; border-bottom: 1px solid var(--line);
}
.sidebar-head h2 {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .04em;
}
.store-picker-wrap { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.group-nav { padding: 8px; max-height: calc(100vh - 220px); overflow: auto; }
.group-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; border: 0; background: transparent;
  color: var(--text); padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer;
}
.group-item:hover { background: rgba(0,0,0,.04); }
.group-item.active { background: rgba(0,113,227,.1); color: var(--accent); font-weight: 500; }
.group-item .count { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.group-children { margin: 0 0 4px 14px; padding-left: 10px; border-left: 1px solid var(--line); }
.group-children .group-item { padding: 8px 10px; font-size: 14px; }

.catalog-header {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px;
}
.token-hint {
  margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: rgba(0,113,227,.08); color: var(--text-2); font-size: 13px; line-height: 1.5;
}
.token-hint code {
  font-family: var(--mono); font-size: 12px; background: rgba(0,0,0,.05);
  padding: 1px 6px; border-radius: 4px;
}
.list-toolbar { margin-bottom: 12px; }
.filter-input { width: 100%; max-width: 420px; }

.product-list-head,
.product-row {
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) 0.9fr 0.7fr 0.7fr 0.7fr;
  gap: 12px; align-items: center;
}
.product-list-head {
  padding: 8px 14px; color: var(--text-3); font-size: 12px;
  text-transform: uppercase; letter-spacing: .03em;
  border-bottom: 1px solid var(--line);
}
.product-list {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card);
}
.product-row {
  width: 100%; text-align: left; border: 0; background: transparent;
  padding: 12px 14px; cursor: pointer; border-bottom: 1px solid var(--line);
  color: var(--text);
}
.product-row:last-child { border-bottom: 0; }
.product-row:hover { background: rgba(0,0,0,.03); }
.product-row .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-row .sub {
  display: block; color: var(--text-3); font-size: 12px; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.product-row .num { font-variant-numeric: tabular-nums; }
.pill {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 980px;
  background: rgba(0,0,0,.04); color: var(--text-2); font-size: 11px; width: fit-content;
}
.pill.ok { background: rgba(29,125,63,.1); color: var(--ok); }
.pill.off { background: rgba(215,0,21,.08); color: var(--danger); }
.empty-state {
  padding: 40px 16px; text-align: center; color: var(--text-3);
}
.skeleton-row {
  height: 52px; border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg,#eee 25%,#f7f7f7 50%,#eee 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear;
}

/* —— Modal —— */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.28);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-card {
  position: relative; width: min(640px, 100%); max-height: min(80vh, 720px);
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,.18); display: flex; flex-direction: column;
  border: 1px solid var(--line);
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 20px 22px 12px; border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.modal-body { padding: 8px 10px 18px; overflow: auto; }
.detail-section { padding: 10px 12px; }
.detail-section h3 {
  font-size: 12px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px;
}
.detail-grid { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; }
.detail-grid dt { color: var(--text-3); font-size: 13px; }
.detail-grid dd { margin: 0; font-size: 14px; word-break: break-word; }
.detail-grid dd.mono { font-family: var(--mono); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.raw-block {
  font-family: var(--mono); font-size: 12px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; overflow: auto; max-height: 180px;
}

.edit-form .edit-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px;
}
.edit-form .edit-grid .field:first-child { grid-column: 1 / -1; }
.edit-actions {
  display: flex; align-items: center; gap: 12px; margin-top: 10px;
}
.btn-primary.sm { padding: 9px 16px; margin-top: 0; }
.edit-status { color: var(--ok); font-size: 13px; }
.btn-danger {
  appearance: none; border: 0; border-radius: 980px; background: var(--danger); color: #fff;
  font-weight: 500; padding: 12px 18px; cursor: pointer;
}
.btn-danger:disabled { opacity: .45; cursor: not-allowed; }
.service-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.service-head, .service-row {
  grid-template-columns: minmax(0, 2.2fr) 0.8fr 0.6fr 0.9fr 1.1fr;
}
.product-list.flat { background: var(--surface); }
.service-row .mono {
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
}
@media (max-width: 640px) {
  .edit-form .edit-grid { grid-template-columns: 1fr; }
  .service-head, .service-row { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-cols { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .catalog-layout { grid-template-columns: 1fr; padding: 20px 16px 40px; }
  .catalog-sidebar { position: static; }
  .group-nav { max-height: 240px; }
  .product-list-head { display: none; }
  .product-row { grid-template-columns: 1fr; gap: 4px; }
}
