:root {
  --bg: #f5f2ee;
  --surface: #ffffff;
  --surface-alt: #f7f7f8;
  --text: #1f2937;
  --muted: #667085;
  --line: #e5e7eb;
  --primary: #183546;
  --primary-hover: #102735;
  --accent: #ea8f47;
  --danger: #c43d3d;
  --danger-bg: #fff2f2;
  --success-bg: #edf8ef;
  --success-text: #246b34;
  --error-bg: #fff1f1;
  --error-text: #b42318;
  --info-bg: #eef5ff;
  --info-text: #1849a9;
  --shadow: 0 18px 45px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: linear-gradient(180deg, #f8f6f2 0%, #f0ece6 100%);
  color: var(--text);
  font-family: 'Inter', sans-serif;
}

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

button,
input,
textarea,
select {
  font: inherit;
}

[hidden] {
  display: none !important;
}

button {
  border: 0;
  background: none;
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}

.admin-brand img {
  display: block;
  width: auto;
  height: 52px;
  object-fit: contain;
}

.admin-auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(234, 143, 71, 0.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(24, 53, 70, 0.16), transparent 30%),
    linear-gradient(180deg, #0f1720 0%, #152533 52%, #f2eee9 52%, #f2eee9 100%);
}

.admin-auth-shell {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
}

.admin-auth-card {
  width: min(100%, 560px);
}

.admin-auth-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.86)),
    linear-gradient(135deg, rgba(234, 143, 71, 0.12), rgba(24, 53, 70, 0.08));
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 28px;
  padding: 34px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.admin-auth-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, #ea8f47 0%, #183546 100%);
}

.admin-auth-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(24, 53, 70, 0.08);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 14px;
}

.admin-auth-copy h1,
.admin-sidebar h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
  margin-bottom: 14px;
}

.admin-auth-copy p,
.admin-sidebar p,
.hint-text,
.empty-state,
.metric-label,
.recent-product-card p,
.view-subtitle {
  color: var(--muted);
  line-height: 1.6;
}

.admin-auth-copy {
  margin: 22px 0 24px;
}

.admin-auth-form,
.product-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.form-field span {
  font-size: 0.92rem;
  font-weight: 700;
}

.checkbox-field {
  gap: 10px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  line-height: 1.4;
}

.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin-top: 2px;
  padding: 0;
  border: 1px solid rgba(136, 161, 183, 0.45);
  border-radius: 5px;
  box-shadow: none;
  background: #fff;
  accent-color: var(--accent);
  transform: none;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  border: 1px solid rgba(136, 161, 183, 0.34);
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(234, 143, 71, 0.08), transparent 42%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 15px 18px;
  color: var(--text);
  outline: none;
  transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease, background 0.22s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 12px 28px rgba(24, 53, 70, 0.05);
}

.form-field textarea {
  resize: vertical;
  min-height: 120px;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-color: rgba(56, 94, 122, 0.55);
  box-shadow:
    0 0 0 5px rgba(24, 53, 70, 0.08),
    0 18px 36px rgba(24, 53, 70, 0.08);
  transform: translateY(-1px);
}

.form-field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  padding-right: 60px;
  background-image:
    radial-gradient(circle at center, rgba(234, 143, 71, 0.16), rgba(234, 143, 71, 0) 72%),
    linear-gradient(45deg, transparent 50%, var(--primary) 50%),
    linear-gradient(135deg, var(--primary) 50%, transparent 50%),
    radial-gradient(circle at top left, rgba(234, 143, 71, 0.08), transparent 42%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  background-position:
    calc(100% - 24px) 50%,
    calc(100% - 25px) calc(50% - 2px),
    calc(100% - 18px) calc(50% - 2px),
    0 0,
    0 0;
  background-size:
    26px 26px,
    7px 7px,
    7px 7px,
    100% 100%,
    100% 100%;
  background-repeat: no-repeat;
  font-weight: 600;
}

