:root {
  --cream: #fff8ef;
  --vanilla: #ffecc8;
  --strawberry: #ff5f8f;
  --raspberry: #8f254d;
  --chocolate: #56362d;
  --pistachio: #9ccb8f;
  --sky: #c9ecff;
  --ink: #3f2830;
  --muted: #806b72;
  --line: #f1dce2;
  --paper: #fffdf9;
  --shadow: 0 18px 45px rgba(143, 37, 77, .12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 248, 239, .95), rgba(255, 241, 247, .95)),
    repeating-linear-gradient(45deg, rgba(143, 37, 77, .035) 0 1px, transparent 1px 16px);
  font: 14px/1.45 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 3px solid rgba(255, 95, 143, .28);
  outline-offset: 2px;
}

.brand {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 24px;
  font-weight: 800;
  color: var(--raspberry);
  letter-spacing: 0;
}
.brand em { color: var(--chocolate); font-style: normal; }
.cake-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--strawberry), #ff9eb9);
  box-shadow: 0 10px 22px rgba(255, 95, 143, .28);
}
.cake-icon::before {
  content: "";
  width: 24px;
  height: 22px;
  background: #fff8ef;
  border-radius: 6px 6px 9px 9px;
  clip-path: polygon(0 35%, 18% 20%, 38% 35%, 58% 20%, 78% 35%, 100% 20%, 100% 100%, 0 100%);
}
.icon { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--raspberry);
  display: inline-grid;
  place-items: center;
}
.primary, .secondary, .ghost {
  min-height: 42px;
  border-radius: 14px;
  padding: 11px 16px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.primary {
  border: 0;
  background: linear-gradient(135deg, var(--raspberry), var(--strawberry));
  color: #fff;
  box-shadow: 0 14px 26px rgba(143, 37, 77, .2);
}
.secondary { border: 1px solid #f0cfd9; background: #fff7fa; color: var(--raspberry); }
.ghost { border: 0; background: transparent; color: var(--raspberry); }
.danger { color: #a30f3d; }
.full { width: 100%; }
.muted { color: var(--muted); }

.auth-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 20% 16%, rgba(255, 95, 143, .18), transparent 30%),
    radial-gradient(circle at 88% 82%, rgba(156, 203, 143, .2), transparent 28%),
    linear-gradient(145deg, #fff8ef, #fff1f6);
}
.login-card {
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid rgba(241, 220, 226, .95);
  border-radius: 24px;
  background: rgba(255, 253, 249, .9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.login-mark { display: flex; justify-content: center; margin-bottom: 14px; }
.brand-login { text-align: center; font-size: 30px; }
.login-card h1 {
  margin: 18px 0 6px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 31px;
  text-align: center;
}
.login-card p { color: var(--muted); text-align: center; margin: 0 0 22px; }
.login-card label, .form-grid label, .field label {
  display: block;
  margin: 14px 0 6px;
  font-size: 12px;
  font-weight: 800;
  color: #684b55;
}
.password-wrap { position: relative; }
.password-wrap input { padding-right: 50px; }
.password-wrap button {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 11px;
  background: #fff4f7;
  color: var(--raspberry);
  display: grid;
  place-items: center;
}
.form-error { min-height: 18px; margin: 10px 0 0 !important; color: #a30f3d !important; font-size: 12px; text-align: left !important; }

.app-shell { min-height: 100dvh; }
.sidebar {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  width: 274px;
  padding: 22px 16px;
  background: rgba(255, 253, 249, .94);
  border-right: 1px solid var(--line);
  box-shadow: 14px 0 35px rgba(86, 54, 45, .05);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(16px);
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 24px; }
.side-brand small { display: block; color: var(--muted); font-weight: 700; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav button, .logout {
  min-height: 45px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #684b55;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  font-weight: 800;
  text-align: left;
}
.sidebar nav button:hover, .sidebar nav button.active {
  background: linear-gradient(135deg, #fff0f5, #fff8ef);
  color: var(--raspberry);
}
.sidebar nav button.active { box-shadow: inset 4px 0 0 var(--strawberry); }
.logout { margin-top: auto; color: #a13b5e; }

main { margin-left: 274px; padding: 28px clamp(18px, 4vw, 48px) 44px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.topbar small { display: block; color: var(--raspberry); font-weight: 800; }
h1, h2, h3 { margin: 0; letter-spacing: 0; }
.topbar h1 { font-family: "Playfair Display", Georgia, serif; font-size: clamp(28px, 4vw, 40px); color: var(--chocolate); }
time { color: var(--muted); font-weight: 700; }
.menu-toggle { display: none; }

.hero-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(241, 220, 226, .9);
  border-radius: 22px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .88), rgba(255, 244, 247, .9)),
    repeating-linear-gradient(-45deg, rgba(255, 95, 143, .05) 0 2px, transparent 2px 18px);
  box-shadow: var(--shadow);
}
.hero-panel::after {
  content: "";
  position: absolute;
  right: 22px;
  top: 20px;
  width: 120px;
  height: 120px;
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(255, 95, 143, .18), rgba(201, 236, 255, .5));
  transform: rotate(10deg);
}
.hero-panel > * { position: relative; z-index: 1; }
.hero-kicker { color: var(--raspberry); font-weight: 900; text-transform: uppercase; font-size: 11px; letter-spacing: .08em; }
.hero-panel h2 { max-width: 720px; margin-top: 6px; font-family: "Playfair Display", Georgia, serif; font-size: clamp(27px, 5vw, 42px); color: var(--chocolate); }
.hero-panel p { max-width: 620px; color: var(--muted); font-size: 15px; }
.actions, .quick-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.metric-grid, .cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.metric-card, .panel, .product-card, .sale-card, .supply-card, .check-card {
  border: 1px solid rgba(241, 220, 226, .9);
  border-radius: 18px;
  background: rgba(255, 253, 249, .92);
  box-shadow: 0 12px 28px rgba(86, 54, 45, .06);
}
.metric-card { padding: 18px; min-height: 122px; }
.metric-card .icon-bubble, .icon-bubble {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: #fff0f5;
  color: var(--raspberry);
  margin-bottom: 12px;
}
.metric-card small { display: block; color: var(--muted); font-weight: 800; }
.metric-card b { display: block; margin-top: 6px; color: var(--chocolate); font-size: 23px; line-height: 1.1; }
.metric-card.pistachio .icon-bubble { background: #eff8ec; color: #47733f; }
.metric-card.sky .icon-bubble { background: #edf8ff; color: #28718e; }
.metric-card.vanilla .icon-bubble { background: #fff1cf; color: #8b6030; }

.dashboard-grid { display: grid; grid-template-columns: 1.45fr .9fr; gap: 16px; margin-top: 16px; }
.panel { padding: 20px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel h2 { font-size: 19px; color: var(--chocolate); }
.panel p { margin: 6px 0 0; }

.product-grid, .supply-grid, .sales-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.product-card, .sale-card, .supply-card { padding: 16px; transition: transform .16s ease, box-shadow .16s ease; }
.product-card:hover, .sale-card:hover, .supply-card:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(86, 54, 45, .09); }
.product-top, .sale-top, .supply-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.product-card h3, .sale-card h3, .supply-card h3 { color: var(--chocolate); font-size: 17px; }
.badge, .status, .flavor-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 9px;
  background: #fff0f5;
  color: var(--raspberry);
  font-size: 11px;
  font-weight: 900;
}
.flavor-badge { margin-top: 10px; }
.status.ok { background: #eff8ec; color: #47733f; }
.status.wait { background: #fff1cf; color: #8b6030; }
.status.low { background: #ffe8ee; color: #a30f3d; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.stat-chip { border-radius: 13px; background: #fff8fb; padding: 10px; }
.stat-chip small { display: block; color: var(--muted); font-size: 11px; font-weight: 800; }
.stat-chip b { display: block; margin-top: 3px; color: var(--chocolate); }
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.card-actions select {
  flex: 1 1 160px;
  min-width: 150px;
  min-height: 42px;
}
.card-actions button { flex: 0 0 auto; }

.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kanban-col { min-height: 150px; border: 1px dashed #eccbd5; border-radius: 16px; padding: 12px; background: #fff9fb; }
.kanban-col h3 { font-size: 13px; color: var(--raspberry); margin-bottom: 10px; }
.mini-sale { padding: 10px; border-radius: 13px; background: #fff; border: 1px solid #f4e3e8; margin-bottom: 8px; }
.mini-sale b { display: block; }
.mini-action { min-height: 30px; padding: 5px 0; font-size: 12px; }

.check-list { display: grid; gap: 9px; }
.check-card { display: flex; align-items: center; gap: 10px; padding: 12px; }
.check-card input { width: 18px; height: 18px; accent-color: var(--strawberry); }
.check-card span { font-weight: 800; }

.empty {
  padding: 32px 18px;
  border: 1px dashed #eccbd5;
  border-radius: 18px;
  background: #fff9fb;
  text-align: center;
  color: var(--muted);
}
.empty b { display: block; color: var(--chocolate); margin-bottom: 4px; }

.table-wrap { overflow: auto; border-radius: 14px; border: 1px solid #f4e3e8; }
table { width: 100%; min-width: 650px; border-collapse: collapse; background: #fff; }
th, td { padding: 12px; border-bottom: 1px solid #f4e8ec; text-align: left; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }

.calculator-layout { display: grid; grid-template-columns: 1fr .85fr; gap: 16px; align-items: start; }
.tip-list { display: grid; gap: 10px; margin-top: 14px; }
.tip { display: flex; gap: 10px; padding: 12px; border-radius: 14px; background: #fff8ef; color: #674535; }
.result-card {
  padding: 22px;
  border-radius: 20px;
  background: linear-gradient(145deg, var(--raspberry), var(--strawberry));
  color: #fff;
  box-shadow: 0 18px 36px rgba(143, 37, 77, .22);
}
.result-card small { opacity: .85; font-weight: 800; }
.result-card b { display: block; font-size: clamp(32px, 6vw, 46px); line-height: 1.05; margin: 8px 0 16px; }
.result-card dl { margin: 0; display: grid; gap: 9px; }
.result-card div { display: flex; justify-content: space-between; gap: 12px; }

.modal {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(63, 40, 48, .45);
}
.modal-box {
  position: relative;
  width: min(760px, 100%);
  max-height: 92vh;
  overflow: auto;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 24px;
  box-shadow: var(--shadow);
}
.close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 13px;
  background: #fff0f5;
  color: var(--raspberry);
  display: grid;
  place-items: center;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.span2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.confirm-modal {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(63, 40, 48, .5);
  backdrop-filter: blur(5px);
}
.confirm-box {
  width: min(430px, 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 26px;
  text-align: center;
}
.confirm-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: inline-grid;
  place-items: center;
  margin-bottom: 14px;
  background: #eff8ec;
  color: #47733f;
}
.confirm-icon.danger {
  background: #ffe8ee;
  color: #a30f3d;
}
.confirm-box h2 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 26px;
  color: var(--chocolate);
}
.confirm-box p {
  margin: 8px 0 20px;
  color: var(--muted);
}
.confirm-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.danger-button {
  background: linear-gradient(135deg, #8e1238, #e44568);
}

#toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  max-width: min(340px, calc(100vw - 32px));
  padding: 13px 16px;
  border-radius: 14px;
  background: var(--chocolate);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: .18s ease;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1120px) {
  .metric-grid, .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-grid, .supply-grid, .sales-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .calculator-layout { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .sidebar {
    width: min(292px, 86vw);
    transform: translateX(-104%);
    transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .backdrop.open { display: block; position: fixed; z-index: 10; inset: 0; background: rgba(63, 40, 48, .32); }
  main { margin-left: 0; padding: 18px 14px 36px; }
  .menu-toggle { display: inline-grid; }
  .topbar { justify-content: flex-start; }
  time { display: none; }
  .hero-panel { padding: 20px; }
  .hero-panel::after { width: 82px; height: 82px; right: 12px; top: 14px; }
  .metric-grid, .cards, .product-grid, .supply-grid, .sales-grid, .kanban { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr; }
  .card-actions > * { flex: 1 1 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .confirm-actions { flex-direction: column-reverse; }
  .confirm-actions button { width: 100%; }
  .login-card { padding: 28px 22px; }
}
