/* MebelFlow — дашборд. Без сборки: один CSS-файл. */
:root {
  --bg: #f5f3ef; --panel: #ffffff; --ink: #1f1d1a; --muted: #77706a; --line: #e6e1d9;
  --brand: #8a5a2b; --brand-ink: #ffffff; --brand-soft: #f3e8dc;
  --ok: #2f7d4f; --ok-soft: #e3f2e8; --warn: #b7791f; --warn-soft: #fbf0d9;
  --bad: #b83a3a; --bad-soft: #f8e1e1; --info: #2f5f8a; --info-soft: #e1ecf6;
  --radius: 12px; --shadow: 0 1px 2px rgba(31, 29, 26, .06), 0 4px 16px rgba(31, 29, 26, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 16px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
small, .muted { color: var(--muted); }

.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: #24201c; color: #e9e3da; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.logo { font-weight: 700; font-size: 18px; color: #fff; margin: 0 8px 20px; display: block; }
.logo span { color: #d9a46b; }
.nav a { display: flex; align-items: center; gap: 10px; color: #cfc6ba; padding: 9px 10px; border-radius: 8px; margin-bottom: 2px; }
.nav a:hover { background: #332d27; text-decoration: none; color: #fff; }
.nav a.on { background: #8a5a2b; color: #fff; }
.side .who { position: absolute; bottom: 18px; left: 22px; right: 14px; font-size: 13px; color: #a69c8f; }
.side .who a { color: #d9a46b; }
.main { padding: 24px 28px 60px; max-width: 1400px; min-width: 0; }
.topbar { display: none; }

.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.stat b { display: block; font-size: 24px; margin-top: 4px; letter-spacing: -.01em; }
.stat.bad b { color: var(--bad); } .stat.ok b { color: var(--ok); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
td a, .card .n { white-space: nowrap; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line); color: var(--ink); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }

.btn, button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 8px 14px; font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover, button:hover { border-color: var(--brand); text-decoration: none; }
.btn.primary, button.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger, button.danger { color: var(--bad); }
.btn.small, button.small { padding: 4px 10px; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.inline { display: inline; }

input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); max-width: 100%; }
textarea { width: 100%; min-height: 90px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > div { flex: 1 1 160px; }
.row input, .row select { width: 100%; }
.row input[type=checkbox], .row input[type=radio] { width: auto; }
.row > div.shrink { flex: 0 0 auto; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 15px; margin: 8px 0; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); } .flash.err { background: var(--bad-soft); color: var(--bad); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
img.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; display: block; }

.red-item { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.red-item:last-child { border-bottom: 0; }

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #ebe6de; border-radius: var(--radius); padding: 10px; min-height: 120px; }
.col h3 { display: flex; justify-content: space-between; margin: 2px 4px 10px; }
.card { display: block; background: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow); color: var(--ink); }
.card:hover { text-decoration: none; outline: 2px solid var(--brand-soft); }
.card .n { font-weight: 700; } .card .m { color: var(--muted); font-size: 13px; }

.gantt { position: relative; }
.g-row { display: grid; grid-template-columns: 220px 1fr; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.g-track { position: relative; height: 26px; background: #f2eee8; border-radius: 6px; }
.g-plan, .g-fact { position: absolute; height: 10px; border-radius: 5px; }
.g-plan { top: 3px; background: #d8cfc3; }
.g-fact { top: 14px; background: var(--brand); }
.g-fact.done { background: var(--ok); } .g-fact.late { background: var(--bad); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.legend i { display: inline-block; width: 18px; height: 8px; border-radius: 4px; margin-right: 6px; vertical-align: middle; }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.thumbs a, .thumbs .th { display: block; width: 96px; height: 96px; border-radius: 8px; overflow: hidden; background: #eee8df; position: relative; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.thumbs.sm a { width: 44px; height: 44px; border-radius: 6px; }
.thumbs .video { display: flex; align-items: center; justify-content: center; font-size: 28px; }
.th .tools { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; background: rgba(0,0,0,.45); }
.th .tools button { border: 0; background: transparent; color: #fff; padding: 3px 6px; font-size: 13px; }

.copy { font-family: ui-monospace, Menlo, Consolas, monospace; background: #f2eee8; padding: 8px 10px; border-radius: 8px; word-break: break-all; }
.chart-box { position: relative; height: 300px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { display: none; position: fixed; z-index: 10; width: 250px; }
  .side.open { display: block; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #24201c; color: #fff; position: sticky; top: 0; z-index: 5; }
  .topbar button { background: transparent; color: #fff; border-color: #574d42; }
  .main { padding: 16px 14px 60px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g2 { grid-template-columns: 1fr; }
  .g-row { grid-template-columns: 1fr; gap: 4px; }
  .stat b { font-size: 19px; }
  h1 { font-size: 21px; }
}

#reminders .row > div { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
#reminders .row input { width: 130px; }

.nowrap { white-space: nowrap; }

button.link-x { background: none; border: 0; padding: 0 0 0 4px; color: var(--bad); cursor: pointer; font-size: 15px; line-height: 1; min-height: 0; }

/* Внутри Telegram Mini App: меньше отступов, верхняя полоса Telegram уже есть */
.in-telegram .main { padding-top: 12px; }