.form-field select:hover {
  border-color: rgba(74, 109, 136, 0.46);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 18px 36px rgba(24, 53, 70, 0.08);
  transform: translateY(-2px);
}

.form-field select:disabled {
  cursor: not-allowed;
  opacity: 0.74;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 8px 20px rgba(24, 53, 70, 0.04);
  transform: none;
}

.form-field option,
.form-field optgroup {
  color: var(--text);
  background: #ffffff;
}

.primary-button,
.secondary-button,
.text-button,
.danger-btn,
.secondary-btn,
.sidebar-link {
  cursor: pointer;
}

.primary-button {
  min-height: 48px;
  background: var(--primary);
  color: #fff;
  border-radius: 16px;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--primary-hover);
}

.secondary-button,
.secondary-btn {
  min-height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0 16px;
  font-weight: 600;
}

.text-button {
  color: var(--info-text);
  font-weight: 600;
}

.danger-btn {
  min-height: 42px;
  border-radius: 14px;
  background: var(--danger-bg);
  color: var(--danger);
  padding: 0 16px;
  font-weight: 700;
}

.full-width {
  width: 100%;
}

.status-message {
  min-height: 24px;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.93rem;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.status-message:empty {
  padding: 0;
  min-height: 0;
}

.status-message.is-hiding {
  opacity: 0;
  transform: translateY(-8px);
}

.status-message[data-state="success"] {
  background: var(--success-bg);
  color: var(--success-text);
}

.status-message[data-state="error"] {
  background: var(--error-bg);
  color: var(--error-text);
}

.status-message[data-state="info"] {
  background: var(--info-bg);
  color: var(--info-text);
}

.admin-auth-meta {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 16px;
}

.admin-auth-meta strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.94rem;
}

