/* Nezzy – styles. Deep green and white, DM Sans with DM Mono for figures. */
:root {
  --ink: #17211C; --muted: #5B6660; --line: #DDE3DE; --soft: #EEF2F0; --ground: #F3F5F2; --card: #FFFFFF;
  --green: #0E6B55; --green-d: #0A4F3F; --green-t: #E3F1EC; --dark: #0F2A22; --dark2: #1C4436; --mint: #3FBF8F;
  --amber: #B45309; --amber-t: #FDF3E3; --amber-ink: #8A4A06; --red: #B42318; --red-t: #FDECEA; --red-ink: #9B1C14;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--ground); font-size: 15px; line-height: 1.45; }
a { color: var(--green); } a:hover { color: var(--green-d); }
h1 { margin: 0; font-size: 26px; font-weight: 700; }
h2 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
h3 { margin: 0; font-size: 15px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; }
.mono { font-family: 'DM Mono', ui-monospace, monospace; }
.good { color: var(--green); } .warn { color: var(--amber); } .bad { color: var(--red); }
.nowrap { white-space: nowrap; } .r { text-align: right; }

/* shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 248px; flex: 0 0 248px; background: var(--dark); color: #E8F0EC; padding: 22px 14px; display: flex; flex-direction: column; gap: 3px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #C9D9D1; text-decoration: none; font-size: 14px; }
.side a:hover { background: #17382D; color: #fff; }
.side a.on { background: var(--dark2); color: #fff; font-weight: 600; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; color: #fff; text-decoration: none; }
.brand b { display: block; font-size: 17px; } .brand small { display: block; font-size: 12px; color: #A9C2B7; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--mint); color: var(--dark); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; flex: 0 0 auto; }
.logo.big { width: 56px; height: 56px; border-radius: 16px; font-size: 26px; }
.me { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid #24493C; display: flex; gap: 10px; align-items: center; font-size: 13px; }
.me b { display: block; color: #fff; } .me small { color: #A9C2B7; } .me a { color: #A9C2B7; display: inline; padding: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #2C5A4A; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex: 0 0 auto; }
.main { flex: 1; min-width: 0; padding: 26px 30px 48px; display: flex; flex-direction: column; gap: 20px; }
.topbar { display: none; }
.bottom { display: none; }

/* page parts */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; }
.page-head p { margin: 4px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; min-width: 0; }
.card.accent { border: 2px solid var(--green); }
.card.dark { background: var(--dark); color: #E8F0EC; border-color: var(--dark); display: flex; flex-direction: column; gap: 8px; }
.card.narrow { max-width: 620px; width: 100%; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.span2 { grid-column: span 2; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tile span { font-size: 13px; color: var(--muted); }
.tile b { font-family: 'DM Mono', monospace; font-size: 22px; font-weight: 500; overflow-wrap: anywhere; }
.tile small { font-size: 12px; color: var(--muted); }
.tile.dark { background: var(--dark); border-color: var(--dark); } .tile.dark span, .tile.dark small { color: #A9C2B7; } .tile.dark b { color: #fff; }
.meter { height: 6px; background: var(--soft); border-radius: 3px; } .meter i { display: block; height: 6px; background: var(--green); border-radius: 3px; }
.big-num { font-family: 'DM Mono', monospace; font-size: 32px; font-weight: 500; color: #fff; } .bad-light { color: #FFB4A8; }
.muted-light { color: #A9C2B7; }
.mini-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mini-tiles div { background: var(--ground); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; } .mini-tiles b { font-family: 'DM Mono', monospace; font-size: 18px; }
.line { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--soft); }
.line small, .feed small { display: block; } .line b.big { font-size: 20px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--soft); font-size: 14px; }
.feed li:first-child { border-top: 0; }
.steps { margin: 0; padding-left: 20px; line-height: 1.9; }
.statement { white-space: pre-wrap; font-family: 'DM Mono', monospace; font-size: 13px; background: var(--ground); padding: 12px; border-radius: 10px; }

/* tags, alerts, flash */
.tag { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--soft); color: #3D4842; white-space: nowrap; }
.tag.good { background: var(--green-t); color: var(--green-d); } .tag.warn { background: var(--amber-t); color: var(--amber-ink); } .tag.bad { background: var(--red-t); color: var(--red-ink); }
.alert { border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; margin-top: 8px; font-size: 14px; background: var(--soft); }
.alert small { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #3D4842; }
.alert.bad { background: var(--red-t); } .alert.bad small { color: var(--red-ink); }
.alert.warn { background: var(--amber-t); } .alert.warn small { color: var(--amber-ink); }
.flash { border-radius: 12px; padding: 12px 14px; font-weight: 600; background: var(--green-t); color: var(--green-d); }
.flash.err { background: var(--red-t); color: var(--red-ink); }

/* buttons and pills */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--green); border-radius: 12px; padding: 10px 16px; background: #fff; color: var(--green); font: 600 14px 'DM Sans', sans-serif; text-decoration: none; cursor: pointer; min-height: 44px; }
.btn:hover { background: var(--green-t); }
.btn.primary { background: var(--green); color: #fff; border-color: var(--green); } .btn.primary:hover { background: var(--green-d); }
.btn.light { background: #fff; color: var(--dark); border-color: #fff; }
.btn.big { min-height: 50px; font-size: 15px; width: 100%; }
.btn.small { min-height: 34px; padding: 6px 10px; font-size: 12px; border-radius: 9px; }
.btn.danger { border-color: #E3B4AE; color: var(--red); } .btn.danger:hover { background: var(--red-t); }
.btn:disabled { opacity: .6; cursor: wait; }
.pills { display: flex; flex-wrap: wrap; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px; align-items: center; }
.pill { border: 0; border-radius: 9px; padding: 8px 13px; background: transparent; color: #3D4842; font: 500 13px 'DM Sans', sans-serif; cursor: pointer; text-decoration: none; list-style: none; }
.pill.on { background: var(--dark); color: #fff; font-weight: 600; }
details.custom { position: relative; } details.custom summary::-webkit-details-marker { display: none; }
.custom-box { position: absolute; right: 0; top: 42px; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; gap: 6px; align-items: center; box-shadow: 0 8px 24px rgba(15, 42, 34, .12); white-space: nowrap; }
.legend { font-size: 12px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; } .legend i.g { background: var(--green); } .legend i.w { background: #E8A54B; }

/* forms */
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
label.inline { flex-direction: row; align-items: center; gap: 8px; }
label.radio { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; font-size: 14px; min-height: 40px; }
input, select { border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; font: 500 15px 'DM Sans', sans-serif; color: var(--ink); background: #fff; min-height: 44px; width: 100%; }
label.inline input, label.inline select, label.radio input { width: auto; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--green); }
input.mono { font-family: 'DM Mono', monospace; }
input:focus, select:focus { outline: 2px solid var(--green); outline-offset: 1px; border-color: var(--green); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.box legend { font-size: 13px; font-weight: 600; padding: 0 6px; }
.perms { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.qty-row { flex-direction: row; justify-content: space-between; align-items: center; padding: 6px 0; border-top: 1px solid var(--soft); }
.qty-row:first-of-type { border-top: 0; } .qty-row small { display: block; font-weight: 400; } .qty { width: 110px; text-align: center; font-size: 17px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 2px 0; }
.small-date { width: 140px; min-height: 34px; padding: 5px 8px; font-size: 13px; }
.inline-add { display: flex; gap: 8px; margin-top: 10px; }
.box-form { border-top: 1px solid var(--soft); margin-top: 14px; padding-top: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; align-items: end; }
label.g { color: var(--green-d); } label.g input { border-color: #9BCDB9; background: #F2F9F6; }
label.w { color: var(--amber-ink); } label.w input { border-color: #EBC58F; background: #FEF8EE; }

/* daily report */
.report { display: flex; flex-direction: column; gap: 10px; }
.rcard { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.rcard.done { border-left: 4px solid var(--green); }
.rhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rhead b { display: block; font-size: 15px; } .rhead small { display: block; }
.rgrid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.rgrid label { font-size: 11px; }
.savebar { position: sticky; bottom: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; box-shadow: 0 -6px 18px rgba(15, 42, 34, .06); }
.savebar .btn.big { width: auto; min-width: 200px; }

/* chart */
.chart { display: flex; align-items: flex-end; gap: 12px; height: 210px; border-bottom: 1px solid var(--line); padding: 0 4px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; height: 100%; }
.chart .bar { width: 100%; max-width: 44px; display: flex; flex-direction: column; gap: 2px; }
.chart .f { background: #E8A54B; border-radius: 6px 6px 0 0; } .chart .d { background: var(--green); border-radius: 0 0 4px 4px; }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--soft); vertical-align: top; }
th.r, td.r { text-align: right; } td.mono { font-family: 'DM Mono', monospace; white-space: nowrap; }
tr.dim td { opacity: .55; }
td a { text-decoration: none; }

/* login */
.login-page { background: var(--dark); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 410px; background: #fff; border-radius: 20px; padding: 30px 26px; display: flex; flex-direction: column; gap: 16px; }
.login-head { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.login-head h1 { font-size: 23px; } .login-head p { margin: 0; }
.tip { border-top: 1px solid var(--soft); padding-top: 14px; margin: 0; }

/* phones */
@media (max-width: 1100px) { .rgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .side { display: none; }
  .main { padding: 0 14px 96px; gap: 14px; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 10; background: var(--dark); margin: 0 -14px; padding: 10px 14px; align-items: center; justify-content: space-between; }
  .topbar .brand { padding: 0; } .topbar .logo { width: 32px; height: 32px; font-size: 16px; }
  .menu summary { list-style: none; width: 44px; height: 44px; border-radius: 12px; background: var(--dark2); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
  .menu summary::-webkit-details-marker { display: none; }
  .menu-list { position: absolute; right: 14px; top: 60px; background: #fff; border-radius: 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, .2); padding: 8px; display: flex; flex-direction: column; min-width: 230px; }
  .menu-list a { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
  .menu-list a:hover { background: var(--soft); }
  .bottom { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: #fff; border-top: 1px solid var(--line); justify-content: space-around; align-items: center; padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
  .bottom a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 56px; padding: 4px 0; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; }
  .bottom a.fab { width: 52px; height: 52px; border-radius: 16px; background: var(--green); color: #fff; justify-content: center; margin-top: -24px; min-width: 0; }
  h1 { font-size: 22px; }
  .span2 { grid-column: auto; }
  .grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile b { font-size: 18px; }
  .rgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .savebar { bottom: 74px; }
  .savebar .btn.big { width: 100%; }
  .page-head .actions { width: 100%; }
  .pills { width: 100%; justify-content: space-between; }
  .mini-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart { gap: 6px; }
}

/* Phase 2: statement, bars, install */
.stmt { display: flex; flex-direction: column; }
.sl { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--soft); font-size: 14px; }
.sl.sub { border-top: 1px solid var(--ink); border-bottom: 0; font-weight: 700; }
.sl.total { border-top: 2px solid var(--ink); border-bottom: 0; font-size: 17px; font-weight: 700; padding-top: 12px; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 140px) 1fr 48px 70px; gap: 10px; align-items: center; font-size: 13px; }
.hbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 12px; background: var(--soft); border-radius: 6px; overflow: hidden; }
.hbar .track i { display: block; height: 12px; border-radius: 6px; background: #9AA59F; }
.hbar .track i.g { background: var(--green); } .hbar .track i.w { background: #E8A54B; } .hbar .track i.b { background: #C2412D; }
.hbar b { text-align: right; } .hbar small { text-align: right; }
.tile b.tile-name { font-family: 'DM Sans', sans-serif; font-size: 18px; font-weight: 700; }
.install-btn { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-top: 8px; border-radius: 10px; border: 1px dashed #3C6656; background: transparent; color: #fff; font: 600 14px 'DM Sans', sans-serif; cursor: pointer; }
.install-btn:hover { background: #17382D; }
.install-btn[hidden] { display: none; }
.menu-list .install-btn { color: var(--green); border-color: #9BCDB9; margin: 4px 0; }
.install-help { position: fixed; inset: 0; background: rgba(15, 42, 34, .55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.install-help > div { background: #fff; border-radius: 18px; padding: 22px; max-width: 380px; width: 100%; }
.install-help ol { padding-left: 20px; line-height: 1.8; }
@media (max-width: 860px) { .hbar { grid-template-columns: 90px 1fr 42px; } .hbar small { display: none; } }
@media (max-width: 860px) { .custom-box { position: static; margin-top: 6px; flex-wrap: wrap; box-shadow: none; } details.custom[open] { width: 100%; } }

/* Daily report form: several products, split by sales rep */
.rform { display: flex; flex-direction: column; gap: 12px; }
.rform-top { display: grid; grid-template-columns: minmax(150px, 220px) minmax(200px, 1fr); gap: 10px; }
.rform input[readonly], .rform select[disabled] { background: var(--soft); color: var(--muted); }
.plines { display: flex; flex-direction: column; gap: 12px; }
.pline { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.pline-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pline-head b { font-size: 15px; }
.pline-head .btn[hidden] { display: none; }
.pgrid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 10px; }
.pgrid label { font-size: 12px; }
.reps { background: var(--soft); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.reps-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.reps-head b { font-size: 13px; }
.rep-rows { display: flex; flex-direction: column; gap: 8px; }
.rep-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 90px 44px; gap: 8px; align-items: end; }
.rep-row label { font-size: 12px; }
.icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.icon-btn:hover { color: var(--red); border-color: var(--red); }
.reps-foot { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.rep-total { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.rep-total:empty { display: none; }
.rep-total.ok { background: var(--green-t); color: var(--green-d); }
.rep-total.bad { background: var(--red-t); color: var(--red-ink); }
.add-line { align-self: flex-start; border-style: dashed; }
.form-error { background: var(--red-t); color: var(--red-ink); border-radius: 12px; padding: 10px 14px; font-weight: 600; font-size: 14px; }
.err-list { margin: 6px 0 0; padding-left: 18px; font-weight: 500; }
@media (max-width: 860px) {
  .rform-top { grid-template-columns: 1fr; }
  .pgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pgrid .span-p { grid-column: 1 / -1; }
  .rep-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 6px 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .rep-row label:first-child { grid-column: 1 / -1; }
  .rform .savebar > span { display: none; }
  .rform .savebar .row-btns { width: 100%; flex-wrap: nowrap; }
  .rform .savebar .row-btns > * { flex: 1; }
  .rform .savebar .btn.big { min-width: 0; }
}
.ded-box { gap: 10px; padding: 12px 14px; }
.ded-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ded-grid small { font-weight: 500; font-size: 12px; }
.pay-sum { margin: 0; background: var(--soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.6; }
.pay-sum:empty { display: none; }

.extras { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.extra-rows { display: flex; flex-direction: column; gap: 8px; }
.extra-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 44px; gap: 8px; align-items: end; }
.add-extra { align-self: flex-start; border-style: dashed; }
@media (max-width: 860px) { .extra-row { grid-template-columns: minmax(0, 1fr) 96px 44px; } }
