@font-face { font-family: Poppins; src: url('/fonts/Poppins-Regular.ttf'); }

:root {
  --ink: #050505;
  --paper: #fff;
  --canvas: #f5f5f6;
  --muted: #686970;
  --line: #dedfe2;
  --red: #e41c34;
  --red-dark: #b20e23;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: #171719; font-family: Poppins, system-ui, sans-serif; }
.hidden { display: none !important; }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 8% 5%, #ffe6e9, transparent 34%), var(--canvas); }
.card { width: min(520px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); box-shadow: 0 22px 70px #05050514; }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.brand img { width: 48px; }
.brand strong { font-size: 18px; }
.eyebrow { color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
h1 { margin: 8px 0 12px; font-size: 31px; line-height: 1.15; }
p { color: var(--muted); line-height: 1.55; }
label { display: grid; gap: 7px; margin: 16px 0; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; padding: 12px 13px; border: 1px solid #c8c9cd; border-radius: 11px; outline: none; background: white; font: inherit; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px #e41c3418; }
button { padding: 11px 16px; border: 0; border-radius: 10px; background: var(--red); color: white; font: inherit; font-weight: 750; cursor: pointer; }
button:hover { background: var(--red-dark); }
button:disabled { cursor: not-allowed; opacity: .55; }
.error { margin: 12px 0; padding: 11px; border-radius: 10px; background: #ffe9e6; color: #96362c; }

.app { display: grid; grid-template-rows: auto 1fr; height: 100vh; }
.bar { display: flex; align-items: center; gap: 11px; min-height: 62px; padding: 8px 17px; border-bottom: 3px solid var(--red); background: var(--ink); color: white; }
.bar-brand { display: flex; align-items: center; gap: 10px; min-width: 245px; }
.bar-brand img { width: 32px; height: 40px; padding: 4px; border-radius: 8px; background: white; }
.bar-brand strong, .bar-brand small { display: block; }
.bar-brand strong { font-size: 13px; }
.bar-brand small { max-width: 330px; overflow: hidden; color: #b8b8be; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.bar > span { margin-left: auto; color: #c9c9ce; font-size: 11px; }
.bar button { padding: 8px 12px; border: 1px solid #ffffff2c; background: #ffffff10; font-size: 11px; }
.bar button:hover { background: #ffffff1d; }
.app iframe { width: 100%; height: 100%; border: 0; background: white; }

.dialog-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: #050505c9; }
.dialog { width: min(1080px, 100%); max-height: 90vh; overflow: auto; padding: 27px; border-radius: 22px; background: white; box-shadow: 0 25px 90px #0005; }
.dialog.narrow { width: min(520px, 100%); }
.dialog > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.dialog > header h2 { margin: 4px 0 0; }
.dialog > header button, .member button { padding: 8px 11px; }
.dialog textarea { min-height: 76px; }
.form-grid { display: grid; grid-template-columns: 1fr 1.4fr .8fr; gap: 12px; }
.form-grid label { margin: 8px 0; }
.product-form { grid-template-columns: repeat(3, 1fr); }
.product-form .wide { grid-column: 1 / -1; }
.create-product { margin-top: 22px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #fafafa; }
.create-product h3 { margin-top: 0; }
.product-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.product-tile { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.product-tile.active { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.product-tile small { color: var(--muted); }
.product-tile h3 { margin: 5px 0; }
.product-tile p { min-height: 50px; margin: 4px 0 12px; font-size: 11px; }
.product-meta { display: grid; gap: 6px; margin: 11px 0; font-size: 10px; color: var(--muted); }
.member { display: grid; grid-template-columns: 1fr 1.4fr .8fr .8fr auto; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid #e0e0e2; }
.member input, .member select { min-width: 0; padding: 9px; }
.member-email { overflow-wrap: anywhere; font-size: 12px; }

@media (max-width: 960px) {
  .product-list { grid-template-columns: 1fr 1fr; }
  .product-form, .form-grid { grid-template-columns: 1fr 1fr; }
  .member { grid-template-columns: 1fr 1fr; }
  .bar > span { display: none; }
}

@media (max-width: 700px) {
  .product-list, .product-form, .form-grid { grid-template-columns: 1fr; }
  .product-form .wide { grid-column: auto; }
  .card { padding: 26px; }
  .bar { flex-wrap: wrap; gap: 6px; padding: 8px; }
  .bar-brand { width: 100%; min-width: 0; margin-right: 0; }
  .bar-brand strong { font-size: 11px; }
  .bar-brand small { max-width: 180px; }
  .bar button { flex: 1 1 calc(50% - 6px); min-width: 0; padding: 7px; }
  .member { grid-template-columns: 1fr; }
}