.admin-auth-meta p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.admin-auth-meta code {
  font-family: inherit;
  font-weight: 700;
  color: var(--primary);
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.admin-topbar-inner {
  width: min(100%, 1360px);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.admin-nav-toggle {
  display: none;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid rgba(24, 53, 70, 0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(245,242,238,0.96));
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  box-shadow: 0 14px 28px rgba(16, 24, 40, 0.08);
}

.admin-nav-toggle span {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--primary);
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.admin-sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 94;
  background: rgba(10, 16, 22, 0.46);
  backdrop-filter: blur(4px);
}

.admin-topbar-actions,
.admin-user-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-label {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.role-badge,
.role-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.role-badge[data-role="super_admin"],
.role-pill[data-role="super_admin"] {
  background: rgba(234, 143, 71, 0.16);
  color: #9a4d13;
}

.role-badge[data-role="admin"],
.role-pill[data-role="admin"] {
  background: rgba(24, 53, 70, 0.08);
  color: var(--primary);
}

.admin-shell {
  width: min(100%, 1360px);
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 24px;
  padding: 28px 24px;
  border-radius: 28px;
  background: linear-gradient(180deg, #183546 0%, #102735 100%);
  color: #fff;
  box-shadow: var(--shadow);
}

.admin-sidebar .eyebrow,
.admin-sidebar p {
  color: rgba(255, 255, 255, 0.72);
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.sidebar-link {
  width: 100%;
  text-align: left;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.84);
  font-weight: 700;
}

.sidebar-link.is-active {
  background: #fff;
  color: var(--primary);
}

.admin-main {
  min-width: 0;
}

.admin-status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 20px;
  align-items: start;
  margin-bottom: 24px;
}

.admin-status-row h2 {
  font-size: clamp(1.9rem, 3vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.admin-status-side {
  display: grid;
  gap: 14px;
}

.admin-welcome-card {
  padding: 18px 20px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(234, 143, 71, 0.18), transparent 38%),
    linear-gradient(135deg, rgba(24, 53, 70, 0.96), rgba(35, 62, 79, 0.92));
  box-shadow: 0 20px 40px rgba(24, 53, 70, 0.16);
  color: #fff;
}

.admin-welcome-label {
  display: inline-block;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.admin-welcome-name {
  display: block;
  color: #ffd4ac;
  font-size: clamp(1.35rem, 2vw, 1.7rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.admin-welcome-copy {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
  line-height: 1.55;
}

.admin-view {
  display: none;
}

.admin-view.is-active {
  display: block;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.metric-card,
.admin-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.metric-card h3 {
  font-size: 2.2rem;
  letter-spacing: -0.05em;
}

.metric-label {
  margin-bottom: 8px;
  font-weight: 700;
}

.recent-products-list {
  display: grid;
  gap: 14px;
}

.recent-product-card,
.admin-user-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: var(--surface);
}

.admin-user-card {
  grid-template-columns: minmax(0, 1fr) auto;
}

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

.recent-product-card img {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
}

.recent-product-card h3,
.admin-user-card h3,
.product-card-copy h3,
.card-header h2 {
  font-size: 1rem;
  line-height: 1.3;
}

.admin-user-card p {
  color: var(--muted);
  font-size: 0.85rem;
  word-break: break-all;
}

.nav-config-card {
  margin-top: 24px;
}

.navigation-builder {
  display: grid;
  gap: 18px;
}

.nav-builder-item,
.nav-builder-column,
.nav-builder-link {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.nav-builder-item {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.nav-builder-item-header,
.nav-builder-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-builder-item-title {
  font-size: 1rem;
  font-weight: 700;
}

.nav-builder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.nav-builder-columns,
.nav-builder-links {
  display: grid;
  gap: 14px;
}

.nav-builder-column {
  padding: 16px;
  display: grid;
  gap: 14px;
  background: var(--surface-alt);
}

.nav-builder-link {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.nav-builder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-builder-note {
  color: var(--muted);
  font-size: 0.88rem;
}

.nav-builder-empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}

.nav-builder-remove {
  min-height: 38px;
}

.table-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 16px;
  margin-bottom: 20px;
}

.compact-field span {
  font-size: 0.84rem;
}

.tree-sort-field {
  min-width: 210px;
  max-width: 240px;
}

.table-wrap {
  overflow-x: auto;
}

.products-table {
  width: 100%;
  border-collapse: collapse;
}

.products-table th,
.products-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.products-table th {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.table-product-image {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
}

.table-actions,
.product-card-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.table-empty {
  margin: 12px 0;
}

.category-tree {
  display: grid;
  gap: 16px;
}

.tree-group,
.tree-subgroup {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  overflow: hidden;
}

.tree-group summary,
.tree-subgroup summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  font-weight: 700;
}

.tree-group summary::-webkit-details-marker,
.tree-subgroup summary::-webkit-details-marker {
  display: none;
}

.tree-group summary small,
.tree-subgroup summary small {
  color: var(--muted);
  font-weight: 600;
}

.tree-subgroups {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
}

.tree-product-list {
  list-style: none;
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.tree-product-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-alt);
}

.empty-inline {
  color: var(--muted);
  padding: 0 16px 16px;
}

.admin-grid,
.admin-management-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 420px;
  gap: 24px;
  align-items: start;
}

.admin-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sticky-card {
  position: sticky;
  top: 92px;
}

.card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.card-kicker {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.selection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.selection-grid > .form-field {
  padding: 18px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(234, 143, 71, 0.1), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 22px 46px rgba(24, 53, 70, 0.06);
}

.selection-grid > .form-field > .form-field {
  gap: 10px;
}

.selection-grid > .form-field > .form-field span {
  letter-spacing: 0.01em;
}

.product-list {
  display: grid;
  gap: 14px;
}

.trending-admin-grid {
  grid-template-columns: minmax(0, 1.15fr) 420px;
}

.trending-products-list,
.trending-catalog-list {
  display: grid;
  gap: 14px;
}

.trending-product-card,
.trending-catalog-card {
  display: grid;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,247,248,0.92));
  padding: 16px;
}

.trending-product-card {
  grid-template-columns: 88px minmax(0, 1fr) auto;
}

.trending-catalog-card {
  grid-template-columns: 72px minmax(0, 1fr) auto;
}

.trending-product-card img,
.trending-catalog-card img {
  width: 100%;
  border-radius: 16px;
  object-fit: cover;
  aspect-ratio: 1 / 1;
}

.trending-product-copy,
.trending-catalog-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.trending-product-copy h3,
.trending-catalog-copy h3 {
  font-size: 1rem;
  line-height: 1.35;
}

.trending-product-copy p,
.trending-catalog-copy p,
.trending-catalog-copy span {
  color: var(--muted);
}

.trending-product-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.trending-product-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.trending-catalog-card.is-featured {
  border-color: rgba(234, 143, 71, 0.38);
  box-shadow: 0 18px 36px rgba(234, 143, 71, 0.1);
}

.trending-toolbar {
  grid-template-columns: 1fr;
}

.image-upload-list {
  display: grid;
  gap: 10px;
}

.image-upload-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.image-upload-thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface-alt);
}

.image-upload-name {
  min-width: 0;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.image-upload-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.image-remove-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 800;
  line-height: 1;
}

.product-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.product-card img {
  width: 88px;
  height: 88px;
  border-radius: 14px;
  object-fit: cover;
}

.product-card-copy p {
  color: var(--muted);
  font-weight: 700;
}

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 24px;
  text-align: center;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  padding: 24px;
}

.admin-modal[hidden] {
  display: none !important;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 22, 0.56);
  backdrop-filter: blur(3px);
}

