/* MyDay — trail palette */
:root {
  --ink: #1C1B18;
  --ink-2: #3a3833;
  --muted: #6b675e;
  --line: #e2ded3;
  --stone: #F3F1EB;
  --paper: #ffffff;
  --orange: #C4471B;
  --orange-2: #E2652F;
  --olive: #4E6136;
  --olive-tint: #e9eedf;
  --red: #b42318; --red-tint: #fdecea;
  --amber: #b45309; --amber-tint: #fff4e0;
  --yellow: #8a6d00; --yellow-tint: #fff8d6;
  --green: #2f6b3a; --green-tint: #e6f3e8;
  --blue: #1f5a8a; --blue-tint: #e6f0f8;
  --gray-tint: #efede7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28,27,24,.06), 0 1px 1px rgba(28,27,24,.04);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--stone); }
body { font-size: 14.5px; line-height: 1.45; }
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* layout */
.app { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #e9e6dd; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand .mark { width: 30px; height: 30px; border-radius: 8px; background: var(--orange); display: grid; place-items: center; font-weight: 800; color: #fff; }
.brand b { font-size: 16px; letter-spacing: .02em; }
.brand small { display: block; color: #a9a497; font-size: 11px; }
.nav a { display: block; color: #dcd8cd; padding: 8px 10px; border-radius: 8px; margin-bottom: 2px; }
.nav a:hover { background: #2c2a25; text-decoration: none; }
.nav a.on { background: #34312b; color: #fff; box-shadow: inset 3px 0 0 var(--orange-2); }
.nav .sec { color: #8f8a7e; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin: 14px 10px 6px; }
.side form { margin: 16px 10px 0; }
.side .who { margin: 18px 10px 0; padding-top: 12px; border-top: 1px solid #34312b; font-size: 12.5px; color: #bdb8ab; }
.side .who b { color: #fff; display: block; }
.main { padding: 22px 26px 60px; min-width: 0; }
.topbar { display: none; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.pagehead .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* cards & grids */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 0; }
.stack > * + * { margin-top: 14px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .v { font-size: 28px; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.kpi.bad .v { color: var(--red); }
.kpi.warn .v { color: var(--amber); }
.kpi.good .v { color: var(--green); }
.kpi a { color: inherit; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 0 10px; }
.section-title h2 { margin: 0; }

/* tables */
.tablewrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f7f5f0; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.closed td { color: var(--muted); }
.card table th { position: static; }
.card .tablewrap { box-shadow: none; }

/* badges */
.b { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--gray-tint); color: var(--ink-2); }
.b.red { background: var(--red-tint); color: var(--red); }
.b.amber { background: var(--amber-tint); color: var(--amber); }
.b.yellow { background: var(--yellow-tint); color: var(--yellow); }
.b.green { background: var(--green-tint); color: var(--green); }
.b.blue { background: var(--blue-tint); color: var(--blue); }
.b.olive { background: var(--olive-tint); color: var(--olive); }

/* forms */
form.inline { display: inline; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #cfcabd; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange-2); outline-offset: 0; border-color: var(--orange-2); }
.fields { display: grid; gap: 12px 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.fields .wide { grid-column: 1 / -1; }
.field-help { font-size: 12px; color: var(--muted); margin-top: 3px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--ink); background: var(--ink); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { text-decoration: none; background: #000; }
.btn.orange { background: var(--orange); border-color: var(--orange); }
.btn.orange:hover { background: #a93b14; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #cfcabd; }
.btn.ghost:hover { background: var(--stone); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.danger { background: #fff; color: var(--red); border-color: #e6b8b3; }
.formbar { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters > div { min-width: 150px; }
.filters .grow { flex: 1; min-width: 200px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 9px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--orange); }
.tabs a:hover { text-decoration: none; color: var(--ink); }

/* flash */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 500; }
.flash.ok { background: var(--green-tint); color: var(--green); border: 1px solid #c4e0c9; }
.flash.err { background: var(--red-tint); color: var(--red); border: 1px solid #f3c7c2; }
.notice { padding: 12px 14px; border-radius: 8px; background: var(--amber-tint); border: 1px solid #f1d6a6; color: #6b3d06; }
.secret { padding: 14px; border-radius: 8px; background: #fffbe8; border: 1px dashed #d8b63e; font-family: ui-monospace, Menlo, monospace; font-size: 18px; letter-spacing: .05em; }

/* task rows */
.taskrow { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.taskrow:last-child { border-bottom: 0; }
.taskrow .t { font-weight: 600; }
.taskrow .m { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
details.done-form summary { list-style: none; cursor: pointer; }
details.done-form summary::-webkit-details-marker { display: none; }
details.done-form[open] { grid-column: 1 / -1; }
details.done-form .fields { margin-top: 10px; padding: 12px; background: var(--stone); border-radius: 8px; }

/* profile */
.profile-head { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--olive-tint); display: grid; place-items: center; font-weight: 800; color: var(--olive); font-size: 22px; flex: none; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
dl.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 13px; }
dl.kv dd { margin: 0; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: 100%; max-width: 380px; }
.login .brand { color: var(--ink); justify-content: center; }

/* week (warehouse) */
.day { margin-bottom: 18px; scroll-margin-top: 70px; }
.day h2 { display: flex; justify-content: space-between; align-items: baseline; }
.progress { height: 6px; background: var(--gray-tint); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress > span { display: block; height: 100%; background: var(--olive); }
.rowform { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rowform input, .rowform select { width: auto; padding: 5px 8px; }
.rowform input[type=number] { width: 90px; }
.rowform input[type=text] { width: 180px; }

@media (max-width: 1100px) {
  .g6 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; inset: 0 30% 0 0; height: auto; transform: translateX(-105%); transition: transform .2s; }
  body.menu-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar { display: flex; align-items: center; justify-content: space-between; background: var(--ink); color: #fff; padding: 10px 14px; position: sticky; top: 0; z-index: 20; }
  .topbar button { background: none; border: 1px solid #4a473f; color: #fff; border-radius: 8px; padding: 6px 10px; font: inherit; }
  .main { padding: 16px 14px 60px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .g4, .g6 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dt { margin-top: 6px; }
}
@media print {
  .side, .topbar, .actions, .formbar, form { display: none !important; }
  .app { display: block; }
}
.maxw-sm { max-width: 460px; }
.maxw-md { max-width: 560px; }
.maxw-lg { max-width: 900px; }
.sidelink { color: #bdb8ab; margin-left: 6px; }
.mt0 { margin-top: 0; } .mt8 { margin-top: 8px; } .mt14 { margin-top: 14px; } .mt22 { margin-top: 22px; }
.mb0 { margin-bottom: 0; } .mb14 { margin-bottom: 14px; }
meter.bar { width: 100%; height: 8px; margin-top: 6px; }
.hidden { display: none; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.cols-2 { columns: 2; }
.plainset { border: 0; padding: 0; margin: 0; min-width: 0; }
