/* A compact, accessible management layer over the existing atelier theme. */
:root {
  --ink: #25262b;
  --muted: #68707c;
  --cream: #f5f6f8;
  --paper: #fff;
  --line: #e4e7ec;
  --rose: #835c51;
  --rose-dark: #694840;
  --shadow: 0 2px 12px rgba(24, 34, 48, .045);
}
body { background: var(--cream); }
.app-view { grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { width: 224px; background: #242427; padding: 24px 13px; }
.side-brand { padding: 3px 16px 24px; }
.sidebar nav { gap: 3px; }
.sidebar nav button, .side-bottom > button { width: 100%; height: 44px; font-weight: 500; }
.sidebar button.active { background: #423634; box-shadow: inset 3px 0 #d3aa94; }
.sidebar button:focus-visible { outline: 2px solid #e7c6ad; outline-offset: 2px; }
main { min-width: 0; }
header { height: 68px; padding: 0 28px; background: rgba(255, 255, 255, .97); }
header h1 { font-size: 18px; font-weight: 700; }
.header-actions { flex-wrap: nowrap; }
.page { width: 100%; max-width: 1580px; padding: 26px 28px 56px; margin: 0 auto; }
.page-tools { gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.page-tools h2 { font-size: 21px; line-height: 1.35; }
.page-tools p { font-size: 12px; line-height: 1.6; margin-top: 5px; }
.page-tools > div:last-child:not(:first-child) { display: flex; gap: 9px; flex-wrap: wrap; }
button, input, select, textarea { accent-color: var(--rose-dark); }
button { transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid #a27967; outline-offset: 2px; }
button:disabled { cursor: not-allowed !important; opacity: .45; }
.primary, .secondary, .icon-btn, .tool-tabs button, .panel-head button, .table-action, .sync-bar button, .detail-back {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; width: auto; border-radius: 9px; padding: 0 15px;
  font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap;
}
.primary { color: #fff; background: var(--rose-dark); border: 1px solid var(--rose-dark); box-shadow: 0 2px 5px rgba(80, 49, 42, .12); }
.primary:hover:not(:disabled) { background: #543730; border-color: #543730; }
.secondary, .panel-head button { color: #364152; background: #fff; border: 1px solid #d7dce3; }
.secondary:hover:not(:disabled), .panel-head button:hover:not(:disabled) { background: #f6f8fa; border-color: #aeb8c5; }
.icon-btn { width: 40px; padding: 0; }
.table-action { min-height: 32px; padding: 0 10px; color: #735146; background: #fff; border: 1px solid #e4d9d3; }
.table-action:hover { background: #f8f1ed; }
.unread-row { background: #fffaf7; }
.read-state { display: inline-flex; align-items: center; gap: 5px; margin-right: 9px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.read-state.unread { color: #ba463f; }
.read-state.read { color: #8b95a1; font-weight: 500; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: #d84944; box-shadow: 0 0 0 3px #fce6e3; }
.sidebar #fabricNavBadge { width: auto; min-width: 25px; padding: 0 6px; font-size: 10px; }
.sync-bar button { min-height: 32px; padding: 0 9px; border: 1px solid transparent; background: transparent; }
.detail-back { color: #76544b; background: #fff; border: 1px solid #e4d9d3; }
.metrics, .inventory-stats { gap: 14px; }
.metrics article, .inventory-stats article, .panel { border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.inventory-stats article { min-height: 94px; padding: 16px 18px; }
.inventory-stats span { font-size: 12px; }
.inventory-stats strong { font-size: 21px; margin-top: 8px; }
.product-grid, .fabric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.product-card, .fabric-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.product-card:hover, .fabric-card:hover { border-color: #d3c4bd; box-shadow: 0 8px 26px rgba(37, 31, 29, .08); }
.product-card.offline, .fabric-card.offline { opacity: .75; }
.product-image, .fabric-image { height: clamp(168px, 18vw, 220px); background-position: center 40%; }
.fabric-image { height: clamp(158px, 16vw, 194px); }
.product-info, .fabric-info { display: flex; flex: 1; flex-direction: column; min-width: 0; padding: 17px 18px 16px; }
.product-info > span { font-size: 11px; letter-spacing: .06em; font-weight: 700; }
.product-info h3, .fabric-info h3 { font-size: 16px; line-height: 1.4; margin: 6px 0; }
.product-info p, .fabric-info p { color: #78808b; font-size: 12px; line-height: 1.55; margin: 0 0 14px; min-height: 36px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.catalog-state, .fabric-stock { margin-top: auto; min-height: 36px; border-top: 1px solid #f0f1f3; padding-top: 11px; }
.catalog-state strong, .fabric-stock > span { color: #41765a; font-size: 12px; font-weight: 600; }
.offline .catalog-state strong, .offline .fabric-stock > span { color: #8b8890; }
.fabric-stock { display: flex; gap: 8px; }
.fabric-stock b { margin-left: auto; white-space: nowrap; font-size: 15px; }
.fabric-stock .toggle { margin-left: 4px; }
.toggle { border: 0; flex: 0 0 34px; }
.catalog-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.catalog-actions button { display: inline-flex; align-items: center; justify-content: center; min-width: 62px; min-height: 34px; padding: 0 9px; border: 1px solid #dce1e7; border-radius: 8px; color: #4c5563; background: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; }
.catalog-actions button:hover:not(:disabled) { background: #f5f7f9; border-color: #b8c1cd; }
.catalog-actions button[data-action="edit"] { margin-left: auto; color: #fff; background: var(--rose-dark); border-color: var(--rose-dark); }
.catalog-actions button[data-action="edit"]:hover { background: #543730; }
.catalog-actions button.danger { min-width: 48px; color: #aa4c43; border-color: #efd9d6; background: #fffafa; }
.catalog-actions button.danger:hover { background: #fff0ee; border-color: #e4b7b1; }
.catalog-actions button:disabled { opacity: .38; }
.option-order button { min-width: 34px; min-height: 34px; padding: 0 9px; font-weight: 600; }
.row-actions { flex-wrap: wrap; }
.table-panel { overflow-x: auto; }
.table-panel table { min-width: 940px; }
.table-panel th { white-space: nowrap; }
.settings-grid .panel, .option-card, .editor-card { border-color: var(--line); box-shadow: var(--shadow); }
.settings-grid .panel { padding: 22px; }
.settings-grid .panel h3 { font-size: 17px; }
.settings-grid .panel label { font-size: 13px; font-weight: 600; color: #4d5561; }
.settings-grid .panel input:not([type="file"]) { width: 100%; min-height: 40px; margin-top: 7px; border: 1px solid #dce1e7; border-radius: 8px; padding: 0 11px; background: #fff; }
.settings-grid .panel p { color: #7b8491; font-size: 12px; line-height: 1.65; }
#removeSettingQr { align-self: flex-start; }
.editor-card { max-width: 1100px; }
.editor-toolbar { grid-template-columns: 180px 1fr; }
.toast { max-width: min(90vw, 500px); text-align: center; }
@media (max-width: 1280px) {
  .product-grid, .fabric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app-view { grid-template-columns: 1fr; display: block; }
  .sidebar { width: 224px; transform: translateX(-100%); z-index: 50; transition: transform .2s ease; }
  .sidebar.open { transform: none; }
  main { display: block; }
  .menu-btn { display: block; }
  .global-search { display: none; }
  .page { padding: 22px 18px 48px; }
  .editor-toolbar { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  header { padding: 0 16px; }
  .page { padding: 18px 14px 42px; }
  .page-tools { flex-wrap: wrap; }
  .page-tools > button, .page-tools > div:last-child:not(:first-child) { width: 100%; }
  .page-tools > div:last-child:not(:first-child) > button { flex: 1; }
  .product-grid, .fabric-grid { grid-template-columns: 1fr; }
  .product-image, .fabric-image { height: 200px; }
  .metrics, .inventory-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-actions button { flex: 1; }
  .catalog-actions button[data-action="edit"] { margin-left: 0; }
  .header-actions .primary { display: none; }
}