.admin-modal-dialog {
  position: relative;
  width: min(100%, 480px);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  padding: 28px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
  display: grid;
  gap: 18px;
  animation: modal-pop-in 0.22s ease;
}

.admin-modal-header {
  display: grid;
  gap: 6px;
}

.admin-modal-message {
  color: var(--muted);
  line-height: 1.65;
}

.admin-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

@keyframes modal-pop-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1100px) {
  body.admin-sidebar-open {
    overflow: hidden;
  }

  .admin-nav-toggle {
    display: inline-flex;
  }

  .admin-topbar-inner {
    justify-content: flex-start;
  }

  .admin-brand {
    margin-right: auto;
  }

  .dashboard-layout {
    display: block;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 95;
    width: min(88vw, 340px);
    height: 100vh;
    overflow-y: auto;
    border-radius: 0 28px 28px 0;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    padding-top: 104px;
  }

  body.admin-sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  body.admin-sidebar-open .admin-sidebar-backdrop {
    display: block !important;
  }

  body.admin-sidebar-open .admin-nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  body.admin-sidebar-open .admin-nav-toggle span:nth-child(2) {
    opacity: 0;
  }

  body.admin-sidebar-open .admin-nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .admin-main {
    width: 100%;
  }
}

@media (max-width: 1200px) {
  .dashboard-layout,
  .admin-grid,
  .admin-management-grid,
  .trending-admin-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .admin-sidebar,
  .sticky-card {
    position: static;
  }
}

@media (max-width: 900px) {
  .admin-status-row,
  .table-toolbar,
  .selection-grid,
  .nav-builder-grid,
  .recent-product-card,
  .product-card,
  .trending-product-card,
  .trending-catalog-card,
  .image-upload-item,
  .admin-user-card {
    grid-template-columns: 1fr;
  }

  .recent-product-card,
  .product-card,
  .trending-product-card,
  .trending-catalog-card,
  .admin-user-card {
    align-items: start;
  }

  .recent-product-card img,
  .product-card img,
  .trending-product-card img,
  .trending-catalog-card img,
  .table-product-image {
    width: 100%;
    height: 220px;
    aspect-ratio: auto;
  }

  .table-actions,
  .product-card-actions,
  .admin-user-actions,
  .admin-topbar-inner,
  .admin-topbar-actions,
  .admin-user-meta,
  .tree-product-item {
    flex-wrap: wrap;
  }
}

