@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Readex+Pro:wght@300;400;500;600;700&display=swap");

:root {
  --ink: #17211d;
  --green: #1b3028;
  --gold: #a88a56;
  --gold-pale: #f4eddd;
  --paper: #fffefa;
  --canvas: #f5f4f0;
  --line: #e8e5dd;
  --muted: #898d85;
  --font: "Readex Pro", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: var(--font); font-weight: 300; }
button, input, textarea, select { font: inherit; }
button, a, label.file-button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
.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; }
.admin-topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding-inline: max(5.5%, calc((100% - 1350px) / 2)); background: #14211c; color: white; }
.admin-brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; overflow: hidden; border: 1px solid #c8a86c; border-radius: 50%; background: #536956; color: #dfc997; font-size: 24px; }
.brand-mark img { width: 100%; height: 100%; display: block; border-radius: inherit; object-fit: cover; }
.admin-brand > span:last-child { display: flex; flex-direction: column; gap: 3px; }
.admin-brand strong { font-size: 13px; font-weight: 500; }
.admin-brand small { color: #aeb8b0; font-size: 9px; }
.view-site { padding: 10px 14px; border: 1px solid rgb(223 201 151 / 50%); color: #dfc997; font-size: 10px; }
.view-site span { margin-inline-start: 8px; }
.logout-button { cursor: pointer; background: transparent; font-family: inherit; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: #14211c; }
.login-card { width: min(100%, 410px); padding: 36px; border: 1px solid #ded9cc; background: var(--paper); text-align: center; }
.login-logo { width: 76px; height: 76px; margin-bottom: 20px; border-radius: 50%; object-fit: cover; }
.login-card h1 { margin: 0 0 10px; font-size: 24px; font-weight: 400; }
.login-intro { margin-bottom: 24px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.login-form { display: grid; gap: 16px; text-align: right; }
.login-form label { display: grid; gap: 7px; color: #555d56; font-size: 10px; }
.login-form input { width: 100%; min-height: 42px; padding: 10px; border: 1px solid #e2e0d8; background: white; }
.login-error { padding: 10px; background: #fff0ef; color: #8b332c; font-size: 11px; line-height: 1.7; }
.login-back { display: inline-block; margin-top: 20px; color: var(--gold); font-size: 10px; }
.admin-shell { width: min(1350px, 89%); min-height: calc(100vh - 140px); display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 45px; margin: 0 auto; padding-block: 42px 60px; }
.admin-sidebar { display: flex; flex-direction: column; }
.sidebar-title { margin: 5px 0 17px; color: #92958d; font-size: 10px; }
.admin-tabs { display: flex; flex-direction: column; gap: 5px; }
.admin-tab { min-height: 45px; display: flex; align-items: center; gap: 11px; padding: 0 12px; border: 0; border-radius: 4px; background: transparent; color: #697068; text-align: right; font-size: 11px; transition: background .2s, color .2s; }
.admin-tab > span:first-child { width: 19px; color: #a38a5e; font-size: 15px; text-align: center; }
.admin-tab:hover { background: #ecebe5; }
.admin-tab.is-active { background: var(--green); color: #fff; }
.admin-tab.is-active > span:first-child { color: #dfc997; }
.tab-count { margin-inline-start: auto; color: #aeb8b0; font: 10px "DM Sans", sans-serif; }
.sidebar-note { display: flex; gap: 10px; margin-top: 40px; padding: 14px; border: 1px solid #e8e2d5; background: #faf8f2; color: #82867e; }
.sidebar-note > span { color: var(--gold); }
.sidebar-note p { margin: 0; font-size: 9px; line-height: 1.9; }
.admin-content { min-width: 0; }
.admin-panel { display: none; }
.admin-panel.is-active { display: block; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin: 0 0 26px; }
.panel-heading h1 { margin: 0 0 6px; font-size: 25px; font-weight: 400; }
.panel-heading p:not(.panel-eyebrow) { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.8; }
.panel-eyebrow { margin: 0 0 6px; color: var(--gold); font-size: 9px; }
.settings-form, .backup-box, .product-row, .category-add-form { border: 1px solid var(--line); background: var(--paper); }
.settings-form { padding: 27px 30px 24px; }
.form-section-title { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; }
.form-section-title:not(:first-child) { margin-top: 34px; }
.form-section-title > span { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: var(--gold-pale); color: #907449; font: 12px "DM Sans", sans-serif; }
.form-section-title h2, .backup-box h2 { margin: 0 0 3px; font-size: 13px; font-weight: 500; }
.form-section-title p, .backup-box p { margin: 0; color: var(--muted); font-size: 9px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 19px; }
.form-grid label, .category-add-form label { display: flex; flex-direction: column; gap: 7px; color: #555d56; font-size: 9px; }
.field-wide { grid-column: 1 / -1; }
.form-grid input, .form-grid textarea, .form-grid select, .category-add-form input { width: 100%; min-height: 39px; padding: 9px 11px; border: 1px solid #e2e0d8; border-radius: 2px; outline: 0; background: #fff; color: var(--ink); font-size: 10px; }
.form-grid textarea { min-height: 70px; resize: vertical; line-height: 1.7; }
.form-grid input:focus, .form-grid textarea:focus, .form-grid select:focus, .category-add-form input:focus, .admin-search:focus-within { border-color: #b7a178; box-shadow: 0 0 0 2px rgb(183 161 120 / 12%); }
.form-actions { display: flex; align-items: center; gap: 19px; margin-top: 22px; }
.primary-button, .secondary-button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 17px; border: 1px solid transparent; border-radius: 2px; font-size: 10px; transition: background .2s, transform .2s; }
.primary-button { background: var(--green); color: #fff; }
.primary-button:hover { background: #294438; transform: translateY(-1px); }
.secondary-button { border-color: #dcd9d0; background: #fff; color: #596059; }
.secondary-button:hover { background: #f6f4ee; }
.currency-note { color: var(--muted); font-size: 9px; }
.currency-note strong { color: #82683d; font-weight: 500; }
.backup-box { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; padding: 17px 20px; }
.backup-actions { display: flex; gap: 8px; }
.backup-actions .secondary-button { font-size: 9px; }
.file-button { position: relative; overflow: hidden; cursor: pointer; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.status-message { position: sticky; z-index: 4; top: 10px; margin-bottom: 18px; padding: 12px 15px; border: 1px solid #bbd4c2; background: #edf7ef; color: #315b3b; font-size: 10px; line-height: 1.7; }
.status-message.is-error { border-color: #e1b5b0; background: #fff0ef; color: #8b332c; }
.panel-heading-row { align-items: center; }
.product-heading-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.batch-editor { margin-bottom: 20px; padding: 21px; border: 1px solid #e4dece; background: #fbfaf6; }
.batch-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.batch-heading h2 { margin: 0 0 5px; font-size: 15px; font-weight: 500; }
.batch-heading p, .batch-note { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.8; }
.batch-rows { display: grid; gap: 10px; }
.batch-row { display: grid; grid-template-columns: 30px minmax(110px, 1fr) minmax(115px, .75fr) minmax(115px, .72fr) minmax(150px, 1.3fr) minmax(150px, 1.2fr) 34px; align-items: end; gap: 9px; padding: 12px; border: 1px solid var(--line); background: #fff; }
.batch-row-number { align-self: center; color: #a38a5e; font: 11px "DM Sans", sans-serif; text-align: center; }
.batch-row label { display: flex; flex-direction: column; gap: 6px; color: #646a62; font-size: 8px; }
.batch-row input, .batch-row select { width: 100%; min-width: 0; height: 36px; padding: 7px 8px; border: 1px solid #e2e0d8; border-radius: 2px; outline: 0; background: #fff; color: var(--ink); font-size: 9px; }
.batch-row input:focus, .batch-row select:focus { border-color: #b7a178; box-shadow: 0 0 0 2px rgb(183 161 120 / 12%); }
.batch-remove { width: 32px; height: 35px; border: 1px solid #e2dfd7; background: #fff; color: #777; font-size: 17px; }
.batch-remove:hover { border-color: #c97b70; color: #9e4138; }
.batch-note { margin-top: 11px; }
.batch-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 15px; }
.batch-error { color: #a23c33; }
.admin-search { max-width: 400px; display: flex; align-items: center; gap: 8px; margin-bottom: 16px; padding: 0 12px; border: 1px solid var(--line); background: #fff; color: #93968f; }
.admin-search > span:first-child { font-size: 20px; }
.admin-search input { width: 100%; height: 40px; border: 0; outline: 0; background: transparent; font-size: 10px; }
.product-list { display: grid; gap: 10px; }
.product-row { display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; align-items: center; gap: 15px; padding: 12px; }
.product-row > img { width: 78px; height: 68px; border-radius: 2px; background: #e9e7df; object-fit: cover; }
.product-summary { min-width: 0; }
.product-summary h3 { margin: 0 0 5px; overflow: hidden; font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.product-summary p { margin: 0 0 5px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.product-meta { display: flex; flex-wrap: wrap; gap: 10px; color: #a1895d; font-size: 9px; }
.product-actions { display: flex; gap: 6px; }
.small-button { min-height: 31px; padding: 0 10px; border: 1px solid #e2dfd7; background: #fff; color: #636a62; font-size: 9px; }
.small-button:hover { border-color: #b8a47a; }
.small-button.delete:hover { border-color: #c97b70; color: #9e4138; }
.admin-empty { padding: 35px 10px; color: var(--muted); text-align: center; font-size: 11px; }
.category-add-form { display: flex; align-items: end; gap: 12px; padding: 18px; }
.category-add-form label { flex: 1; }
.category-list-heading, .managed-category-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 70px 245px; align-items: center; gap: 12px; }
.category-list-heading { padding: 18px 14px 10px; color: #8b8e87; font-size: 9px; }
.managed-category-row { min-height: 61px; padding: 10px 14px; border: 1px solid var(--line); border-bottom: 0; background: var(--paper); }
.managed-category-row:last-child { border-bottom: 1px solid var(--line); }
.managed-category-row input { width: 100%; height: 34px; padding: 6px 9px; border: 1px solid #e4e1d8; outline: 0; background: #fff; font-size: 10px; }
.managed-category-row .category-position { width: 100%; height: 34px; padding: 4px; border: 1px solid #e4e1d8; background: #fff; font-size: 11px; }
.managed-category-row .category-product-count { color: #858980; font: 10px "DM Sans", sans-serif; }
.category-row-actions { display: flex; gap: 6px; }
.category-reset-image { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; }
.category-reset-image input { width: auto; }
.product-dialog { width: min(650px, calc(100% - 30px)); max-height: min(90vh, 850px); padding: 0; border: 1px solid var(--line); background: var(--paper); color: var(--ink); box-shadow: 0 20px 70px rgb(0 0 0 / 22%); }
.product-dialog::backdrop { background: rgb(13 20 17 / 62%); backdrop-filter: blur(2px); }
.product-dialog > form { padding: 24px 27px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 19px; }
.dialog-heading h2 { margin: 0; font-size: 20px; font-weight: 400; }
.dialog-close { width: 33px; height: 33px; border: 1px solid var(--line); background: #fff; color: #777; font-size: 23px; line-height: 1; }
.upload-label input { min-height: auto; padding: 8px; }
.upload-label small { color: var(--muted); font-size: 8px; }
.image-preview-wrap { min-height: 100px; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px dashed #dedbd2; background: #f7f6f2; color: #969991; font-size: 9px; }
.image-preview-wrap img { width: 100%; height: 150px; object-fit: cover; }
.dialog-error { margin: 13px 0 0; color: #a23c33; font-size: 9px; line-height: 1.7; }
.dialog-actions { display: flex; justify-content: flex-start; gap: 8px; margin-top: 19px; }
.admin-footer { min-height: 64px; display: flex; justify-content: space-between; align-items: center; gap: 15px; padding-inline: max(5.5%, calc((100% - 1350px) / 2)); border-top: 1px solid #e3e1da; background: #fbfaf6; color: #90938b; font-size: 9px; }

@media (max-width: 800px) {
  .admin-shell { width: 92%; grid-template-columns: 1fr; gap: 22px; padding-block: 25px 42px; }
  .admin-sidebar { gap: 8px; }
  .sidebar-title { margin: 0; }
  .admin-tabs { flex-direction: row; overflow-x: auto; }
  .admin-tab { flex: 0 0 auto; padding-inline: 10px; font-size: 9px; }
  .sidebar-note { display: none; }
  .panel-heading h1 { font-size: 22px; }
  .batch-row { grid-template-columns: 25px repeat(2, minmax(0, 1fr)); align-items: start; }
  .batch-row-number { grid-row: span 2; padding-top: 28px; }
  .batch-row label:nth-of-type(4), .batch-row label:nth-of-type(5) { grid-column: span 2; }
  .batch-remove { grid-column: 3; justify-self: end; }
}
@media (max-width: 560px) {
  .admin-topbar { height: 66px; padding-inline: 5%; }
  .brand-mark { width: 36px; height: 36px; font-size: 22px; }
  .view-site { padding: 8px 10px; font-size: 9px; }
  .admin-shell { width: 92%; padding-block: 20px 35px; }
  .admin-tabs { gap: 4px; }
  .admin-tab { min-height: 39px; }
  .settings-form { padding: 20px 15px; }
  .form-grid { grid-template-columns: 1fr; gap: 13px; }
  .field-wide { grid-column: auto; }
  .form-section-title:not(:first-child) { margin-top: 27px; }
  .form-actions, .backup-box { align-items: flex-start; flex-direction: column; }
  .backup-actions { width: 100%; flex-wrap: wrap; }
  .panel-heading-row { align-items: flex-start; flex-direction: column; }
  .product-heading-actions { width: 100%; }
  .product-heading-actions > button { flex: 1; padding-inline: 8px; }
  .batch-editor { padding: 15px 11px; }
  .batch-row { grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; padding: 9px; }
  .batch-row-number { grid-row: span 3; padding-top: 27px; }
  .batch-row label:nth-of-type(1), .batch-row label:nth-of-type(2), .batch-row label:nth-of-type(3), .batch-row label:nth-of-type(4), .batch-row label:nth-of-type(5) { grid-column: span 2; }
  .batch-remove { grid-column: 3; }
  .batch-actions { align-items: stretch; flex-direction: column; }
  .product-row { grid-template-columns: 60px minmax(0, 1fr); gap: 10px; padding: 10px; }
  .product-row > img { width: 60px; height: 58px; }
  .product-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .category-add-form { align-items: stretch; flex-direction: column; }
  .category-add-form .primary-button { align-self: flex-start; }
  .category-list-heading, .managed-category-row { grid-template-columns: minmax(0, 1fr) 40px 58px; gap: 6px; }
  .managed-category-row { padding-inline: 8px; }
  .category-list-heading { padding-inline: 8px; font-size: 8px; }
  .category-list-heading span:last-child { display: none; }
  .category-row-actions { grid-column: 1 / -1; gap: 6px; }
  .small-button { padding-inline: 7px; font-size: 8px; }
  .product-dialog > form { padding: 19px 15px; }
  .admin-footer { align-items: flex-start; flex-direction: column; justify-content: center; padding-block: 13px; }
}
