:root {
  --green-950: #03301e;
  --green-900: #06472c;
  --green-800: #075c35;
  --green-700: #08713e;
  --green-600: #10864b;
  --green-100: #dff2df;
  --green-50: #f0f8ef;
  --amber-700: #9b5100;
  --amber-200: #ffd783;
  --amber-100: #fff0c9;
  --red-700: #a52222;
  --red-100: #fee5e5;
  --ink: #13251d;
  --muted: #5b6962;
  --border: #ccd5d0;
  --surface: #fffefa;
  --canvas: #f7f5ee;
  --shadow: 0 12px 32px rgb(3 48 30 / 10%);
  --radius: 18px;
  --content: 1440px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 50% 0, #fff 0, var(--canvas) 55%); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { min-height: 44px; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--green-800); }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid #f1a51a; outline-offset: 3px; }
.skip-link { position: fixed; z-index: 1000; left: 12px; top: -80px; padding: 12px 18px; background: #fff; border-radius: 10px; }
.skip-link:focus { top: 12px; }
.boot { min-height: 70vh; display: grid; place-content: center; text-align: center; gap: 16px; }
.spinner { width: 40px; height: 40px; margin: auto; border: 4px solid var(--green-100); border-top-color: var(--green-700); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.topbar { position: sticky; top: 0; z-index: 30; color: #fff; background: linear-gradient(120deg, var(--green-950), var(--green-700)); box-shadow: 0 5px 20px rgb(0 0 0 / 15%); }
.topbar-inner { max-width: var(--content); margin: auto; min-height: 74px; padding: 10px 22px; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; font-weight: 850; letter-spacing: .02em; white-space: nowrap; }
.brand-mark { width: 43px; height: 30px; display: grid; place-items: center; border: 2px solid currentColor; border-radius: 60% 40% 60% 40%; transform: skewX(-10deg); font-size: 17px; }
.brand small { display: block; opacity: .78; font-size: .69rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.global-search { flex: 1; max-width: 660px; margin-inline: auto; position: relative; }
.global-search input { width: 100%; border: 0; border-radius: 13px; padding: 12px 18px 12px 46px; background: #fffdfa; color: var(--ink); }
.global-search span { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--green-800); font-size: 1.25rem; }
.account-menu { display: flex; gap: 8px; align-items: center; }
.account-menu a, .account-menu button { color: #fff; background: transparent; border: 1px solid rgb(255 255 255 / 28%); border-radius: 12px; padding: 8px 13px; text-decoration: none; }
.user-name { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.shell { max-width: var(--content); margin: auto; padding: 26px 22px 96px; }
.page-head { display: flex; gap: 18px; justify-content: space-between; align-items: end; margin-bottom: 22px; }
.page-head h1, .page-head h2 { margin: 0; line-height: 1.08; color: var(--green-950); }
.page-head h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); }
.page-head p { color: var(--muted); margin: 7px 0 0; }
.eyebrow { color: var(--green-700); font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.layout { display: grid; grid-template-columns: 230px minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.layout.no-cart { grid-template-columns: 230px minmax(0, 1fr); }
.sidebar, .cart-panel, .panel { background: rgb(255 254 250 / 94%); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.sidebar { position: sticky; top: 98px; padding: 12px; }
.sidebar-title { padding: 8px 10px 14px; font-size: 1.15rem; font-weight: 820; }
.sidebar a { min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink); border-bottom: 1px solid #e7ece8; }
.sidebar a:last-child { border-bottom: 0; }
.sidebar a:hover, .sidebar a.active { background: var(--green-100); color: var(--green-950); font-weight: 760; }
.cart-panel { position: sticky; top: 98px; overflow: hidden; }
.cart-panel h2 { margin: 0; padding: 20px; color: var(--green-950); border-bottom: 1px solid var(--border); }
.cart-body { padding: 0 20px 20px; }
.cart-mini-line { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.cart-mini-line small { color: var(--muted); }
.cart-total { display: flex; justify-content: space-between; gap: 20px; padding: 18px 0; font-size: 1.17rem; font-weight: 820; color: var(--green-950); }

.filters { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 18px; }
.chip, .status { display: inline-flex; min-height: 32px; align-items: center; border-radius: 999px; padding: 5px 11px; font-weight: 760; font-size: .84rem; }
.chip { color: var(--green-900); background: transparent; border: 1px solid var(--green-700); text-decoration: none; }
.chip.active { color: #fff; background: var(--green-700); }
.status.available, .status.published, .status.confirmed, .status.converted { background: var(--green-100); color: var(--green-900); }
.status.preoffer, .status.pending, .status.review { background: var(--amber-100); color: var(--amber-700); }
.status.hidden, .status.disabled, .status.cancelled { background: #e7e9e8; color: #4a504d; }
.status.error, .status.declined { background: var(--red-100); color: var(--red-700); }
.catalog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fish-card { min-height: 320px; border-radius: 17px; overflow: hidden; position: relative; background: var(--green-950); color: #fff; box-shadow: 0 8px 22px rgb(3 48 30 / 15%); }
.fish-card .media { height: 100%; min-height: 320px; }
.fish-card img { width: 100%; height: 100%; min-height: 320px; object-fit: cover; }
.media-placeholder { width: 100%; min-height: 210px; display: grid; place-content: center; text-align: center; gap: 8px; padding: 24px; color: #eaf5ed; background: radial-gradient(circle at 30% 25%, #2f8551, var(--green-950)); }
.media-placeholder strong { font-size: clamp(2rem, 6vw, 4rem); opacity: .8; }
.media-placeholder small { max-width: 180px; }
.fish-card .media-placeholder { place-content: start center; padding-top: 42px; }
.fish-card::after { content: ""; position: absolute; inset: 35% 0 0; background: linear-gradient(transparent, rgb(0 0 0 / 88%)); pointer-events: none; }
.fish-card-content { position: absolute; z-index: 2; inset: auto 0 0; padding: 18px; }
.fish-card h3 { margin: 0 0 6px; font-size: clamp(1.2rem, 2.5vw, 1.55rem); font-style: italic; line-height: 1.08; }
.fish-card .scientific { opacity: .75; font-size: .8rem; }
.fish-card-footer { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-top: 11px; }
.price { font-size: 1.2rem; font-weight: 820; }
.link-button, .primary, .secondary, .danger, .ghost { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; border-radius: 11px; padding: 10px 17px; font-weight: 790; text-decoration: none; border: 1px solid transparent; }
.primary, .link-button { color: #fff; background: var(--green-700); border-color: #56bc77; }
.primary:hover, .link-button:hover { background: var(--green-600); }
.secondary { color: var(--green-800); background: #fff; border-color: var(--green-700); }
.ghost { color: var(--ink); background: transparent; border-color: var(--border); }
.danger { color: var(--red-700); background: var(--red-100); border-color: #efbebe; }
.wide { width: 100%; }

.panel { padding: 22px; }
.panel + .panel { margin-top: 18px; }
.panel h2, .panel h3 { margin-top: 0; color: var(--green-950); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid > .full { grid-column: 1 / -1; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label, .field > span { font-weight: 720; }
.field small, .help { color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #9eaaa4; border-radius: 11px; background: #fff; padding: 11px 13px; color: var(--ink); }
.field textarea { min-height: 96px; resize: vertical; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.notice { padding: 14px 16px; border-left: 4px solid var(--green-700); border-radius: 10px; background: var(--green-50); }
.notice.warning { border-color: #d98800; background: var(--amber-100); }
.notice.error { border-color: var(--red-700); background: var(--red-100); }
.empty { min-height: 220px; display: grid; place-content: center; text-align: center; color: var(--muted); padding: 30px; }

.detail { display: grid; grid-template-columns: minmax(280px, .95fr) minmax(320px, 1.05fr); gap: 24px; }
.detail-media { overflow: hidden; border-radius: var(--radius); min-height: 380px; background: var(--green-950); }
.detail-media img, .detail-media .media-placeholder { width: 100%; height: 100%; min-height: 380px; object-fit: cover; }
.fraction-picker { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin: 18px 0; }
.fraction-picker button { border: 0; border-right: 1px solid var(--border); background: #fff; color: var(--ink); }
.fraction-picker button:last-child { border-right: 0; }
.fraction-picker button.active { background: var(--green-700); color: #fff; }
.variant-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.variant-picker p { flex-basis: 100%; margin: 0; }
.variant-meta { padding: 12px; border-left: 4px solid var(--green-700); background: var(--green-50); }
.stepper { max-width: 240px; display: grid; grid-template-columns: 52px 1fr 52px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.stepper button, .stepper input { border: 0; text-align: center; background: #fff; }
.stepper input { width: 100%; font-size: 1.2rem; font-weight: 800; }
.line-summary { display: flex; justify-content: space-between; gap: 20px; padding: 18px 0; margin-top: 16px; border-top: 1px solid var(--border); }

.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: #eef1ef; color: var(--green-950); }
tbody tr:last-child td { border-bottom: 0; }
.row-link { color: inherit; font-weight: 780; text-decoration: none; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { padding: 17px; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
.stat strong { display: block; font-size: 1.85rem; color: var(--green-900); }
.stat span { color: var(--muted); }
.admin-shell { display: grid; grid-template-columns: 245px minmax(0, 1fr); min-height: calc(100vh - 74px); }
.admin-nav { color: #fff; background: var(--green-950); padding: 20px 13px; }
.admin-nav h2 { padding-inline: 12px; font-size: 1rem; }
.admin-nav a { display: flex; align-items: center; gap: 10px; color: #fff; min-height: 48px; border-radius: 11px; padding: 10px 12px; text-decoration: none; }
.admin-nav a:hover, .admin-nav a.active { color: var(--green-950); background: #c6edbd; font-weight: 800; }
.admin-content { min-width: 0; padding: 28px 28px 90px; }
.panel-heading, .dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.panel-heading h2, .panel-heading h3, .dialog-heading h2 { margin: 0; }
.panel-heading .help { margin: 6px 0 16px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.editor-dialog { width: min(1040px, calc(100vw - 28px)); max-width: none; max-height: min(92dvh, 960px); padding: 0; border: 0; border-radius: 20px; color: var(--ink); background: var(--surface); box-shadow: 0 24px 80px rgb(0 0 0 / 30%); }
.editor-dialog.narrow { width: min(620px, calc(100vw - 28px)); }
.editor-dialog::backdrop { background: rgb(2 25 15 / 70%); backdrop-filter: blur(2px); }
.dialog-card { max-height: min(92dvh, 960px); overflow-y: auto; padding: 26px; }
.dialog-heading { position: sticky; z-index: 3; top: -26px; margin: -26px -26px 20px; padding: 22px 26px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.icon-button { min-width: 46px; padding: 6px 12px; font-size: 1.5rem; line-height: 1; }
.dialog-actions { position: sticky; z-index: 2; bottom: -26px; display: flex; justify-content: end; gap: 10px; margin: 24px -26px -26px; padding: 16px 26px; background: var(--surface); border-top: 1px solid var(--border); }
.editor-section { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--border); }
.variant-admin-list { display: grid; gap: 14px; }
.variant-admin-card { border: 1px solid var(--border); border-radius: 13px; padding: 14px; background: var(--green-50); }
.packaging-rows { display: grid; gap: 12px; }
.packaging-row { display: grid; grid-template-columns: minmax(150px, 1.5fr) minmax(125px, 1fr) minmax(110px, .8fr) minmax(130px, 1fr) 90px auto; gap: 10px; align-items: end; padding: 13px; border: 1px solid var(--border); border-radius: 13px; background: var(--green-50); }
.package-active { align-self: center; white-space: nowrap; }
.package-remove { grid-column: 1 / -1; justify-self: end; }
.media-admin-grid { display: grid; gap: 12px; }
.media-admin-card { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 13px; }
.media-admin-card p { margin: 6px 0; }
.media-admin-card small { color: var(--muted); overflow-wrap: anywhere; }
.media-thumb { width: 150px; height: 100px; overflow: hidden; border-radius: 10px; background: var(--green-950); }
.media-thumb img, .media-thumb.media-placeholder { width: 100%; height: 100%; min-height: 100px; object-fit: cover; }
.media-thumb.media-placeholder strong { font-size: 2rem; }
.group-admin-thumb .media-thumb { width: 92px; height: 64px; }
.group-admin-thumb .media-thumb img, .group-admin-thumb .media-thumb.media-placeholder { min-height: 64px; }
.group-admin-thumb .media-thumb small { display: none; }
.review-table input, .review-table select { width: 100%; min-width: 150px; border: 1px solid #9eaaa4; border-radius: 9px; padding: 9px 10px; background: #fff; color: var(--ink); }
.review-table input[readonly] { background: #eef1ef; }
.conversion-panel > .primary { margin-top: 14px; }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, .9fr) minmax(420px, 1.1fr); }
.auth-visual { display: grid; place-content: center; padding: 40px; color: #fff; background: radial-gradient(circle at 65% 20%, #2c8b51, var(--green-950) 65%); }
.auth-visual .brand { font-size: 2rem; }
.auth-visual p { max-width: 520px; font-size: 1.2rem; color: #e6f4e8; }
.auth-form { display: grid; place-content: center; padding: 32px; }
.auth-card { width: min(460px, 100%); padding: 30px; border: 1px solid var(--border); border-radius: 22px; background: #fffefa; box-shadow: var(--shadow); }
.auth-card h1 { color: var(--green-950); }
.checkbox { display: flex; gap: 10px; align-items: center; }
.checkbox input { width: 20px; min-height: 20px; }

.mobile-nav { display: none; }
.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 20px; display: grid; gap: 10px; width: min(390px, calc(100% - 36px)); }
.toast { padding: 14px 16px; border-radius: 12px; color: #fff; background: var(--green-900); box-shadow: var(--shadow); }
.toast.error { background: var(--red-700); }
.skeleton { min-height: 160px; border-radius: 16px; background: linear-gradient(90deg, #edf0ed 25%, #f7faf7 45%, #edf0ed 65%); background-size: 300% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -300% 0; } }

@media (max-width: 1120px) {
  .layout { grid-template-columns: 200px minmax(0, 1fr); }
  .cart-panel { position: static; grid-column: 2; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .topbar-inner { min-height: 66px; padding-inline: 14px; gap: 12px; }
  .brand span:not(.brand-mark), .account-menu .user-name { display: none; }
  .global-search { order: 3; flex-basis: 100%; max-width: none; }
  .topbar-inner { flex-wrap: wrap; }
  .shell { padding: 20px 14px 104px; }
  .layout, .layout.no-cart { grid-template-columns: 1fr; }
  .sidebar { position: static; display: flex; gap: 7px; overflow-x: auto; padding: 7px; }
  .sidebar-title { display: none; }
  .sidebar a { white-space: nowrap; border: 0; }
  .cart-panel { grid-column: 1; }
  .catalog-grid { grid-template-columns: 1fr; }
  .fish-card { min-height: 300px; }
  .fish-card .media, .fish-card img { min-height: 300px; }
  .detail { grid-template-columns: 1fr; }
  .detail-media, .detail-media img, .detail-media .media-placeholder { min-height: 300px; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-nav { display: flex; gap: 6px; overflow-x: auto; padding: 8px; }
  .admin-nav h2 { display: none; }
  .admin-nav a { white-space: nowrap; }
  .admin-content { padding: 22px 14px 100px; }
  .packaging-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .package-remove { grid-column: 1 / -1; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { min-height: 210px; padding: 28px; }
  .auth-visual p { font-size: 1rem; }
  .auth-form { padding: 22px 14px; }
  .mobile-nav { position: fixed; z-index: 35; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(3, 1fr); padding: 7px max(8px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); background: #fff; border-top: 1px solid var(--border); box-shadow: 0 -8px 24px rgb(0 0 0 / 9%); }
  .mobile-nav a { min-height: 48px; display: grid; place-content: center; text-align: center; color: var(--green-900); text-decoration: none; font-size: .79rem; font-weight: 750; }
}

@media (max-width: 520px) {
  .topbar .account-menu .secondary-label { display: none; }
  .page-head { align-items: start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .panel { padding: 17px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat strong { font-size: 1.45rem; }
  .fraction-picker { grid-template-columns: 1fr; }
  .fraction-picker button { border-right: 0; border-bottom: 1px solid var(--border); }
  .fraction-picker button:last-child { border-bottom: 0; }
  .actions > * { flex: 1 1 100%; }
  .panel-heading { align-items: stretch; flex-direction: column; }
  .editor-dialog, .editor-dialog.narrow { width: calc(100vw - 12px); max-height: 96dvh; border-radius: 14px; }
  .dialog-card { max-height: 96dvh; padding: 18px; }
  .dialog-heading { top: -18px; margin: -18px -18px 18px; padding: 16px 18px 12px; }
  .dialog-actions { bottom: -18px; margin: 22px -18px -18px; padding: 13px 18px calc(13px + env(safe-area-inset-bottom)); flex-direction: column-reverse; }
  .packaging-row { grid-template-columns: 1fr; }
  .package-remove { grid-column: auto; justify-self: stretch; }
  .media-admin-card { grid-template-columns: 1fr; }
  .media-thumb { width: 100%; height: 160px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
