.admin-body { min-height: 100vh; background: #f1ece5; }

.admin-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(18px, 4vw, 60px);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.admin-header__site { min-height: 40px; padding: 9px 14px; }
.admin-main { width: min(1380px, 100%); margin: 0 auto; padding: clamp(34px, 6vw, 78px) clamp(16px, 4vw, 56px); }

.login-view { min-height: calc(100vh - 180px); display: grid; place-items: center; }
.login-card { width: min(520px, 100%); padding: clamp(30px, 6vw, 58px); background: var(--paper); box-shadow: 0 20px 70px rgba(35,25,20,.1); }
.login-card h1, .dashboard h1 { margin-bottom: 18px; font-size: clamp(46px, 7vw, 72px); }
.login-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.7; }

.admin-form { display: grid; gap: 18px; margin-top: 30px; }
.admin-form label, .field { display: grid; gap: 8px; }
.admin-form label > span, .field > span { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.admin-form input, .field input, .field textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: 0;
  color: var(--ink);
  background: var(--white);
}
.field textarea { min-height: 110px; resize: vertical; }
.admin-form input:focus, .field input:focus, .field textarea:focus { border-color: var(--wine); box-shadow: 0 0 0 2px rgba(113,31,43,.1); }
.form-message { min-height: 18px; margin: 0; color: var(--wine); font-size: 12px; }
.setup-note { margin-top: 24px; padding: 16px; border-left: 3px solid var(--gold); background: #eee5d8; font-size: 12px; }
.setup-note p { margin: 6px 0 0; color: var(--muted); line-height: 1.6; }
.setup-note code { font-size: 11px; }

.dashboard__heading { display: flex; flex-direction: column; gap: 20px; margin-bottom: 38px; }
.dashboard__heading p:last-child { margin: 0; color: var(--muted); }
.dashboard__actions { display: flex; align-items: center; gap: 18px; }
.text-button { padding: 4px 0; border: 0; border-bottom: 1px solid currentColor; background: transparent; cursor: pointer; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.text-button--danger { color: var(--wine); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 34px; border: 1px solid var(--line); background: var(--paper); }
.stats article { display: flex; min-height: 112px; flex-direction: column; justify-content: space-between; padding: 18px; }
.stats article:nth-child(odd) { border-right: 1px solid var(--line); }
.stats article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
.stats span { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.stats strong { font-family: var(--serif); font-size: 36px; font-weight: 400; }

.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.admin-search { width: min(420px, 100%); }
.admin-search input { width: 100%; min-height: 44px; padding: 10px 13px; border: 1px solid var(--line); background: var(--paper); }
.admin-products { display: grid; gap: 1px; border: 1px solid var(--line); background: var(--line); }
.admin-product { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px; background: var(--paper); }
.admin-product__image { width: 74px; height: 94px; object-fit: cover; background: #e4ddd4; }
.admin-product__info { min-width: 0; }
.admin-product__top { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 5px; }
.admin-product__status { padding: 3px 6px; color: #fff; background: #49614c; font-size: 8px; letter-spacing: .06em; text-transform: uppercase; }
.admin-product__status.is-hidden { background: #8b8178; }
.admin-product__info h2 { margin: 0 0 5px; overflow: hidden; font-family: var(--serif); font-size: 19px; text-overflow: ellipsis; white-space: nowrap; }
.admin-product__info p { margin: 0; color: var(--muted); font-size: 10px; }
.admin-product__stock { display: none; color: var(--muted); font-size: 11px; }
.admin-product__edit { min-height: 38px; padding: 8px 12px; }
.admin-loading { padding: 40px; color: var(--muted); text-align: center; }

.editor-dialog { width: min(980px, calc(100% - 18px)); max-height: calc(100svh - 18px); padding: 0; border: 0; background: var(--paper); box-shadow: var(--shadow); }
.editor-dialog::backdrop { background: rgba(14,12,10,.67); backdrop-filter: blur(3px); }
.editor-dialog__header { position: sticky; z-index: 4; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px clamp(18px, 4vw, 42px); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(10px); }
.editor-dialog__header h2 { margin: 0; font-size: clamp(36px, 5vw, 48px); }
.product-form { padding: 0 clamp(18px, 4vw, 42px) 34px; }
.form-section { padding: 30px 0; border-bottom: 1px solid var(--line); }
.form-section h3 { margin-bottom: 7px; }
.form-section > p, .form-section__heading p, .form-section--media > div > p { margin-bottom: 20px; color: var(--muted); font-size: 12px; }
.form-section--media { display: grid; gap: 24px; }
.image-uploader { position: relative; width: min(240px, 100%); }
.image-uploader img { width: 100%; aspect-ratio: 3/4; object-fit: cover; background: #e8e1d8; }
.image-uploader__button { position: absolute; right: 8px; bottom: 8px; left: 8px; padding: 11px; color: #fff; background: rgba(25,22,19,.9); cursor: pointer; font-size: 9px; font-weight: 700; letter-spacing: .08em; text-align: center; text-transform: uppercase; }
.image-uploader__button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-status { min-height: 18px; margin: 10px 0 0 !important; color: var(--wine) !important; }
.form-grid { display: grid; gap: 18px; }
.form-section__heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.size-editor { display: grid; gap: 8px; }
.size-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.size-row input { width: 100%; min-width: 0; min-height: 42px; padding: 9px 10px; border: 1px solid var(--line); background: var(--white); }
.size-row button { width: 42px; padding: 0; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.form-section--switches { display: grid; gap: 14px; }
.switch-field { display: flex; align-items: flex-start; gap: 12px; padding: 15px; border: 1px solid var(--line); cursor: pointer; }
.switch-field input { width: 18px; height: 18px; accent-color: var(--wine); }
.switch-field span { display: grid; gap: 3px; }
.switch-field strong { font-size: 12px; }
.switch-field small { color: var(--muted); line-height: 1.5; }
.editor-dialog__footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 26px 0 0; }
.editor-dialog__footer > div { display: flex; gap: 8px; margin-left: auto; }

@media (min-width: 700px) {
  .dashboard__heading { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats article { min-height: 132px; padding: 22px; border-right: 1px solid var(--line); border-bottom: 0 !important; }
  .stats article:last-child { border-right: 0; }
  .admin-product { grid-template-columns: 76px minmax(0, 1fr) 150px auto; gap: 18px; padding: 14px 18px; }
  .admin-product__stock { display: block; }
  .form-section--media { grid-template-columns: 240px 1fr; align-items: center; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field--wide { grid-column: 1 / -1; }
  .form-section--switches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .admin-header__site { padding: 8px 10px; font-size: 9px; }
  .stats strong { font-size: 30px; }
  .dashboard__actions { align-items: flex-start; flex-direction: column; }
  .admin-toolbar { align-items: flex-end; flex-direction: column; }
  .admin-product { grid-template-columns: 62px minmax(0, 1fr); }
  .admin-product__image { width: 62px; height: 82px; }
  .admin-product__edit { grid-column: 1 / -1; width: 100%; }
  .editor-dialog__footer { align-items: stretch; flex-direction: column-reverse; }
  .editor-dialog__footer > div { display: grid; width: 100%; grid-template-columns: 1fr 1fr; }
  .text-button--danger { align-self: flex-start; }
}
