:root {
  --green: #2e7d32; --green-dk: #1b5e20; --amber: #f9a825; --bg: #f4f6f4;
  --card: #ffffff; --ink: #1c2b1e; --muted: #6b7c6e; --line: #dde5dd;
  --blue: #1565c0; --red: #c62828; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
h1, h2, h3 { margin: 0 0 .4em; }
a { color: var(--blue); text-decoration: none; }
button { font: inherit; cursor: pointer; }

.topbar { position: sticky; top: 0; z-index: 30; background: var(--green-dk); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.topbar .logo { font-weight: 800; letter-spacing: .3px; font-size: 17px; }
.topbar .spacer { flex: 1; }
.topbar button { background: transparent; border: 0; color: #cfe6cf; padding: 6px; }

.tabs { display: flex; gap: 2px; background: var(--green); overflow-x: auto;
  position: sticky; top: 44px; z-index: 29; -webkit-overflow-scrolling: touch; }
.tabs button { flex: 1; min-width: 86px; padding: 10px 8px; border: 0; background: transparent;
  color: #d6ead6; font-weight: 600; font-size: 13px; white-space: nowrap; }
.tabs button.active { background: var(--bg); color: var(--green-dk); border-radius: 10px 10px 0 0; }

main { padding: 14px; max-width: 1080px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 14px; }
.card h2 { font-size: 16px; color: var(--green-dk); display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 10px; }
.g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) { .g3, .g4 { grid-template-columns: repeat(2, 1fr); } }

label.f { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
label.f span { display: block; margin-bottom: 3px; }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; background: #fff; }
input:focus, select:focus { outline: 2px solid #a5d6a7; border-color: var(--green); }
input[readonly] { background: #f2f5f2; color: var(--muted); }

.btn { background: var(--green); color: #fff; border: 0; border-radius: 8px; padding: 10px 16px; font-weight: 700; }
.btn.sec { background: #e8f0e8; color: var(--green-dk); }
.btn.warn { background: var(--red); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); padding: 6px 8px; border-bottom: 2px solid var(--line); }
table.t td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
table.t tr.click { cursor: pointer; } table.t tr.click:hover { background: #f0f6f0; }
.scroll-x { overflow-x: auto; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.pill.fermenting { background: #fff3cd; color: #8a6d00; }
.pill.packaged { background: #e3f2e5; color: var(--green-dk); }
.pill.planned { background: #e3ecf7; color: var(--blue); }
.pill.brewing { background: #fde2cf; color: #a34700; }
.pill.conditioning { background: #ece5f7; color: #5e35b1; }
.pill.archived { background: #eee; color: #666; }

.stat { text-align: center; padding: 8px 4px; background: #f7faf7; border-radius: 10px; border: 1px solid var(--line); }
.stat .v { font-size: 19px; font-weight: 800; color: var(--green-dk); }
.stat .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.stat .range { font-size: 11px; color: var(--muted); }
.stat.out .v { color: var(--red); }

.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 4px; vertical-align: -3px;
  border: 1px solid rgba(0,0,0,.2); }

.sec-head { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.sec-body.closed { display: none; }
.chev::after { content: '▾'; color: var(--muted); } .closed-h .chev::after { content: '▸'; }

.login-wrap { max-width: 380px; margin: 12vh auto; }
.login-wrap .logo-big { text-align: center; font-size: 40px; }
.err { color: var(--red); font-size: 13px; margin-top: 8px; }
.ok { color: var(--green-dk); font-size: 13px; margin-top: 8px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.savebar { position: fixed; bottom: 14px; right: 14px; z-index: 40; background: var(--green-dk);
  color: #fff; border-radius: 24px; padding: 9px 18px; font-weight: 700; box-shadow: 0 4px 14px rgba(0,0,0,.25);
  opacity: 0; transition: opacity .25s; pointer-events: none; }
.savebar.show { opacity: 1; }

.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center;
  color: var(--muted); background: #fbfdfb; }
.dropzone.drag { border-color: var(--green); background: #eef7ee; }

.chart-wrap { overflow-x: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; margin-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 14px; height: 3px; display: inline-block; }

.upd-row td { vertical-align: middle; }
.delta-up { color: var(--red); font-weight: 700; }
.delta-down { color: var(--green-dk); font-weight: 700; }

/* ---- brewhouse tank board ---- */
.tankboard { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-around; padding: 6px 0; }
.tank { width: 96px; text-align: center; border-radius: 10px; padding: 6px 2px; transition: background .15s, transform .15s; }
.tank.click { cursor: pointer; }
.tank.click:hover { background: #eef5ee; transform: translateY(-2px); }
.tank svg { width: 100%; display: block; }
.tank .tb-name { font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .5px; }
.tank .tb-brand { font-size: 11px; font-weight: 700; line-height: 1.2; min-height: 26px;
  display: flex; align-items: center; justify-content: center; padding: 2px 0; }
@media (max-width: 640px) { .tankboard { gap: 4px; } .tank { width: 30%; } }
.tb-divider { text-align: center; font-size: 11px; font-weight: 800; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted); margin: 12px 0 4px;
  display: flex; align-items: center; gap: 10px; }
.tb-divider::before, .tb-divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }

/* ---- general polish ---- */
.stat.click { cursor: pointer; transition: box-shadow .15s; }
.stat.click:hover { box-shadow: 0 2px 8px rgba(46,125,50,.2); }
table.t tr:nth-child(even) td { background: #fafcfa; }
.btn { transition: filter .12s, transform .05s; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
input, select { transition: border-color .12s; }
.tabs button { transition: background .15s, color .15s; }

/* ---- branding ---- */
.topbar .logo-img { height: 34px; width: auto; display: block; }
.login-logo { background: var(--green-dk); border-radius: var(--radius) var(--radius) 0 0;
  padding: 26px 30px; display: flex; justify-content: center; }
.login-logo img { max-width: 240px; width: 70%; height: auto; }
.login-wrap .card { border-radius: 0 0 var(--radius) var(--radius); margin-top: 0; }

/* ---- print ---- */
.print-head { display: none; }
@media print {
  .topbar, .tabs, .savebar, .no-print, .btn, button, .dropzone, datalist { display: none !important; }
  body { background: #fff; font-size: 12px; }
  main { padding: 0; max-width: none; }
  .card { border: 1px solid #bbb; border-radius: 4px; padding: 8px 10px; margin-bottom: 8px;
    break-inside: avoid; page-break-inside: avoid; }
  .card h2 { font-size: 13px; margin-bottom: 4px; }
  .sec-body.closed, .sec-body.print-open { display: block !important; }
  .sec-head .chev { display: none; }
  .grid { gap: 4px; }
  input, select { border: 0; border-bottom: 1px solid #999; border-radius: 0; padding: 1px 2px;
    font-size: 12px; background: #fff !important; -webkit-appearance: none; appearance: none; }
  label.f span { font-size: 9px; }
  table.t th, table.t td { padding: 2px 4px; font-size: 11px; }
  .stat { padding: 4px; } .stat .v { font-size: 14px; }
  .print-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px;
    background: #1b5e20; border-radius: 6px; padding: 8px 12px; color: #fff;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-head img { height: 44px; }
  .print-head h1 { font-size: 16px; margin: 0; color: #fff; }
  .print-head .muted { color: #d6ead6; font-size: 11px; }
  a { text-decoration: none; color: inherit; }
}