@media (max-width: 820px) {
  .orders-table,
  .orders-table thead,
  .orders-table tbody,
  .orders-table tr,
  .orders-table th,
  .orders-table td,
  .products-table,
  .products-table thead,
  .products-table tbody,
  .products-table tr,
  .products-table th,
  .products-table td {
    display: block;
    width: 100%;
  }

  .orders-table thead,
  .products-table thead {
    display: none;
  }

  .orders-table tr,
  .products-table tr {
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 8px 0;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 28px rgba(16, 24, 40, 0.06);
  }

  .orders-table tr.is-unread,
  .products-table tr.is-unread {
    border-color: rgba(94, 176, 107, 0.36);
  }

  .orders-table td,
  .products-table td {
    min-width: 0;
    display: grid;
    gap: 10px;
    align-items: start;
    border-bottom: 1px solid rgba(229, 231, 235, 0.82);
    padding: 14px 16px;
  }

  .orders-table td:last-child,
  .products-table td:last-child {
    border-bottom: 0;
  }

  .orders-table td::before,
  .products-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.2;
  }

  .orders-table td[colspan],
  .products-table td[colspan] {
    padding-left: 16px;
  }

  .orders-table td[colspan]::before,
  .products-table td[colspan]::before {
    content: none;
  }

  .orders-table .admin-save-order-btn,
  .orders-table .order-status-select,
  .products-table .table-actions,
  .products-table .secondary-btn,
  .products-table .danger-btn {
    width: 100%;
  }

  .products-table td[data-label="Image"] {
    gap: 12px;
  }

  .products-table td[data-label="Actions"] {
    gap: 12px;
  }

  .products-table .table-product-image {
    width: 100%;
    height: 200px;
  }

  .products-table .table-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 680px) {
  .admin-auth-shell,
  .admin-shell {
    padding-left: 16px;
    padding-right: 16px;
  }

  .admin-auth-panel,
  .metric-card,
  .admin-card,
  .admin-sidebar {
    padding: 20px;
  }

  .admin-modal-dialog {
    padding: 22px;
  }

  .admin-topbar-inner {
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
  }

  .products-table th,
  .products-table td {
    padding-left: 8px;
    padding-right: 8px;
  }

  .table-toolbar {
    grid-template-columns: 1fr;
  }

  .admin-status-row h2,
  .admin-auth-copy h1,
  .admin-sidebar h1 {
    word-break: break-word;
  }

  .primary-button,
  .secondary-button,
  .danger-btn,
  .secondary-btn {
    width: 100%;
  }

  .admin-modal-actions,
  .table-actions,
  .product-card-actions,
  .admin-user-actions,
  .nav-builder-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

.stats-grid-rich {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 168px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: auto -24px -42px auto;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(24, 53, 70, 0.12), transparent 68%);
}

.metric-card-highlight {
  background:
    radial-gradient(circle at top right, rgba(234, 143, 71, 0.22), transparent 34%),
    linear-gradient(135deg, rgba(24, 53, 70, 0.98), rgba(31, 67, 88, 0.94));
  color: #fff;
}

.metric-card-highlight .metric-label,
.metric-card-highlight .metric-footnote,
.metric-card-highlight h3 {
  color: inherit;
}

.metric-footnote {
  font-size: 0.88rem;
  color: var(--muted);
}

.dashboard-panels-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 24px;
  margin-bottom: 24px;
}

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

.chart-card {
  min-height: 360px;
}

.revenue-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 14px;
  min-height: 240px;
  padding: 12px 4px 0;
}

.revenue-bar {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.revenue-bar-track {
  width: 100%;
  min-height: 190px;
  display: flex;
  align-items: end;
  padding: 10px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(24, 53, 70, 0.06), rgba(24, 53, 70, 0.02));
}

