/* NutriGate stylesheet — red / black / white */
:root {
  --bg: #f3f3f3;
  --panel: #ffffff;
  --ink: #141414;
  --muted: #666666;
  --line: #d9d9d9;
  --black: #000000;
  --red: #c8102e;
  --red-dark: #9e0c24;
  --red-tint: #fbe9ec;
  --danger: #c8102e;
  --warn: #8a5a00;
  --ok: #1a7f37;
  --radius: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--red); }
a:hover { color: var(--red-dark); }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
code { background: #eee; padding: 0 .3em; border-radius: 3px; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; left: -9999px; }

/* ---- header: black bar, full-size logo on the left, nav on the right ---- */
.site-header {
  background: var(--black);
  color: #fff;
  border-bottom: 4px solid var(--red);
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}
.brand { display: block; line-height: 0; flex: none; }
.brand img { display: block; width: 548px; max-width: 100%; height: auto; }
.nav { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; justify-content: flex-end; }
.nav a, .nav button.link { color: #fff; text-decoration: none; font-weight: 600; letter-spacing: .01em; }
.nav a:hover, .nav button.link:hover { color: #ff5a6e; text-decoration: underline; }
.nav .muted { color: #bbb; font-weight: 400; }
.inline { display: inline; }
button.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
/* narrow screens: logo on top (shrunk to fit), nav underneath */
@media (max-width: 900px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .brand { width: 100%; }
  .nav { justify-content: flex-start; width: 100%; }
}

.site-footer {
  margin-top: auto;
  padding: .9rem 1.25rem;
  background: var(--black);
  color: #bbb;
  font-size: .85rem;
  border-top: 4px solid var(--red);
  text-align: center;
}
.page { width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.25rem; }

/* flashes */
.flash { padding: .6rem .9rem; border-radius: var(--radius); margin: 0 0 .75rem; border: 1px solid; }
.flash-success { background: #e8f4ea; border-color: #b7dcc0; color: var(--ok); }
.flash-error   { background: var(--red-tint); border-color: #f0b4bd; color: var(--red-dark); }
.flash-warning { background: #fff5d6; border-color: #efd88f; color: var(--warn); }

/* cards & forms */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 0 0 1rem;
}
.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }
label { display: block; font-weight: 600; margin: .75rem 0 .25rem; font-size: .9rem; }
.check label { font-weight: 400; display: flex; gap: .4rem; align-items: center; }
input[type=text], input[type=password], input[type=search], input[type=file], select {
  width: 100%; padding: .5rem .6rem; border: 1px solid #b8b8b8; border-radius: var(--radius);
  font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, button:focus { outline: 2px solid var(--red); outline-offset: 1px; }
button, .button {
  display: inline-block; padding: .5rem .9rem; border-radius: var(--radius); border: 1px solid var(--black);
  background: #fff; color: var(--black); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  line-height: 1.3;
}
button:hover, .button:hover { background: var(--black); color: #fff; }
button.primary { background: var(--red); border-color: var(--red); color: #fff; }
button.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
button.danger { background: var(--black); border-color: var(--black); color: #fff; }
button.danger:hover { background: var(--red); border-color: var(--red); }
button.warn { background: #fff; border-color: var(--red); color: var(--red); }
button.warn:hover { background: var(--red); color: #fff; }
.form-actions { margin-top: 1rem; display: flex; gap: .5rem; align-items: center; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 1rem; align-items: end; }
.grid-form .check, .grid-form .form-actions { grid-column: 1 / -1; }
@media (max-width: 760px) { .grid-form { grid-template-columns: 1fr; } }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0; }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; }

/* toolbar */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.toolbar h1, .toolbar h2 { margin: 0; }
.crumbs { font-size: 1.05rem; font-weight: 600; }
.crumbs .sep { color: var(--muted); margin: 0 .2rem; font-weight: 400; }
.search { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.search input[type=search] { width: 18rem; max-width: 60vw; }
.search select { width: auto; }
.actions { margin: 0 0 .75rem; display: flex; gap: .5rem; }

/* tables */
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); }
th, td { padding: .5rem .7rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--black); color: #fff; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
th a { color: #fff; text-decoration: none; }
th a:hover { color: #ff5a6e; }
tbody tr:hover { background: #fafafa; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.date { white-space: nowrap; color: var(--muted); font-size: .9rem; }
td.empty { text-align: center; color: var(--muted); padding: 2rem; }
.col-name { width: 55%; min-width: 12rem; overflow-wrap: anywhere; }
.file-link { text-decoration: none; display: inline-flex; align-items: center; gap: .45rem; color: var(--ink); }
.file-link:hover { text-decoration: underline; color: var(--red); }
.row-dir .file-link { font-weight: 600; }
.actions-col { white-space: nowrap; font-size: .9rem; }
.actions-col a { margin-right: .6rem; }
.actions-col a.danger { color: var(--danger); }
.row-disabled td { color: var(--muted); }
.log td { font-size: .85rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: nowrap; }
.log td:last-child { white-space: normal; }
.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; margin: 1rem 0; }

/* badges */
.badge { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; font-weight: 600; }
.badge-on { background: #e8f4ea; color: var(--ok); }
.badge-off { background: #e5e5e5; color: var(--muted); }
.badge-warn { background: var(--red-tint); color: var(--red-dark); }

/* file-type icons (pure CSS, no external requests) */
.icon { width: 18px; height: 18px; border-radius: 3px; display: inline-block; flex: none; position: relative; }
.icon::after { content: ""; position: absolute; inset: 0; }
.icon-dir { background: #f4c542; box-shadow: inset 0 -9px 0 #e7b32b; }
.icon-pdf { background: var(--red); }
.icon-pdf::after { content: "PDF"; color: #fff; font-size: 7px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.icon-doc, .icon-docx { background: #2b579a; }
.icon-xls, .icon-xlsx, .icon-csv { background: #217346; }
.icon-txt { background: #888; }
.icon-png, .icon-jpg, .icon-jpeg, .icon-gif { background: #7b4ea3; }

@media (max-width: 640px) {
  .page { padding: .75rem; }
  .col-dl, .col-mod { display: none; } /* hide downloads + modified on phones */
  .files .col-name { width: auto; min-width: 9rem; }
  .files .actions-col { white-space: normal; }
  .files .actions-col a { display: block; margin: 0 0 .25rem; }
  th, td { padding: .45rem .5rem; }
  .search input[type=search] { width: 100%; max-width: none; }
}
