/* ============ double11.com — white + gradient theme ============ */
:root {
  --bg: #f4f6fc;
  --surface: #ffffff;
  --surface-2: #f8f9fe;
  --ink: #14161f;
  --muted: #71768a;
  --line: #ecedf5;
  --brand1: #ff6a3d;
  --brand2: #ff2d78;
  --grad: linear-gradient(135deg, #ff6a3d 0%, #ff2d78 100%);
  --grad-soft: linear-gradient(135deg, rgba(255,106,61,.12), rgba(255,45,120,.12));
  --accent: #ff2d78;
  --green: #12b76a;
  --red: #f04438;
  --amber: #f79009;
  --blue: #2e90fa;
  --violet: #7a5af8;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 40px rgba(16,24,40,.12);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
h1, h2, h3 { margin: 0; }

.brand-logo { font-weight: 800; letter-spacing: -.02em; display: inline-flex; align-items: center; gap: 9px; user-select: none; -webkit-user-select: none; }
.brand-logo * { user-select: none; -webkit-user-select: none; }
.brand-logo .mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--grad); color: #fff;
  display: grid; place-items: center; font-size: 16px; font-weight: 800; box-shadow: 0 6px 16px rgba(255,45,120,.35);
}
.brand-logo .txt b { color: var(--accent); }

/* ---------------- Auth ---------------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; position: relative; overflow: hidden; }
.auth::before, .auth::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; z-index: 0;
}
.auth::before { width: 380px; height: 380px; background: #ffb199; top: -120px; right: -80px; }
.auth::after { width: 360px; height: 360px; background: #ff8fb1; bottom: -140px; left: -100px; }
.auth .box {
  position: relative; z-index: 1; background: var(--surface); border-radius: 22px;
  box-shadow: var(--shadow-lg); width: 100%; max-width: 410px; padding: 34px 30px;
}
.auth h1 { font-size: 24px; margin-bottom: 6px; }
.auth .tagline { color: var(--muted); margin: 0 0 22px; }
.auth .switch { text-align: center; margin-top: 18px; color: var(--muted); }
.msg { padding: 10px 13px; border-radius: 10px; font-size: 13px; margin: 12px 0; }
.msg.err { background: #fef3f2; color: var(--red); }
.msg.ok { background: #ecfdf3; color: var(--green); }

/* ---------------- App shell ---------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand-logo { padding: 6px 8px 20px; font-size: 19px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; min-height: 0; }
.nav button {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 11px;
  color: var(--muted); font-weight: 600; font-size: 14px; text-align: left; width: 100%; transition: .15s;
}
.nav button .ic { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.nav button .ic svg { width: 20px; height: 20px; display: block; }
.nav button:hover { background: var(--surface-2); color: var(--ink); }
.nav button.active { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(255,45,120,.3); }
.nav button { position: relative; }
.nav-dot { position: absolute; top: 8px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--surface); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: .6; } }
.sidebar .side-foot { border-top: 1px solid var(--line); padding-top: 14px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.side-user .av { width: 34px; height: 34px; border-radius: 50%; background: var(--grad-soft); display: grid; place-items: center; font-weight: 700; color: var(--accent); }
.side-user .who { font-size: 13px; line-height: 1.2; overflow: hidden; }
.side-user .who b { display: block; }
.side-user .who span { color: var(--muted); font-size: 12px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.7);
  backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5;
}
.topbar h2 { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 1px; }
.content { padding: 24px 28px 60px; max-width: 1200px; width: 100%; }

/* ---------------- Stat tiles ---------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); gap: 14px; margin-bottom: 22px; }
.tile { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.tile .ic { position: absolute; right: 14px; top: 14px; font-size: 22px; opacity: .35; }
.tile .label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.tile .value { font-size: 26px; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; }
.tile.hero { background: var(--grad); color: #fff; }
.tile.hero .label, .tile.hero .ic { color: #fff; opacity: .9; }

/* ---------------- Cards ---------------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card > h3 { padding: 16px 20px; border-bottom: 1px solid var(--line); font-size: 15px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card .body { padding: 20px; }

/* ---------------- Pills / filters ---------------- */
.pills { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.pills button { padding: 7px 15px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: 13px; }
.pills button.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------------- Table ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); }
tbody tr:hover { background: var(--surface-2); }
td.wrap { white-space: normal; max-width: 240px; }
.thumbcell { width: 40px; }