.revenue-bar-fill {
  width: 100%;
  min-height: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ea8f47 0%, #c7652a 100%);
  box-shadow: 0 18px 28px rgba(199, 101, 42, 0.2);
}

.revenue-bar strong {
  font-size: 0.82rem;
}

.revenue-bar span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.revenue-legend {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.status-summary-card {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(247,247,248,0.9));
}

.status-summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.5rem;
  letter-spacing: -0.04em;
}

.status-summary-card span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.orders-mini-list,
.orders-admin-list {
  display: grid;
  gap: 14px;
}

.order-mini-card,
.order-admin-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(247,247,248,0.92));
  padding: 18px;
}

.order-mini-head,
.order-admin-head,
.order-admin-meta,
.order-admin-actions,
.package-overview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.order-mini-head h3,
.order-admin-head h3 {
  font-size: 1.04rem;
}

.order-mini-copy,
.order-admin-copy,
.order-admin-customer {
  display: grid;
  gap: 6px;
}

.order-mini-copy p,
.order-admin-copy p,
.order-admin-customer p {
  color: var(--muted);
}

.order-admin-body {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 18px;
  margin-top: 16px;
}

.order-item-stack {
  display: grid;
  gap: 10px;
}

.order-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid rgba(229, 231, 235, 0.9);
}

.order-item-row p {
  color: var(--muted);
  font-size: 0.88rem;
}

.order-meta-pills,
.package-overview {
  gap: 10px;
}

.order-meta-pill,
.package-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(24, 53, 70, 0.08);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
}

.order-meta-pill.is-accent,
.package-pill.is-accent {
  background: rgba(234, 143, 71, 0.16);
  color: #9a4d13;
}

.package-controls {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(24, 53, 70, 0.04);
  border: 1px solid rgba(24, 53, 70, 0.08);
}

.package-controls label {
  display: grid;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
}

.orders-toolbar {
  align-items: end;
}

.package-overview {
  margin-bottom: 18px;
}

.admin-save-order-btn {
  min-height: 44px;
}

@media (max-width: 1200px) {
  .dashboard-panels-grid,
  .dashboard-panels-grid-wide,
  .stats-grid-rich,
  .status-summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .order-admin-body,
  .revenue-chart {
    grid-template-columns: 1fr;
  }

  .revenue-chart {
    align-items: stretch;
  }

  .revenue-bar-track {
    min-height: 120px;
  }
}

.orders-table-wrap {
  margin-top: 4px;
}

.orders-table th,
.orders-table td {
  min-width: 120px;
  vertical-align: middle;
}

.order-table-primary {
  display: grid;
  gap: 4px;
}

.order-table-primary strong {
  font-size: 0.95rem;
}

.order-table-primary span,
.order-items-preview span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.order-items-preview {
  display: grid;
  gap: 4px;
  min-width: 220px;
}

.order-status-select {
  min-width: 170px;
}

.orders-table .admin-save-order-btn {
  min-width: 120px;
}

.sidebar-link {
  position: relative;
}

.sidebar-link.has-alert {
  background: rgba(112, 189, 123, 0.18);
  color: #f1fff2;
  box-shadow: inset 0 0 0 1px rgba(129, 212, 141, 0.18);
}

.sidebar-link.has-alert::after {
  content: attr(data-alert-count);
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #77c878 0%, #43a047 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(67, 160, 71, 0.22);
}

