:root {
  color-scheme: dark;
  --bg: #0b0e0d;
  --panel: #141918;
  --panel-soft: #101413;
  --line: #29322e;
  --text: #f2f3ef;
  --muted: #919b94;
  --red: #d3132a;
  --red-light: #ff4052;
  --green: #3cb087;
  font-family: Inter, "Segoe UI", "Noto Sans SC", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 15% 10%, rgba(211,19,42,.14), transparent 28%), radial-gradient(circle at 88% 85%, rgba(60,176,135,.08), transparent 30%); }
.login-brand { position: absolute; left: 32px; top: 28px; display: flex; align-items: center; gap: 12px; }
.login-brand > div, .sidebar-brand > div { display: grid; gap: 4px; }
.login-brand strong, .sidebar-brand strong { font-size: 14px; letter-spacing: .22em; }
.login-brand small, .sidebar-brand small { color: var(--red-light); font-size: 8px; letter-spacing: .2em; }
.brand-mark { width: 38px; height: 48px; display: grid; place-items: center; border: 1px solid var(--red); color: var(--red-light); font: 24px Georgia, serif; clip-path: polygon(0 0,100% 0,100% 72%,50% 100%,0 72%); }
.login-card { width: min(460px, 100%); padding: 42px; border: 1px solid var(--line); background: rgba(20,25,24,.96); box-shadow: 0 30px 80px rgba(0,0,0,.42); }
.eyebrow { margin: 0 0 10px; color: var(--red-light); font-size: 10px; font-weight: 700; letter-spacing: .18em; }
.login-card h1 { margin: 0; font: 400 38px/1.1 Georgia, "Noto Serif SC", serif; }
.login-card > p:not(.eyebrow):not(.form-status) { color: var(--muted); line-height: 1.7; }
label { display: grid; gap: 8px; color: #c0c7c1; font-size: 12px; }
input, textarea, select { width: 100%; border: 1px solid #344039; border-radius: 0; outline: 0; background: #0c100f; color: var(--text); padding: 12px 13px; transition: border-color .2s, box-shadow .2s; }
input:focus, textarea:focus, select:focus { border-color: var(--red-light); box-shadow: 0 0 0 3px rgba(211,19,42,.1); }
textarea { resize: vertical; line-height: 1.55; }
.primary-button, .save-button { border: 0; background: linear-gradient(135deg, var(--red-light), var(--red)); color: white; min-height: 48px; padding: 0 20px; font-weight: 700; cursor: pointer; }
.login-card .primary-button { width: 100%; margin-top: 18px; }
.form-status { min-height: 20px; margin: 12px 0 0; color: #ff9baa; font-size: 12px; }

.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 25px 18px 20px; border-right: 1px solid var(--line); background: #0e1211; z-index: 20; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 40px; }
.sidebar-nav { display: grid; gap: 5px; }
.nav-item { width: 100%; min-height: 50px; display: flex; align-items: center; gap: 13px; border: 0; background: transparent; color: #9ba49d; padding: 0 13px; text-align: left; cursor: pointer; }
.nav-item span { color: #59615c; font: 10px Georgia, serif; }
.nav-item b { min-width: 21px; height: 21px; display: grid; place-items: center; margin-left: auto; border-radius: 20px; background: #252d29; color: #c7cec8; font-size: 10px; }
.nav-item:hover, .nav-item.active { background: #1a211e; color: white; }
.nav-item.active { box-shadow: inset 3px 0 var(--red); }
.nav-item.active span { color: var(--red-light); }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; }
.sidebar-foot a, .sidebar-foot button { min-height: 42px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: transparent; color: #aeb6b0; font-size: 12px; cursor: pointer; }

.workspace { min-width: 0; padding: 36px clamp(24px,4vw,64px) 80px; }
.workspace-header { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 30px; margin-bottom: 34px; border-bottom: 1px solid var(--line); }
.workspace-header p { margin: 0 0 7px; color: var(--red-light); font-size: 9px; font-weight: 700; letter-spacing: .18em; }
.workspace-header h1 { margin: 0 0 22px; font: 400 33px/1.1 Georgia, "Noto Serif SC", serif; }
.save-button { flex: 0 0 auto; margin-bottom: 22px; }
.save-button:disabled, .primary-button:disabled { opacity: .55; cursor: wait; }
.page { display: none; }
.page.active { display: block; }
.toast { position: fixed; z-index: 50; right: 28px; top: 24px; max-width: 360px; padding: 13px 17px; background: #dfe9e1; color: #132018; box-shadow: 0 14px 40px rgba(0,0,0,.35); font-size: 13px; transform: translateY(-100px); opacity: 0; transition: .25s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #ffd8de; color: #4b1019; }

.stat-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.stat-card { min-height: 176px; padding: 24px; display: grid; align-content: space-between; border: 1px solid var(--line); background: linear-gradient(145deg,rgba(255,255,255,.02),transparent),var(--panel); }
.stat-card span { color: #a7afa9; font-size: 12px; }
.stat-card strong { font: 400 50px/1 Georgia, serif; }
.stat-card:nth-child(3) strong { font: 700 23px/1.2 "Segoe UI",sans-serif; color: var(--green); }
.stat-card small { color: #6f7872; font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 14px; margin-top: 14px; }
.panel { border: 1px solid var(--line); background: var(--panel); padding: 26px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.panel-heading h2, .page-toolbar h2 { margin: 0; font: 400 25px/1.2 Georgia, "Noto Serif SC", serif; }
.panel-heading p:not(.eyebrow), .page-toolbar p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.text-button { border: 0; background: transparent; color: var(--red-light); cursor: pointer; }
.compact-list { display: grid; }
.compact-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 14px 0; border-top: 1px solid var(--line); }
.compact-item strong { font-size: 13px; }
.compact-item p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.compact-item time { color: #727c75; font-size: 10px; white-space: nowrap; }
.empty-state { padding: 32px 16px; border: 1px dashed #344039; color: var(--muted); text-align: center; font-size: 13px; }
.quick-actions { display: grid; gap: 8px; }
.quick-actions button { min-height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 15px; border: 1px solid var(--line); background: var(--panel-soft); color: #cbd1cc; cursor: pointer; text-align: left; }
.quick-actions button:hover { border-color: var(--red); }
.quick-actions span { color: var(--red-light); font-size: 20px; }

.page-toolbar { min-height: 78px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.secondary-button { min-height: 44px; border: 1px solid var(--red); background: transparent; color: var(--red-light); padding: 0 17px; cursor: pointer; }
.product-editor-list { display: grid; gap: 14px; }
.product-editor { display: grid; grid-template-columns: 190px minmax(0,1fr); border: 1px solid var(--line); background: var(--panel); overflow: hidden; }
.product-preview { min-height: 240px; position: relative; display: grid; place-items: center; background: #f3f3f0; }
.product-preview img { width: 100%; height: 100%; max-height: 260px; object-fit: contain; padding: 16px; }
.product-number { position: absolute; left: 12px; top: 12px; min-width: 32px; height: 26px; display: grid; place-items: center; background: var(--red); color: white; font: 11px Georgia,serif; }
.product-fields { min-width: 0; padding: 22px; }
.product-fields-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.product-fields-head h3 { margin: 0; font: 400 24px Georgia,serif; }
.product-controls { display: flex; gap: 6px; }
.icon-button { width: 36px; height: 34px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.icon-button:hover { border-color: var(--red); }
.icon-button.delete { color: #ff8998; }
.product-form-grid, .form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.full-field { grid-column: 1/-1; }
.features-field textarea { min-height: 108px; }
.upload-field { margin-top: 2px; padding: 13px; border: 1px dashed #3b4741; background: #101513; }
.upload-field input[type="file"] { min-height: auto; padding: 9px; background: #171d1a; cursor: pointer; }
.upload-field input[type="file"]::file-selector-button { margin-right: 12px; border: 0; background: var(--red); color: white; padding: 8px 12px; cursor: pointer; }
.upload-field small { color: #7e8981; font-size: 10px; line-height: 1.5; }
.form-panel { max-width: 980px; }
.notification-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.notification-grid .panel { min-height: 310px; }
.one-column { grid-template-columns: 1fr; }
.notice { margin-top: 14px; padding: 18px 21px; border-left: 3px solid var(--red); background: #171d1a; }
.notice strong { font-size: 13px; }
.notice p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.search-box { display: flex; min-width: min(460px,100%); }
.search-box input { min-width: 0; }
.search-box button { flex: 0 0 auto; border: 1px solid var(--line); border-left: 0; background: #1b221f; padding: 0 16px; cursor: pointer; }
.inquiry-list { display: grid; gap: 10px; }
.inquiry-card { display: grid; grid-template-columns: 180px minmax(0,1fr) 180px; gap: 22px; padding: 21px; border: 1px solid var(--line); background: var(--panel); }
.inquiry-person strong { display: block; font-size: 15px; }
.inquiry-person small, .inquiry-meta { color: var(--muted); font-size: 11px; }
.inquiry-contact { display: grid; gap: 7px; margin-top: 12px; }
.inquiry-contact a { color: #d2d8d3; font-size: 12px; overflow-wrap: anywhere; }
.inquiry-message strong { color: var(--red-light); font-size: 11px; letter-spacing: .08em; }
.inquiry-message p { margin: 9px 0 0; color: #c0c6c1; font-size: 13px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.inquiry-meta { display: grid; align-content: start; gap: 8px; }
.inquiry-meta span { padding-bottom: 8px; border-bottom: 1px solid var(--line); }

@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; height: auto; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand, .sidebar-foot { display: none; }
  .sidebar-nav { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; }
  .sidebar-nav::-webkit-scrollbar { display: none; }
  .nav-item { width: auto; min-width: max-content; min-height: 44px; padding: 0 13px; }
  .nav-item.active { box-shadow: inset 0 -3px var(--red); }
  .workspace { padding: 25px 20px 60px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .product-editor { grid-template-columns: 160px minmax(0,1fr); }
  .inquiry-card { grid-template-columns: 150px minmax(0,1fr); }
  .inquiry-meta { grid-column: 1/-1; grid-template-columns: repeat(3,1fr); }
}

@media (max-width: 680px) {
  .login-shell { align-items: center; padding: 14px; }
  .login-brand { left: 18px; top: 18px; }
  .login-card { padding: 28px 20px; margin-top: 70px; }
  .login-card h1 { font-size: 32px; }
  input, textarea, select { min-height: 46px; font-size: 16px; }
  .workspace { padding: 20px 14px 54px; }
  .workspace-header { align-items: stretch; flex-direction: column; gap: 0; margin-bottom: 22px; }
  .workspace-header h1 { font-size: 29px; margin-bottom: 16px; }
  .save-button { width: 100%; margin-bottom: 18px; }
  .toast { left: 14px; right: 14px; top: 12px; max-width: none; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 130px; }
  .stat-card strong { font-size: 42px; }
  .panel { padding: 19px; }
  .page-toolbar { flex-direction: column; align-items: stretch; gap: 14px; }
  .page-toolbar .secondary-button { width: 100%; }
  .search-box { min-width: 0; width: 100%; }
  .product-editor { grid-template-columns: 1fr; }
  .product-preview { min-height: 230px; max-height: 280px; }
  .product-fields { padding: 18px; }
  .product-fields-head { align-items: flex-start; flex-direction: column; }
  .product-controls { width: 100%; }
  .icon-button { flex: 1; min-height: 42px; }
  .product-form-grid, .form-grid, .notification-grid { grid-template-columns: 1fr; }
  .full-field { grid-column: auto; }
  .notification-grid .panel { min-height: auto; }
  .inquiry-card { grid-template-columns: 1fr; gap: 17px; padding: 18px; }
  .inquiry-meta { grid-column: auto; grid-template-columns: 1fr; }
  .compact-item { grid-template-columns: 1fr; }
  .compact-item time { white-space: normal; }
}