/* ---------------- Badges ---------------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.new { background: #eff8ff; color: var(--blue); }
.badge.confirmed { background: #f4f3ff; color: var(--violet); }
.badge.delivered { background: #ecfdf3; color: var(--green); }
.badge.cancelled { background: #fef3f2; color: var(--red); }
.badge.paid { background: #ecfdf3; color: var(--green); }
.badge.pending { background: #fffaeb; color: var(--amber); }
.badge.active { background: #ecfdf3; color: var(--green); }
.badge.trial { background: #eff8ff; color: var(--blue); }
.badge.expired { background: #fef3f2; color: var(--red); }
.badge.low { background: #fef3f2; color: var(--red); }
.badge.ok { background: #ecfdf3; color: var(--green); }

/* ---------------- Buttons ---------------- */
.btn { border-radius: 10px; padding: 9px 15px; font-size: 13px; font-weight: 700; background: var(--surface); border: 1px solid var(--line); color: var(--ink); transition: .15s; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--grad); color: #fff; border: none; box-shadow: 0 6px 16px rgba(255,45,120,.28); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.dark { background: var(--ink); color: #fff; border: none; }
.btn.green { background: var(--green); color: #fff; border: none; }
.btn.red { background: var(--red); color: #fff; border: none; }
.btn.violet { background: var(--violet); color: #fff; border: none; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------- Forms ---------------- */
label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; margin: 12px 0 5px; }
input, textarea, select {
  width: 100%; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 14px; background: var(--surface); color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,45,120,.12); }
textarea { resize: vertical; min-height: 84px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }
.field-inline { display: flex; align-items: center; gap: 10px; }
.field-inline label { margin: 0; }

/* ---------------- Charts ---------------- */
.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 200px; padding-top: 10px; }
.chart-bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.chart-bars .bar .fill { width: 70%; max-width: 34px; background: var(--grad); border-radius: 7px 7px 0 0; min-height: 3px; transition: height .3s; }
.chart-bars .bar .day { font-size: 10px; color: var(--muted); }
.chart-bars .bar .amt { font-size: 10px; color: var(--muted); font-weight: 700; }

.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar .top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.hbar .track { height: 9px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.hbar .track .fill { height: 100%; background: var(--grad); border-radius: 999px; }

/* ---------------- Chat simulator ---------------- */
.chat { display: flex; flex-direction: column; height: 460px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.chat .log { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.bubble { max-width: 78%; padding: 9px 13px; border-radius: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font-size: 13.5px; }
.bubble.user { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 4px; }
.bubble.bot { align-self: flex-start; background: var(--surface); color: var(--ink); border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.chat .inputbar { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.chat .inputbar input { flex: 1; }
#voiceBtn { transition: .15s; }
#voiceBtn.rec { background: var(--red); color: #fff; border-color: var(--red); animation: micpulse 1s infinite; }
@keyframes micpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(240,68,56,.5); } 50% { box-shadow: 0 0 0 6px rgba(240,68,56,0); } }

/* ---------------- Board layout + capability panel ---------------- */
.board-layout { display: flex; gap: 20px; align-items: flex-start; }
.board-layout > .card:first-child { flex: 1; min-width: 0; }
.board-caps { width: 300px; flex: none; }
.cap-group { margin-bottom: 14px; }
.cap-group h4 { font-size: 13px; margin: 0 0 7px; color: var(--muted); }
.cap-chip { display: block; width: 100%; text-align: left; padding: 9px 12px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13px; color: var(--ink); transition: .15s; }
.cap-chip:hover { border-color: var(--accent); background: var(--surface-2); transform: translateX(2px); }
.cap-chip b { color: var(--accent); }
.chan-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; margin-bottom: 6px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink); border: 1px solid var(--line); transition: .15s; }
.chan-item:hover { background: var(--surface-2); }
.chan-item.active { background: var(--grad); color: #fff; border-color: transparent; }
.chan-del { color: inherit; opacity: .6; font-size: 12px; padding: 0 4px; }
.chan-del:hover { opacity: 1; }
@media (max-width: 860px) { .board-layout { flex-direction: column; } .board-caps { width: 100%; } }

/* ---------------- Notes board ---------------- */
.note { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.note .meta { color: var(--muted); font-size: 12px; margin-bottom: 4px; display: flex; justify-content: space-between; }
.note .txt { white-space: pre-wrap; }

/* ---------------- Misc ---------------- */
.hint { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.empty { text-align: center; color: var(--muted); padding: 40px; }
.right { text-align: right; }
.thumb-sq { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; display: block; background: var(--surface-2); }

/* Product add form with image */
.prod-form { display: flex; gap: 16px; align-items: flex-start; }
.img-upload {
  width: 110px; height: 110px; flex: none; border: 2px dashed var(--line); border-radius: 14px;
  display: grid; place-items: center; cursor: pointer; color: var(--muted); text-align: center;
  font-size: 13px; overflow: hidden; background: var(--surface-2); transition: .15s;
}
.img-upload:hover { border-color: var(--accent); color: var(--accent); }
.img-upload img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 640px) { .prod-form { flex-direction: column; align-items: stretch; } .img-upload { width: 100%; height: 130px; } }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-lg); z-index: 100; }
.toast.err { background: var(--red); }
.hidden { display: none !important; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(20,22,31,.45); display: grid; place-items: start center; padding: 6vh 16px; z-index: 60; overflow-y: auto; }
.modal .modal-card { background: var(--surface); border-radius: 18px; width: 100%; max-width: 480px; padding: 24px; box-shadow: var(--shadow-lg); }
.modal .modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: sticky; top: 0; flex-direction: row; align-items: center; padding: 10px; overflow-x: auto; gap: 8px; }
  .sidebar .brand-logo { padding: 6px 8px; font-size: 17px; }
  .nav { flex-direction: row; flex: 1; overflow-x: auto; }
  .nav button { white-space: nowrap; padding: 9px 12px; }
  .nav button .lbl { display: none; }
  .nav button .ic { font-size: 19px; }
  .sidebar .side-foot { border: none; padding: 0; }
  .side-user .who { display: none; }
  .content { padding: 16px; }
  .topbar { padding: 14px 16px; }
}