.admin-notification-tray {
  position: fixed;
  top: 92px;
  right: 24px;
  z-index: 450;
  display: grid;
  gap: 12px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.admin-order-toast {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(129, 212, 141, 0.26), transparent 32%),
    linear-gradient(135deg, rgba(20, 58, 35, 0.98), rgba(44, 92, 58, 0.94));
  color: #effff0;
  box-shadow: 0 20px 45px rgba(28, 74, 44, 0.28);
  border: 1px solid rgba(173, 233, 178, 0.2);
  transform: translateY(0);
  opacity: 1;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.admin-order-toast.is-hiding {
  opacity: 0;
  transform: translateY(-8px);
}

.admin-order-toast strong {
  font-size: 0.95rem;
}

.admin-order-toast span {
  color: rgba(239, 255, 240, 0.82);
  font-size: 0.88rem;
  line-height: 1.5;
}

.order-mini-card.is-unread,
.orders-table tr.is-unread td {
  background:
    radial-gradient(circle at top right, rgba(139, 214, 151, 0.18), transparent 38%),
    linear-gradient(180deg, rgba(243, 255, 245, 0.96), rgba(232, 249, 236, 0.92));
}

.order-mini-card.is-unread {
  border-color: rgba(94, 176, 107, 0.45);
  box-shadow: 0 18px 34px rgba(94, 176, 107, 0.12);
}

.orders-table tr.is-unread td:first-child {
  border-left: 4px solid #55b966;
}

.orders-table tr.is-unread td {
  border-bottom-color: rgba(94, 176, 107, 0.18);
}

.orders-table tr.is-unread .order-table-primary strong,
.orders-table tr.is-unread .order-items-preview strong {
  color: #1f6a2b;
}

@media (max-width: 1100px) {
  .admin-status-row {
    grid-template-columns: 1fr;
  }

  .dashboard-panels-grid,
  .dashboard-panels-grid-wide,
  .stats-grid-rich,
  .status-summary-grid,
  .selection-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .admin-notification-tray {
    top: 76px;
    right: 16px;
    left: 16px;
    width: auto;
  }

  .sidebar-link.has-alert::after {
    right: 10px;
  }
}

.full-span-toolbar {
  grid-column: 1 / -1;
}

.admin-modal-dialog-wide {
  width: min(100%, 980px);
  max-height: min(88vh, 920px);
  overflow: auto;
}

.order-details-content {
  display: grid;
  gap: 18px;
}

.order-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.order-detail-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,247,248,0.92));
  padding: 20px;
  display: grid;
  gap: 14px;
}

.order-detail-card h3 {
  font-size: 1.05rem;
}

.order-detail-card-wide {
  grid-column: 1 / -1;
}

.order-detail-stack {
  display: grid;
  gap: 8px;
}

.order-detail-stack p {
  color: var(--muted);
  line-height: 1.55;
}

.order-detail-stack strong {
  color: var(--text);
}

.order-detail-items {
  display: grid;
  gap: 12px;
}

.order-detail-item-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid rgba(229, 231, 235, 0.92);
}

.order-detail-item-row img {
  width: 82px;
  height: 82px;
  border-radius: 16px;
  object-fit: cover;
}

.order-detail-item-row h4 {
  font-size: 0.98rem;
  margin-bottom: 4px;
}

.order-detail-item-row p,
.order-detail-item-row span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.order-detail-customization {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(248, 241, 233, 0.9);
  border: 1px solid rgba(212, 198, 182, 0.9);
}

.order-detail-customization strong {
  color: #3a2d25;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.order-detail-customization span {
  color: #65544a;
  font-size: 0.82rem;
  line-height: 1.5;
}

.admin-order-view-btn {
  min-width: 90px;
}

.orders-table td:first-child,
.orders-table th:first-child {
  min-width: 96px;
}

@media (max-width: 900px) {
  .order-details-grid {
    grid-template-columns: 1fr;
  }

  .order-detail-card-wide {
    grid-column: auto;
  }
}

@media (max-width: 680px) {
  .order-detail-item-row {
    grid-template-columns: 1fr;
  }

  .order-detail-item-row img {
    width: 100%;
    height: 220px;
  }
}

@media (max-width: 1100px) {
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 95;
  }

  .sticky-card {
    position: static;
  }
}
