:root {
  --ink: #090705;
  --panel: #12100d;
  --panel-soft: #191510;
  --line: rgba(231, 190, 105, .2);
  --gold: #d7aa52;
  --gold-light: #f0cd82;
  --cream: #f6ecd8;
  --muted: rgba(246, 236, 216, .62);
  --green: #278c58;
  --danger: #c55b52;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ink); }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--cream); background: radial-gradient(circle at 75% -10%, rgba(128, 40, 69, .24), transparent 34%), radial-gradient(circle at 10% 20%, rgba(9, 89, 117, .18), transparent 28%), #080604; font-family: Arial, Helvetica, sans-serif; }
button, input, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.admin-shell { min-height: 100vh; }
.brand { margin: 0; color: var(--gold-light); font-family: Georgia, 'Times New Roman', serif; font-size: 1.45rem; font-weight: 600; letter-spacing: .22em; }
.brand small { display: block; margin-top: .12rem; font-family: Arial, sans-serif; font-size: .52rem; letter-spacing: .5em; text-align: center; }
.eyebrow { margin: 0 0 .55rem; color: var(--gold); font-size: .67rem; font-weight: 700; letter-spacing: .22em; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }

.login-view { display: grid; min-height: 100vh; place-items: center; padding: 1.5rem; }
.login-card { width: min(100%, 440px); padding: clamp(2rem, 6vw, 3.4rem); background: rgba(15, 12, 9, .94); border: 1px solid var(--line); box-shadow: 0 35px 90px rgba(0,0,0,.52); }
.login-card .brand { width: max-content; margin: 0 auto 3rem; text-align: center; }
.login-card h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(2.15rem, 7vw, 3.4rem); font-weight: 400; line-height: .98; }
.login-card .muted { margin: 1.15rem 0 2rem; line-height: 1.65; }
label { display: grid; gap: .48rem; color: rgba(255,255,255,.76); font-size: .75rem; font-weight: 700; letter-spacing: .06em; }
input, textarea { width: 100%; border: 1px solid rgba(255,255,255,.13); border-radius: 8px; outline: 0; padding: .83rem .9rem; color: #fff; background: rgba(255,255,255,.045); transition: border-color .2s ease, box-shadow .2s ease; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(215,170,82,.12); }
#login-form { display: grid; gap: 1.1rem; }
.form-message { min-height: 1.2rem; margin: 1rem 0 0; color: #e88980; font-size: .82rem; }

.primary-button, .ghost-button, .danger-button, .icon-button, .upload-button { border: 0; border-radius: 8px; cursor: pointer; font-weight: 700; transition: transform .2s ease, background .2s ease, opacity .2s ease; }
.primary-button { padding: .92rem 1.25rem; color: #171006; background: linear-gradient(135deg, #f1ce82, #c8953d); }
.primary-button:hover:not(:disabled), .upload-button:hover { transform: translateY(-2px); }
.primary-button:disabled { cursor: not-allowed; opacity: .42; }
.ghost-button { padding: .7rem .9rem; color: var(--cream); background: rgba(255,255,255,.06); }
.danger-button { padding: .72rem 1rem; color: #fff; background: rgba(197,91,82,.17); border: 1px solid rgba(197,91,82,.38); }
.icon-button { display: grid; width: 2.45rem; height: 2.45rem; place-items: center; color: var(--gold-light); background: rgba(215,170,82,.09); border: 1px solid rgba(215,170,82,.2); font-size: 1.2rem; }
.add-product-button { display: flex; align-items: center; justify-content: center; gap: .45rem; width: 100%; margin-top: 1rem; padding: .78rem 1rem; color: #171006; background: linear-gradient(135deg, #f1ce82, #c8953d); border: 0; border-radius: 8px; cursor: pointer; font-weight: 800; transition: transform .2s ease, filter .2s ease; }
.add-product-button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.add-product-button span { font-size: 1.15rem; line-height: 1; }

.dashboard { min-height: 100vh; padding-bottom: 96px; }
.dashboard-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 2rem; min-height: 82px; padding: 1rem clamp(1rem, 4vw, 4rem); background: rgba(7,6,4,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.session-copy { margin: .35rem 0 0; color: var(--muted); font-size: .75rem; }
.header-actions { display: flex; align-items: center; gap: 1rem; color: var(--muted); font-size: .78rem; }
.dashboard-body { display: grid; gap: 1.25rem; width: min(1500px, calc(100% - 2rem)); margin: 1.5rem auto 0; }
.panel { background: rgba(18,16,13,.94); border: 1px solid rgba(255,255,255,.08); box-shadow: 0 22px 60px rgba(0,0,0,.22); }
.settings-panel, .product-editor-panel, .product-list-panel { padding: clamp(1.15rem, 2.5vw, 2rem); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.section-heading.compact { margin-bottom: .45rem; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(1.6rem, 3vw, 2.35rem); font-weight: 400; }
.status-pill { padding: .46rem .7rem; color: #bfe5cf; background: rgba(39,140,88,.12); border: 1px solid rgba(39,140,88,.28); border-radius: 99px; font-size: .7rem; }
.settings-grid, .product-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.wide-field { grid-column: 1 / -1; }
.catalog-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.product-list-panel { position: sticky; top: 98px; max-height: calc(100vh - 122px); overflow: auto; }
.product-list { display: grid; gap: .55rem; margin-top: 1.2rem; }
.product-list-item { display: grid; grid-template-columns: 46px minmax(0,1fr) auto; align-items: center; gap: .75rem; width: 100%; padding: .6rem; color: inherit; background: rgba(255,255,255,.025); border: 1px solid transparent; border-radius: 9px; cursor: pointer; text-align: left; }
.product-list-item:hover { background: rgba(255,255,255,.05); }
.product-list-item.active { background: rgba(215,170,82,.09); border-color: rgba(215,170,82,.34); }
.product-list-item img { width: 46px; height: 58px; object-fit: cover; background: #060504; border-radius: 5px; }
.product-list-item strong, .product-list-item span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-list-item strong { font-family: Georgia, serif; font-size: 1.03rem; font-weight: 400; }
.product-list-item span { margin-top: .2rem; color: var(--muted); font-size: .68rem; }
.visibility-dot { width: .48rem; height: .48rem; background: var(--green); border-radius: 50%; }
.visibility-dot.off { background: #777; }
.empty-editor { display: grid; min-height: 420px; place-items: center; align-content: center; padding: 2rem; text-align: center; }
.empty-editor > span { font-size: 3rem; filter: grayscale(1); }
.empty-editor h2 { margin: 1rem 0 .35rem; font-family: Georgia, serif; font-weight: 400; }
.empty-editor p { max-width: 440px; margin: 0; color: var(--muted); line-height: 1.6; }
.order-actions { display: flex; gap: .45rem; }
.switch-row { display: flex; flex-wrap: wrap; gap: 1.6rem; margin: 1.3rem 0; padding: 1rem; background: rgba(255,255,255,.025); border-radius: 9px; }
.switch { display: flex; grid: none; align-items: center; gap: .65rem; cursor: pointer; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch span { position: relative; width: 2.35rem; height: 1.28rem; background: #3b3731; border-radius: 99px; transition: background .2s ease; }
.switch span::after { content: ''; position: absolute; top: .18rem; left: .18rem; width: .92rem; height: .92rem; background: #fff; border-radius: 50%; transition: transform .2s ease; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(1.06rem); }
.image-editors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.image-editor { display: grid; gap: 1rem; padding: 1rem; background: rgba(255,255,255,.025); border: 1px solid rgba(255,255,255,.07); }
.image-editor.is-disabled { opacity: .55; }
.image-editor h3 { margin: 0; font-family: Georgia, serif; font-size: 1.35rem; font-weight: 400; }
.image-preview { display: grid; min-height: 250px; place-items: center; overflow: hidden; background: #080604; }
.image-preview img { width: 100%; height: 300px; object-fit: contain; }
.image-preview img:not([src]), .image-preview img[src=""] { display: none; }
.upload-button { display: block; padding: .78rem 1rem; color: var(--gold-light); background: rgba(215,170,82,.09); border: 1px solid rgba(215,170,82,.24); text-align: center; }
.upload-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.2rem; padding: 1rem; background: rgba(197,91,82,.06); border: 1px solid rgba(197,91,82,.17); }
.danger-zone strong { color: #f0aaa4; }
.danger-zone p { margin: .25rem 0 0; color: var(--muted); font-size: .72rem; }
.save-bar { position: fixed; right: 0; bottom: 0; left: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 78px; padding: .8rem clamp(1rem, 4vw, 4rem); background: rgba(7,6,4,.96); border-top: 1px solid var(--line); backdrop-filter: blur(18px); }
.save-bar strong, .save-bar span { display: block; }
.save-bar span { margin-top: .25rem; color: var(--muted); font-size: .72rem; }
.toast { position: fixed; right: 1rem; bottom: 96px; z-index: 50; max-width: min(400px, calc(100% - 2rem)); padding: .9rem 1.1rem; color: #fff; background: #236c47; border-radius: 8px; box-shadow: 0 18px 50px rgba(0,0,0,.45); opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: #873f39; }

.security-dialog { width: min(100% - 2rem, 520px); padding: 0; color: var(--cream); background: #12100d; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 35px 100px rgba(0,0,0,.72); }
.security-dialog::backdrop { background: rgba(0,0,0,.76); backdrop-filter: blur(5px); }
.security-dialog form { padding: clamp(1.35rem, 4vw, 2rem); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.dialog-heading h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(1.8rem, 6vw, 2.5rem); font-weight: 400; }
.dialog-close { display: grid; width: 2.35rem; height: 2.35rem; flex: 0 0 auto; place-items: center; color: var(--cream); background: rgba(255,255,255,.06); border: 0; border-radius: 50%; cursor: pointer; font-size: 1.45rem; }
.security-intro { margin: 1rem 0 1.35rem; line-height: 1.55; }
.security-fields { display: grid; gap: 1rem; }
.password-hint { margin: .9rem 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.25rem; }

@media (max-width: 900px) {
  .catalog-layout { grid-template-columns: 1fr; }
  .product-list-panel { position: static; max-height: none; }
  .product-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .dashboard-header { align-items: flex-start; }
  .header-actions { align-items: flex-end; flex-direction: column; gap: .45rem; }
  .settings-grid, .product-form-grid, .image-editors, .product-list { grid-template-columns: 1fr; }
  .status-pill { display: none; }
  .save-bar { align-items: stretch; flex-direction: column; }
  .save-bar .primary-button { width: 100%; }
  .dashboard { padding-bottom: 132px; }
  .dialog-actions { align-items: stretch; flex-direction: column-reverse; }
}
